brainie.min.js 92 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020
  1. function startGame() {
  2. this.lang = SG.lang
  3. mainFont = mainFontName[lang];
  4. game = new Brainie.BrainieMain
  5. }
  6. var __extends = this.__extends || function(e, t) {
  7. function n() {
  8. this.constructor = e
  9. }
  10. for (var r in t) t.hasOwnProperty(r) && (e[r] = t[r]);
  11. n.prototype = t.prototype;
  12. e.prototype = new n
  13. },
  14. game, brainieMain, gW = 600,
  15. gH = 730,
  16. sndPlr, gameTexts, lang, SG_Hooks, mainFontName, mainFont, gameCanvas, isStockAndroid = !1,
  17. Brainie;
  18. (function(e) {
  19. var t = function(t) {
  20. function n() {
  21. t.call(this, 600, 730, Phaser.CANVAS, "gameContainer", null, !1, !0);
  22. this.snds = "box_color box_explosion box_normal box_select_1 box_select_2 box_select_boom box_select_wrong clear_eff game_over level_complete reset wave".split(" ");
  23. var n = navigator.userAgent;
  24. if (isStockAndroid = -1 < n.indexOf("Mozilla/5.0") && -1 < n.indexOf("Android ") && -1 < n.indexOf("AppleWebKit") && !(-1 < n.indexOf("Chrome"))) gameCanvas = document.getElementById("gameContainer"), gameCanvas.style.opacity = .99;
  25. this.state.add("Boot", e.Boot, !1);
  26. this.state.add("Preloader", e.Preloader, !1);
  27. this.state.add("GameMain", e.GameMain, !1);
  28. this.state.start("Boot")
  29. }
  30. __extends(n, t);
  31. return n
  32. }(Phaser.Game);
  33. e.BrainieMain = t
  34. })(Brainie || (Brainie = {}));
  35. (function(e) {
  36. var t = function(e) {
  37. function t(t, n, r, i, s, o, u, a) {
  38. "undefined" === typeof a && (a = "center");
  39. e.call(this, t, n, "", !1);
  40. this.anchorY = this.anchorX = 0;
  41. this.x = r;
  42. this.y = i;
  43. this.txFld = new Phaser.BitmapText(this.game, 0, 0, s, o, u);
  44. this.txFld.align = a;
  45. this.add(this.txFld)
  46. }
  47. __extends(t, e);
  48. t.prototype.setAnchor = function(e, t) {
  49. this.anchorX = e;
  50. this.anchorY = t;
  51. this.anchorUpdate()
  52. };
  53. t.prototype.anchorUpdate = function() {
  54. this.txFld.updateTransform();
  55. this.txFld.x = -this.txFld.textWidth * this.anchorX;
  56. this.txFld.y = -this.txFld.textHeight * this.anchorY
  57. };
  58. t.prototype.setText = function(e) {
  59. this.txFld.setText(e);
  60. this.anchorUpdate()
  61. };
  62. t.prototype.getWidth = function() {
  63. return this.txFld.textWidth
  64. };
  65. return t
  66. }(Phaser.Group);
  67. e.BrainieBmText = t
  68. })(Brainie || (Brainie = {}));
  69. (function(e) {
  70. var t = function(e) {
  71. function t(t, n, r, i, s, o, u, a, f) {
  72. "undefined" === typeof f && (f = "center");
  73. e.call(this, t, n, "", !1);
  74. this.anchorY = this.anchorX = 0;
  75. this.x = r;
  76. this.y = i;
  77. this.txFld = new Phaser.Text(this.game, 0, 0, o, {
  78. font: u.toString() + "px " + s,
  79. fill: a,
  80. align: f
  81. });
  82. this.add(this.txFld)
  83. }
  84. __extends(t, e);
  85. t.prototype.setAnchor = function(e, t) {
  86. this.anchorX = e;
  87. this.anchorY = t;
  88. this.anchorUpdate()
  89. };
  90. t.prototype.anchorUpdate = function() {
  91. this.txFld.x = -this.txFld.width * this.anchorX;
  92. this.txFld.y = -this.txFld.height * this.anchorY
  93. };
  94. t.prototype.setText = function(e) {
  95. this.txFld.setText(e);
  96. this.anchorUpdate()
  97. };
  98. t.prototype.getWidth = function() {
  99. return this.txFld.width
  100. };
  101. return t
  102. }(Phaser.Group);
  103. e.BrainieNormalText = t
  104. })(Brainie || (Brainie = {}));
  105. (function(e) {
  106. var t = function(t) {
  107. function n(n, r, i, s, o, u, a) {
  108. t.call(this, n, r, "", !1);
  109. this.bName = "";
  110. this.bSmall = !1;
  111. this.initX = 0;
  112. this.isEnabled = !0;
  113. this.bName = o;
  114. this.bSmall = u;
  115. this.x = i;
  116. this.y = s;
  117. this.bgBm = this.create(0, 0, "mainSt", "");
  118. this.bSmall ? (this.bgBm.frameName = "menuBtnSml_up.png", this.initX = 65) : (this.bgBm.frameName = "menuBtn_up.png", this.initX = 130.5);
  119. this.labelFld = new e.BrainieNormalText(this.game, this, this.initX, 20, mainFont, o, a, "#764f5c");
  120. this.labelFld.setAnchor(.5, 0);
  121. this.bgBm.inputEnabled = !0;
  122. this.bgBm.events.onInputDown.add(this.down, this);
  123. this.bgBm.events.onInputOut.add(this.up, this);
  124. this.bgBm.events.onInputUp.add(this.up, this)
  125. }
  126. __extends(n, t);
  127. n.prototype.down = function() {
  128. this.bgBm.frameName = this.bSmall ? "menuBtnSml_dn.png" : "menuBtn_dn.png"
  129. };
  130. n.prototype.up = function() {
  131. this.bgBm.frameName = this.bSmall ? "menuBtnSml_up.png" : "menuBtn_up.png"
  132. };
  133. n.prototype.enableBtn = function(e) {
  134. this.isEnabled = e;
  135. this.alpha = (this.bgBm.input.enabled = e) ? 1 : .3
  136. };
  137. n.prototype.enableBtnInput = function(e) {
  138. this.isEnabled && (this.bgBm.input.enabled = e)
  139. };
  140. return n
  141. }(Phaser.Group);
  142. e.BtnBase = t
  143. })(Brainie || (Brainie = {}));
  144. (function(e) {
  145. var t = function(e) {
  146. function t(t, n, r, i, s, o) {
  147. e.call(this, t, n, r, "mainSt", 0);
  148. this.dnRect = this.upRect = this.bName = "";
  149. this.isEnabled = !0;
  150. this.bName = i;
  151. this.upRect = s;
  152. this.dnRect = o;
  153. this.frameName = this.upRect;
  154. this.inputEnabled = !0;
  155. this.events.onInputDown.add(this.down, this);
  156. this.events.onInputOut.add(this.up, this);
  157. this.events.onInputUp.add(this.up, this)
  158. }
  159. __extends(t, e);
  160. t.prototype.down = function() {
  161. this.frameName = this.dnRect
  162. };
  163. t.prototype.up = function() {
  164. this.frameName = this.upRect
  165. };
  166. t.prototype.enableBtn = function(e) {
  167. this.isEnabled = e;
  168. this.alpha = (this.input.enabled = e) ? 1 : .3
  169. };
  170. t.prototype.enableBtnInput = function(e) {
  171. this.isEnabled && (this.input.enabled = e)
  172. };
  173. return t
  174. }(Phaser.Sprite);
  175. e.ImgBtnBase = t
  176. })(Brainie || (Brainie = {}));
  177. (function(e) {
  178. var t = function(t) {
  179. function n() {
  180. t.apply(this, arguments)
  181. }
  182. __extends(n, t);
  183. n.prototype.preload = function() {
  184. this.txGrp = this.game.add.group();
  185. this.initTx = new e.BrainieNormalText(this.game, this.txGrp, -100, -100, mainFont, "A", 20, "#ffffff");
  186. this.load.image("mainBg", "img/mainBg.jpg");
  187. this.load.image("preloaderBg", "img/preloader_bg.png");
  188. this.load.image("preloaderFill", "img/preloader_fill.png")
  189. };
  190. n.prototype.create = function() {
  191. this.initTx.destroy();
  192. this.txGrp.destroy();
  193. this.input.maxPointers = 1;
  194. this.scale.pageAlignHorizontally = !0;
  195. this.scale.pageAlignVertically = !0;
  196. this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
  197. this.scale.hasResized.add(this.gameResized, this);
  198. this.game.device.desktop || (this.scale.forceOrientation(!1, !0), this.scale.enterIncorrectOrientation.add(this.enterIncorrectOrientation, this), this.scale.leaveIncorrectOrientation.add(this.leaveIncorrectOrientation, this));
  199. this.scale.setScreenSize(!0);
  200. this.game.state.start("Preloader", !0, !1);
  201. SG_Hooks.setOrientationHandler(this.orientationChange);
  202. SG_Hooks.setResizeHandler(this.gameResized)
  203. };
  204. n.prototype.gameResized = function(e, t) {};
  205. n.prototype.enterIncorrectOrientation = function() {
  206. var e = this;
  207. this.orientationChange(!1);
  208. setTimeout(function() {
  209. return e.androidRefresh()
  210. }, 500)
  211. };
  212. n.prototype.leaveIncorrectOrientation = function() {
  213. var e = this;
  214. this.orientationChange(!0);
  215. setTimeout(function() {
  216. return e.androidRefresh()
  217. }, 500)
  218. };
  219. n.prototype.androidRefresh = function() {
  220. this.game.scale.refresh()
  221. };
  222. n.prototype.orientationChange = function(e) {
  223. e ? document.getElementById("orientation").style.display = "none" : document.getElementById("orientation").style.display = "block"
  224. };
  225. return n
  226. }(Phaser.State);
  227. e.Boot = t
  228. })(Brainie || (Brainie = {}));
  229. (function(e) {
  230. var t = function(t) {
  231. function n() {
  232. t.apply(this, arguments);
  233. this.BOX_SIZE = 70;
  234. this.GRID_COLUMNS = this.GRID_ROWS = 8;
  235. this.GRID_TOP_PADDING = 49;
  236. this.GRID_LEFT_PADDING = 20;
  237. this.CLOSE_TIME = this.OPEN_TIME = 800;
  238. this.GUI_FADE = 200;
  239. this.MENU_FADE = 300;
  240. this.SELECTED_BOXES_ARR = [];
  241. this.gameType = "cl";
  242. this.isReturning = !1;
  243. this.dTm = 1;
  244. this.fTm = 1e3 / 60
  245. }
  246. __extends(n, t);
  247. n.prototype.create = function() {
  248. brainieMain = this;
  249. sndPlr = new e.SoundPlayer(this.game);
  250. this.gameBg = this.add.sprite(0, 0, "mainBg");
  251. this.gamesCont = this.game.add.group();
  252. this.mainCont = this.game.add.group();
  253. this.goalNumber = new e.GoalNumber;
  254. this.randomBox = new e.RandomBox;
  255. this.checkSelection = new e.CheckSelection;
  256. this.gOverlay = new e.GameOverlay(this.game, this.mainCont);
  257. this.gGui = new e.GameGui(this.game, this.mainCont);
  258. this.scrnCont = new e.ScreensCont(this.game, this.mainCont);
  259. this.scrnCont.showMainMenu()
  260. };
  261. n.prototype.startActionGame = function() {
  262. this.gameType = "ac";
  263. null != this.actualGame && (this.actualGame.resetOnRemove(), this.actualGame.destroy());
  264. this.actualGame = new e.GameMainAction(this.game, this.gamesCont);
  265. this.actualGame.startGame();
  266. this.trackStart()
  267. };
  268. n.prototype.startClassicGame = function() {
  269. this.gameType = "cl";
  270. null != this.actualGame && (this.actualGame.resetOnRemove(), this.actualGame.destroy());
  271. this.actualGame = new e.GameMainClassic(this.game, this.gamesCont);
  272. this.actualGame.startGame();
  273. this.trackStart()
  274. };
  275. n.prototype.update = function() {
  276. this.dTm = this.game.time.elapsed / this.fTm;
  277. null != this.actualGame && this.actualGame.loop()
  278. };
  279. n.prototype.gameCallback = function(e) {
  280. switch (e) {
  281. case "levelComplete":
  282. this.scrnCont.showLevelMenu();
  283. sndPlr.playGameSnd("level_complete");
  284. this.trackClassicLevel();
  285. break;
  286. case "levelActionComplete":
  287. this.trackActionLevel();
  288. break;
  289. case "gameOver":
  290. this.scrnCont.showEndMenu();
  291. sndPlr.playGameSnd("game_over");
  292. this.trackGameOver();
  293. break;
  294. case "showPauseOver":
  295. this.scrnCont.showPauseMenu();
  296. break;
  297. case "Start_GAME_ACTION":
  298. this.scrnCont.hideMainMenu();
  299. this.startActionGame();
  300. break;
  301. case "Start_GAME_CLASSIC":
  302. this.scrnCont.hideMainMenu();
  303. this.startClassicGame();
  304. break;
  305. case "GAME_NEXT_LEVEL":
  306. this.scrnCont.hideLevelMenu();
  307. this.actualGame.startNextLevel();
  308. break;
  309. case "GAME_PAUSE":
  310. this.actualGame.pauseGame();
  311. break;
  312. case "GAME_RESUME":
  313. this.scrnCont.hidePauseMenu();
  314. this.actualGame.resumeGame();
  315. break;
  316. case "GAME_END_PAUSE":
  317. this.actualGame.enableGame(!1);
  318. this.actualGame.gameStarted = !1;
  319. this.scrnCont.hidePauseMenu();
  320. this.scrnCont.showEndMenu();
  321. this.trackGameOver();
  322. break;
  323. case "GAME_END_LEVEL":
  324. this.actualGame.enableGame(!1);
  325. this.actualGame.gameStarted = !1;
  326. this.scrnCont.hideLevelMenu();
  327. this.scrnCont.showEndMenu();
  328. this.trackGameOver();
  329. break;
  330. case "GAME_BACKTOMAIN":
  331. this.isReturning = !0;
  332. this.gameType = "cl";
  333. this.scrnCont.hideEndMenu();
  334. this.scrnCont.showMainMenu();
  335. break;
  336. case "SHOW_HELP":
  337. this.scrnCont.showHelp();
  338. break;
  339. case "CLOSE_HELP":
  340. this.scrnCont.hideHelp();
  341. break;
  342. case "RESET_SELECTION":
  343. this.actualGame && this.actualGame.resetBoxSelection()
  344. }
  345. };
  346. n.prototype.pauseCall = function() {};
  347. n.prototype.resumeCall = function() {};
  348. n.prototype.moreGamesCall = function() {
  349. SG.redirectToPortal()
  350. };
  351. n.prototype.trackActionLevel = function() {
  352. this.actualGame.pauseGame();
  353. SG_Hooks.levelUp(this.actualGame.currentLevel - 1, this.actualGame.score)
  354. };
  355. n.prototype.trackClassicLevel = function() {
  356. this.actualGame.pauseGame();
  357. SG_Hooks.levelUp(this.actualGame.currentLevel, this.actualGame.score);
  358. // play68_submitScore(this.actualGame.currentLevel, this.actualGame.score);
  359. // Play68.setRankingLevelScoreDesc(this.actualGame.currentLevel, this.actualGame.score)
  360. };
  361. n.prototype.trackGameOver = function() {
  362. SG_Hooks.gameOver(this.actualGame.currentLevel, this.actualGame.score);
  363. // play68_submitScore(this.actualGame.currentLevel, this.actualGame.score);
  364. // Play68.setRankingLevelScoreDesc(this.actualGame.currentLevel, this.actualGame.score)
  365. };
  366. n.prototype.trackStart = function() {
  367. SG_Hooks.start()
  368. };
  369. return n
  370. }(Phaser.State);
  371. e.GameMain = t
  372. })(Brainie || (Brainie = {}));
  373. (function(e) {
  374. var t = function() {
  375. return function(e, t, n) {
  376. this.var0 = e;
  377. this.var1 = t;
  378. this.var2 = n
  379. }
  380. }();
  381. e.CheckSelectedResult = t
  382. })(Brainie || (Brainie = {}));
  383. (function(e) {
  384. var t = function() {
  385. function t() {
  386. this.isColor = this.isMatch = !1;
  387. this.calcValue = this.addPoints = 0;
  388. this.ptsMult = 1;
  389. this.colorID = 0
  390. }
  391. t.prototype.checkSelected = function(t, n) {
  392. this.isMatch = !1;
  393. this.calcValue = this.addPoints = 0;
  394. this.ptsMult = 1;
  395. this.colorID = 0;
  396. 1 < t.length ? (this.isColor = !0, this.colorID = t[0].bxColor) : this.isColor = !1;
  397. for (var r = 0; r < t.length; r++) switch (t[r].bxColor != this.colorID && (this.isColor = !1), t[r].bxType) {
  398. case 1:
  399. this.calcValue += t[r].bxValue;
  400. break;
  401. case 2:
  402. this.calcValue -= t[r].bxValue;
  403. this.ptsMult = 1.2;
  404. break;
  405. case 3:
  406. this.calcValue *= t[r].bxValue;
  407. this.ptsMult = 1.5;
  408. break;
  409. case 4:
  410. this.calcValue /= t[r].bxValue, this.ptsMult = 1.5
  411. }
  412. if (this.calcValue == n) switch (this.isMatch = !0, t.length) {
  413. case 1:
  414. this.addPoints = 50;
  415. break;
  416. case 2:
  417. this.addPoints = 110;
  418. break;
  419. case 3:
  420. this.addPoints = 170;
  421. break;
  422. case 4:
  423. this.addPoints = 230;
  424. break;
  425. case 5:
  426. this.addPoints = 290;
  427. break;
  428. case 6:
  429. this.addPoints = 350;
  430. break;
  431. case 7:
  432. this.addPoints = 410;
  433. break;
  434. case 8:
  435. this.addPoints = 470;
  436. break;
  437. case 9:
  438. this.addPoints = 530;
  439. break;
  440. default:
  441. this.addPoints = 600
  442. }
  443. this.addPoints = Math.round(this.addPoints * this.ptsMult);
  444. this.isColor && (this.addPoints = Math.round(1.5 * this.addPoints));
  445. return new e.CheckSelectedResult(this.isMatch, this.addPoints, this.isColor)
  446. };
  447. return t
  448. }();
  449. e.CheckSelection = t
  450. })(Brainie || (Brainie = {}));
  451. (function(e) {
  452. var t = function() {
  453. function e() {
  454. this.pos = [];
  455. this.neg = [];
  456. this.mul = [];
  457. this.div = [];
  458. this.actualLevel = 1;
  459. this.returnNum = 0
  460. }
  461. e.prototype.setArrays = function(e) {
  462. this.pos = [];
  463. this.neg = [];
  464. this.mul = [];
  465. this.div = [];
  466. for (var t = 0; t < e.length; t++) switch (e[t].bxType) {
  467. case 1:
  468. this.pos.push(e[t].bxValue);
  469. break;
  470. case 2:
  471. this.neg.push(e[t].bxValue);
  472. break;
  473. case 3:
  474. this.mul.push(e[t].bxValue);
  475. break;
  476. case 4:
  477. this.div.push(e[t].bxValue)
  478. }
  479. };
  480. e.prototype.getGoalNumber = function(e, t) {
  481. this.actualLevel = t;
  482. this.returnNum = 0;
  483. this.setArrays(e);
  484. var n = 0,
  485. n = 3 > this.actualLevel ? Math.round(1.9 * Math.random() + .5) : Math.round(2.9 * Math.random() + .5);
  486. 0 == this.pos.length ? (this.returnNum = Math.round(10 * Math.random()) + 4, n = 0) : n > this.pos.length && (n = this.pos.length);
  487. for (var r = 0; r < n; r++) {
  488. var i = Math.round(Math.random() * (this.pos.length - 1));
  489. this.returnNum += this.pos[i];
  490. this.pos.splice(i, 1)
  491. }
  492. n = 0;
  493. n = 3 > this.actualLevel ? Math.round(1.9 * Math.random() + .5) - 1 : Math.round(1.9 * Math.random() + .5);
  494. n > this.neg.length && (n = this.neg.length);
  495. for (r = 0; r < n; r++) i = Math.round(Math.random() * (this.neg.length - 1)), 0 < this.returnNum - this.neg[i] && (this.returnNum -= this.neg[i]), this.neg.splice(i, 1);
  496. n = r = 0;
  497. 5 > this.actualLevel ? r = Math.round(1.9 * Math.random() + .5) - 1 : .5 < Math.random() ? r = 3 < this.pos.length ? Math.round(1.9 * Math.random() + .5) - 1 : 1 : n = 3 < this.pos.length ? Math.round(1.9 * Math.random() + .5) - 1 : 1;
  498. r > this.mul.length && (r = this.mul.length);
  499. n > this.div.length && (n = this.div.length);
  500. for (i = 0; i < r; i++) {
  501. var s = Math.round(Math.random() * (this.mul.length - 1));
  502. 100 > this.returnNum * this.mul[s] && (this.returnNum *= this.mul[s]);
  503. this.mul.splice(s, 1)
  504. }
  505. for (r = 0; r < n; r++) i = Math.round(Math.random() * (this.div.length - 1)), 0 == this.returnNum % this.div[i] && (this.returnNum /= this.div[i]), this.div.splice(i, 1);
  506. return this.returnNum
  507. };
  508. return e
  509. }();
  510. e.GoalNumber = t
  511. })(Brainie || (Brainie = {}));
  512. (function(e) {
  513. var t = function() {
  514. function t() {
  515. this.randomer = 0;
  516. this.selectedValue = this.selectedColor = this.selectedType = 1;
  517. this.currRow = this.currCol = 0;
  518. this.actualLevel = 1
  519. }
  520. t.prototype.getRandomNumBox = function(t, n, r, i, s, o, u) {
  521. "undefined" === typeof r && (r = 0);
  522. "undefined" === typeof i && (i = 0);
  523. "undefined" === typeof s && (s = 0);
  524. "undefined" === typeof o && (o = !1);
  525. "undefined" === typeof u && (u = null);
  526. brainieMain.goalNumber.setArrays(u);
  527. this.actualLevel = s;
  528. this.currCol = i;
  529. this.currRow = r;
  530. this.randomer = Math.random();
  531. this.selectedType = o && brainieMain.goalNumber.pos.length < brainieMain.goalNumber.neg.length + brainieMain.goalNumber.mul.length + brainieMain.goalNumber.div.length ? 1 : 1 == this.actualLevel ? 1 : 2 == this.actualLevel ? .8 < this.randomer ? 2 : 1 : 3 == this.actualLevel ? .7 < this.randomer ? 2 : 1 : 4 == this.actualLevel ? .7 < this.randomer ? 2 : .65 < this.randomer ? 3 : 1 : .7 < this.randomer ? 2 : .65 < this.randomer ? 3 : .6 < this.randomer ? 4 : 1;
  532. this.selectedValue = 1 == this.actualLevel ? Math.round(3.9 * Math.random() + .5) : 2 == this.actualLevel ? .8 < this.randomer ? Math.round(1.9 * Math.random() + .5) : Math.round(8.9 * Math.random() + .5) : 3 == this.actualLevel ? .7 < this.randomer ? Math.round(1.9 * Math.random() + .5) : Math.round(8.9 * Math.random() + .5) : 4 == this.actualLevel ? .7 < this.randomer ? Math.round(1.9 * Math.random() + .5) : .65 < this.randomer ? Math.round(1.9 * Math.random() + 1.5) : Math.round(8.9 * Math.random() + .5) : .7 < this.randomer ? Math.round(1.9 * Math.random() + .5) : .65 < this.randomer ? Math.round(1.9 * Math.random() + 1.5) : .6 < this.randomer ? Math.round(1.9 * Math.random() + 1.5) : Math.round(8.9 * Math.random() + .5);
  533. this.selectedColor = 5 > this.actualLevel ? 1 + Math.round(Math.random() * (this.actualLevel + .9) - .5) : 1 + Math.round(5.9 * Math.random() - .5);
  534. return new e.NumBox(t, n, this.selectedValue, this.selectedType, this.currCol, this.currRow, this.selectedColor)
  535. };
  536. return t
  537. }();
  538. e.RandomBox = t
  539. })(Brainie || (Brainie = {}));
  540. (function(e) {
  541. var t = function() {
  542. function e(e) {
  543. this.soundEnabled = this.soundOn = !0;
  544. this.sndsPool = [];
  545. this.sndIDsPool = [];
  546. if (e.device.desktop && e.device.webAudio) {
  547. this.soundEnabled = !0;
  548. for (var t = 0; t < game.snds.length; t++) this.sndIDsPool.push(game.snds[t]), this.sndsPool.push(e.add.audio(game.snds[t]))
  549. } else this.soundEnabled = !1
  550. }
  551. e.prototype.playGameSnd = function(e) {
  552. this.soundOn && this.soundEnabled && -1 != this.sndIDsPool.indexOf(e) && this.sndsPool[this.sndIDsPool.indexOf(e)].play("", 0, 1, !1)
  553. };
  554. e.prototype.playSelectSound = function() {.5 > Math.random() ? this.playGameSnd("box_select_1") : this.playGameSnd("box_select_2")
  555. };
  556. return e
  557. }();
  558. e.SoundPlayer = t
  559. })(Brainie || (Brainie = {}));
  560. (function(e) {
  561. var t = function(e) {
  562. function t(t, n) {
  563. e.call(this, t, n, "", !1);
  564. this.gameStarted = this.gameRunning = !1;
  565. this.y = 730
  566. }
  567. __extends(t, e);
  568. t.prototype.resetOnRemove = function() {};
  569. t.prototype.pauseGame = function() {};
  570. t.prototype.startGame = function() {};
  571. t.prototype.startNextLevel = function() {};
  572. t.prototype.resumeGame = function() {};
  573. t.prototype.enableGame = function(e) {};
  574. t.prototype.resetBoxSelection = function(e) {};
  575. t.prototype.boxEvent = function(e) {};
  576. t.prototype.loop = function() {};
  577. t.prototype.openAnim = function() {
  578. this.tempTwn && this.tempTwn.stop();
  579. this.tempTwn = game.add.tween(this);
  580. this.tempTwn.to({
  581. y: 0
  582. }, brainieMain.OPEN_TIME, Phaser.Easing.Sinusoidal.InOut, !0, 0, !1)
  583. };
  584. t.prototype.closeAnim = function() {
  585. this.tempTwn && this.tempTwn.stop();
  586. this.tempTwn = game.add.tween(this);
  587. this.tempTwn.to({
  588. y: 730
  589. }, brainieMain.CLOSE_TIME, Phaser.Easing.Sinusoidal.InOut, !0, brainieMain.GUI_FADE, !1)
  590. };
  591. return t
  592. }(Phaser.Group);
  593. e.GameBase = t
  594. })(Brainie || (Brainie = {}));
  595. (function(e) {
  596. var t = function(t) {
  597. function n(e, n) {
  598. t.call(this, e, n);
  599. this.score = 0;
  600. this.goalNum = 1;
  601. this.gameIsOver = this.gameStarted = this.gameRunning = !1;
  602. this.endCt = 0;
  603. this.fallLimit = 4e3;
  604. this.currentFallTime = this.gameTime = 0;
  605. this.currentLevel = 1;
  606. this.boxesArr = [];
  607. this.startRows = 3;
  608. this.bxInWave = 0;
  609. this.possibleWPos = [];
  610. this.bombOnBox = this.boxRemoved = this.boxesTotal = this.waveID = this.selectedCol = this.selectedRow = 0;
  611. this.enableGame(!1);
  612. this.setLayers();
  613. brainieMain.gGui.resetGui()
  614. }
  615. __extends(n, t);
  616. n.prototype.setGoalNumber = function() {
  617. this.goalNum = brainieMain.goalNumber.getGoalNumber(this.boxesArr, this.currentLevel);
  618. brainieMain.gGui.numBubble.showNumber(this.goalNum)
  619. };
  620. n.prototype.resetOnRemove = function() {
  621. for (var e = 0; e < this.boxesArr.length; e++) this.boxesArr[e].destroyBox();
  622. this.removeAll()
  623. };
  624. n.prototype.scoreUpdate = function() {
  625. brainieMain.gGui.scoreLabel.updateScore(this.score)
  626. };
  627. n.prototype.enableGame = function(e) {
  628. "undefined" === typeof e && (e = !0);
  629. this.gameRunning = e ? !0 : !1;
  630. for (var t = 0; t < this.boxesArr.length; t++) this.boxesArr[t].enableBox(e);
  631. brainieMain.gGui && brainieMain.gGui.gameButtons.enableButtons(e)
  632. };
  633. n.prototype.startGame = function() {
  634. var e = this;
  635. this.gameStarted = !0;
  636. brainieMain.SELECTED_BOXES_ARR = [];
  637. brainieMain.gOverlay.openOver();
  638. this.openAnim();
  639. this.createStartBoxes();
  640. setTimeout(function() {
  641. return e.setGoalNumber()
  642. }, brainieMain.GUI_FADE + brainieMain.OPEN_TIME);
  643. this.resetTimers();
  644. this.initBombPosition();
  645. setTimeout(function() {
  646. return e.enableGame(!0)
  647. }, brainieMain.GUI_FADE + brainieMain.OPEN_TIME)
  648. };
  649. n.prototype.pauseGame = function() {
  650. this.gameRunning && (setTimeout(function() {
  651. return brainieMain.gameCallback("showPauseOver")
  652. }, brainieMain.GUI_FADE + brainieMain.CLOSE_TIME), brainieMain.gOverlay.closeOver(), this.closeAnim(), this.enableGame(!1))
  653. };
  654. n.prototype.resumeGame = function() {
  655. var e = this;
  656. this.gameRunning || (brainieMain.gOverlay.openOver(), this.openAnim(), setTimeout(function() {
  657. return e.enableGame(!0)
  658. }, brainieMain.GUI_FADE + brainieMain.OPEN_TIME))
  659. };
  660. n.prototype.gameOver = function() {
  661. this.gameStarted = !1;
  662. brainieMain.gGui.numBubble.hideLabel();
  663. this.gameIsOver = !0;
  664. this.enableGame(!1)
  665. };
  666. n.prototype.checkGameOver = function() {
  667. for (var e = this.endCt = 0; e < this.boxesArr.length; e++) 0 == this.boxesArr[e].moveSpeed && this.endCt++;
  668. this.endCt == this.boxesArr.length && (this.gameIsOver = !1, brainieMain.gOverlay.closeOver(), this.closeAnim(), setTimeout(function() {
  669. return brainieMain.gameCallback("gameOver")
  670. }, brainieMain.GUI_FADE + brainieMain.CLOSE_TIME))
  671. };
  672. n.prototype.resetBoxSelection = function(e) {
  673. "undefined" === typeof e && (e = !0);
  674. e && sndPlr.playGameSnd("reset");
  675. for (e = 0; e < brainieMain.SELECTED_BOXES_ARR.length; e++) brainieMain.SELECTED_BOXES_ARR[e].selected && brainieMain.SELECTED_BOXES_ARR[e].deselectBox(!1);
  676. brainieMain.SELECTED_BOXES_ARR = []
  677. };
  678. n.prototype.setLayers = function() {
  679. this.gameBg = new e.GameBg(this.game);
  680. this.add(this.gameBg);
  681. this.bxLr = this.game.add.group();
  682. this.bxLr.x = brainieMain.GRID_LEFT_PADDING;
  683. this.bxLr.y = brainieMain.GRID_TOP_PADDING;
  684. this.add(this.bxLr);
  685. this.effLr = new e.EffectsLr(this.game, this)
  686. };
  687. n.prototype.resetTimers = function() {
  688. this.currentFallTime = this.gameTime = 0;
  689. brainieMain.gGui.timers.updateHands(0, 0)
  690. };
  691. n.prototype.updateTimers = function() {
  692. this.gameRunning && (this.currentFallTime += this.game.time.elapsed, this.gameTime += this.game.time.elapsed, this.currentFallTime >= this.fallLimit && (6 > this.currentLevel ? this.createWave(this.currentLevel) : this.createWave(6), this.currentFallTime = 0), brainieMain.gGui.timers.updateHands(this.boxRemoved % 10 / 10, this.currentFallTime / this.fallLimit))
  693. };
  694. n.prototype.levelComplete = function() {
  695. this.currentLevel++;
  696. brainieMain.gGui.levels.updateLevel(this.currentLevel);
  697. brainieMain.gameCallback("levelActionComplete");
  698. this.fallLimit -= 300;
  699. 1e3 > this.fallLimit && (this.fallLimit = 1e3)
  700. };
  701. n.prototype.createStartBoxes = function() {
  702. this.waveID = 0;
  703. if (0 < this.boxesArr.length) {
  704. for (var e = 0; e < this.boxesArr.length; e++) this.boxesArr[e].destroyBox();
  705. this.boxesArr = []
  706. }
  707. for (e = 0; e < this.startRows; e++)
  708. for (var t = 0; t < brainieMain.GRID_COLUMNS; t++) {
  709. var n = brainieMain.randomBox.getRandomNumBox(this.game, this.bxLr, brainieMain.GRID_ROWS - e, t, this.currentLevel, !1, this.boxesArr);
  710. n.y = brainieMain.BOX_SIZE * brainieMain.GRID_ROWS - e * brainieMain.BOX_SIZE;
  711. this.boxesArr.push(n)
  712. }
  713. };
  714. n.prototype.createWave = function(t) {
  715. sndPlr.playGameSnd("wave");
  716. this.waveID++;
  717. this.bxInWave = t;
  718. this.possibleWPos = [];
  719. for (t = 0; t < brainieMain.GRID_COLUMNS; t++) this.possibleWPos.push(t);
  720. for (t = 0; t < this.boxesArr.length; t++) 1 == this.boxesArr[t].bxRow && this.possibleWPos.length > this.bxInWave && this.possibleWPos.splice(this.possibleWPos.indexOf(this.boxesArr[t].bxCol), 1);
  721. for (t = 0; t < this.bxInWave; t++) {
  722. this.boxesTotal++;
  723. this.selectedCol = this.possibleWPos.splice(Math.round(Math.random() * (this.possibleWPos.length - 1)), 1)[0];
  724. this.selectedRow = brainieMain.GRID_ROWS;
  725. for (var n = 0; n < this.boxesArr.length; n++) this.boxesArr[n].bxCol == this.selectedCol && this.selectedRow--;
  726. if (0 == this.selectedRow) {
  727. this.gameOver();
  728. break
  729. }
  730. n = this.testBombCreation(t) ? new e.NumBox(this.game, this.bxLr, 0, 5, this.selectedCol, this.selectedRow, 7) : brainieMain.randomBox.getRandomNumBox(this.game, this.bxLr, this.selectedRow, this.selectedCol, this.currentLevel, !0, this.boxesArr);
  731. n.dropBox();
  732. this.boxesArr.push(n)
  733. }
  734. };
  735. n.prototype.boxEvent = function(e) {
  736. this.selectedBox = e;
  737. this.selectedBox.selected ? (5 == this.selectedBox.bxType && (this.resetBoxSelection(!1), brainieMain.gGui.numBubble.hintChange(!1)), brainieMain.SELECTED_BOXES_ARR.push(this.selectedBox)) : brainieMain.SELECTED_BOXES_ARR.splice(brainieMain.SELECTED_BOXES_ARR.indexOf(this.selectedBox), 1);
  738. if (0 < brainieMain.SELECTED_BOXES_ARR.length && 5 != this.selectedBox.bxType)
  739. if (5 == brainieMain.SELECTED_BOXES_ARR[0].bxType) {
  740. for (e = 0; e < this.boxesArr.length; e++) this.boxesArr[e].bxColor == this.selectedBox.bxColor && this.boxesArr[e] != this.selectedBox && brainieMain.SELECTED_BOXES_ARR.push(this.boxesArr[e]);
  741. sndPlr.playGameSnd("box_explosion");
  742. this.score += 70 * (brainieMain.SELECTED_BOXES_ARR.length - 1);
  743. this.scoreUpdate();
  744. this.removeSelectedBoxes();
  745. brainieMain.gGui.numBubble.hintChange(!0)
  746. } else this.checkSelectedResult = brainieMain.checkSelection.checkSelected(brainieMain.SELECTED_BOXES_ARR, this.goalNum), !0 == this.checkSelectedResult.var0 && (this.score += this.checkSelectedResult.var1, this.scoreUpdate(), this.removeSelectedBoxes(), 0 < this.boxesArr.length && this.setGoalNumber(), this.checkSelectedResult.var2 ? (this.effLr.showColorEff(), sndPlr.playGameSnd("box_color")) : sndPlr.playGameSnd("box_normal"))
  747. };
  748. n.prototype.removeSelectedBoxes = function() {
  749. for (var e = 0; e < brainieMain.SELECTED_BOXES_ARR.length; e++) {
  750. this.boxesArr.splice(this.boxesArr.indexOf(brainieMain.SELECTED_BOXES_ARR[e]), 1);
  751. for (var t = 0; t < this.boxesArr.length; t++) this.boxesArr[t].bxCol == brainieMain.SELECTED_BOXES_ARR[e].bxCol && this.boxesArr[t].bxRow < brainieMain.SELECTED_BOXES_ARR[e].bxRow && this.boxesArr[t].moveDown();
  752. brainieMain.SELECTED_BOXES_ARR[e].destroyBox()
  753. }
  754. brainieMain.SELECTED_BOXES_ARR = [];
  755. 0 == this.boxesArr.length && (this.score += 1e3, this.scoreUpdate(), this.effLr.showClearEff(), setTimeout(function() {
  756. return sndPlr.playGameSnd("clear_eff")
  757. }, 200), this.createWave(8), this.currentFallTime = 0, this.setGoalNumber());
  758. this.boxRemoved++;
  759. 0 == this.boxRemoved % 10 && this.levelComplete()
  760. };
  761. n.prototype.initBombPosition = function() {
  762. this.bombOnBox = 15 + Math.round(8 * Math.random())
  763. };
  764. n.prototype.testBombCreation = function(e) {
  765. this.tstBmbReturn = !1;
  766. this.boxesTotal >= this.bombOnBox && (this.tstBmbReturn = !0, this.bombOnBox = this.boxesTotal + 30 + Math.round(15 * Math.random()));
  767. return this.tstBmbReturn
  768. };
  769. n.prototype.loop = function() {
  770. this.updateTimers();
  771. this.gameRunning ? this.bxsUpdate() : this.gameIsOver && (this.bxsUpdate(), this.checkGameOver())
  772. };
  773. n.prototype.bxsUpdate = function() {
  774. for (var e = 0; e < this.boxesArr.length; e++) this.boxesArr[e].tryMove()
  775. };
  776. return n
  777. }(e.GameBase);
  778. e.GameMainAction = t
  779. })(Brainie || (Brainie = {}));
  780. (function(e) {
  781. var t = function(t) {
  782. function n(e, n) {
  783. t.call(this, e, n);
  784. this.score = 0;
  785. this.goalNum = 1;
  786. this.gameIsOver = this.gameStarted = this.gameRunning = !1;
  787. this.endCt = 0;
  788. this.levelLimit = 6e4;
  789. this.fallLimit = 1e4;
  790. this.currentFallTime = this.currentLevelTime = 0;
  791. this.currentLevel = 1;
  792. this.boxesArr = [];
  793. this.startRows = 3;
  794. this.bxInWave = 0;
  795. this.possibleWPos = [];
  796. this.waveID = this.selectedCol = this.selectedRow = 0;
  797. this.boxesInWave = 1;
  798. this.bombsLevelLimit = 2;
  799. this.bombsWavePosArr = [];
  800. this.bombsPosArr = [];
  801. this.bombsTempArr = [];
  802. this.enableGame(!1);
  803. this.setLayers();
  804. brainieMain.gGui.resetGui()
  805. }
  806. __extends(n, t);
  807. n.prototype.setGoalNumber = function() {
  808. this.goalNum = brainieMain.goalNumber.getGoalNumber(this.boxesArr, this.currentLevel);
  809. brainieMain.gGui.numBubble.showNumber(this.goalNum)
  810. };
  811. n.prototype.resetOnRemove = function() {
  812. for (var e = 0; e < this.boxesArr.length; e++) this.boxesArr[e].destroyBox();
  813. this.removeAll()
  814. };
  815. n.prototype.scoreUpdate = function() {
  816. brainieMain.gGui.scoreLabel.updateScore(this.score)
  817. };
  818. n.prototype.enableGame = function(e) {
  819. "undefined" === typeof e && (e = !0);
  820. this.gameRunning = e ? !0 : !1;
  821. for (var t = 0; t < this.boxesArr.length; t++) this.boxesArr[t].enableBox(e);
  822. brainieMain.gGui && brainieMain.gGui.gameButtons.enableButtons(e)
  823. };
  824. n.prototype.startGame = function() {
  825. var e = this;
  826. this.gameStarted = !0;
  827. brainieMain.SELECTED_BOXES_ARR = [];
  828. brainieMain.gOverlay.openOver();
  829. this.openAnim();
  830. this.createStartBoxes();
  831. setTimeout(function() {
  832. return e.setGoalNumber()
  833. }, brainieMain.GUI_FADE + brainieMain.OPEN_TIME);
  834. this.resetTimers();
  835. this.setBombsPositions();
  836. setTimeout(function() {
  837. return e.enableGame(!0)
  838. }, brainieMain.GUI_FADE + brainieMain.OPEN_TIME)
  839. };
  840. n.prototype.pauseGame = function() {
  841. this.gameRunning && (setTimeout(function() {
  842. return brainieMain.gameCallback("showPauseOver")
  843. }, brainieMain.GUI_FADE + brainieMain.CLOSE_TIME), brainieMain.gOverlay.closeOver(), this.closeAnim(), this.enableGame(!1))
  844. };
  845. n.prototype.resumeGame = function() {
  846. var e = this;
  847. this.gameRunning || (brainieMain.gOverlay.openOver(), this.openAnim(), setTimeout(function() {
  848. return e.enableGame(!0)
  849. }, brainieMain.GUI_FADE + brainieMain.OPEN_TIME))
  850. };
  851. n.prototype.gameOver = function() {
  852. this.gameStarted = !1;
  853. brainieMain.gGui.numBubble.hideLabel();
  854. this.gameIsOver = !0;
  855. this.enableGame(!1)
  856. };
  857. n.prototype.checkGameOver = function() {
  858. for (var e = this.endCt = 0; e < this.boxesArr.length; e++) 0 == this.boxesArr[e].moveSpeed && this.endCt++;
  859. this.endCt == this.boxesArr.length && (this.gameIsOver = !1, brainieMain.gOverlay.closeOver(), this.closeAnim(), setTimeout(function() {
  860. return brainieMain.gameCallback("gameOver")
  861. }, brainieMain.GUI_FADE + brainieMain.CLOSE_TIME))
  862. };
  863. n.prototype.resetBoxSelection = function(e) {
  864. "undefined" === typeof e && (e = !0);
  865. e && sndPlr.playGameSnd("reset");
  866. for (e = 0; e < brainieMain.SELECTED_BOXES_ARR.length; e++) brainieMain.SELECTED_BOXES_ARR[e].selected && brainieMain.SELECTED_BOXES_ARR[e].deselectBox(!1);
  867. brainieMain.SELECTED_BOXES_ARR = []
  868. };
  869. n.prototype.setLayers = function() {
  870. this.gameBg = new e.GameBg(this.game);
  871. this.add(this.gameBg);
  872. this.bxLr = this.game.add.group();
  873. this.bxLr.x = brainieMain.GRID_LEFT_PADDING;
  874. this.bxLr.y = brainieMain.GRID_TOP_PADDING;
  875. this.add(this.bxLr);
  876. this.effLr = new e.EffectsLr(this.game, this)
  877. };
  878. n.prototype.resetTimers = function() {
  879. this.currentFallTime = this.currentLevelTime = 0;
  880. brainieMain.gGui.timers.updateHands(0, 0)
  881. };
  882. n.prototype.updateTimers = function() {
  883. this.gameRunning && (this.currentLevelTime += this.game.time.elapsed, this.currentFallTime += this.game.time.elapsed, this.currentLevelTime >= this.levelLimit ? (this.currentLevelTime = this.levelLimit, this.levelComplete()) : this.currentFallTime >= this.fallLimit && (this.createWave(), this.currentFallTime = 0), brainieMain.gGui.timers.updateHands(this.currentLevelTime / this.levelLimit, this.currentFallTime / this.fallLimit))
  884. };
  885. n.prototype.levelComplete = function() {
  886. this.gameStarted = !1;
  887. brainieMain.gGui.numBubble.hideLabel();
  888. this.enableGame(!1);
  889. brainieMain.gOverlay.closeOver();
  890. this.closeAnim();
  891. setTimeout(function() {
  892. return brainieMain.gameCallback("levelComplete")
  893. }, brainieMain.GUI_FADE + brainieMain.CLOSE_TIME)
  894. };
  895. n.prototype.startNextLevel = function() {
  896. this.gameStarted = !0;
  897. this.currentLevel++;
  898. brainieMain.gGui.levels.updateLevel(this.currentLevel);
  899. this.fallLimit = 1e4 - 1e3 * (this.currentLevel - 1);
  900. 5e3 > this.fallLimit && (this.fallLimit = 5e3);
  901. this.startGame()
  902. };
  903. n.prototype.createStartBoxes = function() {
  904. this.waveID = 0;
  905. if (0 < this.boxesArr.length) {
  906. for (var e = 0; e < this.boxesArr.length; e++) this.boxesArr[e].destroyBox();
  907. this.boxesArr = []
  908. }
  909. this.startRows = 1 == this.currentLevel ? 2 : 4 >= this.currentLevel ? 3 : 7 >= this.currentLevel ? 4 : 5;
  910. for (e = 0; e < this.startRows; e++)
  911. for (var t = 0; t < brainieMain.GRID_COLUMNS; t++) {
  912. var n = brainieMain.randomBox.getRandomNumBox(this.game, this.bxLr, brainieMain.GRID_ROWS - e, t, this.currentLevel, !1, this.boxesArr);
  913. n.y = brainieMain.BOX_SIZE * brainieMain.GRID_ROWS - e * brainieMain.BOX_SIZE;
  914. this.boxesArr.push(n)
  915. }
  916. };
  917. n.prototype.createWave = function() {
  918. sndPlr.playGameSnd("wave");
  919. this.waveID++;
  920. this.bxInWave = this.getBoxInWave();
  921. this.bxInWave > brainieMain.GRID_COLUMNS && (this.bxInWave = brainieMain.GRID_COLUMNS);
  922. this.possibleWPos = [];
  923. for (var t = 0; t < brainieMain.GRID_COLUMNS; t++) this.possibleWPos.push(t);
  924. for (t = 0; t < this.boxesArr.length; t++) 1 == this.boxesArr[t].bxRow && this.possibleWPos.length > this.bxInWave && this.possibleWPos.splice(this.possibleWPos.indexOf(this.boxesArr[t].bxCol), 1);
  925. for (t = 0; t < this.bxInWave; t++) {
  926. this.selectedCol = this.possibleWPos.splice(Math.round(Math.random() * (this.possibleWPos.length - 1)), 1)[0];
  927. this.selectedRow = brainieMain.GRID_ROWS;
  928. for (var n = 0; n < this.boxesArr.length; n++) this.boxesArr[n].bxCol == this.selectedCol && this.selectedRow--;
  929. if (0 == this.selectedRow) {
  930. this.gameOver();
  931. break
  932. }
  933. n = this.testBombCreation(t) ? new e.NumBox(this.game, this.bxLr, 0, 5, this.selectedCol, this.selectedRow, 7) : brainieMain.randomBox.getRandomNumBox(this.game, this.bxLr, this.selectedRow, this.selectedCol, this.currentLevel, !0, this.boxesArr);
  934. n.dropBox();
  935. this.boxesArr.push(n)
  936. }
  937. };
  938. n.prototype.getBoxInWave = function() {
  939. return this.boxesInWave = 2 >= this.currentLevel ? 2 : 4 >= this.currentLevel ? 3 : 6 >= this.currentLevel ? 4 : 8 >= this.currentLevel ? 5 : 6
  940. };
  941. n.prototype.boxEvent = function(e) {
  942. this.selectedBox = e;
  943. this.selectedBox.selected ? (5 == this.selectedBox.bxType && (this.resetBoxSelection(!1), brainieMain.gGui.numBubble.hintChange(!1)), brainieMain.SELECTED_BOXES_ARR.push(this.selectedBox)) : brainieMain.SELECTED_BOXES_ARR.splice(brainieMain.SELECTED_BOXES_ARR.indexOf(this.selectedBox), 1);
  944. if (0 < brainieMain.SELECTED_BOXES_ARR.length && 5 != this.selectedBox.bxType)
  945. if (5 == brainieMain.SELECTED_BOXES_ARR[0].bxType) {
  946. for (e = 0; e < this.boxesArr.length; e++) this.boxesArr[e].bxColor == this.selectedBox.bxColor && this.boxesArr[e] != this.selectedBox && brainieMain.SELECTED_BOXES_ARR.push(this.boxesArr[e]);
  947. sndPlr.playGameSnd("box_explosion");
  948. this.score += 70 * (brainieMain.SELECTED_BOXES_ARR.length - 1);
  949. this.scoreUpdate();
  950. this.removeSelectedBoxes();
  951. brainieMain.gGui.numBubble.hintChange(!0)
  952. } else this.checkSelectedResult = brainieMain.checkSelection.checkSelected(brainieMain.SELECTED_BOXES_ARR, this.goalNum), !0 == this.checkSelectedResult.var0 && (this.score += this.checkSelectedResult.var1, this.scoreUpdate(), this.removeSelectedBoxes(), 0 < this.boxesArr.length && this.setGoalNumber(), this.checkSelectedResult.var2 ? (this.effLr.showColorEff(), sndPlr.playGameSnd("box_color")) : sndPlr.playGameSnd("box_normal"))
  953. };
  954. n.prototype.removeSelectedBoxes = function() {
  955. for (var e = this, t = 0; t < brainieMain.SELECTED_BOXES_ARR.length; t++) {
  956. this.boxesArr.splice(this.boxesArr.indexOf(brainieMain.SELECTED_BOXES_ARR[t]), 1);
  957. for (var n = 0; n < this.boxesArr.length; n++) this.boxesArr[n].bxCol == brainieMain.SELECTED_BOXES_ARR[t].bxCol && this.boxesArr[n].bxRow < brainieMain.SELECTED_BOXES_ARR[t].bxRow && this.boxesArr[n].moveDown();
  958. brainieMain.SELECTED_BOXES_ARR[t].destroyBox()
  959. }
  960. brainieMain.SELECTED_BOXES_ARR = [];
  961. 0 == this.boxesArr.length && (this.score += 1e3, this.scoreUpdate(), this.effLr.showClearEff(), setTimeout(function() {
  962. return sndPlr.playGameSnd("clear_eff")
  963. }, 200), brainieMain.gGui.numBubble.hideLabel(), this.enableGame(!1), setTimeout(function() {
  964. return e.levelComplete()
  965. }, 1500))
  966. };
  967. n.prototype.setBombsPositions = function() {
  968. this.bombsWavePosArr = [];
  969. this.bombsPosArr = [];
  970. this.bombsTempArr = [];
  971. for (var e = 1; e < Math.floor(this.levelLimit / this.fallLimit); e++) this.bombsTempArr.push(e);
  972. this.bombsLevelLimit > this.bombsTempArr.length && (this.bombsLevelLimit = this.bombsTempArr.length);
  973. for (e = 0; e < this.bombsLevelLimit; e++) this.bombsWavePosArr.push(this.bombsTempArr.splice(Math.round(Math.random() * (this.bombsTempArr.length - 1)), 1)[0]), this.bombsPosArr.push(Math.round(Math.random() * (this.getBoxInWave() - 1)))
  974. };
  975. n.prototype.testBombCreation = function(e) {
  976. this.tstBmbReturn = !1; - 1 != this.bombsWavePosArr.indexOf(this.waveID) && this.bombsPosArr[this.bombsWavePosArr.indexOf(this.waveID)] == e && (this.tstBmbReturn = !0);
  977. return this.tstBmbReturn
  978. };
  979. n.prototype.loop = function() {
  980. this.updateTimers();
  981. this.gameRunning ? this.bxsUpdate() : this.gameIsOver && (this.bxsUpdate(), this.checkGameOver())
  982. };
  983. n.prototype.bxsUpdate = function() {
  984. for (var e = 0; e < this.boxesArr.length; e++) this.boxesArr[e].tryMove()
  985. };
  986. return n
  987. }(e.GameBase);
  988. e.GameMainClassic = t
  989. })(Brainie || (Brainie = {}));
  990. (function(e) {
  991. var t = function(t) {
  992. function n(e, n) {
  993. t.call(this, e, n, "", !1);
  994. this.setLayers();
  995. this.resetGui();
  996. this.visible = !1
  997. }
  998. __extends(n, t);
  999. n.prototype.setLayers = function() {
  1000. this.timers = new e.GameTimers(this.game, this);
  1001. this.numBubble = new e.NumberBubble(this.game, this);
  1002. this.levels = new e.Levels(this.game, this);
  1003. this.scoreLabel = new e.ScoreLabel(this.game, this);
  1004. this.gameButtons = new e.GameButtons(this.game, this)
  1005. };
  1006. n.prototype.showGui = function(e) {
  1007. this.tempTwn && this.tempTwn.stop();
  1008. this.gameButtons.enableButtons(!1);
  1009. e ? (this.visible = !0, this.alpha = 0, this.tempTwn = game.add.tween(this), this.tempTwn.to({
  1010. alpha: 1
  1011. }, brainieMain.GUI_FADE, Phaser.Easing.Linear.None, !1, 0, !1), this.tempTwn.onComplete.add(this.showEnd, this)) : (this.tempTwn = game.add.tween(this), this.tempTwn.to({
  1012. alpha: 0
  1013. }, brainieMain.GUI_FADE, Phaser.Easing.Linear.None, !1, 0, !1), this.tempTwn.onComplete.add(this.hideEnd, this));
  1014. this.tempTwn.start(0)
  1015. };
  1016. n.prototype.showEnd = function() {
  1017. this.gameButtons.enableButtons(!0)
  1018. };
  1019. n.prototype.hideEnd = function() {
  1020. this.visible = !1
  1021. };
  1022. n.prototype.resetGui = function() {
  1023. this.timers.updateHands(0, 0);
  1024. this.levels.updateLevel(1);
  1025. this.scoreLabel.updateScore(0);
  1026. this.numBubble.resetBubble()
  1027. };
  1028. return n
  1029. }(Phaser.Group);
  1030. e.GameGui = t
  1031. })(Brainie || (Brainie = {}));
  1032. (function(e) {
  1033. var t = function(e) {
  1034. function t(t, n) {
  1035. e.call(this, t, n, "", !1);
  1036. this.contCloseY = 573;
  1037. this.contOpenY = -109;
  1038. this.bgBm = this.create(11, 662, "mainSt", "bgLr_3.png");
  1039. this.bgMoveCont = this.game.add.group();
  1040. this.bgMoveCont.x = 3;
  1041. this.bgMoveCont.y = this.contCloseY;
  1042. this.add(this.bgMoveCont);
  1043. this.bgMove2 = this.bgMoveCont.create(0, 238, "mainSt", "bgLr_2_2.png");
  1044. this.bgMove3 = this.bgMoveCont.create(575, 238, "mainSt", "bgLr_2_3.png");
  1045. this.bgMove1 = this.bgMoveCont.create(1, 0, "mainSt", "bgLr_2_1.png");
  1046. this.overBm = this.create(12, 662, "mainSt", "bgLr_1.png");
  1047. this.faceBm = this.create(58, 630, "mainSt", "menuFace.png")
  1048. }
  1049. __extends(t, e);
  1050. t.prototype.openOver = function() {
  1051. this.tempTwn1 && this.tempTwn1.stop();
  1052. this.tempTwn1 = game.add.tween(this.bgMoveCont);
  1053. this.tempTwn1.to({
  1054. y: this.contOpenY
  1055. }, brainieMain.OPEN_TIME, Phaser.Easing.Sinusoidal.InOut, !1, 0, !1);
  1056. this.tempTwn1.onComplete.add(this.openEnd, this);
  1057. this.tempTwn1.start(0);
  1058. this.tempTwn2 && this.tempTwn2.stop();
  1059. this.tempTwn2 = game.add.tween(this.faceBm);
  1060. this.tempTwn2.to({
  1061. y: 730
  1062. }, 250, Phaser.Easing.Sinusoidal.In, !1, 0, !1);
  1063. this.tempTwn2.start(0)
  1064. };
  1065. t.prototype.openEnd = function() {
  1066. this.faceBm.visible = !1;
  1067. brainieMain.gGui.showGui(!0)
  1068. };
  1069. t.prototype.closeOver = function() {
  1070. brainieMain.gGui.showGui(!1);
  1071. this.tempTwn1 && this.tempTwn1.stop();
  1072. this.tempTwn1 = game.add.tween(this.bgMoveCont);
  1073. this.tempTwn1.to({
  1074. y: this.contCloseY
  1075. }, brainieMain.CLOSE_TIME, Phaser.Easing.Sinusoidal.InOut, !1, brainieMain.GUI_FADE, !1);
  1076. this.tempTwn1.start(0);
  1077. this.tempTwn2 && this.tempTwn2.stop();
  1078. this.faceBm.visible = !0;
  1079. this.tempTwn2 = game.add.tween(this.faceBm);
  1080. this.tempTwn2.to({
  1081. y: 630
  1082. }, 300, Phaser.Easing.Sinusoidal.InOut, !1, 500 + brainieMain.GUI_FADE, !1);
  1083. this.tempTwn2.start(0)
  1084. };
  1085. return t
  1086. }(Phaser.Group);
  1087. e.GameOverlay = t
  1088. })(Brainie || (Brainie = {}));
  1089. (function(e) {
  1090. var t = function(e) {
  1091. function t(t, n) {
  1092. e.call(this, t, n, "", !1);
  1093. this.setColorAnim();
  1094. this.setClearAnim()
  1095. }
  1096. __extends(t, e);
  1097. t.prototype.setColorAnim = function() {
  1098. this.colorEff = this.create(87, 347, "animSt");
  1099. this.colorEff.animations.add("colorEff", Phaser.Animation.generateFrameNames("bAnim_color_", 1, 11, ".png", 2), 20, !1);
  1100. this.colorEff.events.onAnimationComplete.add(this.colorAnimEnd, this);
  1101. this.colorEff.visible = !1
  1102. };
  1103. t.prototype.colorAnimEnd = function() {
  1104. this.colorEff.visible = !1
  1105. };
  1106. t.prototype.showColorEff = function() {
  1107. this.colorEff.visible = !0;
  1108. this.colorEff.animations.play("colorEff")
  1109. };
  1110. t.prototype.setClearAnim = function() {
  1111. this.clearEff = this.create(84, 345, "animSt");
  1112. this.clearEff.animations.add("clearEff", Phaser.Animation.generateFrameNames("bAnim_clean_", 1, 29, ".png", 2), 20, !1);
  1113. this.clearEff.events.onAnimationComplete.add(this.clearAnimEnd, this);
  1114. this.clearEff.visible = !1
  1115. };
  1116. t.prototype.clearAnimEnd = function() {
  1117. this.clearEff.visible = !1
  1118. };
  1119. t.prototype.showClearEff = function() {
  1120. this.clearEff.visible = !0;
  1121. this.clearEff.animations.play("clearEff")
  1122. };
  1123. return t
  1124. }(Phaser.Group);
  1125. e.EffectsLr = t
  1126. })(Brainie || (Brainie = {}));
  1127. (function(e) {
  1128. var t = function(e) {
  1129. function t(t) {
  1130. e.call(this, t, 16, 96, "gameAreaBg", 0)
  1131. }
  1132. __extends(t, e);
  1133. return t
  1134. }(Phaser.Sprite);
  1135. e.GameBg = t
  1136. })(Brainie || (Brainie = {}));
  1137. (function(e) {
  1138. var t = function(t) {
  1139. function n(e, n) {
  1140. t.call(this, e, n, "", !1);
  1141. this.setMc()
  1142. }
  1143. __extends(n, t);
  1144. n.prototype.setMc = function() {
  1145. this.Btn_RESET_SELECTION = new e.ImgBtnBase(this.game, 39, 16, "Btn_RESET_SELECTION", "resetSelBtn_up.png", "resetSelBtn_dn.png");
  1146. this.add(this.Btn_RESET_SELECTION);
  1147. this.Btn_RESET_SELECTION.events.onInputUp.add(this.resetClick, this);
  1148. this.Btn_GAME_PAUSE = new e.ImgBtnBase(this.game, 484, 25, "Btn_GAME_PAUSE", "pauseBtn_up.png", "pauseBtn_dn.png");
  1149. this.add(this.Btn_GAME_PAUSE);
  1150. this.Btn_GAME_PAUSE.events.onInputUp.add(this.pauseClick, this);
  1151. this.resetTitle = new e.BrainieNormalText(this.game, this, 91, 55, mainFont, gameTexts[lang][6][0], gameTexts[lang][6][1], "#bd8379");
  1152. this.resetTitle.setAnchor(.5, .5);
  1153. this.selectionTitle = new e.BrainieNormalText(this.game, this, 91, 77, mainFont, gameTexts[lang][7][0], gameTexts[lang][7][1], "#bd8379");
  1154. this.selectionTitle.setAnchor(.5, .5)
  1155. };
  1156. n.prototype.resetClick = function() {
  1157. // Play68.goHome()
  1158. };
  1159. n.prototype.pauseClick = function() {
  1160. brainieMain.gameCallback("GAME_PAUSE")
  1161. };
  1162. n.prototype.enableButtons = function(e) {
  1163. this.Btn_GAME_PAUSE.enableBtnInput(e);
  1164. this.Btn_RESET_SELECTION.enableBtnInput(e)
  1165. };
  1166. return n
  1167. }(Phaser.Group);
  1168. e.GameButtons = t
  1169. })(Brainie || (Brainie = {}));
  1170. (function(e) {
  1171. var t = function(t) {
  1172. function n(e, n) {
  1173. t.call(this, e, n, "", !1);
  1174. isStockAndroid ? (this.x = 339, this.y = 24) : (this.x = 346, this.y = 10);
  1175. this.setMc()
  1176. }
  1177. __extends(n, t);
  1178. n.prototype.setMc = function() {
  1179. isStockAndroid ? (this.lvlTitle = new e.BrainieNormalText(this.game, this, 55, 0, mainFont, gameTexts[lang][10][0], 24, "#c05c54"), this.lvlTitle.setAnchor(.5, 0), this.tmrBg = this.create(0, 34, "mainSt", "clockBgAlt.png"), this.Hand1 = this.create(2, 36, "mainSt", "clockAltFill.png"), this.Hand2 = this.create(2, 58, "mainSt", "clockAltFill.png")) : (this.tmrBg = this.create(0, 0, "mainSt", "clockBg.png"), this.Hand2 = this.create(45, 50, "mainSt", "handBig.png"), this.Hand2.anchor.setTo(.5, 1), this.Hand1 = this.create(45, 50, "mainSt", "handSmall.png"), this.Hand1.anchor.setTo(5 / 11, 1))
  1180. };
  1181. n.prototype.updateHands = function(e, t) {
  1182. "undefined" === typeof e && (e = 0);
  1183. "undefined" === typeof t && (t = 0);
  1184. isStockAndroid ? (this.Hand1.scale.x = e, this.Hand2.scale.x = t) : (this.Hand1.angle = 360 * e, this.Hand2.angle = 360 * t)
  1185. };
  1186. return n
  1187. }(Phaser.Group);
  1188. e.GameTimers = t
  1189. })(Brainie || (Brainie = {}));
  1190. (function(e) {
  1191. var t = function(t) {
  1192. function n(e, n) {
  1193. t.call(this, e, n, "", !1);
  1194. this.y = 690;
  1195. this.setMc()
  1196. }
  1197. __extends(n, t);
  1198. n.prototype.setMc = function() {
  1199. this.fld_level = new e.BrainieNormalText(this.game, this, 577, 0, mainFont, "0", gameTexts[lang][10][1], "#c05c54");
  1200. this.fld_level.setAnchor(1, 0);
  1201. this.fld_level.setText(gameTexts[lang][10][0] + ": 1")
  1202. };
  1203. n.prototype.updateLevel = function(e) {
  1204. "undefined" === typeof e && (e = 0);
  1205. this.fld_level.setText(gameTexts[lang][10][0] + ": " + e.toString())
  1206. };
  1207. return n
  1208. }(Phaser.Group);
  1209. e.Levels = t
  1210. })(Brainie || (Brainie = {}));
  1211. (function(e) {
  1212. var t = function(t) {
  1213. function n(e, n) {
  1214. t.call(this, e, n, "", !1);
  1215. this.initScaleX = .3;
  1216. this.initScaleY = .2;
  1217. this.HIDE_TIME = 200;
  1218. this.tempNum = 0;
  1219. this.x = 243;
  1220. this.y = 58;
  1221. this.setMc();
  1222. this.resetBubble()
  1223. }
  1224. __extends(n, t);
  1225. n.prototype.resetBubble = function() {
  1226. this.hLbl.visible = !1;
  1227. this.fld_num.setText("");
  1228. this.fld_num.visible = !0;
  1229. this.bBg.scale.setTo(this.initScaleX, this.initScaleY);
  1230. this.hLbl.scale.setTo(this.initScaleX, this.initScaleY);
  1231. this.fld_num.scale.setTo(this.initScaleX, this.initScaleY);
  1232. this.alpha = 0
  1233. };
  1234. n.prototype.hideLabel = function() {
  1235. this.hLbl.visible = !1;
  1236. this.fld_num.setText("");
  1237. this.fld_num.visible = !0;
  1238. this.tryStopTweens();
  1239. this.tempTwn = game.add.tween(this);
  1240. this.tempTwn.to({
  1241. alpha: 0
  1242. }, 200, Phaser.Easing.Sinusoidal.In, !0, 0, !1);
  1243. this.tempTwnScl1 = game.add.tween(this.bBg.scale);
  1244. this.tempTwnScl1.to({
  1245. x: this.initScaleX,
  1246. y: this.initScaleY
  1247. }, 200, Phaser.Easing.Sinusoidal.In, !0, 0, !1);
  1248. this.tempTwnScl2 = game.add.tween(this.hLbl.scale);
  1249. this.tempTwnScl2.to({
  1250. x: this.initScaleX,
  1251. y: this.initScaleY
  1252. }, 200, Phaser.Easing.Sinusoidal.In, !0, 0, !1);
  1253. this.tempTwnScl3 = game.add.tween(this.fld_num.scale);
  1254. this.tempTwnScl3.to({
  1255. x: this.initScaleX,
  1256. y: this.initScaleY
  1257. }, 200, Phaser.Easing.Sinusoidal.In, !0, 0, !1)
  1258. };
  1259. n.prototype.tryStopTweens = function() {
  1260. this.tempTwn && this.tempTwn.stop();
  1261. this.tempTwnScl1 && this.tempTwnScl1.stop();
  1262. this.tempTwnScl2 && this.tempTwnScl2.stop();
  1263. this.tempTwnScl3 && this.tempTwnScl3.stop()
  1264. };
  1265. n.prototype.hintChange = function(e) {
  1266. e ? (this.fld_num.visible = !0, this.hLbl.visible = !1) : (this.fld_num.visible = !1, this.hLbl.visible = !0)
  1267. };
  1268. n.prototype.setMc = function() {
  1269. this.bBg = this.create(0, 0, "mainSt", "numFldBg.png");
  1270. this.bBg.anchor.setTo(.5, .5);
  1271. this.hLbl = new e.BrainieNormalText(this.game, this, 0, 2, mainFont, gameTexts[lang][8][0], gameTexts[lang][8][1], "#460c07");
  1272. this.hLbl.setAnchor(.5, .5);
  1273. this.fld_num = new e.BrainieNormalText(this.game, this, 0, 2, mainFont, "0", 67, "#460c07");
  1274. this.fld_num.setAnchor(.5, .5);
  1275. this.fld_num.setText("");
  1276. this.hLbl.visible = !1
  1277. };
  1278. n.prototype.showNumber = function(e) {
  1279. this.tempNum = e;
  1280. this.fld_num.visible = !0;
  1281. this.hLbl.visible = !1;
  1282. this.tryStopTweens();
  1283. this.tempTwn = game.add.tween(this);
  1284. this.tempTwn.to({
  1285. alpha: 0
  1286. }, 210, Phaser.Easing.Sinusoidal.In, !1, 0, !1);
  1287. this.tempTwn.onComplete.add(this.animHalf, this);
  1288. this.tempTwn.start(0);
  1289. this.tempTwnScl1 = game.add.tween(this.bBg.scale);
  1290. this.tempTwnScl1.to({
  1291. x: this.initScaleX,
  1292. y: this.initScaleY
  1293. }, 200, Phaser.Easing.Sinusoidal.In, !0, 0, !1);
  1294. this.tempTwnScl2 = game.add.tween(this.hLbl.scale);
  1295. this.tempTwnScl2.to({
  1296. x: this.initScaleX,
  1297. y: this.initScaleY
  1298. }, 200, Phaser.Easing.Sinusoidal.In, !0, 0, !1);
  1299. this.tempTwnScl3 = game.add.tween(this.fld_num.scale);
  1300. this.tempTwnScl3.to({
  1301. x: this.initScaleX,
  1302. y: this.initScaleY
  1303. }, 200, Phaser.Easing.Sinusoidal.In, !0, 0, !1)
  1304. };
  1305. n.prototype.animHalf = function() {
  1306. this.fld_num.setText(this.tempNum.toString());
  1307. this.tryStopTweens();
  1308. this.tempTwn = game.add.tween(this);
  1309. this.tempTwn.to({
  1310. alpha: 1
  1311. }, 400, Phaser.Easing.Back.Out, !0, 0, !1);
  1312. this.tempTwnScl1 = game.add.tween(this.bBg.scale);
  1313. this.tempTwnScl1.to({
  1314. x: 1,
  1315. y: 1
  1316. }, 400, Phaser.Easing.Back.Out, !0, 0, !1);
  1317. this.tempTwnScl2 = game.add.tween(this.hLbl.scale);
  1318. this.tempTwnScl2.to({
  1319. x: 1,
  1320. y: 1
  1321. }, 400, Phaser.Easing.Back.Out, !0, 0, !1);
  1322. this.tempTwnScl3 = game.add.tween(this.fld_num.scale);
  1323. this.tempTwnScl3.to({
  1324. x: 1,
  1325. y: 1
  1326. }, 400, Phaser.Easing.Back.Out, !0, 0, !1)
  1327. };
  1328. return n
  1329. }(Phaser.Group);
  1330. e.NumberBubble = t
  1331. })(Brainie || (Brainie = {}));
  1332. (function(e) {
  1333. var t = function(t) {
  1334. function n(e, n, r, i, s, o, u) {
  1335. "undefined" === typeof r && (r = 1);
  1336. "undefined" === typeof i && (i = 1);
  1337. "undefined" === typeof s && (s = 0);
  1338. "undefined" === typeof o && (o = 0);
  1339. "undefined" === typeof u && (u = 0);
  1340. t.call(this, e, n, "", !1);
  1341. this.bxType = this.bxValue = 1;
  1342. this.bxColor = this.bxRow = this.bxCol = 0;
  1343. this.txTemp = "";
  1344. this.boxFrames = "block_1.png block_2.png block_3.png block_4.png block_5.png block_6.png block_7_up.png block_7_dn.png".split(" ");
  1345. this.tempBoxID = 0;
  1346. this.selected = !1;
  1347. this.MAX_SPEED = 3;
  1348. this.ELASTICITY = .6;
  1349. this.GRAVITY = .1;
  1350. this.goalPosition = this.moveSpeed = 0;
  1351. this.bxValue = r;
  1352. this.bxType = i;
  1353. this.bxCol = s;
  1354. this.bxRow = o;
  1355. this.bxColor = u;
  1356. this.x = brainieMain.BOX_SIZE * this.bxCol;
  1357. this.setBg();
  1358. 5 != this.bxType && this.setNumber();
  1359. this.boxBg.inputEnabled = !0;
  1360. this.boxBg.events.onInputDown.add(this.clickEvt, this)
  1361. }
  1362. __extends(n, t);
  1363. n.prototype.enableBox = function(e) {
  1364. this.boxBg.input.enabled = e
  1365. };
  1366. n.prototype.destroyBox = function() {
  1367. this.boxBg.events.onInputDown.remove(this.clickEvt, this);
  1368. this.boxBg.destroy();
  1369. this.destroy()
  1370. };
  1371. n.prototype.setNumber = function() {
  1372. this.boxNumSelect = new e.BrainieBmText(this.game, this, brainieMain.BOX_SIZE / 2, 35, "salsa_box_2", "0", 33);
  1373. this.boxNumSelect.setAnchor(.5, .5);
  1374. this.boxNumSelect.visible = !1;
  1375. this.boxNumDedelect = new e.BrainieBmText(this.game, this, brainieMain.BOX_SIZE / 2, 35, "salsa_box_1", "0", 33);
  1376. this.boxNumDedelect.setAnchor(.5, .5);
  1377. if (5 != this.bxType) {
  1378. switch (this.bxType) {
  1379. case 1:
  1380. this.txTemp = "";
  1381. break;
  1382. case 2:
  1383. this.txTemp = "-";
  1384. break;
  1385. case 3:
  1386. this.txTemp = "*";
  1387. break;
  1388. case 4:
  1389. this.txTemp = "/"
  1390. }
  1391. this.txTemp += this.bxValue.toString();
  1392. this.boxNumSelect.setText(this.txTemp);
  1393. this.boxNumDedelect.setText(this.txTemp)
  1394. }
  1395. };
  1396. n.prototype.setBg = function() {
  1397. this.tempBoxID = this.bxColor - 1;
  1398. this.boxBg = this.create(0, -17, "mainSt", this.boxFrames[this.tempBoxID])
  1399. };
  1400. n.prototype.setBomb = function(e) {
  1401. this.tempBoxID = e ? 7 : 6;
  1402. this.boxBg.frameName = this.boxFrames[this.tempBoxID]
  1403. };
  1404. n.prototype.selectBox = function() {
  1405. 0 == brainieMain.SELECTED_BOXES_ARR.length && 2 < this.bxType && 5 > this.bxType ? sndPlr.playGameSnd("box_select_wrong") : (this.selected = !0, 7 != this.bxColor ? (this.boxNumSelect.visible = !0, this.boxNumDedelect.visible = !1, sndPlr.playSelectSound()) : (this.setBomb(!0), sndPlr.playGameSnd("box_select_boom")), brainieMain.actualGame.boxEvent(this))
  1406. };
  1407. n.prototype.deselectBox = function(e) {
  1408. "undefined" === typeof e && (e = !0);
  1409. this.selected = !1;
  1410. e && brainieMain.actualGame.boxEvent(this);
  1411. 7 != this.bxColor ? (this.boxNumSelect.visible = !1, this.boxNumDedelect.visible = !0, sndPlr.playSelectSound()) : (this.setBomb(!1), brainieMain.gGui.numBubble.hintChange(!0), sndPlr.playGameSnd("box_select_boom"))
  1412. };
  1413. n.prototype.clickEvt = function() {
  1414. this.selected ? this.deselectBox(!0) : this.selectBox()
  1415. };
  1416. n.prototype.dropBox = function() {
  1417. this.y = 0;
  1418. this.moveSpeed = this.MAX_SPEED;
  1419. this.goalPosition = this.bxRow * brainieMain.BOX_SIZE
  1420. };
  1421. n.prototype.moveDown = function() {
  1422. this.bxRow++;
  1423. this.moveSpeed = this.MAX_SPEED;
  1424. this.goalPosition = this.bxRow * brainieMain.BOX_SIZE
  1425. };
  1426. n.prototype.tryMove = function() {
  1427. 0 != this.moveSpeed && (this.moveSpeed = this.moveSpeed < this.MAX_SPEED ? this.moveSpeed + this.GRAVITY : this.MAX_SPEED, this.y += this.moveSpeed * brainieMain.dTm, this.y >= this.goalPosition && (this.y = this.goalPosition, this.moveSpeed = -this.moveSpeed * this.ELASTICITY, .15 > this.moveSpeed && -.15 < this.moveSpeed && (this.moveSpeed = 0)))
  1428. };
  1429. return n
  1430. }(Phaser.Group);
  1431. e.NumBox = t
  1432. })(Brainie || (Brainie = {}));
  1433. (function(e) {
  1434. var t = function(t) {
  1435. function n(e, n) {
  1436. t.call(this, e, n, "", !1);
  1437. this.lastScore = this.addScore = 0;
  1438. this.y = 690;
  1439. this.setMc()
  1440. }
  1441. __extends(n, t);
  1442. n.prototype.setMc = function() {
  1443. this.fld_score = new e.BrainieNormalText(this.game, this, 25, 0, mainFont, "0", gameTexts[lang][9][2], "#c05c54");
  1444. this.fld_scoreAdd = new e.BrainieNormalText(this.game, this, 150, 0, mainFont, "", gameTexts[lang][9][2], "#c05c54");
  1445. this.fld_scoreAdd.visible = !1
  1446. };
  1447. n.prototype.updateScore = function(e) {
  1448. "undefined" === typeof e && (e = 0);
  1449. var t = this;
  1450. this.fld_score.setText(gameTexts[lang][9][0] + ": " + e.toString());
  1451. e != this.lastScore && (this.addScore = e - this.lastScore, setTimeout(function() {
  1452. return t.showAddText()
  1453. }, 50));
  1454. this.lastScore = e
  1455. };
  1456. n.prototype.showAddText = function() {
  1457. this.fld_scoreAdd.setText("+" + this.addScore.toString());
  1458. this.fld_scoreAdd.x = this.fld_score.x + 2 + this.fld_score.getWidth();
  1459. this.tempTwn && this.tempTwn.stop();
  1460. this.fld_scoreAdd.visible = !0;
  1461. this.fld_scoreAdd.alpha = 1;
  1462. this.tempTwn = game.add.tween(this.fld_scoreAdd);
  1463. this.tempTwn.to({
  1464. alpha: 0
  1465. }, 500, Phaser.Easing.Linear.None, !1, 300, !1);
  1466. this.tempTwn.onComplete.add(this.moveComplete, this);
  1467. this.tempTwn.start(0)
  1468. };
  1469. n.prototype.moveComplete = function() {
  1470. this.fld_scoreAdd.visible = !1
  1471. };
  1472. return n
  1473. }(Phaser.Group);
  1474. e.ScoreLabel = t
  1475. })(Brainie || (Brainie = {}));
  1476. (function(e) {
  1477. var t = function(e) {
  1478. function t() {
  1479. e.apply(this, arguments)
  1480. }
  1481. __extends(t, e);
  1482. t.prototype.preload = function() {
  1483. this.preloadBg = this.add.sprite(0, 0, "mainBg");
  1484. this.preloadBarBg = this.add.sprite(177, 340, "preloaderBg");
  1485. this.preloadBarFill = this.add.sprite(184, 346, "preloaderFill");
  1486. this.load.setPreloadSprite(this.preloadBarFill);
  1487. this.load.bitmapFont("salsa_box_1", "img/salsa_box_1.png", "img/salsa_box_1.xml");
  1488. this.load.bitmapFont("salsa_box_2", "img/salsa_box_2.png", "img/salsa_box_2.xml");
  1489. this.load.image("gameAreaBg", "img/gameAreaBg.jpg");
  1490. this.load.image("helpBm", "img/helpBm.jpg");
  1491. this.load.atlasXML("mainSt", "img/mainSt.png", "img/mainSt.xml", null);
  1492. this.load.atlasXML("animSt", "img/animSt.png", "img/animSt.xml", null);
  1493. if (this.game.device.desktop && this.game.device.webAudio)
  1494. for (var e = 0; e < game.snds.length; e++) this.load.audio(game.snds[e], ["snds/" + game.snds[e] + ".mp3", "snds/" + game.snds[e] + ".ogg"])
  1495. };
  1496. t.prototype.create = function() {
  1497. this.preloadBarBg.kill();
  1498. this.preloadBarFill.kill();
  1499. this.preloadBg.kill();
  1500. this.game.state.start("GameMain", !0, !1)
  1501. };
  1502. return t
  1503. }(Phaser.State);
  1504. e.Preloader = t
  1505. })(Brainie || (Brainie = {}));
  1506. (function(e) {
  1507. var t = function(e) {
  1508. function t(t) {
  1509. e.call(this, t, 299, 242, "mainSt", 0);
  1510. this.frameName = "logoBrainie.png";
  1511. this.anchor.setTo(222 / 441, 115 / 170)
  1512. }
  1513. __extends(t, e);
  1514. t.prototype.showLogo = function(e) {
  1515. this.tempTwn && this.tempTwn.stop();
  1516. this.tempTwnScl && this.tempTwnScl.stop();
  1517. e ? (this.visible = !0, this.alpha = 0, this.scale.setTo(.4, .3), this.tempTwn = game.add.tween(this), this.tempTwn.to({
  1518. alpha: 1
  1519. }, 600, Phaser.Easing.Back.Out, !1, brainieMain.MENU_FADE, !1), this.tempTwn.start(0), this.tempTwnScl = game.add.tween(this.scale), this.tempTwnScl.to({
  1520. x: 1,
  1521. y: 1
  1522. }, 600, Phaser.Easing.Back.Out, !1, brainieMain.MENU_FADE, !1), this.tempTwnScl.onComplete.add(this.showEnd, this)) : (this.tempTwn = game.add.tween(this), this.tempTwn.to({
  1523. alpha: 0
  1524. }, 300, Phaser.Easing.Sinusoidal.In, !1, 0, !1), this.tempTwn.start(0), this.tempTwnScl = game.add.tween(this.scale), this.tempTwnScl.to({
  1525. x: .4,
  1526. y: .3
  1527. }, 300, Phaser.Easing.Sinusoidal.In, !1, 0, !1), this.tempTwnScl.onComplete.add(this.hideEnd, this));
  1528. this.tempTwnScl.start(0)
  1529. };
  1530. t.prototype.hideEnd = function() {
  1531. this.visible = !1
  1532. };
  1533. t.prototype.showEnd = function() {};
  1534. return t
  1535. }(Phaser.Sprite);
  1536. e.MainLogo = t
  1537. })(Brainie || (Brainie = {}));
  1538. (function(e) {
  1539. var t = function(e) {
  1540. function t(t, n) {
  1541. e.call(this, t, n, "", !1);
  1542. this.x = 511;
  1543. this.y = 28;
  1544. this.visible = !1;
  1545. this.btnBg = this.create(0, 0, "mainSt", "sndBtn_up.png");
  1546. this.crossBm = this.create(0, 0, "mainSt", "sndBtn_cross.png");
  1547. this.crossBm.visible = !1;
  1548. this.btnBg.inputEnabled = !0;
  1549. this.btnBg.events.onInputDown.add(this.swDn, this);
  1550. this.btnBg.events.onInputOut.add(this.up, this);
  1551. this.btnBg.events.onInputUp.add(this.upClick, this)
  1552. }
  1553. __extends(t, e);
  1554. t.prototype.showSwitch = function(e) {
  1555. this.visible = this.btnBg.input.enabled = e
  1556. };
  1557. t.prototype.swDn = function() {
  1558. this.btnBg.frameName = "sndBtn_dn.png"
  1559. };
  1560. t.prototype.upClick = function() {
  1561. sndPlr.soundOn ? (sndPlr.soundOn = !1, this.crossBm.visible = !0) : (sndPlr.soundOn = !0, this.crossBm.visible = !1);
  1562. this.up()
  1563. };
  1564. t.prototype.up = function() {
  1565. this.btnBg.frameName = "sndBtn_up.png"
  1566. };
  1567. return t
  1568. }(Phaser.Group);
  1569. e.SoundSwitch = t
  1570. })(Brainie || (Brainie = {}));
  1571. (function(e) {
  1572. var t = function(t) {
  1573. function n(n, r) {
  1574. t.call(this, n, r, "", !1);
  1575. this.titleFld = new e.BrainieNormalText(this.game, this, 0, -30, mainFont, gameTexts[lang][14][0], gameTexts[lang][14][1], "#cea9b5");
  1576. this.titleFld.setAnchor(.5, 0);
  1577. this.Btn_YES = new e.BtnBase(this.game, this, -135, 5, gameTexts[lang][15][0], !0, gameTexts[lang][15][1]);
  1578. this.Btn_NO = new e.BtnBase(this.game, this, 5, 5, gameTexts[lang][16][0], !0, gameTexts[lang][16][1]);
  1579. this.enableCont(!1)
  1580. }
  1581. __extends(n, t);
  1582. n.prototype.enableCont = function(e) {
  1583. this.Btn_YES.enableBtnInput(e);
  1584. this.Btn_NO.enableBtnInput(e)
  1585. };
  1586. return n
  1587. }(Phaser.Group);
  1588. e.SureCont = t
  1589. })(Brainie || (Brainie = {}));
  1590. (function(e) {
  1591. var t = function(t) {
  1592. function n(e, n) {
  1593. t.call(this, e, n, "", !1);
  1594. this.setDisabler();
  1595. this.setSoundSwitch()
  1596. }
  1597. __extends(n, t);
  1598. n.prototype.setDisabler = function() {
  1599. this.menuDisabler = this.create(-30, -30, "mainSt", "menuDisabler.png");
  1600. this.menuDisabler.scale.setTo((gW + 60) / 50, (gH + 60) / 50);
  1601. this.menuDisabler.alpha = 0;
  1602. this.menuDisabler.visible = !1;
  1603. this.menuDisabler.inputEnabled = !0
  1604. };
  1605. n.prototype.showDisabler = function(e) {
  1606. this.menuDisabler.visible = e;
  1607. this.menuDisabler.input.enabled = e
  1608. };
  1609. n.prototype.showMainMenu = function() {
  1610. this.sndSw && this.sndSw.showSwitch(!0);
  1611. this.scrnMainMenu = new e.Scrn_MainMenu(this.game, this);
  1612. this.showDisabler(!0);
  1613. this.scrnMainMenu.resetMenu();
  1614. this.scrnMainMenu.showContent()
  1615. };
  1616. n.prototype.hideMainMenu = function() {
  1617. this.sndSw && this.sndSw.showSwitch(!1);
  1618. this.showDisabler(!1);
  1619. this.scrnMainMenu.destroy()
  1620. };
  1621. n.prototype.showPauseMenu = function() {
  1622. this.sndSw && this.sndSw.showSwitch(!0);
  1623. this.scrnPause = new e.Scrn_Pause(this.game, this);
  1624. this.showDisabler(!0);
  1625. this.scrnPause.showContent()
  1626. };
  1627. n.prototype.hidePauseMenu = function() {
  1628. this.sndSw && this.sndSw.showSwitch(!1);
  1629. this.showDisabler(!1);
  1630. this.scrnPause.destroy()
  1631. };
  1632. n.prototype.showLevelMenu = function() {
  1633. this.sndSw && this.sndSw.showSwitch(!0);
  1634. this.scrnLevel = new e.Scrn_Level(this.game, this);
  1635. this.showDisabler(!0);
  1636. this.scrnLevel.showContent()
  1637. };
  1638. n.prototype.hideLevelMenu = function() {
  1639. this.sndSw && this.sndSw.showSwitch(!1);
  1640. this.showDisabler(!1);
  1641. this.scrnLevel.destroy()
  1642. };
  1643. n.prototype.showEndMenu = function() {
  1644. this.sndSw && this.sndSw.showSwitch(!0);
  1645. this.scrnEnd = new e.Scrn_End(this.game, this);
  1646. this.showDisabler(!0);
  1647. this.scrnEnd.showContent()
  1648. };
  1649. n.prototype.hideEndMenu = function() {
  1650. this.sndSw && this.sndSw.showSwitch(!1);
  1651. this.showDisabler(!1);
  1652. this.scrnEnd.destroy()
  1653. };
  1654. n.prototype.showHelp = function() {
  1655. this.scrnHelp = new e.Scrn_Help(this.game, this);
  1656. this.scrnHelp.showCont()
  1657. };
  1658. n.prototype.hideHelp = function() {
  1659. this.scrnHelp.destroy()
  1660. };
  1661. n.prototype.setSoundSwitch = function() {
  1662. sndPlr.soundEnabled && (this.sndSw = new e.SoundSwitch(this.game, this))
  1663. };
  1664. return n
  1665. }(Phaser.Group);
  1666. e.ScreensCont = t
  1667. })(Brainie || (Brainie = {}));
  1668. (function(e) {
  1669. var t = function(t) {
  1670. function n(n, r) {
  1671. t.call(this, n, r, "", !1);
  1672. this.scrnTitle = new e.BrainieNormalText(this.game, this, 300, 170, mainFont, gameTexts[lang][17][0], gameTexts[lang][17][1], "#cea9b5");
  1673. this.scrnTitle.setAnchor(.5, 0);
  1674. this.scoreFld = new e.BrainieNormalText(this.game, this, 300, 245, mainFont, gameTexts[lang][9][0] + ": 0", gameTexts[lang][9][1], "#cea9b5");
  1675. this.scoreFld.setAnchor(.5, 0);
  1676. this.Btn_GAME_BACKTOMAIN = new e.BtnBase(this.game, this, 34, 335, gameTexts[lang][18][0], !1, gameTexts[lang][18][1]);
  1677. this.Btn_GAME_BACKTOMAIN.bgBm.events.onInputUp.add(this.backToMainClick, this);
  1678. this.Btn_SHOW_HELP = new e.BtnBase(this.game, this, 305, 335, gameTexts[lang][19][0], !1, gameTexts[lang][19][1]);
  1679. this.Btn_SHOW_HELP.bgBm.events.onInputUp.add(this.helpClick, this);
  1680. this.Btn_MORE = new e.BtnBase(this.game, this, 169, 420, gameTexts[lang][25][0], !1, gameTexts[lang][25][1]);
  1681. this.Btn_MORE.bgBm.events.onInputDown.add(this.showClick, this)
  1682. }
  1683. __extends(n, t);
  1684. n.prototype.backToMainClick = function() {
  1685. this.setButtons(!1);
  1686. brainieMain.gameCallback("GAME_BACKTOMAIN")
  1687. };
  1688. n.prototype.helpClick = function() {
  1689. brainieMain.gameCallback("SHOW_HELP")
  1690. };
  1691. n.prototype.showClick = function() {
  1692. brainieMain.moreGamesCall()
  1693. };
  1694. n.prototype.showContent = function() {
  1695. this.scoreFld.setText(gameTexts[lang][9][0] + ": " + brainieMain.actualGame.score.toString());
  1696. this.setButtons(!1);
  1697. this.tempTwn && this.tempTwn.stop();
  1698. this.alpha = 0;
  1699. this.tempTwn = game.add.tween(this);
  1700. this.tempTwn.to({
  1701. alpha: 1
  1702. }, brainieMain.MENU_FADE, Phaser.Easing.Linear.None, !1, 0, !1);
  1703. this.tempTwn.onComplete.add(this.showContEnd, this);
  1704. this.tempTwn.start(0)
  1705. };
  1706. n.prototype.showContEnd = function() {
  1707. this.setButtons(!0)
  1708. };
  1709. n.prototype.setButtons = function(e) {
  1710. this.Btn_GAME_BACKTOMAIN.enableBtnInput(e);
  1711. this.Btn_MORE.enableBtnInput(e);
  1712. this.Btn_SHOW_HELP.enableBtnInput(e)
  1713. };
  1714. return n
  1715. }(Phaser.Group);
  1716. e.Scrn_End = t
  1717. })(Brainie || (Brainie = {}));
  1718. (function(e) {
  1719. var t = function(t) {
  1720. function n(n, r) {
  1721. t.call(this, n, r, "", !1);
  1722. this.setDisabler();
  1723. this.helpCont = this.game.add.group();
  1724. this.add(this.helpCont);
  1725. this.helpBm = this.helpCont.create(10, 10, "helpBm");
  1726. this.hTx1 = new e.BrainieNormalText(this.game, this.helpCont, 47, 48, mainFont, gameTexts[lang][21][0], gameTexts[lang][21][1], "#784c5b", "left");
  1727. this.hTx2 = new e.BrainieNormalText(this.game, this.helpCont, 47, 235, mainFont, gameTexts[lang][22][0], gameTexts[lang][22][1], "#784c5b", "left");
  1728. this.hTx3 = new e.BrainieNormalText(this.game, this.helpCont, 47, 348, mainFont, gameTexts[lang][23][0], gameTexts[lang][23][1], "#784c5b", "left");
  1729. this.hTx4 = new e.BrainieNormalText(this.game, this.helpCont, 47, 534, mainFont, gameTexts[lang][24][0], gameTexts[lang][24][1], "#784c5b", "left");
  1730. this.Btn_CLOSE_HELP = new e.BtnBase(this.game, this.helpCont, 170, 602, gameTexts[lang][20][0], !1, gameTexts[lang][20][1]);
  1731. this.Btn_CLOSE_HELP.bgBm.events.onInputUp.add(this.closeClick, this)
  1732. }
  1733. __extends(n, t);
  1734. n.prototype.showCont = function() {
  1735. this.enableDisabler(!0);
  1736. this.Btn_CLOSE_HELP.enableBtnInput(!1);
  1737. this.helpCont.y = gH;
  1738. this.tempTwn = game.add.tween(this.helpCont);
  1739. this.tempTwn.to({
  1740. y: 0
  1741. }, 500, Phaser.Easing.Sinusoidal.Out, !1, 0, !1);
  1742. this.tempTwn.onComplete.add(this.showContEnd, this);
  1743. this.tempTwn.start(0)
  1744. };
  1745. n.prototype.showContEnd = function() {
  1746. this.Btn_CLOSE_HELP.enableBtnInput(!0)
  1747. };
  1748. n.prototype.closeClick = function() {
  1749. this.Btn_CLOSE_HELP.enableBtnInput(!1);
  1750. this.tempTwn = game.add.tween(this.helpCont);
  1751. this.tempTwn.to({
  1752. y: gH
  1753. }, 400, Phaser.Easing.Sinusoidal.In, !1, 0, !1);
  1754. this.tempTwn.onComplete.add(this.closeEnd, this);
  1755. this.tempTwn.start(0)
  1756. };
  1757. n.prototype.closeEnd = function() {
  1758. brainieMain.gameCallback("CLOSE_HELP")
  1759. };
  1760. n.prototype.setDisabler = function() {
  1761. this.disabler = this.create(-30, -30, "mainSt", "menuDisabler.png");
  1762. this.disabler.scale.setTo((gW + 60) / 50, (gH + 60) / 50);
  1763. this.disabler.alpha = 0;
  1764. this.disabler.visible = !1;
  1765. this.disabler.inputEnabled = !0
  1766. };
  1767. n.prototype.enableDisabler = function(e) {
  1768. this.disabler.visible = e;
  1769. this.disabler.input.enabled = e
  1770. };
  1771. return n
  1772. }(Phaser.Group);
  1773. e.Scrn_Help = t
  1774. })(Brainie || (Brainie = {}));
  1775. (function(e) {
  1776. var t = function(t) {
  1777. function n(n, r) {
  1778. t.call(this, n, r, "", !1);
  1779. this.scrnTitle = new e.BrainieNormalText(this.game, this, 300, 140, mainFont, gameTexts[lang][11][0], gameTexts[lang][11][1], "#cea9b5");
  1780. this.scrnTitle.setAnchor(.5, 0);
  1781. this.Btn_GAME_NEXT_LEVEL = new e.BtnBase(this.game, this, 34, 335, gameTexts[lang][12][0], !1, gameTexts[lang][12][1]);
  1782. this.Btn_GAME_NEXT_LEVEL.bgBm.events.onInputUp.add(this.nextClick, this);
  1783. this.Btn_SHOW_HELP = new e.BtnBase(this.game, this, 305, 335, gameTexts[lang][19][0], !1, gameTexts[lang][19][1]);
  1784. this.Btn_SHOW_HELP.bgBm.events.onInputUp.add(this.helpClick, this);
  1785. this.Btns_GAME_END_LEVEL = new e.BtnBase(this.game, this, 169, 420, gameTexts[lang][13][0], !1, gameTexts[lang][13][1]);
  1786. this.Btns_GAME_END_LEVEL.bgBm.events.onInputUp.add(this.endClick, this);
  1787. this.sureCont = new e.SureCont(this.game, this);
  1788. this.sureCont.x = this.Btns_GAME_END_LEVEL.x + 131;
  1789. this.sureCont.y = this.Btns_GAME_END_LEVEL.y + 30;
  1790. this.sureCont.Btn_YES.bgBm.events.onInputUp.add(this.yesEndClick, this);
  1791. this.sureCont.Btn_NO.bgBm.events.onInputUp.add(this.noEndClick, this)
  1792. }
  1793. __extends(n, t);
  1794. n.prototype.nextClick = function() {
  1795. this.setButtons(!1);
  1796. this.sureCont.enableCont(!1);
  1797. brainieMain.gameCallback("GAME_NEXT_LEVEL")
  1798. };
  1799. n.prototype.helpClick = function() {
  1800. brainieMain.gameCallback("SHOW_HELP")
  1801. };
  1802. n.prototype.endClick = function() {
  1803. this.sureCont.visible = !0;
  1804. this.sureCont.enableCont(!0);
  1805. this.Btns_GAME_END_LEVEL.visible = !1
  1806. };
  1807. n.prototype.noEndClick = function() {
  1808. this.sureCont.visible = !1;
  1809. this.sureCont.enableCont(!1);
  1810. this.Btns_GAME_END_LEVEL.visible = !0
  1811. };
  1812. n.prototype.yesEndClick = function() {
  1813. this.setButtons(!1);
  1814. this.sureCont.enableCont(!1);
  1815. brainieMain.gameCallback("GAME_END_LEVEL")
  1816. };
  1817. n.prototype.showContent = function() {
  1818. this.setButtons(!1);
  1819. this.sureCont.visible = !1;
  1820. this.sureCont.enableCont(!1);
  1821. this.Btns_GAME_END_LEVEL.visible = !0;
  1822. this.tempTwn && this.tempTwn.stop();
  1823. this.alpha = 0;
  1824. this.tempTwn = game.add.tween(this);
  1825. this.tempTwn.to({
  1826. alpha: 1
  1827. }, brainieMain.MENU_FADE, Phaser.Easing.Linear.None, !1, 0, !1);
  1828. this.tempTwn.onComplete.add(this.showContEnd, this);
  1829. this.tempTwn.start(0)
  1830. };
  1831. n.prototype.showContEnd = function() {
  1832. this.setButtons(!0)
  1833. };
  1834. n.prototype.setButtons = function(e) {
  1835. this.Btn_GAME_NEXT_LEVEL.enableBtnInput(e);
  1836. this.Btn_SHOW_HELP.enableBtnInput(e);
  1837. this.Btns_GAME_END_LEVEL.enableBtnInput(e)
  1838. };
  1839. return n
  1840. }(Phaser.Group);
  1841. e.Scrn_Level = t
  1842. })(Brainie || (Brainie = {}));
  1843. (function(e) {
  1844. var t = function(t) {
  1845. function n(e, n) {
  1846. t.call(this, e, n, "", !1);
  1847. this.setMain();
  1848. this.setMode()
  1849. }
  1850. __extends(n, t);
  1851. n.prototype.showContent = function() {
  1852. this.alpha = 0;
  1853. this.tempTwn = game.add.tween(this);
  1854. this.tempTwn.to({
  1855. alpha: 1
  1856. }, brainieMain.MENU_FADE, Phaser.Easing.Linear.None, !1, 0, !1);
  1857. this.tempTwn.onComplete.add(this.showContEnd, this);
  1858. this.tempTwn.start(0)
  1859. };
  1860. n.prototype.showContEnd = function() {
  1861. this.btnMainStart.enableBtnInput(!0);
  1862. this.btnMainMore.enableBtnInput(!0);
  1863. this.btnMainHelp.enableBtnInput(!0)
  1864. };
  1865. n.prototype.resetMenu = function() {
  1866. this.brainieLogo.showLogo(!0);
  1867. this.mainMenuCont.visible = !0;
  1868. this.modeMenuCont.visible = !1;
  1869. this.disableButtons()
  1870. };
  1871. n.prototype.disableButtons = function() {
  1872. this.btnMainStart.enableBtnInput(!1);
  1873. this.btnMainMore.enableBtnInput(!1);
  1874. this.btnMainHelp.enableBtnInput(!1);
  1875. this.Btn_GAME_CLASSIC.enableBtnInput(!1);
  1876. this.Btn_GAME_ACTION.enableBtnInput(!1)
  1877. };
  1878. n.prototype.setMain = function() {
  1879. this.mainMenuCont = this.game.add.group();
  1880. this.add(this.mainMenuCont);
  1881. this.btnMainStart = new e.BtnBase(this.game, this.mainMenuCont, 169, 310, gameTexts[lang][0][0], !1, gameTexts[lang][0][1]);
  1882. this.btnMainStart.bgBm.events.onInputUp.add(this.startClick, this);
  1883. this.btnMainHelp = new e.BtnBase(this.game, this.mainMenuCont, 169, this.btnMainStart.y + 83 + 83, gameTexts[lang][19][0], !1, gameTexts[lang][19][1]);
  1884. this.btnMainHelp.bgBm.events.onInputUp.add(this.helpClick, this);
  1885. this.brainieLogo = new e.MainLogo(this.game);
  1886. this.add(this.brainieLogo);
  1887. this.btnMainMore = new e.BtnBase(this.game, this.mainMenuCont, 169, this.btnMainStart.y + 83, gameTexts[lang][25][0], !1, gameTexts[lang][25][1]);
  1888. this.btnMainMore.bgBm.events.onInputDown.add(this.moreClick, this)
  1889. };
  1890. n.prototype.startClick = function() {
  1891. this.btnMainStart.enableBtnInput(!1);
  1892. this.btnMainMore.enableBtnInput(!1);
  1893. this.btnMainHelp.enableBtnInput(!1);
  1894. this.brainieLogo.showLogo(!1);
  1895. this.tempTwn = game.add.tween(this.mainMenuCont);
  1896. this.tempTwn.to({
  1897. alpha: 0
  1898. }, 300, Phaser.Easing.Linear.None, !1, 0, !1);
  1899. this.tempTwn.onComplete.add(this.switchAnimPt2, this);
  1900. this.tempTwn.start(0)
  1901. };
  1902. n.prototype.switchAnimPt2 = function() {
  1903. this.mainMenuCont.visible = !1;
  1904. this.mainMenuCont.alpha = 1;
  1905. this.modeMenuCont.visible = !0;
  1906. this.modeMenuCont.alpha = 0;
  1907. this.tempTwn = game.add.tween(this.modeMenuCont);
  1908. this.tempTwn.to({
  1909. alpha: 1
  1910. }, 300, Phaser.Easing.Linear.None, !1, 0, !1);
  1911. this.tempTwn.onComplete.add(this.switchAnimEnd, this);
  1912. this.tempTwn.start(0)
  1913. };
  1914. n.prototype.switchAnimEnd = function() {
  1915. this.Btn_GAME_CLASSIC.enableBtnInput(!0);
  1916. this.Btn_GAME_ACTION.enableBtnInput(!0)
  1917. };
  1918. n.prototype.moreClick = function() {
  1919. brainieMain.moreGamesCall()
  1920. };
  1921. n.prototype.setMode = function() {
  1922. this.modeMenuCont = this.game.add.group();
  1923. this.add(this.modeMenuCont);
  1924. this.selectTitle = new e.BrainieNormalText(this.game, this.modeMenuCont, 300, 150, mainFont, gameTexts[lang][1][0], gameTexts[lang][1][1], "#cea9b5");
  1925. this.selectTitle.setAnchor(.5, 0);
  1926. this.Btn_GAME_CLASSIC = new e.BtnBase(this.game, this.modeMenuCont, 169, 335, gameTexts[lang][2][0], !1, gameTexts[lang][2][1]);
  1927. this.Btn_GAME_CLASSIC.bgBm.events.onInputUp.add(this.classicClick, this);
  1928. this.Btn_GAME_ACTION = new e.BtnBase(this.game, this.modeMenuCont, 169, 420, gameTexts[lang][3][0], !1, gameTexts[lang][3][1]);
  1929. this.Btn_GAME_ACTION.bgBm.events.onInputUp.add(this.actionClick, this)
  1930. };
  1931. n.prototype.classicClick = function() {
  1932. this.disableButtons();
  1933. brainieMain.gameCallback("Start_GAME_CLASSIC")
  1934. };
  1935. n.prototype.actionClick = function() {
  1936. this.disableButtons();
  1937. brainieMain.gameCallback("Start_GAME_ACTION")
  1938. };
  1939. n.prototype.helpClick = function() {
  1940. brainieMain.gameCallback("SHOW_HELP")
  1941. };
  1942. return n
  1943. }(Phaser.Group);
  1944. e.Scrn_MainMenu = t
  1945. })(Brainie || (Brainie = {}));
  1946. (function(e) {
  1947. var t = function(t) {
  1948. function n(n, r) {
  1949. t.call(this, n, r, "", !1);
  1950. this.pauseTitle = new e.BrainieNormalText(this.game, this, 300, 195, mainFont, gameTexts[lang][4][0], gameTexts[lang][4][1], "#cea9b5");
  1951. this.pauseTitle.setAnchor(.5, 0);
  1952. this.Btn_GAME_RESUME = new e.BtnBase(this.game, this, 34, 335, gameTexts[lang][5][0], !1, gameTexts[lang][5][1]);
  1953. this.Btn_GAME_RESUME.bgBm.events.onInputUp.add(this.resumeClick, this);
  1954. this.Btn_SHOW_HELP = new e.BtnBase(this.game, this, 305, 335, gameTexts[lang][19][0], !1, gameTexts[lang][19][1]);
  1955. this.Btn_SHOW_HELP.bgBm.events.onInputUp.add(this.helpClick, this);
  1956. this.Btns_GAME_END_PAUSE = new e.BtnBase(this.game, this, 305, 420, gameTexts[lang][13][0], !1, gameTexts[lang][13][1]);
  1957. this.Btns_GAME_END_PAUSE.bgBm.events.onInputUp.add(this.endClick, this);
  1958. this.Btn_MORE = new e.BtnBase(this.game, this, 34, 420, gameTexts[lang][25][0], !1, gameTexts[lang][25][1]);
  1959. this.Btn_MORE.bgBm.events.onInputDown.add(this.moreClick, this);
  1960. this.sureCont = new e.SureCont(this.game, this);
  1961. this.sureCont.x = this.Btns_GAME_END_PAUSE.x + 131;
  1962. this.sureCont.y = this.Btns_GAME_END_PAUSE.y + 30;
  1963. this.sureCont.Btn_YES.bgBm.events.onInputUp.add(this.yesEndClick, this);
  1964. this.sureCont.Btn_NO.bgBm.events.onInputUp.add(this.noEndClick, this)
  1965. }
  1966. __extends(n, t);
  1967. n.prototype.moreClick = function() {
  1968. brainieMain.moreGamesCall()
  1969. };
  1970. n.prototype.resumeClick = function() {
  1971. this.setButtons(!1);
  1972. this.sureCont.enableCont(!1);
  1973. brainieMain.gameCallback("GAME_RESUME")
  1974. };
  1975. n.prototype.helpClick = function() {
  1976. brainieMain.gameCallback("SHOW_HELP")
  1977. };
  1978. n.prototype.endClick = function() {
  1979. this.sureCont.visible = !0;
  1980. this.sureCont.enableCont(!0);
  1981. this.Btns_GAME_END_PAUSE.visible = !1
  1982. };
  1983. n.prototype.noEndClick = function() {
  1984. this.sureCont.visible = !1;
  1985. this.sureCont.enableCont(!1);
  1986. this.Btns_GAME_END_PAUSE.visible = !0
  1987. };
  1988. n.prototype.yesEndClick = function() {
  1989. this.setButtons(!1);
  1990. this.sureCont.enableCont(!1);
  1991. brainieMain.gameCallback("GAME_END_PAUSE")
  1992. };
  1993. n.prototype.showContent = function() {
  1994. this.setButtons(!1);
  1995. this.sureCont.visible = !1;
  1996. this.sureCont.enableCont(!1);
  1997. this.Btns_GAME_END_PAUSE.visible = !0;
  1998. this.tempTwn && this.tempTwn.stop();
  1999. this.alpha = 0;
  2000. this.tempTwn = game.add.tween(this);
  2001. this.tempTwn.to({
  2002. alpha: 1
  2003. }, brainieMain.MENU_FADE, Phaser.Easing.Linear.None, !1, 0, !1);
  2004. this.tempTwn.onComplete.add(this.showContEnd, this);
  2005. this.tempTwn.start(0)
  2006. };
  2007. n.prototype.showContEnd = function() {
  2008. this.setButtons(!0)
  2009. };
  2010. n.prototype.setButtons = function(e) {
  2011. this.Btn_GAME_RESUME.enableBtnInput(e);
  2012. this.Btn_SHOW_HELP.enableBtnInput(e);
  2013. this.Btn_MORE.enableBtnInput(e);
  2014. this.Btns_GAME_END_PAUSE.enableBtnInput(e)
  2015. };
  2016. return n
  2017. }(Phaser.Group);
  2018. e.Scrn_Pause = t
  2019. })(Brainie || (Brainie = {}))