tool.js 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755
  1. //////////////////////////////////////////////
  2. // Obfuscated by Javascript Obfuscator 4.3 //
  3. // http://javascript-source.com //
  4. //////////////////////////////////////////////
  5. var __extends = this.__extends ||
  6. function(c, a) {
  7. function b() {
  8. this.constructor = c;
  9. }
  10. for (var d in a) {
  11. a.hasOwnProperty(d) && (c[d] = a[d]);
  12. }
  13. b.prototype = a.prototype;
  14. c.prototype = new b;
  15. },
  16. OverView = (function(c) {
  17. function a() {
  18. c.call(this);
  19. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
  20. a._instance = this;
  21. }
  22. __extends(a, c);
  23. a.instance = function() {
  24. null == a._instance && (a._instance = new a);
  25. return a._instance;
  26. };
  27. a.prototype.onAddToStage = function(b) {
  28. if (null == this.part1) {
  29. this.part1 = new egret.DisplayObjectContainer;
  30. this.part2 = new egret.DisplayObjectContainer;
  31. this.bg = new egret.Bitmap;
  32. this.bg.texture = RES.getRes("infoBg");
  33. this.bg.x = this.bg.width / 2;
  34. this.bg.anchorX = 0.5;
  35. this.bg.scaleX = -1;
  36. this.part2.addChild(this.bg);
  37. this.bg = new egret.Bitmap;
  38. this.bg.texture = RES.getRes("overBg");
  39. this.addChild(this.part2);
  40. this.addChild(this.part1);
  41. this.part1.addChild(this.bg);
  42. b = new egret.Bitmap;
  43. b.name = "restartBtn";
  44. b.texture = RES.getRes("restartBtn");
  45. b.anchorX = b.anchorY = 0.5;
  46. b.scaleX = b.scaleY = 0.8;
  47. b.x = 1.3 * b.width / 2 + 10;
  48. b.y = this.bg.height / 2 + 1.6 * b.height;
  49. b.touchEnabled = true;
  50. b.addEventListener(egret.TouchEvent.TOUCH_TAP, this.touchHandler, this);
  51. b.addEventListener(egret.TouchEvent.TOUCH_END, this.touchHandler, this);
  52. b.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.touchHandler, this);
  53. this.part1.addChild(b);
  54. //add html5yx
  55. _hehe = new egret.Bitmap;
  56. _hehe.name = "shareBtn";
  57. _hehe.texture = RES.getRes("shareBtn");
  58. _hehe.anchorX = _hehe.anchorY = 0.5;
  59. _hehe.scaleX = _hehe.scaleY = 0.8;
  60. _hehe.x = 2.95 * _hehe.width / 2 + 10;
  61. _hehe.y = this.bg.height / 2 + 1.6 * _hehe.height;
  62. _hehe.touchEnabled = true;
  63. _hehe.addEventListener(egret.TouchEvent.TOUCH_TAP, this.touchHandler, this);
  64. _hehe.addEventListener(egret.TouchEvent.TOUCH_END, this.touchHandler, this);
  65. _hehe.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.touchHandler, this);
  66. this.part1.addChild(_hehe);
  67. //end add html5yx
  68. b = new egret.Bitmap;
  69. b.name = "moreBtn";
  70. b.texture = RES.getRes("moreBtn");
  71. b.anchorX = b.anchorY = 0.5;
  72. b.scaleX = b.scaleY = 0.8;
  73. b.x = 2.4 * b.width;
  74. b.y = this.bg.height / 2 + 1.6 * b.height;
  75. b.touchEnabled = true;
  76. b.addEventListener(egret.TouchEvent.TOUCH_TAP, this.touchHandler, this);
  77. b.addEventListener(egret.TouchEvent.TOUCH_END, this.touchHandler, this);
  78. b.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.touchHandler, this);
  79. this.part1.addChild(b);
  80. b = new egret.Bitmap;
  81. b.name = "infoBtn";
  82. b.texture = RES.getRes("infoBtn");
  83. b.alpha = 0;
  84. b.scaleX = b.scaleY = 0.7;
  85. b.x = this.bg.width - b.width - 15;
  86. b.y = -3;
  87. b.touchEnabled = true;
  88. b.addEventListener(egret.TouchEvent.TOUCH_TAP, this.touchHandler, this);
  89. this.part1.addChild(b);
  90. b = new egret.Bitmap;
  91. b.name = "backBtn";
  92. b.texture = RES.getRes("infoBtn");
  93. b.alpha = 0;
  94. b.scaleX = b.scaleY = 0.9;
  95. b.x = this.bg.width - b.width - 23;
  96. b.y = -6;
  97. b.touchEnabled = true;
  98. b.addEventListener(egret.TouchEvent.TOUCH_TAP, this.touchHandler, this);
  99. this.part2.addChild(b);
  100. b = RES.getRes("orange_font_fnt");
  101. var d = new egret.BitmapText;
  102. d.spriteSheet = b;
  103. d.text = "0";
  104. d.y = GameData.scoreBoardTop2 + GameData.scoreBoardH / 2 - 3;
  105. d.anchorX = 0.5;
  106. d.anchorY = 0.5;
  107. d.x = this.bg.width / 2;
  108. this.part1.addChild(d);
  109. this.scoreTxt = d;
  110. b = RES.getRes("yellow_font_fnt");
  111. d = new egret.BitmapText;
  112. d.spriteSheet = b;
  113. d.text = "110";
  114. d.y = GameData.scoreBoardTop2 + GameData.scoreBoardH / 2 + 95;
  115. d.x = this.bg.width - 120;
  116. d.anchorY = 0.5;
  117. this.comboTxt = d;
  118. this.part1.addChild(d);
  119. b = new egret.Bitmap;
  120. b.texture = RES.getRes("new");
  121. b.anchorX = 0.5;
  122. b.anchorY = 0.5;
  123. b.x = this.bg.width - b.width;
  124. b.y = this.scoreTxt.y;
  125. this.part1.addChild(b);
  126. this.newFlag = b;
  127. b = RES.getRes("gray_font_fnt");
  128. d = new egret.BitmapText;
  129. d.spriteSheet = b;
  130. d.text = "012324";
  131. d.y = GameData.scoreBoardTop2 + GameData.scoreBoardH / 2 + 40;
  132. d.anchorY = 0.5;
  133. d.x = this.bg.width / 2 + 6;
  134. this.part1.addChild(d);
  135. this.bestScoreTxt = d;
  136. this.part1.x = GameData.GameWidth / 2;
  137. this.part1.y = GameData.GameHeight / 2 - this.bg.height / 2 - 60 * GameData.scale;
  138. this.part2.x = GameData.GameWidth / 2;
  139. this.part2.y = GameData.GameHeight / 2 - this.bg.height / 2 - 60 * GameData.scale;
  140. }
  141. this.part1.anchorX = 0.5;
  142. this.part2.anchorX = 0.5;
  143. this.part1.scaleX = 1;
  144. this.part2.scaleX = 0;
  145. this.scoreTxt.text = GameData.score + "";
  146. b = GameData.bestScore;
  147. GameData.updateScore();
  148. this.newFlag.visible = b < GameData.bestScore ? true: false;
  149. this.bestScoreTxt.text = b + "";
  150. this.comboTxt.text = GameData.bestCombo2 + "";
  151. a.isShowing = true;
  152. GameData.shareFun && GameData.shareFun();
  153. dp_submitScore(GameData.score);
  154. };
  155. a.prototype.touchHandler = function(b) {
  156. var d = b.currentTarget;
  157. switch (b.type) {
  158. case egret.TouchEvent.TOUCH_BEGIN:
  159. d.scaleX = d.scaleY = 1;
  160. break;
  161. case egret.TouchEvent.TOUCH_END:
  162. d.scaleX = d.scaleY = 0.8;
  163. break;
  164. case egret.TouchEvent.TOUCH_TAP:
  165. if (SoundManager.instance().playSound("ui_click"), "restartBtn" == d.name) {
  166. this.parent.removeChild(this),
  167. PlayView.instance().restartGame(),
  168. a.isShowing = false;
  169. } else if ("shareBtn" != d.name) {
  170. if ("moreBtn" == d.name) {
  171. clickMore();
  172. } else if ("infoBtn" == d.name) {
  173. var c = this.part1,
  174. e = this.part2;
  175. egret.Tween.get(c, false).to({
  176. scaleX: 0
  177. },
  178. 150).call(function() {
  179. egret.Tween.get(e, false).to({
  180. scaleX: 1
  181. },
  182. 150);
  183. });
  184. } else {
  185. "backBtn" == d.name && (c = this.part1, e = this.part2, egret.Tween.get(e, false).to({
  186. scaleX: 0
  187. },
  188. 150).call(function() {
  189. egret.Tween.get(c, false).to({
  190. scaleX: 1
  191. },
  192. 150);
  193. }));
  194. }
  195. }else{
  196. //share btn click
  197. dp_share();
  198. }
  199. default:
  200. ;
  201. }
  202. };
  203. a.isShowing = false;
  204. return a;
  205. })(egret.DisplayObjectContainer);
  206. OverView.prototype.__class__ = "OverView";
  207. var __extends = this.__extends ||
  208. function(c, a) {
  209. function b() {
  210. this.constructor = c;
  211. }
  212. for (var d in a) {
  213. a.hasOwnProperty(d) && (c[d] = a[d]);
  214. }
  215. b.prototype = a.prototype;
  216. c.prototype = new b;
  217. },
  218. HighComboMc = (function(c) {
  219. function a() {
  220. c.call(this);
  221. this.bg = new egret.Bitmap;
  222. this.bg.anchorX = 0.5;
  223. this.bg.anchorY = 0.5;
  224. this.bg.texture = RES.getRes("highCombo");
  225. this.addChild(this.bg);
  226. var b = RES.getRes("111_fnt"),
  227. d = new egret.BitmapText;
  228. d.spriteSheet = b;
  229. d.text = "36";
  230. d.scaleX = 0.7;
  231. d.scaleY = 0.7;
  232. d.y = 30;
  233. d.anchorX = 0.5;
  234. d.anchorY = 0.5;
  235. d.x = 0;
  236. this.combTxt = d;
  237. this.addChild(this.combTxt);
  238. a.currPos = 0;
  239. a.bottom = 0;
  240. a.top = 0;
  241. }
  242. __extends(a, c);
  243. a.prototype.play = function(b) {
  244. this.combTxt.text = b + "";
  245. };
  246. return a;
  247. })(egret.DisplayObjectContainer);
  248. HighComboMc.prototype.__class__ = "HighComboMc";
  249. var __extends = this.__extends ||
  250. function(c, a) {
  251. function b() {
  252. this.constructor = c;
  253. }
  254. for (var d in a) {
  255. a.hasOwnProperty(d) && (c[d] = a[d]);
  256. }
  257. b.prototype = a.prototype;
  258. c.prototype = new b;
  259. },
  260. NewerHandMc = (function(c) {
  261. function a() {
  262. var b = RES.getRes("newerHandMc_json"),
  263. a = RES.getRes("newerHandMc_png");
  264. c.call(this, b, a);
  265. this.frameRate = 24;
  266. this.addEventListener(egret.Event.COMPLETE, this.onComplete, this);
  267. }
  268. __extends(a, c);
  269. a.prototype.onComplete = function(b) {
  270. this.stop();
  271. GameData.paused = false;
  272. };
  273. a.prototype.playAnimate = function() {
  274. this.gotoAndPlay("\u624B\u52BF\u52A8\u753B");
  275. };
  276. return a;
  277. })(egret.MovieClip);
  278. NewerHandMc.prototype.__class__ = "NewerHandMc";
  279. var __extends = this.__extends ||
  280. function(c, a) {
  281. function b() {
  282. this.constructor = c;
  283. }
  284. for (var d in a) {
  285. a.hasOwnProperty(d) && (c[d] = a[d]);
  286. }
  287. b.prototype = a.prototype;
  288. c.prototype = new b;
  289. },
  290. ReadyGoMc = (function(c) {
  291. function a() {
  292. var b = RES.getRes("readygo_json"),
  293. a = RES.getRes("readygo_png");
  294. c.call(this, b, a);
  295. this.frameRate = 24;
  296. this.addEventListener(egret.Event.COMPLETE, this.onComplete, this);
  297. }
  298. __extends(a, c);
  299. a.prototype.onComplete = function(b) {
  300. b = b.target;
  301. this.stop();
  302. b.parent && b.parent.removeChild(b);
  303. PlayView.instance().hideReadyGo();
  304. };
  305. a.prototype.playAnimate = function() {
  306. this.gotoAndPlay("ready");
  307. };
  308. return a;
  309. })(egret.MovieClip);
  310. ReadyGoMc.prototype.__class__ = "ReadyGoMc";
  311. var __extends = this.__extends ||
  312. function(c, a) {
  313. function b() {
  314. this.constructor = c;
  315. }
  316. for (var d in a) {
  317. a.hasOwnProperty(d) && (c[d] = a[d]);
  318. }
  319. b.prototype = a.prototype;
  320. c.prototype = new b;
  321. },
  322. PlayView = (function(c) {
  323. function a() {
  324. c.call(this);
  325. this.toAddDirtyArea = true;
  326. this.toAddDirtyAreaCount = 1;
  327. this.oldSocre = 0;
  328. this.bombBoxAddIconList = [];
  329. this.emptyBoxList = [];
  330. this.initedGrid = false;
  331. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
  332. a._instance = this;
  333. }
  334. __extends(a, c);
  335. a.instance = function() {
  336. return a._instance;
  337. };
  338. a.prototype.showBoxAnimate = function(b) {
  339. this.boxLayer.alpha = 0;
  340. egret.Tween.get(this.boxLayer, {
  341. loop: false
  342. },
  343. null, true).to({
  344. alpha: 1
  345. },
  346. 1000).call(function() {
  347. a.instance().showNewerDes(b);
  348. });
  349. };
  350. a.prototype.hideReadyGo = function() {
  351. GameData.ready = true;
  352. };
  353. a.prototype.showHighCombo = function() {
  354. null == this.highComboMc && (this.highComboMc = new HighComboMc, this.highComboMc.x = GameData.GameWidth / 2, this.highComboMc.y = GameData.GameHeight_2 / 2, HighComboMc.currPos = this.highComboMc.y, HighComboMc.top = this.highComboMc.y - 60, HighComboMc.bottom = this.highComboMc.y + 50);
  355. this.addChild(this.highComboMc);
  356. this.highComboMc.play(GameData.bestCombo);
  357. var b = this.highComboMc;
  358. b.visible = true;
  359. b.y = HighComboMc.bottom;
  360. var a = HighComboMc.top,
  361. c = HighComboMc.currPos;
  362. b.alpha = 0;
  363. egret.Tween.get(b, false, null, true).to({
  364. y: c,
  365. alpha: 1
  366. },
  367. 500).call(function() {
  368. GameData.showBombtimerId = egret.setTimeout(function() {
  369. egret.Tween.get(b, false, null, true).to({
  370. y: a,
  371. alpha: 0
  372. },
  373. 300).call(function() {
  374. b.visible = false;
  375. b.parent && b.parent.removeChild(b);
  376. GameData.isOver = false;
  377. });
  378. },
  379. b, 800);
  380. });
  381. };
  382. a.prototype.showReadyGo = function() {
  383. null == this.readyGoMc && (this.readyGoMc = new ReadyGoMc, this.readyGoMc.x = GameData.GameWidth / 4 - 20, this.readyGoMc.y = GameData.GameHeight_2 / 2);
  384. this.addChild(this.readyGoMc);
  385. this.readyGoMc.playAnimate();
  386. GameData.ready = false;
  387. SoundManager.instance().playSound("readygo");
  388. };
  389. a.prototype.showAd = function() {
  390. var b = document.getElementById("spn");
  391. b && (b.style.display = "block");
  392. };
  393. a.prototype.onAddToStage = function(b) {
  394. GameData.ready = false;
  395. SoundManager.instance().inPlaying = true;
  396. SoundManager.instance().playMusic();
  397. GameData.bestCombo2 = 0;
  398. GameData.isNewer ? (this.setgame(Config.newer_gk[0]), this.boxLayer.y = GameData.boxBoardTop_newer, this.showBoxAnimate(1)) : (this.setgame(Config.gk[0]), this.showAd(), this.initSoundBtn());
  399. egret.MainContext.instance.stage.addEventListener(egret.Event.DEACTIVATE, this.onDeActivate, this);
  400. egret.MainContext.instance.stage.addEventListener(egret.Event.ACTIVATE, this.onActivate, this);
  401. };
  402. a.prototype.onActivate = function(b) {
  403. SoundManager.instance().playMusic();
  404. };
  405. a.prototype.onDeActivate = function(b) {
  406. SoundManager.instance().stopMusic();
  407. };
  408. a.prototype.setgame = function(b) {
  409. this.bombMc = new BombMc;
  410. BoxMapHelper.init(b.xs, b.ys);
  411. this.initBgGrid(b);
  412. this.initGame(b);
  413. this.initBoard();
  414. this.initBtn();
  415. this.boxLayer.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this);
  416. };
  417. a.prototype.initBtn = function() {};
  418. a.prototype.resetGame = function(b, d) {
  419. this.emptyBoxList = [];
  420. var c = Config.ui,
  421. e = 10 * c.jx * GameData.scale,
  422. h = GameData.boxBgW;
  423. Math.round(h * c.bi);
  424. var c = h + c.jx,
  425. h = b.xs,
  426. l = b.ys,
  427. n = b.arr,
  428. f = null,
  429. k = h * l;
  430. if (false == d) {
  431. for (var f = [], g = 1; g <= n.length; g++) {
  432. for (var m = n[g - 1], q = 0; q < m; q++) {
  433. f.push(g);
  434. }
  435. }
  436. for (; f.length < k;) {
  437. f.push(0);
  438. }
  439. } else {
  440. f = b.arr;
  441. }
  442. n = true;
  443. null != this.boxMap ? (n = false) : (this.boxMap = []);
  444. for (k = 0; k < h; k++) {
  445. for (n && (this.boxMap[k] = [], m = new Box), g = 0; g < l; g++) {
  446. m = null;
  447. q = 0;
  448. q = d ? f[k][g] : this.getRandomBox(f);
  449. n && (m = new Box, this.boxMap[k][g] = m, m.data = new BoxData, this.boxLayer.addChild(m), m.touchEnabled = true, m.addEventListener(egret.TouchEvent.TOUCH_TAP, this.touchHandler, this), BoxMapHelper.setBox(k, g, m), m.x = 2 + GameData.boxHW + e + g * c, m.y = GameData.boxHW + e + k * c + 4 * GameData.scale);
  450. var m = this.boxMap[k][g],
  451. r = m.data;
  452. r.type = q;
  453. 0 != q && (m.texture = RES.getRes(q + "1"));
  454. r.i = k;
  455. r.j = g;
  456. this.addBox(m, !GameData.isNewer);
  457. 0 == q && this.moveToEmptyBoxList(m);
  458. }
  459. }
  460. d ? (1 == GameData.newer_gk ? egret.setTimeout(this.showNewer, this, 100) : egret.setTimeout(this.showNewer, this, 1300), GameData.paused = true, GameData.ready = true) : (this.boxLayer.y = GameData.boxBoardTop, false == GameData.shwingBonus && egret.setTimeout(function() {
  461. a.instance().showReadyGo();
  462. },
  463. this, 1000), GameData.paused = false);
  464. };
  465. a.prototype.initGame = function(b) {
  466. this.boxLayer = new egret.DisplayObjectContainer;
  467. this.boxLayer.y = GameData.boxBoardTop;
  468. this.addChild(this.boxLayer);
  469. this.reset();
  470. this.resetGame(b, GameData.isNewer);
  471. };
  472. a.prototype.restartGame = function() {
  473. GameData.ready = false;
  474. GameData.bestCombo2 = 0;
  475. GameData.shwingBonus = false;
  476. this.reset();
  477. this.resetGame(Config.gk[0], GameData.isNewer);
  478. this.initGrid();
  479. false == GameData.isNewer && (this.scoreBoard.visible = true, this.initSoundBtn());
  480. };
  481. a.prototype.initSoundBtn = function() {
  482. if (null == this.soundBtn) {
  483. var b = new egret.Bitmap;
  484. b.texture = GameData.soundEnabled ? RES.getRes("soundBtn2") : RES.getRes("soundBtn1");
  485. b.name = "soundbtn";
  486. b.anchorX = b.anchorY = 0.5;
  487. b.touchEnabled = true;
  488. b.addEventListener(egret.TouchEvent.TOUCH_TAP, this.touchHandler2, this);
  489. b.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.touchHandler2, this);
  490. b.addEventListener(egret.TouchEvent.TOUCH_END, this.touchHandler2, this);
  491. b.y = 23 + b.height / 2;
  492. b.x = GameData.GameWidth - b.width / 2 - 10;
  493. this.scoreBoard.addChild(b);
  494. this.soundBtn = b;
  495. }
  496. };
  497. a.prototype.onEnterFrame = function(b) {
  498. b = this.bombBoxAddIconList.length;
  499. for (var a = GameData.speed,
  500. c = 0,
  501. e = 0,
  502. h = [], l = [], n = 0; n < b; n++) {
  503. var f = this.bombBoxAddIconList[n],
  504. k = null,
  505. k = null;
  506. switch (f.dir) {
  507. case AddIcon.TOP_DIR:
  508. f.y -= a;
  509. k = BoxMapHelper.getCol(f.boxData.j);
  510. for (c = f.boxData.i; 0 <= c; c--) {
  511. var g = k[c];
  512. if (g.y > f.y) {
  513. if (0 != g.data.type) {
  514. f.targetBox = g;
  515. h.push(f);
  516. break;
  517. } else {
  518. 0 == c && g.y - GameData.boxHW / 2 > f.y && (f.targetBox = g, l.push(f));
  519. }
  520. }
  521. }
  522. break;
  523. case AddIcon.BOTTOM_DIR:
  524. f.y += a;
  525. k = BoxMapHelper.getCol(f.boxData.j);
  526. e = k.length;
  527. for (c = f.boxData.i; c < e; c++) {
  528. if (g = k[c], f.y > g.y) {
  529. if (0 != g.data.type) {
  530. f.targetBox = g;
  531. h.push(f);
  532. break;
  533. } else {
  534. c == e - 1 && f.y > g.y + GameData.boxHW / 2 && (f.targetBox = g, l.push(f));
  535. }
  536. }
  537. }
  538. break;
  539. case AddIcon.LEFT_DIR:
  540. f.x -= a;
  541. k = BoxMapHelper.getRow(f.boxData.i);
  542. for (c = f.boxData.j; 0 <= c; c--) {
  543. if (g = k[c], f.x < g.x) {
  544. if (0 != g.data.type) {
  545. f.targetBox = g;
  546. h.push(f);
  547. break;
  548. } else {
  549. 0 == c && f.x < g.x - GameData.boxHW / 2 && (f.targetBox = g, l.push(f));
  550. }
  551. }
  552. }
  553. break;
  554. case AddIcon.RIGHT_DIR:
  555. for (f.x += a, k = BoxMapHelper.getRow(f.boxData.i), e = k.length, c = f.boxData.j; c < e; c++) {
  556. if (g = k[c], f.x > g.x) {
  557. if (0 != g.data.type) {
  558. f.targetBox = g;
  559. h.push(f);
  560. break;
  561. } else {
  562. c == e - 1 && f.x > g.x + GameData.boxHW / 2 && (f.targetBox = g, l.push(f));
  563. }
  564. }
  565. }
  566. default:
  567. ;
  568. }
  569. }
  570. this.deleteAddIcon(h);
  571. this.onCrashAddIcon(l);
  572. this.updateScore();
  573. 0 == this.bombBoxAddIconList.length && 0 == GameData.bombCount && false == GameData.comboEnd && this.comboOver();
  574. };
  575. a.prototype.onCleanup = function() {
  576. GameData.isNewer ? (GameData.newer_gk = 2, this.resetGame(Config.newer_gk[1], GameData.isNewer), this.showBoxAnimate(2)) : this.resetGame(Config.gk[1], GameData.isNewer);
  577. };
  578. a.prototype.comboOver = function() {
  579. GameData.isOver || (GameData.combo > GameData.bestCombo && (GameData.bestCombo = GameData.combo), GameData.combo > GameData.bestCombo2 && (GameData.bestCombo2 = GameData.combo), this.emptyBoxList.length == GameData.rows * GameData.cols ? (this.calScoreOnBonusEnd(), GameData.shwingBonus = true, this.showAnimate(true), this.onCleanup()) : (this.onComboEndAddBox(), this.calScoreOnComboEnd()), GameData.shareFun2 && GameData.shareFun2(), GameData.comboEnd = true);
  580. };
  581. a.prototype.showAnimate = function(b) {
  582. var a = GameData.combo;
  583. 1 >= a && false == b || (null == this.animate1 && (this.animate1 = new Animate1, this.animate1.x = GameData.GameWidth / 2, this.animate1.y = GameData.GameHeight_3 / 2 + 25), this.addChild(this.animate1), b ? false == GameData.isNewer && (GameData.isOver = true, this.animate1.bonus()) : a >= Config.amazingNeed ? this.animate1.amazing() : a >= Config.greatNeed ? this.animate1.great() : a >= Config.goodNeed && this.animate1.good());
  584. };
  585. a.prototype.reset = function() {
  586. GameData.score = 0;
  587. GameData.combo = 0;
  588. GameData.bestCombo = 0;
  589. GameData.bombCount = 0;
  590. GameData.comboEnd = true;
  591. GameData.addCount = 2;
  592. GameData.isOver = false;
  593. this.P4 = Config.p4;
  594. this.P3 = Config.p3;
  595. this.P2 = Config.p2;
  596. this.bestScoreTxt && (this.bestScoreTxt.text = "Best " + GameData.bestScore);
  597. };
  598. a.prototype.updateScore = function() {
  599. this.oldSocre != GameData.score && (this.scoreTxt.text = GameData.score + "", this.oldSocre = GameData.score);
  600. };
  601. a.prototype.onCrashAddIcon = function(b) {
  602. for (var a = b.length,
  603. c = 0; c < a; c++) {
  604. var e = b[c];
  605. this.removeAddIcon(e, this.bombBoxAddIconList);
  606. var h = e.targetBox;
  607. this.boxLayer.removeChild(e);
  608. h.showCrash(e.dir);
  609. }
  610. };
  611. a.prototype.deleteAddIcon = function(b) {
  612. for (var a = b.length,
  613. c = 0; c < a; c++) {
  614. var e = b[c];
  615. this.removeAddIcon(e, this.bombBoxAddIconList);
  616. var h = e.targetBox;
  617. e.x = h.x;
  618. e.y = h.y;
  619. this.addBoxWhenBomb(h);
  620. this.boxLayer.removeChild(e);
  621. }
  622. };
  623. a.prototype.addBox = function(b, a) {
  624. void 0 === a && (a = true);
  625. 0 != b.data.type ? (b.texture = RES.getRes(b.data.type + "1"), a ? AnimateHelper.bubbleBox(b) : (b.scaleX = 1, b.scaleY = 1)) : (b.texture = null);
  626. };
  627. a.prototype.onCrashEnd = function(b) {};
  628. a.prototype.onBombEnd = function(b) {
  629. this.boxLayer.removeChild(b.bomb);
  630. this.showAddIcon(b, AddIcon.TOP_DIR, 0, -GameData.boxHW);
  631. this.showAddIcon(b, AddIcon.BOTTOM_DIR, 0, GameData.boxHW);
  632. this.showAddIcon(b, AddIcon.LEFT_DIR, -GameData.boxHW, 0);
  633. this.showAddIcon(b, AddIcon.RIGHT_DIR, GameData.boxHW, 0);
  634. GameData.bombCount -= 1;
  635. GameData.combo += 1;
  636. this.showCombo();
  637. GameData.addCount = 2;
  638. this.calScoreOnBombEnd();
  639. };
  640. a.prototype.calScoreOnBombEnd = function() {
  641. GameData.score += 4;
  642. };
  643. a.prototype.calScoreOnComboEnd = function() {
  644. GameData.score += 4 * (GameData.combo - 1);
  645. };
  646. a.prototype.calScoreOnBonusEnd = function() {
  647. GameData.score += 128;
  648. };
  649. a.prototype.removeAddIcon = function(b, a) {
  650. for (var c = a.length,
  651. e = 0; e < c; e++) {
  652. if (a[e] == b) {
  653. a.splice(e, 1);
  654. break;
  655. }
  656. }
  657. };
  658. a.prototype.showAddIcon = function(b, a, c, e) {
  659. a = b.getIconByDir(a);
  660. a.x = b.x + c;
  661. a.y = b.y + e;
  662. this.boxLayer.addChild(a);
  663. this.bombBoxAddIconList.push(a);
  664. };
  665. a.prototype.addBoxWhenBomb = function(b) {
  666. 4 <= b.data.type ? (b.data.type = 0, b.showBomb(), GameData.bombCount += 1, this.moveToEmptyBoxList(b), GameData.isNewer && this.hideNewerDes()) : 0 != b.data.type && (b.data.type++, AnimateHelper.bubbleBox(b), this.addBox(b));
  667. };
  668. a.prototype.onComboEndAddBox = function() {
  669. var b = GameData.combo,
  670. a = 0,
  671. a = b <= Config.add1Need ? 1 : b <= Config.add2Need ? 2 : b <= Config.add3Need ? 3 : 4;
  672. false == this.addRandomBox(a) && this.showAnimate(false);
  673. };
  674. a.prototype.fillAllBoxForNewer = function() {
  675. this.addRandomBox(this.emptyBoxList.length);
  676. };
  677. a.prototype.addRandomBox = function(b) {
  678. var a = false,
  679. c = this.emptyBoxList.length;
  680. if (0 == c) {
  681. a = true,
  682. this.onGameOver();
  683. } else {
  684. for (; 0 < b;) {
  685. b--;
  686. var c = null,
  687. e = 1;
  688. GameData.isNewer && GameData.newerStep < Config.newer_step_ij.length ? (c = Config.newer_step_ij[GameData.newerStep], c = this.getBoxForNewer(this.emptyBoxList, c.i, c.j), e = Math.floor(3 * Math.random()) + 1, GameData.newerStep++) : (c = this.getRandomBox(this.emptyBoxList), e = this.getRandomType());
  689. c.data.type = e;
  690. this.addBox(c);
  691. c = this.emptyBoxList.length;
  692. if (GameData.isNewer) {
  693. if (20 == c) {
  694. a = true;
  695. this.onGameOver();
  696. break;
  697. }
  698. } else if (0 == c) {
  699. a = true;
  700. this.onGameOver();
  701. break;
  702. }
  703. }
  704. }
  705. this.checkWarning();
  706. return a;
  707. };
  708. a.prototype.checkWarning = function() {
  709. if (0 < this.emptyBoxList.length) {
  710. if (4 >= this.emptyBoxList.length) {
  711. for (var b = 0; b < this.emptyBoxList.length; b++) {
  712. this.emptyBoxList[b].showWarning();
  713. }
  714. } else {
  715. AnimateHelper.freeAllWarningMc();
  716. }
  717. }
  718. };
  719. a.prototype.addBoxWhenClick = function(b) {
  720. if (0 < this.emptyBoxList.length) {
  721. b.data.type++,
  722. this.addBox(b),
  723. b = GameData.addCount,
  724. SoundManager.instance().playSound("addSound"),
  725. this.addRandomBox(b),
  726. 4 > GameData.addCount && (GameData.addCount += 1);
  727. } else {
  728. this.onGameOver();
  729. }
  730. };
  731. a.prototype.onGameOver = function() {
  732. false == GameData.isOver && (GameData.isOver = true, GameData.comboEnd = false, GameData.isNewer ? (GameData.isNewer = false, GameData.updateNewer()) : egret.setTimeout(this.showOver, this, 800));
  733. };
  734. a.prototype.showOver = function() {
  735. this.hideNewerDes();
  736. this.addChild(OverView.instance());
  737. };
  738. a.prototype.moveToEmptyBoxList = function(b) {
  739. this.emptyBoxList.push(b);
  740. };
  741. a.prototype.touchHandler = function(b) {
  742. if (false != GameData.comboEnd && !GameData.isOver && !GameData.paused && false != GameData.ready) {
  743. b = b.currentTarget;
  744. var c = b.data;
  745. GameData.isNewer && 2 > GameData.newerStep && (3 != c.i || 2 != c.j) || (AnimateHelper.freeAllWarningMc(), 0 < c.type && 4 > c.type ? (GameData.isNewer && (this.hideNewerDes(), 0 == GameData.newerStep ? this.showNewerDes(3, false) : 0 < GameData.newerStep && egret.setTimeout(function() {
  746. this.showNewerDes(4, false,
  747. function() {
  748. a.instance().showNewerEnd();
  749. });
  750. },
  751. this, 500)), AnimateHelper.bubbleBox(b), a.instance().addBoxWhenClick(b)) : (GameData.combo = 0, GameData.comboEnd = false, b.showBomb(), GameData.bombCount += 1, b.data.type = 0, this.moveToEmptyBoxList(b)));
  752. }
  753. };
  754. a.prototype.showNewerEnd = function() {
  755. egret.setTimeout(function() {
  756. egret.Tween.get(a.instance().boxLayer, {
  757. loop: false
  758. },
  759. null, true).to({
  760. alpha: 0
  761. },
  762. 800).call(function() {
  763. a.instance().showNewerDes5();
  764. });
  765. egret.Tween.get(a.instance().newerDes, {
  766. loop: false
  767. },
  768. null, true).to({
  769. alpha: 0
  770. },
  771. 800);
  772. },
  773. this, 1000);
  774. };
  775. a.prototype.getRandomType = function() {
  776. this.Px = 100 / (100 + GameData.score);
  777. var b = 0,
  778. b = Math.random(),
  779. b = b <= this.P4 ? 4 : b <= this.P3 ? 3 : b <= this.P2 ? 2 : 1;
  780. switch (b) {
  781. case 4:
  782. this.P3 += this.P3 * this.Px;
  783. this.P2 += this.P2 * this.Px;
  784. this.P4 = Config.p4 * this.Px;
  785. break;
  786. case 3:
  787. this.P4 += this.P4 * this.Px;
  788. this.P2 += this.P2 * this.Px;
  789. this.P3 = Config.p3 * this.Px;
  790. break;
  791. case 2:
  792. this.P4 += this.P4 * this.Px;
  793. this.P3 += this.P3 * this.Px;
  794. this.P2 = Config.p2 * this.Px;
  795. break;
  796. case 1:
  797. this.P4 += this.P4 * this.Px,
  798. this.P3 += this.P3 * this.Px,
  799. this.P2 += this.P2 * this.Px;
  800. default:
  801. ;
  802. }
  803. return b;
  804. };
  805. a.prototype.getRandomBox = function(b) {
  806. var a = Math.floor(Math.random() * b.length),
  807. c = b[a];
  808. b.splice(a, 1);
  809. return c;
  810. };
  811. a.prototype.getBoxForNewer = function(b, a, c) {
  812. for (var e = 0,
  813. h = null,
  814. l = 0; l < b.length; l++) {
  815. if (h = b[l], h.data.i == a && h.data.j == c) {
  816. e = l;
  817. break;
  818. }
  819. }
  820. b.splice(e, 1);
  821. return h;
  822. };
  823. a.prototype.updateCombo = function() {
  824. this.comboTxt.y >= this.comboTop ? (this.comboTxt.y -= GameData.comboSpeed) : (this.comboTxt.visible = false);
  825. };
  826. a.prototype.showCombo = function() {
  827. this.comboTxt.text = "Combo" + GameData.combo + "!";
  828. this.comboTxt.visible = true;
  829. var b = this.comboTxt,
  830. a = this.comboTop,
  831. c = this.comboBottom - 50 * GameData.scale / 2;
  832. egret.clearTimeout(GameData.showBombtimerId);
  833. this.comboTxt.y == c ? (GameData.showBombtimerId = egret.setTimeout(function() {
  834. egret.Tween.get(b, false, null, true).to({
  835. y: a,
  836. alpha: 0
  837. },
  838. 150).call(function() {
  839. b.visible = false;
  840. });
  841. },
  842. b, 500)) : (this.comboTxt.y = this.comboBottom, this.comboTxt.alpha = 0, egret.Tween.get(this.comboTxt, false, null, true).to({
  843. y: c,
  844. alpha: 1
  845. },
  846. 160).call(function() {
  847. GameData.showBombtimerId = egret.setTimeout(function() {
  848. egret.Tween.get(b, false, null, true).to({
  849. y: a,
  850. alpha: 0
  851. },
  852. 150).call(function() {
  853. b.visible = false;
  854. });
  855. },
  856. b, 500);
  857. }));
  858. };
  859. a.prototype.touchHandler2 = function(b) {
  860. var a = b.currentTarget;
  861. switch (b.type) {
  862. case egret.TouchEvent.TOUCH_BEGIN:
  863. a.scaleX = a.scaleY = 1.2;
  864. break;
  865. case egret.TouchEvent.TOUCH_END:
  866. a.scaleX = a.scaleY = 1;
  867. break;
  868. case egret.TouchEvent.TOUCH_TAP:
  869. "soundbtn" == a.name && (SoundManager.instance().playSound("ui_click"), GameData.soundEnabled = !GameData.soundEnabled, GameData.updateSoundEnabled(), a.texture = GameData.soundEnabled ? RES.getRes("soundBtn2") : RES.getRes("soundBtn1"), GameData.soundEnabled ? SoundManager.instance().playMusic() : SoundManager.instance().stopMusic());
  870. default:
  871. ;
  872. }
  873. };
  874. a.prototype.initBoard = function() {
  875. this.scoreBoard = new egret.Sprite;
  876. this.scoreBoard.graphics.beginFill(GameData.scoreBoardColor);
  877. this.scoreBoard.graphics.drawRect(0, GameData.scoreBoardTop, GameData.GameWidth, GameData.scoreBoardH);
  878. this.scoreBoard.graphics.endFill();
  879. this.scoreBoard.y = 0;
  880. this.addChild(this.scoreBoard);
  881. var b = RES.getRes("111_fnt"),
  882. a = new egret.BitmapText;
  883. a.spriteSheet = b;
  884. a.text = "0";
  885. a.y = GameData.scoreBoardTop + GameData.scoreBoardH / 2;
  886. a.anchorX = 0.5;
  887. a.anchorY = 0.5;
  888. a.x = GameData.GameWidth / 2;
  889. this.scoreBoard.addChild(a);
  890. this.scoreTxt = a;
  891. b = RES.getRes("gray_font_fnt");
  892. a = new egret.BitmapText;
  893. a.spriteSheet = b;
  894. a.text = "Best " + GameData.bestScore;
  895. a.anchorY = 0.5;
  896. a.y = GameData.scoreBoardTop + GameData.scoreBoardH + 25;
  897. a.x = 20;
  898. this.scoreBoard.addChild(a);
  899. this.bestScoreTxt = a;
  900. b = RES.getRes("red_font_fnt");
  901. a = new egret.BitmapText;
  902. a.spriteSheet = b;
  903. a.text = "Combo20!";
  904. this.comboTop = GameData.scoreBoardTop + GameData.scoreBoardH + 6 * GameData.scale;
  905. a.y = this.comboTop;
  906. a.x = GameData.GameWidth - 320 * GameData.scale;
  907. this.comboBottom = this.comboTop + 38 * GameData.scale;
  908. this.comboTxt = a;
  909. this.comboTxt.visible = false;
  910. this.scoreBoard.addChild(a);
  911. this.scoreBoard.visible = GameData.isNewer ? false: true;
  912. };
  913. a.prototype.initBgGrid = function(b) {
  914. var a = Config.ui;
  915. Math.round(GameData.boxBgW * a.bi);
  916. var c = new egret.Sprite;
  917. this.bgGrid = c;
  918. c.graphics.beginFill(a.bgc);
  919. c.graphics.drawRect(0, 0, GameData.GameWidth, GameData.GameHeight);
  920. c.graphics.endFill();
  921. a = b.ys;
  922. GameData.rows = b.xs;
  923. GameData.cols = a;
  924. b = new egret.DisplayObjectContainer;
  925. false == GameData.isNewer && this.initGrid();
  926. b.addChild(c);
  927. this.addChild(b);
  928. };
  929. a.prototype.initGrid = function() {
  930. if (!this.initedGrid) {
  931. var b = Config.ui,
  932. a = 10 * b.jx * GameData.scale,
  933. c, e = GameData.boxBgW,
  934. h = this.bgGrid;
  935. c = e + b.jx;
  936. for (var l = 0; l < GameData.rows; l++) {
  937. for (var n = 0; n < GameData.cols; n++) {
  938. h.graphics.beginFill(b.gbc),
  939. h.graphics.drawRoundRect(a + n * c, a + l * c + GameData.boxBoardTop, e, e, 48 * GameData.scale, 48 * GameData.scale),
  940. h.graphics.endFill();
  941. }
  942. }
  943. h.width = GameData.GameWidth;
  944. h.height = GameData.GameHeight;
  945. this.initedGrid = h.cacheAsBitmap = true;
  946. }
  947. };
  948. a.prototype.showNewerDes5 = function() {
  949. this.newerDes5 = new egret.Bitmap;
  950. this.newerDes5.texture = RES.getRes("newer_des5");
  951. this.newerDes5.anchorX = 0.5;
  952. this.newerDes5.x = GameData.GameWidth / 2;
  953. this.newerDes5.y = GameData.newerHandMc5Y;
  954. this.addChild(this.newerDes5);
  955. this.newerDes5Tween = egret.Tween.get(this.newerDes5, {
  956. loop: true
  957. },
  958. null, true).to({
  959. alpha: 0.8
  960. },
  961. 1000).to({
  962. alpha: 1
  963. },
  964. 1000);
  965. this.stage.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onResrartHandle, this);
  966. };
  967. a.prototype.onResrartHandle = function(b) {
  968. this.boxLayer.alpha = 1;
  969. this.hideNewerDes();
  970. this.hideNewerDes5();
  971. this.stage.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onResrartHandle, this);
  972. this.restartGame();
  973. this.showAd();
  974. };
  975. a.prototype.hideNewerDes5 = function() {
  976. this.newerDes5Tween && this.newerDes5Tween.setPaused(true);
  977. this.newerDes5 && this.newerDes5.parent && this.removeChild(this.newerDes5);
  978. };
  979. a.prototype.showNewerDes = function(b, c, p) {
  980. void 0 === c && (c = true);
  981. void 0 === p && (p = null);
  982. this.newerDes && (this.newerDes.texture = RES.getRes("newer_des" + b), this.addChild(this.newerDes), this.newerDes.x = this.newerDes.width / 2, this.newerDes.alpha = 0, null == this.showNewerDesTwwen && (this.showNewerDesTwwen = null, egret.Tween.get(this.newerDes, {
  983. loop: false
  984. },
  985. null, true).to({
  986. alpha: 1,
  987. x: GameData.GameWidth / 2
  988. },
  989. 1000).call(function() {
  990. c ? a.instance().showHandAnimate() : null != p && p();
  991. })));
  992. };
  993. a.prototype.showHandAnimate = function() {
  994. this.addChild(this.newerHandMc);
  995. this.newerHandMc.playAnimate();
  996. };
  997. a.prototype.hideNewerDes = function() {
  998. this.newerDes && this.newerDes.parent && (this.removeChild(this.newerDes), this.newerHandMc.stop(), this.newerHandMc.parent && this.removeChild(this.newerHandMc));
  999. };
  1000. a.prototype.showNewer = function() {
  1001. GameData.isNewer && null == this.newerDes && (this.newerDes = new egret.Bitmap, this.newerDes.anchorX = 0.5, this.newerDes.x = GameData.GameWidth / 2, this.newerDes.y = GameData.newerDesY, this.newerHandMc = new NewerHandMc, this.newerHandMc.x = GameData.GameWidth / 2 - 30, this.newerHandMc.y = GameData.newerHandMcY);
  1002. };
  1003. return a;
  1004. })(egret.DisplayObjectContainer);
  1005. PlayView.prototype.__class__ = "PlayView";
  1006. var GameData = (function() {
  1007. function c() {}
  1008. c.initNewer = function() {
  1009. "false" == egret.localStorage.getItem("isnewer") ? (c.isNewer = false) : (c.isNewer = true);
  1010. "false" == egret.localStorage.getItem("soundEnabled") ? (c.soundEnabled = false) : (c.soundEnabled = true);
  1011. };
  1012. c.updateNewer = function() {
  1013. egret.localStorage.setItem("isnewer", "false");
  1014. };
  1015. c.updateSoundEnabled = function() {
  1016. egret.localStorage.setItem("soundEnabled", c.soundEnabled ? "true": "false");
  1017. };
  1018. c.updateScore = function() {
  1019. c.score > c.bestScore && (c.bestScore = c.score, egret.localStorage.setItem("bestscore", c.bestScore + ""));
  1020. };
  1021. c.initBestScore = function() {
  1022. var a = egret.localStorage.getItem("bestscore");
  1023. c.bestScore = null == a ? 0 : a;
  1024. };
  1025. c.scale = 0.5;
  1026. c.bestCombo = 0;
  1027. c.bestCombo2 = 0;
  1028. c.boxW = 104 * c.scale;
  1029. c.boxHW = c.boxW / 2;
  1030. c.crashMCW = 14 * c.scale;
  1031. c.boxBgW = 110 * c.scale;
  1032. c.speed = 10 * c.scale;
  1033. c.GameWidth = 720 * c.scale;
  1034. c.GameHeight = 1040 * c.scale;
  1035. c.GameHeight_2 = 1040 * c.scale;
  1036. c.GameHeight_3 = 1200 * c.scale;
  1037. c.limitH1 = 1070 * c.scale;
  1038. c.limitH2 = 1100 * c.scale;
  1039. c.scoreBoardTop = 30 * c.scale;
  1040. c.scoreBoardTop2 = 90 * c.scale;
  1041. c.boxBoardTop = 230 * c.scale;
  1042. c.newerDesY = 150 * c.scale;
  1043. c.boxBoardTop_newer = 170 * c.scale;
  1044. c.newerHandMcY = 574 * c.scale;
  1045. c.newerHandMc5Y = 444 * c.scale;
  1046. c.scoreBoardH = 120 * c.scale;
  1047. c.scoreBoardColor = 16278114;
  1048. c.comboSpeed = 6 * c.scale;
  1049. c.isOver = false;
  1050. c.paused = false;
  1051. c.ready = false;
  1052. c.bestScore = 0;
  1053. c.isNewer = true;
  1054. c.newerStep = 0;
  1055. c.newer_gk = 1;
  1056. c.WScale = 1;
  1057. c.lastBoxY = 1;
  1058. c.shwingBonus = false;
  1059. c.soundEnabled = true;
  1060. c.dirtyRect1 = new egret.Rectangle(5, c.scoreBoardTop, c.GameWidth - 10, c.GameHeight - c.scoreBoardTop - 50);
  1061. return c;
  1062. })();
  1063. GameData.prototype.__class__ = "GameData";
  1064. var __extends = this.__extends ||
  1065. function(c, a) {
  1066. function b() {
  1067. this.constructor = c;
  1068. }
  1069. for (var d in a) {
  1070. a.hasOwnProperty(d) && (c[d] = a[d]);
  1071. }
  1072. b.prototype = a.prototype;
  1073. c.prototype = new b;
  1074. },
  1075. Box = (function(c) {
  1076. function a() {
  1077. c.call(this);
  1078. this.addCionList = null;
  1079. this.anchorY = this.anchorX = 0.5;
  1080. }
  1081. __extends(a, c);
  1082. a.prototype.onBombComplete = function(b) {
  1083. b.onBombEnd();
  1084. };
  1085. a.prototype.onCrashComplete = function(b) {
  1086. b.onCrashEnd();
  1087. };
  1088. a.prototype.onCrashEnd = function() {
  1089. this.crash.stop();
  1090. PlayView.instance().onCrashEnd(this);
  1091. this.crash.parent && this.crash.parent.removeChild(this.crash);
  1092. };
  1093. a.prototype.onBombEnd = function() {
  1094. this.bomb.stop();
  1095. PlayView.instance().onBombEnd(this);
  1096. };
  1097. a.prototype.showCrash = function(b) {
  1098. null == this.crash && (this.crash = new CrashMc);
  1099. var a = this.data.i,
  1100. c = this.data.j;
  1101. 0 == a && 0 == c ? b == AddIcon.TOP_DIR && (c = 1) : 0 == a && c == GameData.cols - 1 ? b == AddIcon.RIGHT_DIR && (a = 1) : a == GameData.rows - 1 && c == GameData.cols - 1 ? b == AddIcon.BOTTOM_DIR && (c = 1) : a == GameData.rows - 1 && 0 == c && b == AddIcon.BOTTOM_DIR && (c = 1);
  1102. this.crash.setBox(this, a, c, this.onCrashComplete);
  1103. this.onReadyToCrash();
  1104. };
  1105. a.prototype.onReadyToCrash = function() {
  1106. this.parent.addChild(this.crash);
  1107. this.crash.gotoAndPlay("\u52A8\u753B");
  1108. };
  1109. a.prototype.showBomb = function() {
  1110. null == this.bomb && (this.bomb = new BombMc);
  1111. this.bomb.setBox(this, this.onBombComplete);
  1112. this.data.type = 0;
  1113. AnimateHelper.bombBox(this, this.onReadyToBomb);
  1114. SoundManager.instance().playSound("bombSound");
  1115. };
  1116. a.prototype.onReadyToBomb = function() {
  1117. this.parent.addChild(this.bomb);
  1118. PlayView.instance().addBox(this);
  1119. this.bomb.gotoAndPlay("\u5143\u4EF6 15");
  1120. };
  1121. a.prototype.getIconByDir = function(b) {
  1122. null == this.addCionList && (this.addCionList = [new AddIcon(AddIcon.TOP_DIR, this.data), new AddIcon(AddIcon.LEFT_DIR, this.data), new AddIcon(AddIcon.RIGHT_DIR, this.data), new AddIcon(AddIcon.BOTTOM_DIR, this.data)]);
  1123. return this.addCionList[b - 1];
  1124. };
  1125. a.prototype.hideWarning = function() {
  1126. this.warningMc && (this.warningMc.box = null, this.warningMc.inUse = false);
  1127. this.warningMc = null;
  1128. };
  1129. a.prototype.showWarning = function() {
  1130. this.warningMc = AnimateHelper.getWarningMc();
  1131. this.warningMc.x = this.x - GameData.boxHW;
  1132. this.warningMc.y = this.y - GameData.boxHW - 1;
  1133. this.warningMc.playAnimate();
  1134. this.parent.addChild(this.warningMc);
  1135. };
  1136. return a;
  1137. })(egret.Bitmap);
  1138. Box.prototype.__class__ = "Box";
  1139. var SoundManager = (function() {
  1140. function c() {
  1141. this.isMusicPlaying = this.inPlaying = false;
  1142. }
  1143. c.prototype.initSound = function() {
  1144. c.canPlaySound = egret.WebAudio.canUseWebAudio ? true: false;
  1145. c.canPlaySound && (this.bombSound = RES.getRes("bomb"), this.addSound = RES.getRes("add"), this.ui_click = RES.getRes("ui_click"), this.amazing = RES.getRes("amazing"), this.bonus = RES.getRes("bonus"), this.good = RES.getRes("good"), this.great = RES.getRes("great"), this.readygo = RES.getRes("readygo"), this.warning = RES.getRes("warning"));
  1146. };
  1147. c.instance = function() {
  1148. null == c._instance && (c._instance = new c);
  1149. return c._instance;
  1150. };
  1151. c.prototype.playSound = function(a) {
  1152. if (false != c.canPlaySound && false != GameData.soundEnabled) {
  1153. switch (a) {
  1154. case "bombSound":
  1155. this.bombSound.play();
  1156. break;
  1157. case "addSound":
  1158. this.addSound.play();
  1159. break;
  1160. case "ui_click":
  1161. this.ui_click.play();
  1162. break;
  1163. case "amazing":
  1164. this.amazing.play();
  1165. break;
  1166. case "bonus":
  1167. this.bonus.play();
  1168. break;
  1169. case "good":
  1170. this.good.play();
  1171. break;
  1172. case "great":
  1173. this.great.play();
  1174. break;
  1175. case "readygo":
  1176. this.readygo.play();
  1177. break;
  1178. case "warning":
  1179. this.warning.play();
  1180. default:
  1181. ;
  1182. }
  1183. }
  1184. };
  1185. c.prototype.initBgSound = function() {
  1186. this.bgSound = RES.getRes("music");
  1187. };
  1188. c.prototype.stopMusic = function() {
  1189. this.bgSound && this.isMusicPlaying && (this.isMusicPlaying = false, this.bgSound.pause());
  1190. };
  1191. c.prototype.playMusic = function() {
  1192. this.bgSound && GameData.soundEnabled && false == this.isMusicPlaying && this.inPlaying && (this.isMusicPlaying = true, this.bgSound.play(true));
  1193. };
  1194. c.canPlaySound = false;
  1195. return c;
  1196. })();
  1197. SoundManager.prototype.__class__ = "SoundManager";
  1198. var __extends = this.__extends ||
  1199. function(c, a) {
  1200. function b() {
  1201. this.constructor = c;
  1202. }
  1203. for (var d in a) {
  1204. a.hasOwnProperty(d) && (c[d] = a[d]);
  1205. }
  1206. b.prototype = a.prototype;
  1207. c.prototype = new b;
  1208. },
  1209. BombMc = (function(c) {
  1210. function a() {
  1211. var b = RES.getRes("bomb_json"),
  1212. a = RES.getRes("bomb_png");
  1213. c.call(this, b, a);
  1214. this.frameRate = 42;
  1215. this.addEventListener(egret.Event.COMPLETE, this.onComplete, this);
  1216. }
  1217. __extends(a, c);
  1218. a.prototype.onComplete = function(b) {
  1219. this._onComplete(b.target._box);
  1220. };
  1221. a.prototype.setBox = function(b, a) {
  1222. this._box = b;
  1223. this.x = b.x;
  1224. this.y = b.y;
  1225. this.currType = b.data.type;
  1226. this._onComplete = a;
  1227. };
  1228. return a;
  1229. })(egret.MovieClip);
  1230. BombMc.prototype.__class__ = "BombMc";
  1231. var __extends = this.__extends ||
  1232. function(c, a) {
  1233. function b() {
  1234. this.constructor = c;
  1235. }
  1236. for (var d in a) {
  1237. a.hasOwnProperty(d) && (c[d] = a[d]);
  1238. }
  1239. b.prototype = a.prototype;
  1240. c.prototype = new b;
  1241. },
  1242. WarningMc = (function(c) {
  1243. function a() {
  1244. var b = RES.getRes("warning_json"),
  1245. a = RES.getRes("warning_png");
  1246. c.call(this, b, a);
  1247. this.frameRate = 24;
  1248. this.scaleX = this.scaleY = 0.95;
  1249. this.addEventListener(egret.Event.COMPLETE, this.onComplete, this);
  1250. }
  1251. __extends(a, c);
  1252. a.prototype.onComplete = function(b) {
  1253. this.count++;
  1254. 2 <= this.count ? (this.stop(), this.parent && this.parent.removeChild(this)) : SoundManager.instance().playSound("warning");
  1255. };
  1256. a.prototype.playAnimate = function() {
  1257. this.count = 0;
  1258. this.gotoAndPlay("\u5143\u4EF6 2");
  1259. SoundManager.instance().playSound("warning");
  1260. };
  1261. return a;
  1262. })(egret.MovieClip);
  1263. WarningMc.prototype.__class__ = "WarningMc";
  1264. var AnimateHelper = (function() {
  1265. function c() {}
  1266. c.bubbleBox = function(a, b) {
  1267. a.scaleX = 0.25;
  1268. a.scaleY = 0.25;
  1269. null == b ? egret.Tween.get(a, {
  1270. loop: false
  1271. },
  1272. null, true).to({
  1273. scaleX: 1,
  1274. scaleY: 1
  1275. },
  1276. 800, egret.Ease.elasticOut) : egret.Tween.get(a, {
  1277. loop: false
  1278. },
  1279. null, true).to({
  1280. scaleX: 1,
  1281. scaleY: 1
  1282. },
  1283. 800, egret.Ease.elasticOut).call(b);
  1284. };
  1285. c.bombBox = function(a, b) {
  1286. a.scaleX = 1;
  1287. a.scaleY = 1;
  1288. egret.Tween.get(a, {
  1289. loop: false
  1290. },
  1291. null, true).to({
  1292. scaleX: 0.8,
  1293. scaleY: 0.8
  1294. },
  1295. 50).call(b);
  1296. };
  1297. c.init = function() {
  1298. c.warningMcList = [];
  1299. for (var a = 0; 4 > a; a++) {
  1300. var b = new WarningMc;
  1301. b.inUse = false;
  1302. c.warningMcList.push(b);
  1303. }
  1304. };
  1305. c.getWarningMc = function() {
  1306. for (var a, b = 0; 4 > b; b++) {
  1307. if (a = this.warningMcList[b], false == a.inUse) {
  1308. a.inUse = true;
  1309. break;
  1310. }
  1311. }
  1312. return a;
  1313. };
  1314. c.freeAllWarningMc = function() {
  1315. for (var a, b = 0; 4 > b; b++) {
  1316. a = c.warningMcList[b],
  1317. a.inUse = false,
  1318. a.stop(),
  1319. a.parent && a.parent.removeChild(a),
  1320. a.box && (a.box.warningMc = null);
  1321. }
  1322. };
  1323. return c;
  1324. })();
  1325. AnimateHelper.prototype.__class__ = "AnimateHelper";
  1326. var __extends = this.__extends ||
  1327. function(c, a) {
  1328. function b() {
  1329. this.constructor = c;
  1330. }
  1331. for (var d in a) {
  1332. a.hasOwnProperty(d) && (c[d] = a[d]);
  1333. }
  1334. b.prototype = a.prototype;
  1335. c.prototype = new b;
  1336. },
  1337. LoadingUI = (function(c) {
  1338. function a() {
  1339. c.call(this);
  1340. this.createView();
  1341. }
  1342. __extends(a, c);
  1343. a.prototype.createView = function() {
  1344. this.textField = new egret.TextField;
  1345. this.addChild(this.textField);
  1346. this.textField.y = GameData.GameHeight / 2;
  1347. this.textField.width = GameData.GameWidth;
  1348. this.textField.height = 100;
  1349. this.textField.textAlign = "center";
  1350. };
  1351. a.prototype.setProgress = function(b, a) {
  1352. this.textField.text = "\u8D44\u6E90\u52A0\u8F7D\u4E2D..." + b + "/" + a;
  1353. };
  1354. return a;
  1355. })(egret.Sprite);
  1356. LoadingUI.prototype.__class__ = "LoadingUI";
  1357. var BoxData = (function() {
  1358. function c() {}
  1359. c.prototype.copyFrom = function(a) {
  1360. this.type = a.type;
  1361. this.i = a.i;
  1362. this.j = a.j;
  1363. };
  1364. return c;
  1365. })();
  1366. BoxData.prototype.__class__ = "BoxData";
  1367. var __extends = this.__extends ||
  1368. function(c, a) {
  1369. function b() {
  1370. this.constructor = c;
  1371. }
  1372. for (var d in a) {
  1373. a.hasOwnProperty(d) && (c[d] = a[d]);
  1374. }
  1375. b.prototype = a.prototype;
  1376. c.prototype = new b;
  1377. },
  1378. StartView = (function(c) {
  1379. function a() {
  1380. c.call(this);
  1381. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
  1382. }
  1383. __extends(a, c);
  1384. a.prototype.onAddToStage = function(b) {
  1385. b = new egret.Bitmap;
  1386. b.texture = RES.getRes("bg");
  1387. b.scaleX = b.scaleY = 1;
  1388. b.anchorY = 0.5;
  1389. b.y = GameData.GameHeight / 2;
  1390. b.x = 0;
  1391. this.addChild(b);
  1392. var a = new egret.Bitmap;
  1393. a.texture = RES.getRes("sbt");
  1394. a.anchorX = a.anchorY = 0.5;
  1395. a.scaleX = a.scaleY = 0.8;
  1396. a.name = "startBtn";
  1397. a.addEventListener(egret.TouchEvent.TOUCH_TAP, this.touchHandler, this);
  1398. a.addEventListener(egret.TouchEvent.TOUCH_END, this.touchHandler, this);
  1399. a.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.touchHandler, this);
  1400. a.x = GameData.GameWidth / 2;
  1401. a.y = 0.8 * GameData.GameHeight - 40 * GameData.scale;
  1402. this.addChild(a);
  1403. a.touchEnabled = true;
  1404. a = new egret.Bitmap;
  1405. a.texture = RES.getRes("infoBtn");
  1406. a.anchorX = a.anchorY = 0.5;
  1407. a.scaleX = a.scaleY = 0.8;
  1408. a.addEventListener(egret.TouchEvent.TOUCH_TAP, this.touchHandler, this);
  1409. a.addEventListener(egret.TouchEvent.TOUCH_END, this.touchHandler, this);
  1410. a.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.touchHandler, this);
  1411. a.x = GameData.GameWidth - 70 * GameData.scale;
  1412. a.y = 70 * GameData.scale;
  1413. this.addChild(a);
  1414. a.touchEnabled = true;
  1415. a.name = "infoBtn";
  1416. b = new egret.Bitmap;
  1417. b.texture = RES.getRes("infoBg");
  1418. b.x = b.width / 2;
  1419. b.anchorX = 0.5;
  1420. b.scaleX = -1;
  1421. this.infoPanel = new egret.DisplayObjectContainer;
  1422. this.infoPanel.addChild(b);
  1423. a = new egret.Bitmap;
  1424. a.name = "closeInfoBtn";
  1425. a.texture = RES.getRes("infoBtn");
  1426. a.alpha = 0;
  1427. a.scaleX = a.scaleY = 0.9;
  1428. a.x = b.width - a.width + 6;
  1429. a.y = -6;
  1430. a.touchEnabled = true;
  1431. a.addEventListener(egret.TouchEvent.TOUCH_TAP, this.touchHandler, this);
  1432. this.infoPanel.addChild(a);
  1433. this.addChild(this.infoPanel);
  1434. this.infoPanel.anchorX = 0.5;
  1435. this.infoPanel.anchorY = 0.5;
  1436. this.infoPanel.x = GameData.GameWidth / 2;
  1437. this.infoPanel.y = GameData.GameHeight / 2 - 100 * GameData.scale;
  1438. this.infoPanel.visible = false;
  1439. GameData.initBestScore();
  1440. AnimateHelper.init();
  1441. GameData.shareFun2 && GameData.shareFun2();
  1442. };
  1443. a.prototype.touchHandler = function(a) {
  1444. var c = a.target;
  1445. switch (a.type) {
  1446. case egret.TouchEvent.TOUCH_BEGIN:
  1447. c.scaleX = c.scaleY = 1;
  1448. break;
  1449. case egret.TouchEvent.TOUCH_END:
  1450. c.scaleX = c.scaleY = 0.8;
  1451. break;
  1452. case egret.TouchEvent.TOUCH_TAP:
  1453. SoundManager.instance().playSound("ui_click"),
  1454. "startBtn" == c.name ? (a = this.stage, this.parent.removeChild(this), a.addChild(new PlayView)) : "infoBtn" == c.name ? (this.infoPanel.visible = !this.infoPanel.visible) : "closeInfoBtn" == c.name && (this.infoPanel.visible = false);
  1455. default:
  1456. ;
  1457. }
  1458. };
  1459. return a;
  1460. })(egret.DisplayObjectContainer);
  1461. StartView.prototype.__class__ = "StartView";
  1462. var __extends = this.__extends ||
  1463. function(c, a) {
  1464. function b() {
  1465. this.constructor = c;
  1466. }
  1467. for (var d in a) {
  1468. a.hasOwnProperty(d) && (c[d] = a[d]);
  1469. }
  1470. b.prototype = a.prototype;
  1471. c.prototype = new b;
  1472. },
  1473. LoadingMc = (function(c) {
  1474. function a() {
  1475. c.call(this);
  1476. this.frame = 1;
  1477. this.bg2 = new egret.Bitmap;
  1478. this.bg2.anchorX = 0.5;
  1479. this.bg2.anchorY = 0.5;
  1480. this.bg2.texture = RES.getRes("3");
  1481. this.addChild(this.bg2);
  1482. this.bg2.mask = new egret.Rectangle(0, 0, this.bg2.width, 1);
  1483. }
  1484. __extends(a, c);
  1485. a.prototype.setProgress = function(a) {
  1486. this.bg2.mask && (this.bg2.mask.height = this.bg2.height * a);
  1487. 1 == a && (this.bg2.mask = null);
  1488. };
  1489. a.prototype.play = function() {
  1490. this.timer = new egret.Timer(100);
  1491. this.frame = 1;
  1492. this.timer.addEventListener(egret.TimerEvent.TIMER, this.onTimer, this);
  1493. this.timer.start();
  1494. };
  1495. a.prototype.onTimer = function(a) {
  1496. this.frame++;
  1497. 3 < this.frame && (this.frame = 1);
  1498. };
  1499. return a;
  1500. })(egret.DisplayObjectContainer);
  1501. LoadingMc.prototype.__class__ = "LoadingMc";
  1502. var __extends = this.__extends ||
  1503. function(c, a) {
  1504. function b() {
  1505. this.constructor = c;
  1506. }
  1507. for (var d in a) {
  1508. a.hasOwnProperty(d) && (c[d] = a[d]);
  1509. }
  1510. b.prototype = a.prototype;
  1511. c.prototype = new b;
  1512. },
  1513. Main = (function(c) {
  1514. function a() {
  1515. c.call(this);
  1516. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
  1517. }
  1518. __extends(a, c);
  1519. a.prototype.onAddToStage = function(a) {
  1520. RES.addEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
  1521. GameData.initNewer();
  1522. GameData.isNewer ? RES.loadConfig("resource/resource_newer.json", "resource/") : RES.loadConfig("resource/resource.json", "resource/");
  1523. };
  1524. a.prototype.onConfigComplete = function(a) {
  1525. RES.removeEventListener(RES.ResourceEvent.CONFIG_COMPLETE, this.onConfigComplete, this);
  1526. RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onResourceLoadComplete, this);
  1527. RES.addEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
  1528. RES.loadGroup("loading");
  1529. };
  1530. a.prototype.loadMusic = function() {
  1531. RES.loadGroup("sound2");
  1532. RES.loadGroup("sound1");
  1533. };
  1534. a.prototype.onResourceLoadComplete = function(a) {
  1535. "loading" == a.groupName && (this.loadingMc = new LoadingMc, this.loadingMc.x = GameData.GameWidth / 2, this.loadingMc.y = 0.4 * GameData.GameHeight, this.addChild(this.loadingMc), RES.loadGroup("preload2"));
  1536. "sound1" == a.groupName && SoundManager.instance().initSound();
  1537. "sound2" == a.groupName && SoundManager.instance().initBgSound();
  1538. if ("preload2" == a.groupName) {
  1539. RES.removeEventListener(RES.ResourceEvent.GROUP_PROGRESS, this.onResourceProgress, this);
  1540. var c = this;
  1541. setTimeout(function() {
  1542. c.removeChild(c.loadingMc);
  1543. c.stage.addChild(new StartView);
  1544. c.loadMusic();
  1545. },
  1546. 1000);
  1547. }
  1548. };
  1549. a.prototype.onResourceProgress = function(a) {
  1550. if ("preload2" == a.groupName) {
  1551. this.loadingMc.setProgress(a.itemsLoaded / a.itemsTotal);
  1552. }
  1553. };
  1554. a.prototype.createScene = function() {};
  1555. a.prototype.onButtonClick = function(a) {};
  1556. return a;
  1557. })(egret.DisplayObjectContainer);
  1558. Main.prototype.__class__ = "Main";
  1559. var Config = (function() {
  1560. function c() {}
  1561. c.gk = [{
  1562. xs: 6,
  1563. ys: 6,
  1564. arr: [4, 7, 6, 14]
  1565. },
  1566. {
  1567. xs: 6,
  1568. ys: 6,
  1569. arr: [5, 7, 7, 5]
  1570. }];
  1571. c.newer_step_ij = [{
  1572. i: 3,
  1573. j: 1
  1574. },
  1575. {
  1576. i: 4,
  1577. j: 1
  1578. },
  1579. {
  1580. i: 4,
  1581. j: 2
  1582. },
  1583. {
  1584. i: 4,
  1585. j: 3
  1586. },
  1587. {
  1588. i: 4,
  1589. j: 4
  1590. }];
  1591. c.newer_gk = [{
  1592. xs: 6,
  1593. ys: 6,
  1594. arr: [[0, 0, 0, 0, 0, 0], [0, 4, 3, 4, 4, 0], [0, 4, 4, 1, 4, 0], [0, 2, 4, 4, 4, 0], [0, 4, 4, 4, 3, 0], [0, 0, 0, 0, 0, 0]]
  1595. },
  1596. {
  1597. xs: 6,
  1598. ys: 6,
  1599. arr: [[0, 0, 0, 0, 0, 0], [0, 2, 3, 1, 3, 0], [0, 3, 1, 2, 3, 0], [0, 0, 2, 3, 2, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]
  1600. }];
  1601. c.p4 = 0.1;
  1602. c.p3 = 0.2;
  1603. c.p2 = 0.3;
  1604. c.goodNeed = 3;
  1605. c.greatNeed = 6;
  1606. c.amazingNeed = 10;
  1607. c.add1Need = 3;
  1608. c.add2Need = 7;
  1609. c.add3Need = 15;
  1610. c.ui = {
  1611. bi: 0.95,
  1612. jx: 2,
  1613. bgc: 15986903,
  1614. hc: 16278114,
  1615. gbc: 14802612,
  1616. jgc: 16278114,
  1617. sbc: 15986390
  1618. };
  1619. return c;
  1620. })();
  1621. Config.prototype.__class__ = "Config";
  1622. var BoxMapHelper = (function() {
  1623. function c() {}
  1624. c.setBox = function(a, b, d) {
  1625. var p = c._cols;
  1626. c._rows[a][b] = d;
  1627. p[b][a] = d;
  1628. };
  1629. c.init = function(a, b) {
  1630. for (var d = [], p = [], e = 0; e < a; e++) {
  1631. d[e] = [];
  1632. p[e] = [];
  1633. for (var h = 0; h < b; h++) {
  1634. d[e][h] = [],
  1635. p[e][h] = [];
  1636. }
  1637. }
  1638. c._cols = p;
  1639. c._rows = d;
  1640. };
  1641. c.getRow = function(a) {
  1642. return c._rows[a];
  1643. };
  1644. c.getCol = function(a) {
  1645. return c._cols[a];
  1646. };
  1647. return c;
  1648. })();
  1649. BoxMapHelper.prototype.__class__ = "BoxMapHelper";
  1650. var __extends = this.__extends ||
  1651. function(c, a) {
  1652. function b() {
  1653. this.constructor = c;
  1654. }
  1655. for (var d in a) {
  1656. a.hasOwnProperty(d) && (c[d] = a[d]);
  1657. }
  1658. b.prototype = a.prototype;
  1659. c.prototype = new b;
  1660. },
  1661. AddIcon = (function(c) {
  1662. function a(a, d) {
  1663. c.call(this);
  1664. this.anchorY = this.anchorX = 0.5;
  1665. this.texture = RES.getRes("555");
  1666. this.dir = a;
  1667. this.boxData = d;
  1668. }
  1669. __extends(a, c);
  1670. a.TOP_DIR = 1;
  1671. a.LEFT_DIR = 2;
  1672. a.RIGHT_DIR = 3;
  1673. a.BOTTOM_DIR = 4;
  1674. return a;
  1675. })(egret.Bitmap);
  1676. AddIcon.prototype.__class__ = "AddIcon";
  1677. var __extends = this.__extends ||
  1678. function(c, a) {
  1679. function b() {
  1680. this.constructor = c;
  1681. }
  1682. for (var d in a) {
  1683. a.hasOwnProperty(d) && (c[d] = a[d]);
  1684. }
  1685. b.prototype = a.prototype;
  1686. c.prototype = new b;
  1687. },
  1688. Animate1 = (function(c) {
  1689. function a() {
  1690. var a = RES.getRes("animate1_json"),
  1691. d = RES.getRes("animate1_png");
  1692. c.call(this, a, d);
  1693. this.frameRate = 24;
  1694. this.addEventListener(egret.Event.COMPLETE, this.onComplete, this);
  1695. }
  1696. __extends(a, c);
  1697. a.prototype.onComplete = function(a) {
  1698. this.stop();
  1699. this.parent && this.parent.removeChild(this);
  1700. "bonus" == this.animateName && PlayView.instance().showHighCombo();
  1701. };
  1702. a.prototype.good = function() {
  1703. this.animateName = "good";
  1704. this.gotoAndPlay("good");
  1705. SoundManager.instance().playSound("good");
  1706. };
  1707. a.prototype.amazing = function() {
  1708. this.animateName = "amazing";
  1709. this.gotoAndPlay("amazing");
  1710. SoundManager.instance().playSound("amazing");
  1711. };
  1712. a.prototype.great = function() {
  1713. this.animateName = "great";
  1714. this.gotoAndPlay("great");
  1715. SoundManager.instance().playSound("great");
  1716. };
  1717. a.prototype.bonus = function() {
  1718. this.animateName = "bonus";
  1719. this.gotoAndPlay("bonus");
  1720. SoundManager.instance().playSound("bonus");
  1721. };
  1722. return a;
  1723. })(egret.MovieClip);
  1724. Animate1.prototype.__class__ = "Animate1";
  1725. var __extends = this.__extends ||
  1726. function(c, a) {
  1727. function b() {
  1728. this.constructor = c;
  1729. }
  1730. for (var d in a) {
  1731. a.hasOwnProperty(d) && (c[d] = a[d]);
  1732. }
  1733. b.prototype = a.prototype;
  1734. c.prototype = new b;
  1735. },
  1736. CrashMc = (function(c) {
  1737. function a() {
  1738. var a = RES.getRes("crash_json"),
  1739. d = RES.getRes("crash_png");
  1740. c.call(this, a, d);
  1741. this.frameRate = 20;
  1742. this.addEventListener(egret.Event.COMPLETE, this.onComplete, this);
  1743. }
  1744. __extends(a, c);
  1745. a.prototype.onComplete = function(a) {
  1746. this._onComplete(a.target._box);
  1747. };
  1748. a.prototype.setBox = function(a, c, p, e) {
  1749. this._box = a;
  1750. 0 == p ? (this.x = a.x - GameData.boxHW + GameData.crashMCW, this.y = a.y) : 0 == c ? (this.rotation = 90, this.x = a.x, this.y = a.y - GameData.boxHW + GameData.crashMCW) : p == GameData.cols - 1 ? (this.rotation = 180, this.x = a.x + GameData.boxHW - GameData.crashMCW, this.y = a.y) : (this.rotation = -90, this.x = a.x, this.y = a.y + GameData.boxHW - GameData.crashMCW);
  1751. this._onComplete = e;
  1752. };
  1753. return a;
  1754. })(egret.MovieClip);
  1755. CrashMc.prototype.__class__ = "CrashMc";