function startGame() { this.lang = SG.lang mainFont = mainFontName[lang]; game = new Brainie.BrainieMain } var __extends = this.__extends || function(e, t) { function n() { this.constructor = e } for (var r in t) t.hasOwnProperty(r) && (e[r] = t[r]); n.prototype = t.prototype; e.prototype = new n }, game, brainieMain, gW = 600, gH = 730, sndPlr, gameTexts, lang, SG_Hooks, mainFontName, mainFont, gameCanvas, isStockAndroid = !1, Brainie; (function(e) { var t = function(t) { function n() { t.call(this, 600, 730, Phaser.CANVAS, "gameContainer", null, !1, !0); 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(" "); var n = navigator.userAgent; 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; this.state.add("Boot", e.Boot, !1); this.state.add("Preloader", e.Preloader, !1); this.state.add("GameMain", e.GameMain, !1); this.state.start("Boot") } __extends(n, t); return n }(Phaser.Game); e.BrainieMain = t })(Brainie || (Brainie = {})); (function(e) { var t = function(e) { function t(t, n, r, i, s, o, u, a) { "undefined" === typeof a && (a = "center"); e.call(this, t, n, "", !1); this.anchorY = this.anchorX = 0; this.x = r; this.y = i; this.txFld = new Phaser.BitmapText(this.game, 0, 0, s, o, u); this.txFld.align = a; this.add(this.txFld) } __extends(t, e); t.prototype.setAnchor = function(e, t) { this.anchorX = e; this.anchorY = t; this.anchorUpdate() }; t.prototype.anchorUpdate = function() { this.txFld.updateTransform(); this.txFld.x = -this.txFld.textWidth * this.anchorX; this.txFld.y = -this.txFld.textHeight * this.anchorY }; t.prototype.setText = function(e) { this.txFld.setText(e); this.anchorUpdate() }; t.prototype.getWidth = function() { return this.txFld.textWidth }; return t }(Phaser.Group); e.BrainieBmText = t })(Brainie || (Brainie = {})); (function(e) { var t = function(e) { function t(t, n, r, i, s, o, u, a, f) { "undefined" === typeof f && (f = "center"); e.call(this, t, n, "", !1); this.anchorY = this.anchorX = 0; this.x = r; this.y = i; this.txFld = new Phaser.Text(this.game, 0, 0, o, { font: u.toString() + "px " + s, fill: a, align: f }); this.add(this.txFld) } __extends(t, e); t.prototype.setAnchor = function(e, t) { this.anchorX = e; this.anchorY = t; this.anchorUpdate() }; t.prototype.anchorUpdate = function() { this.txFld.x = -this.txFld.width * this.anchorX; this.txFld.y = -this.txFld.height * this.anchorY }; t.prototype.setText = function(e) { this.txFld.setText(e); this.anchorUpdate() }; t.prototype.getWidth = function() { return this.txFld.width }; return t }(Phaser.Group); e.BrainieNormalText = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(n, r, i, s, o, u, a) { t.call(this, n, r, "", !1); this.bName = ""; this.bSmall = !1; this.initX = 0; this.isEnabled = !0; this.bName = o; this.bSmall = u; this.x = i; this.y = s; this.bgBm = this.create(0, 0, "mainSt", ""); this.bSmall ? (this.bgBm.frameName = "menuBtnSml_up.png", this.initX = 65) : (this.bgBm.frameName = "menuBtn_up.png", this.initX = 130.5); this.labelFld = new e.BrainieNormalText(this.game, this, this.initX, 20, mainFont, o, a, "#764f5c"); this.labelFld.setAnchor(.5, 0); this.bgBm.inputEnabled = !0; this.bgBm.events.onInputDown.add(this.down, this); this.bgBm.events.onInputOut.add(this.up, this); this.bgBm.events.onInputUp.add(this.up, this) } __extends(n, t); n.prototype.down = function() { this.bgBm.frameName = this.bSmall ? "menuBtnSml_dn.png" : "menuBtn_dn.png" }; n.prototype.up = function() { this.bgBm.frameName = this.bSmall ? "menuBtnSml_up.png" : "menuBtn_up.png" }; n.prototype.enableBtn = function(e) { this.isEnabled = e; this.alpha = (this.bgBm.input.enabled = e) ? 1 : .3 }; n.prototype.enableBtnInput = function(e) { this.isEnabled && (this.bgBm.input.enabled = e) }; return n }(Phaser.Group); e.BtnBase = t })(Brainie || (Brainie = {})); (function(e) { var t = function(e) { function t(t, n, r, i, s, o) { e.call(this, t, n, r, "mainSt", 0); this.dnRect = this.upRect = this.bName = ""; this.isEnabled = !0; this.bName = i; this.upRect = s; this.dnRect = o; this.frameName = this.upRect; this.inputEnabled = !0; this.events.onInputDown.add(this.down, this); this.events.onInputOut.add(this.up, this); this.events.onInputUp.add(this.up, this) } __extends(t, e); t.prototype.down = function() { this.frameName = this.dnRect }; t.prototype.up = function() { this.frameName = this.upRect }; t.prototype.enableBtn = function(e) { this.isEnabled = e; this.alpha = (this.input.enabled = e) ? 1 : .3 }; t.prototype.enableBtnInput = function(e) { this.isEnabled && (this.input.enabled = e) }; return t }(Phaser.Sprite); e.ImgBtnBase = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n() { t.apply(this, arguments) } __extends(n, t); n.prototype.preload = function() { this.txGrp = this.game.add.group(); this.initTx = new e.BrainieNormalText(this.game, this.txGrp, -100, -100, mainFont, "A", 20, "#ffffff"); this.load.image("mainBg", "img/mainBg.jpg"); this.load.image("preloaderBg", "img/preloader_bg.png"); this.load.image("preloaderFill", "img/preloader_fill.png") }; n.prototype.create = function() { this.initTx.destroy(); this.txGrp.destroy(); this.input.maxPointers = 1; this.scale.pageAlignHorizontally = !0; this.scale.pageAlignVertically = !0; this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.scale.hasResized.add(this.gameResized, this); this.game.device.desktop || (this.scale.forceOrientation(!1, !0), this.scale.enterIncorrectOrientation.add(this.enterIncorrectOrientation, this), this.scale.leaveIncorrectOrientation.add(this.leaveIncorrectOrientation, this)); this.scale.setScreenSize(!0); this.game.state.start("Preloader", !0, !1); SG_Hooks.setOrientationHandler(this.orientationChange); SG_Hooks.setResizeHandler(this.gameResized) }; n.prototype.gameResized = function(e, t) {}; n.prototype.enterIncorrectOrientation = function() { var e = this; this.orientationChange(!1); setTimeout(function() { return e.androidRefresh() }, 500) }; n.prototype.leaveIncorrectOrientation = function() { var e = this; this.orientationChange(!0); setTimeout(function() { return e.androidRefresh() }, 500) }; n.prototype.androidRefresh = function() { this.game.scale.refresh() }; n.prototype.orientationChange = function(e) { e ? document.getElementById("orientation").style.display = "none" : document.getElementById("orientation").style.display = "block" }; return n }(Phaser.State); e.Boot = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n() { t.apply(this, arguments); this.BOX_SIZE = 70; this.GRID_COLUMNS = this.GRID_ROWS = 8; this.GRID_TOP_PADDING = 49; this.GRID_LEFT_PADDING = 20; this.CLOSE_TIME = this.OPEN_TIME = 800; this.GUI_FADE = 200; this.MENU_FADE = 300; this.SELECTED_BOXES_ARR = []; this.gameType = "cl"; this.isReturning = !1; this.dTm = 1; this.fTm = 1e3 / 60 } __extends(n, t); n.prototype.create = function() { brainieMain = this; sndPlr = new e.SoundPlayer(this.game); this.gameBg = this.add.sprite(0, 0, "mainBg"); this.gamesCont = this.game.add.group(); this.mainCont = this.game.add.group(); this.goalNumber = new e.GoalNumber; this.randomBox = new e.RandomBox; this.checkSelection = new e.CheckSelection; this.gOverlay = new e.GameOverlay(this.game, this.mainCont); this.gGui = new e.GameGui(this.game, this.mainCont); this.scrnCont = new e.ScreensCont(this.game, this.mainCont); this.scrnCont.showMainMenu() }; n.prototype.startActionGame = function() { this.gameType = "ac"; null != this.actualGame && (this.actualGame.resetOnRemove(), this.actualGame.destroy()); this.actualGame = new e.GameMainAction(this.game, this.gamesCont); this.actualGame.startGame(); this.trackStart() }; n.prototype.startClassicGame = function() { this.gameType = "cl"; null != this.actualGame && (this.actualGame.resetOnRemove(), this.actualGame.destroy()); this.actualGame = new e.GameMainClassic(this.game, this.gamesCont); this.actualGame.startGame(); this.trackStart() }; n.prototype.update = function() { this.dTm = this.game.time.elapsed / this.fTm; null != this.actualGame && this.actualGame.loop() }; n.prototype.gameCallback = function(e) { switch (e) { case "levelComplete": this.scrnCont.showLevelMenu(); sndPlr.playGameSnd("level_complete"); this.trackClassicLevel(); break; case "levelActionComplete": this.trackActionLevel(); break; case "gameOver": this.scrnCont.showEndMenu(); sndPlr.playGameSnd("game_over"); this.trackGameOver(); break; case "showPauseOver": this.scrnCont.showPauseMenu(); break; case "Start_GAME_ACTION": this.scrnCont.hideMainMenu(); this.startActionGame(); break; case "Start_GAME_CLASSIC": this.scrnCont.hideMainMenu(); this.startClassicGame(); break; case "GAME_NEXT_LEVEL": this.scrnCont.hideLevelMenu(); this.actualGame.startNextLevel(); break; case "GAME_PAUSE": this.actualGame.pauseGame(); break; case "GAME_RESUME": this.scrnCont.hidePauseMenu(); this.actualGame.resumeGame(); break; case "GAME_END_PAUSE": this.actualGame.enableGame(!1); this.actualGame.gameStarted = !1; this.scrnCont.hidePauseMenu(); this.scrnCont.showEndMenu(); this.trackGameOver(); break; case "GAME_END_LEVEL": this.actualGame.enableGame(!1); this.actualGame.gameStarted = !1; this.scrnCont.hideLevelMenu(); this.scrnCont.showEndMenu(); this.trackGameOver(); break; case "GAME_BACKTOMAIN": this.isReturning = !0; this.gameType = "cl"; this.scrnCont.hideEndMenu(); this.scrnCont.showMainMenu(); break; case "SHOW_HELP": this.scrnCont.showHelp(); break; case "CLOSE_HELP": this.scrnCont.hideHelp(); break; case "RESET_SELECTION": this.actualGame && this.actualGame.resetBoxSelection() } }; n.prototype.pauseCall = function() {}; n.prototype.resumeCall = function() {}; n.prototype.moreGamesCall = function() { SG.redirectToPortal() }; n.prototype.trackActionLevel = function() { this.actualGame.pauseGame(); SG_Hooks.levelUp(this.actualGame.currentLevel - 1, this.actualGame.score) }; n.prototype.trackClassicLevel = function() { this.actualGame.pauseGame(); SG_Hooks.levelUp(this.actualGame.currentLevel, this.actualGame.score); // play68_submitScore(this.actualGame.currentLevel, this.actualGame.score); // Play68.setRankingLevelScoreDesc(this.actualGame.currentLevel, this.actualGame.score) }; n.prototype.trackGameOver = function() { SG_Hooks.gameOver(this.actualGame.currentLevel, this.actualGame.score); // play68_submitScore(this.actualGame.currentLevel, this.actualGame.score); // Play68.setRankingLevelScoreDesc(this.actualGame.currentLevel, this.actualGame.score) }; n.prototype.trackStart = function() { SG_Hooks.start() }; return n }(Phaser.State); e.GameMain = t })(Brainie || (Brainie = {})); (function(e) { var t = function() { return function(e, t, n) { this.var0 = e; this.var1 = t; this.var2 = n } }(); e.CheckSelectedResult = t })(Brainie || (Brainie = {})); (function(e) { var t = function() { function t() { this.isColor = this.isMatch = !1; this.calcValue = this.addPoints = 0; this.ptsMult = 1; this.colorID = 0 } t.prototype.checkSelected = function(t, n) { this.isMatch = !1; this.calcValue = this.addPoints = 0; this.ptsMult = 1; this.colorID = 0; 1 < t.length ? (this.isColor = !0, this.colorID = t[0].bxColor) : this.isColor = !1; for (var r = 0; r < t.length; r++) switch (t[r].bxColor != this.colorID && (this.isColor = !1), t[r].bxType) { case 1: this.calcValue += t[r].bxValue; break; case 2: this.calcValue -= t[r].bxValue; this.ptsMult = 1.2; break; case 3: this.calcValue *= t[r].bxValue; this.ptsMult = 1.5; break; case 4: this.calcValue /= t[r].bxValue, this.ptsMult = 1.5 } if (this.calcValue == n) switch (this.isMatch = !0, t.length) { case 1: this.addPoints = 50; break; case 2: this.addPoints = 110; break; case 3: this.addPoints = 170; break; case 4: this.addPoints = 230; break; case 5: this.addPoints = 290; break; case 6: this.addPoints = 350; break; case 7: this.addPoints = 410; break; case 8: this.addPoints = 470; break; case 9: this.addPoints = 530; break; default: this.addPoints = 600 } this.addPoints = Math.round(this.addPoints * this.ptsMult); this.isColor && (this.addPoints = Math.round(1.5 * this.addPoints)); return new e.CheckSelectedResult(this.isMatch, this.addPoints, this.isColor) }; return t }(); e.CheckSelection = t })(Brainie || (Brainie = {})); (function(e) { var t = function() { function e() { this.pos = []; this.neg = []; this.mul = []; this.div = []; this.actualLevel = 1; this.returnNum = 0 } e.prototype.setArrays = function(e) { this.pos = []; this.neg = []; this.mul = []; this.div = []; for (var t = 0; t < e.length; t++) switch (e[t].bxType) { case 1: this.pos.push(e[t].bxValue); break; case 2: this.neg.push(e[t].bxValue); break; case 3: this.mul.push(e[t].bxValue); break; case 4: this.div.push(e[t].bxValue) } }; e.prototype.getGoalNumber = function(e, t) { this.actualLevel = t; this.returnNum = 0; this.setArrays(e); var n = 0, n = 3 > this.actualLevel ? Math.round(1.9 * Math.random() + .5) : Math.round(2.9 * Math.random() + .5); 0 == this.pos.length ? (this.returnNum = Math.round(10 * Math.random()) + 4, n = 0) : n > this.pos.length && (n = this.pos.length); for (var r = 0; r < n; r++) { var i = Math.round(Math.random() * (this.pos.length - 1)); this.returnNum += this.pos[i]; this.pos.splice(i, 1) } n = 0; n = 3 > this.actualLevel ? Math.round(1.9 * Math.random() + .5) - 1 : Math.round(1.9 * Math.random() + .5); n > this.neg.length && (n = this.neg.length); 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); n = r = 0; 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; r > this.mul.length && (r = this.mul.length); n > this.div.length && (n = this.div.length); for (i = 0; i < r; i++) { var s = Math.round(Math.random() * (this.mul.length - 1)); 100 > this.returnNum * this.mul[s] && (this.returnNum *= this.mul[s]); this.mul.splice(s, 1) } 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); return this.returnNum }; return e }(); e.GoalNumber = t })(Brainie || (Brainie = {})); (function(e) { var t = function() { function t() { this.randomer = 0; this.selectedValue = this.selectedColor = this.selectedType = 1; this.currRow = this.currCol = 0; this.actualLevel = 1 } t.prototype.getRandomNumBox = function(t, n, r, i, s, o, u) { "undefined" === typeof r && (r = 0); "undefined" === typeof i && (i = 0); "undefined" === typeof s && (s = 0); "undefined" === typeof o && (o = !1); "undefined" === typeof u && (u = null); brainieMain.goalNumber.setArrays(u); this.actualLevel = s; this.currCol = i; this.currRow = r; this.randomer = Math.random(); 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; 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); this.selectedColor = 5 > this.actualLevel ? 1 + Math.round(Math.random() * (this.actualLevel + .9) - .5) : 1 + Math.round(5.9 * Math.random() - .5); return new e.NumBox(t, n, this.selectedValue, this.selectedType, this.currCol, this.currRow, this.selectedColor) }; return t }(); e.RandomBox = t })(Brainie || (Brainie = {})); (function(e) { var t = function() { function e(e) { this.soundEnabled = this.soundOn = !0; this.sndsPool = []; this.sndIDsPool = []; if (e.device.desktop && e.device.webAudio) { this.soundEnabled = !0; for (var t = 0; t < game.snds.length; t++) this.sndIDsPool.push(game.snds[t]), this.sndsPool.push(e.add.audio(game.snds[t])) } else this.soundEnabled = !1 } e.prototype.playGameSnd = function(e) { this.soundOn && this.soundEnabled && -1 != this.sndIDsPool.indexOf(e) && this.sndsPool[this.sndIDsPool.indexOf(e)].play("", 0, 1, !1) }; e.prototype.playSelectSound = function() {.5 > Math.random() ? this.playGameSnd("box_select_1") : this.playGameSnd("box_select_2") }; return e }(); e.SoundPlayer = t })(Brainie || (Brainie = {})); (function(e) { var t = function(e) { function t(t, n) { e.call(this, t, n, "", !1); this.gameStarted = this.gameRunning = !1; this.y = 730 } __extends(t, e); t.prototype.resetOnRemove = function() {}; t.prototype.pauseGame = function() {}; t.prototype.startGame = function() {}; t.prototype.startNextLevel = function() {}; t.prototype.resumeGame = function() {}; t.prototype.enableGame = function(e) {}; t.prototype.resetBoxSelection = function(e) {}; t.prototype.boxEvent = function(e) {}; t.prototype.loop = function() {}; t.prototype.openAnim = function() { this.tempTwn && this.tempTwn.stop(); this.tempTwn = game.add.tween(this); this.tempTwn.to({ y: 0 }, brainieMain.OPEN_TIME, Phaser.Easing.Sinusoidal.InOut, !0, 0, !1) }; t.prototype.closeAnim = function() { this.tempTwn && this.tempTwn.stop(); this.tempTwn = game.add.tween(this); this.tempTwn.to({ y: 730 }, brainieMain.CLOSE_TIME, Phaser.Easing.Sinusoidal.InOut, !0, brainieMain.GUI_FADE, !1) }; return t }(Phaser.Group); e.GameBase = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(e, n) { t.call(this, e, n); this.score = 0; this.goalNum = 1; this.gameIsOver = this.gameStarted = this.gameRunning = !1; this.endCt = 0; this.fallLimit = 4e3; this.currentFallTime = this.gameTime = 0; this.currentLevel = 1; this.boxesArr = []; this.startRows = 3; this.bxInWave = 0; this.possibleWPos = []; this.bombOnBox = this.boxRemoved = this.boxesTotal = this.waveID = this.selectedCol = this.selectedRow = 0; this.enableGame(!1); this.setLayers(); brainieMain.gGui.resetGui() } __extends(n, t); n.prototype.setGoalNumber = function() { this.goalNum = brainieMain.goalNumber.getGoalNumber(this.boxesArr, this.currentLevel); brainieMain.gGui.numBubble.showNumber(this.goalNum) }; n.prototype.resetOnRemove = function() { for (var e = 0; e < this.boxesArr.length; e++) this.boxesArr[e].destroyBox(); this.removeAll() }; n.prototype.scoreUpdate = function() { brainieMain.gGui.scoreLabel.updateScore(this.score) }; n.prototype.enableGame = function(e) { "undefined" === typeof e && (e = !0); this.gameRunning = e ? !0 : !1; for (var t = 0; t < this.boxesArr.length; t++) this.boxesArr[t].enableBox(e); brainieMain.gGui && brainieMain.gGui.gameButtons.enableButtons(e) }; n.prototype.startGame = function() { var e = this; this.gameStarted = !0; brainieMain.SELECTED_BOXES_ARR = []; brainieMain.gOverlay.openOver(); this.openAnim(); this.createStartBoxes(); setTimeout(function() { return e.setGoalNumber() }, brainieMain.GUI_FADE + brainieMain.OPEN_TIME); this.resetTimers(); this.initBombPosition(); setTimeout(function() { return e.enableGame(!0) }, brainieMain.GUI_FADE + brainieMain.OPEN_TIME) }; n.prototype.pauseGame = function() { this.gameRunning && (setTimeout(function() { return brainieMain.gameCallback("showPauseOver") }, brainieMain.GUI_FADE + brainieMain.CLOSE_TIME), brainieMain.gOverlay.closeOver(), this.closeAnim(), this.enableGame(!1)) }; n.prototype.resumeGame = function() { var e = this; this.gameRunning || (brainieMain.gOverlay.openOver(), this.openAnim(), setTimeout(function() { return e.enableGame(!0) }, brainieMain.GUI_FADE + brainieMain.OPEN_TIME)) }; n.prototype.gameOver = function() { this.gameStarted = !1; brainieMain.gGui.numBubble.hideLabel(); this.gameIsOver = !0; this.enableGame(!1) }; n.prototype.checkGameOver = function() { for (var e = this.endCt = 0; e < this.boxesArr.length; e++) 0 == this.boxesArr[e].moveSpeed && this.endCt++; this.endCt == this.boxesArr.length && (this.gameIsOver = !1, brainieMain.gOverlay.closeOver(), this.closeAnim(), setTimeout(function() { return brainieMain.gameCallback("gameOver") }, brainieMain.GUI_FADE + brainieMain.CLOSE_TIME)) }; n.prototype.resetBoxSelection = function(e) { "undefined" === typeof e && (e = !0); e && sndPlr.playGameSnd("reset"); for (e = 0; e < brainieMain.SELECTED_BOXES_ARR.length; e++) brainieMain.SELECTED_BOXES_ARR[e].selected && brainieMain.SELECTED_BOXES_ARR[e].deselectBox(!1); brainieMain.SELECTED_BOXES_ARR = [] }; n.prototype.setLayers = function() { this.gameBg = new e.GameBg(this.game); this.add(this.gameBg); this.bxLr = this.game.add.group(); this.bxLr.x = brainieMain.GRID_LEFT_PADDING; this.bxLr.y = brainieMain.GRID_TOP_PADDING; this.add(this.bxLr); this.effLr = new e.EffectsLr(this.game, this) }; n.prototype.resetTimers = function() { this.currentFallTime = this.gameTime = 0; brainieMain.gGui.timers.updateHands(0, 0) }; n.prototype.updateTimers = function() { 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)) }; n.prototype.levelComplete = function() { this.currentLevel++; brainieMain.gGui.levels.updateLevel(this.currentLevel); brainieMain.gameCallback("levelActionComplete"); this.fallLimit -= 300; 1e3 > this.fallLimit && (this.fallLimit = 1e3) }; n.prototype.createStartBoxes = function() { this.waveID = 0; if (0 < this.boxesArr.length) { for (var e = 0; e < this.boxesArr.length; e++) this.boxesArr[e].destroyBox(); this.boxesArr = [] } for (e = 0; e < this.startRows; e++) for (var t = 0; t < brainieMain.GRID_COLUMNS; t++) { var n = brainieMain.randomBox.getRandomNumBox(this.game, this.bxLr, brainieMain.GRID_ROWS - e, t, this.currentLevel, !1, this.boxesArr); n.y = brainieMain.BOX_SIZE * brainieMain.GRID_ROWS - e * brainieMain.BOX_SIZE; this.boxesArr.push(n) } }; n.prototype.createWave = function(t) { sndPlr.playGameSnd("wave"); this.waveID++; this.bxInWave = t; this.possibleWPos = []; for (t = 0; t < brainieMain.GRID_COLUMNS; t++) this.possibleWPos.push(t); 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); for (t = 0; t < this.bxInWave; t++) { this.boxesTotal++; this.selectedCol = this.possibleWPos.splice(Math.round(Math.random() * (this.possibleWPos.length - 1)), 1)[0]; this.selectedRow = brainieMain.GRID_ROWS; for (var n = 0; n < this.boxesArr.length; n++) this.boxesArr[n].bxCol == this.selectedCol && this.selectedRow--; if (0 == this.selectedRow) { this.gameOver(); break } 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); n.dropBox(); this.boxesArr.push(n) } }; n.prototype.boxEvent = function(e) { this.selectedBox = e; 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); if (0 < brainieMain.SELECTED_BOXES_ARR.length && 5 != this.selectedBox.bxType) if (5 == brainieMain.SELECTED_BOXES_ARR[0].bxType) { 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]); sndPlr.playGameSnd("box_explosion"); this.score += 70 * (brainieMain.SELECTED_BOXES_ARR.length - 1); this.scoreUpdate(); this.removeSelectedBoxes(); brainieMain.gGui.numBubble.hintChange(!0) } 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")) }; n.prototype.removeSelectedBoxes = function() { for (var e = 0; e < brainieMain.SELECTED_BOXES_ARR.length; e++) { this.boxesArr.splice(this.boxesArr.indexOf(brainieMain.SELECTED_BOXES_ARR[e]), 1); 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(); brainieMain.SELECTED_BOXES_ARR[e].destroyBox() } brainieMain.SELECTED_BOXES_ARR = []; 0 == this.boxesArr.length && (this.score += 1e3, this.scoreUpdate(), this.effLr.showClearEff(), setTimeout(function() { return sndPlr.playGameSnd("clear_eff") }, 200), this.createWave(8), this.currentFallTime = 0, this.setGoalNumber()); this.boxRemoved++; 0 == this.boxRemoved % 10 && this.levelComplete() }; n.prototype.initBombPosition = function() { this.bombOnBox = 15 + Math.round(8 * Math.random()) }; n.prototype.testBombCreation = function(e) { this.tstBmbReturn = !1; this.boxesTotal >= this.bombOnBox && (this.tstBmbReturn = !0, this.bombOnBox = this.boxesTotal + 30 + Math.round(15 * Math.random())); return this.tstBmbReturn }; n.prototype.loop = function() { this.updateTimers(); this.gameRunning ? this.bxsUpdate() : this.gameIsOver && (this.bxsUpdate(), this.checkGameOver()) }; n.prototype.bxsUpdate = function() { for (var e = 0; e < this.boxesArr.length; e++) this.boxesArr[e].tryMove() }; return n }(e.GameBase); e.GameMainAction = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(e, n) { t.call(this, e, n); this.score = 0; this.goalNum = 1; this.gameIsOver = this.gameStarted = this.gameRunning = !1; this.endCt = 0; this.levelLimit = 6e4; this.fallLimit = 1e4; this.currentFallTime = this.currentLevelTime = 0; this.currentLevel = 1; this.boxesArr = []; this.startRows = 3; this.bxInWave = 0; this.possibleWPos = []; this.waveID = this.selectedCol = this.selectedRow = 0; this.boxesInWave = 1; this.bombsLevelLimit = 2; this.bombsWavePosArr = []; this.bombsPosArr = []; this.bombsTempArr = []; this.enableGame(!1); this.setLayers(); brainieMain.gGui.resetGui() } __extends(n, t); n.prototype.setGoalNumber = function() { this.goalNum = brainieMain.goalNumber.getGoalNumber(this.boxesArr, this.currentLevel); brainieMain.gGui.numBubble.showNumber(this.goalNum) }; n.prototype.resetOnRemove = function() { for (var e = 0; e < this.boxesArr.length; e++) this.boxesArr[e].destroyBox(); this.removeAll() }; n.prototype.scoreUpdate = function() { brainieMain.gGui.scoreLabel.updateScore(this.score) }; n.prototype.enableGame = function(e) { "undefined" === typeof e && (e = !0); this.gameRunning = e ? !0 : !1; for (var t = 0; t < this.boxesArr.length; t++) this.boxesArr[t].enableBox(e); brainieMain.gGui && brainieMain.gGui.gameButtons.enableButtons(e) }; n.prototype.startGame = function() { var e = this; this.gameStarted = !0; brainieMain.SELECTED_BOXES_ARR = []; brainieMain.gOverlay.openOver(); this.openAnim(); this.createStartBoxes(); setTimeout(function() { return e.setGoalNumber() }, brainieMain.GUI_FADE + brainieMain.OPEN_TIME); this.resetTimers(); this.setBombsPositions(); setTimeout(function() { return e.enableGame(!0) }, brainieMain.GUI_FADE + brainieMain.OPEN_TIME) }; n.prototype.pauseGame = function() { this.gameRunning && (setTimeout(function() { return brainieMain.gameCallback("showPauseOver") }, brainieMain.GUI_FADE + brainieMain.CLOSE_TIME), brainieMain.gOverlay.closeOver(), this.closeAnim(), this.enableGame(!1)) }; n.prototype.resumeGame = function() { var e = this; this.gameRunning || (brainieMain.gOverlay.openOver(), this.openAnim(), setTimeout(function() { return e.enableGame(!0) }, brainieMain.GUI_FADE + brainieMain.OPEN_TIME)) }; n.prototype.gameOver = function() { this.gameStarted = !1; brainieMain.gGui.numBubble.hideLabel(); this.gameIsOver = !0; this.enableGame(!1) }; n.prototype.checkGameOver = function() { for (var e = this.endCt = 0; e < this.boxesArr.length; e++) 0 == this.boxesArr[e].moveSpeed && this.endCt++; this.endCt == this.boxesArr.length && (this.gameIsOver = !1, brainieMain.gOverlay.closeOver(), this.closeAnim(), setTimeout(function() { return brainieMain.gameCallback("gameOver") }, brainieMain.GUI_FADE + brainieMain.CLOSE_TIME)) }; n.prototype.resetBoxSelection = function(e) { "undefined" === typeof e && (e = !0); e && sndPlr.playGameSnd("reset"); for (e = 0; e < brainieMain.SELECTED_BOXES_ARR.length; e++) brainieMain.SELECTED_BOXES_ARR[e].selected && brainieMain.SELECTED_BOXES_ARR[e].deselectBox(!1); brainieMain.SELECTED_BOXES_ARR = [] }; n.prototype.setLayers = function() { this.gameBg = new e.GameBg(this.game); this.add(this.gameBg); this.bxLr = this.game.add.group(); this.bxLr.x = brainieMain.GRID_LEFT_PADDING; this.bxLr.y = brainieMain.GRID_TOP_PADDING; this.add(this.bxLr); this.effLr = new e.EffectsLr(this.game, this) }; n.prototype.resetTimers = function() { this.currentFallTime = this.currentLevelTime = 0; brainieMain.gGui.timers.updateHands(0, 0) }; n.prototype.updateTimers = function() { 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)) }; n.prototype.levelComplete = function() { this.gameStarted = !1; brainieMain.gGui.numBubble.hideLabel(); this.enableGame(!1); brainieMain.gOverlay.closeOver(); this.closeAnim(); setTimeout(function() { return brainieMain.gameCallback("levelComplete") }, brainieMain.GUI_FADE + brainieMain.CLOSE_TIME) }; n.prototype.startNextLevel = function() { this.gameStarted = !0; this.currentLevel++; brainieMain.gGui.levels.updateLevel(this.currentLevel); this.fallLimit = 1e4 - 1e3 * (this.currentLevel - 1); 5e3 > this.fallLimit && (this.fallLimit = 5e3); this.startGame() }; n.prototype.createStartBoxes = function() { this.waveID = 0; if (0 < this.boxesArr.length) { for (var e = 0; e < this.boxesArr.length; e++) this.boxesArr[e].destroyBox(); this.boxesArr = [] } this.startRows = 1 == this.currentLevel ? 2 : 4 >= this.currentLevel ? 3 : 7 >= this.currentLevel ? 4 : 5; for (e = 0; e < this.startRows; e++) for (var t = 0; t < brainieMain.GRID_COLUMNS; t++) { var n = brainieMain.randomBox.getRandomNumBox(this.game, this.bxLr, brainieMain.GRID_ROWS - e, t, this.currentLevel, !1, this.boxesArr); n.y = brainieMain.BOX_SIZE * brainieMain.GRID_ROWS - e * brainieMain.BOX_SIZE; this.boxesArr.push(n) } }; n.prototype.createWave = function() { sndPlr.playGameSnd("wave"); this.waveID++; this.bxInWave = this.getBoxInWave(); this.bxInWave > brainieMain.GRID_COLUMNS && (this.bxInWave = brainieMain.GRID_COLUMNS); this.possibleWPos = []; for (var t = 0; t < brainieMain.GRID_COLUMNS; t++) this.possibleWPos.push(t); 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); for (t = 0; t < this.bxInWave; t++) { this.selectedCol = this.possibleWPos.splice(Math.round(Math.random() * (this.possibleWPos.length - 1)), 1)[0]; this.selectedRow = brainieMain.GRID_ROWS; for (var n = 0; n < this.boxesArr.length; n++) this.boxesArr[n].bxCol == this.selectedCol && this.selectedRow--; if (0 == this.selectedRow) { this.gameOver(); break } 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); n.dropBox(); this.boxesArr.push(n) } }; n.prototype.getBoxInWave = function() { return this.boxesInWave = 2 >= this.currentLevel ? 2 : 4 >= this.currentLevel ? 3 : 6 >= this.currentLevel ? 4 : 8 >= this.currentLevel ? 5 : 6 }; n.prototype.boxEvent = function(e) { this.selectedBox = e; 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); if (0 < brainieMain.SELECTED_BOXES_ARR.length && 5 != this.selectedBox.bxType) if (5 == brainieMain.SELECTED_BOXES_ARR[0].bxType) { 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]); sndPlr.playGameSnd("box_explosion"); this.score += 70 * (brainieMain.SELECTED_BOXES_ARR.length - 1); this.scoreUpdate(); this.removeSelectedBoxes(); brainieMain.gGui.numBubble.hintChange(!0) } 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")) }; n.prototype.removeSelectedBoxes = function() { for (var e = this, t = 0; t < brainieMain.SELECTED_BOXES_ARR.length; t++) { this.boxesArr.splice(this.boxesArr.indexOf(brainieMain.SELECTED_BOXES_ARR[t]), 1); 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(); brainieMain.SELECTED_BOXES_ARR[t].destroyBox() } brainieMain.SELECTED_BOXES_ARR = []; 0 == this.boxesArr.length && (this.score += 1e3, this.scoreUpdate(), this.effLr.showClearEff(), setTimeout(function() { return sndPlr.playGameSnd("clear_eff") }, 200), brainieMain.gGui.numBubble.hideLabel(), this.enableGame(!1), setTimeout(function() { return e.levelComplete() }, 1500)) }; n.prototype.setBombsPositions = function() { this.bombsWavePosArr = []; this.bombsPosArr = []; this.bombsTempArr = []; for (var e = 1; e < Math.floor(this.levelLimit / this.fallLimit); e++) this.bombsTempArr.push(e); this.bombsLevelLimit > this.bombsTempArr.length && (this.bombsLevelLimit = this.bombsTempArr.length); 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))) }; n.prototype.testBombCreation = function(e) { this.tstBmbReturn = !1; - 1 != this.bombsWavePosArr.indexOf(this.waveID) && this.bombsPosArr[this.bombsWavePosArr.indexOf(this.waveID)] == e && (this.tstBmbReturn = !0); return this.tstBmbReturn }; n.prototype.loop = function() { this.updateTimers(); this.gameRunning ? this.bxsUpdate() : this.gameIsOver && (this.bxsUpdate(), this.checkGameOver()) }; n.prototype.bxsUpdate = function() { for (var e = 0; e < this.boxesArr.length; e++) this.boxesArr[e].tryMove() }; return n }(e.GameBase); e.GameMainClassic = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(e, n) { t.call(this, e, n, "", !1); this.setLayers(); this.resetGui(); this.visible = !1 } __extends(n, t); n.prototype.setLayers = function() { this.timers = new e.GameTimers(this.game, this); this.numBubble = new e.NumberBubble(this.game, this); this.levels = new e.Levels(this.game, this); this.scoreLabel = new e.ScoreLabel(this.game, this); this.gameButtons = new e.GameButtons(this.game, this) }; n.prototype.showGui = function(e) { this.tempTwn && this.tempTwn.stop(); this.gameButtons.enableButtons(!1); e ? (this.visible = !0, this.alpha = 0, this.tempTwn = game.add.tween(this), this.tempTwn.to({ alpha: 1 }, 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({ alpha: 0 }, brainieMain.GUI_FADE, Phaser.Easing.Linear.None, !1, 0, !1), this.tempTwn.onComplete.add(this.hideEnd, this)); this.tempTwn.start(0) }; n.prototype.showEnd = function() { this.gameButtons.enableButtons(!0) }; n.prototype.hideEnd = function() { this.visible = !1 }; n.prototype.resetGui = function() { this.timers.updateHands(0, 0); this.levels.updateLevel(1); this.scoreLabel.updateScore(0); this.numBubble.resetBubble() }; return n }(Phaser.Group); e.GameGui = t })(Brainie || (Brainie = {})); (function(e) { var t = function(e) { function t(t, n) { e.call(this, t, n, "", !1); this.contCloseY = 573; this.contOpenY = -109; this.bgBm = this.create(11, 662, "mainSt", "bgLr_3.png"); this.bgMoveCont = this.game.add.group(); this.bgMoveCont.x = 3; this.bgMoveCont.y = this.contCloseY; this.add(this.bgMoveCont); this.bgMove2 = this.bgMoveCont.create(0, 238, "mainSt", "bgLr_2_2.png"); this.bgMove3 = this.bgMoveCont.create(575, 238, "mainSt", "bgLr_2_3.png"); this.bgMove1 = this.bgMoveCont.create(1, 0, "mainSt", "bgLr_2_1.png"); this.overBm = this.create(12, 662, "mainSt", "bgLr_1.png"); this.faceBm = this.create(58, 630, "mainSt", "menuFace.png") } __extends(t, e); t.prototype.openOver = function() { this.tempTwn1 && this.tempTwn1.stop(); this.tempTwn1 = game.add.tween(this.bgMoveCont); this.tempTwn1.to({ y: this.contOpenY }, brainieMain.OPEN_TIME, Phaser.Easing.Sinusoidal.InOut, !1, 0, !1); this.tempTwn1.onComplete.add(this.openEnd, this); this.tempTwn1.start(0); this.tempTwn2 && this.tempTwn2.stop(); this.tempTwn2 = game.add.tween(this.faceBm); this.tempTwn2.to({ y: 730 }, 250, Phaser.Easing.Sinusoidal.In, !1, 0, !1); this.tempTwn2.start(0) }; t.prototype.openEnd = function() { this.faceBm.visible = !1; brainieMain.gGui.showGui(!0) }; t.prototype.closeOver = function() { brainieMain.gGui.showGui(!1); this.tempTwn1 && this.tempTwn1.stop(); this.tempTwn1 = game.add.tween(this.bgMoveCont); this.tempTwn1.to({ y: this.contCloseY }, brainieMain.CLOSE_TIME, Phaser.Easing.Sinusoidal.InOut, !1, brainieMain.GUI_FADE, !1); this.tempTwn1.start(0); this.tempTwn2 && this.tempTwn2.stop(); this.faceBm.visible = !0; this.tempTwn2 = game.add.tween(this.faceBm); this.tempTwn2.to({ y: 630 }, 300, Phaser.Easing.Sinusoidal.InOut, !1, 500 + brainieMain.GUI_FADE, !1); this.tempTwn2.start(0) }; return t }(Phaser.Group); e.GameOverlay = t })(Brainie || (Brainie = {})); (function(e) { var t = function(e) { function t(t, n) { e.call(this, t, n, "", !1); this.setColorAnim(); this.setClearAnim() } __extends(t, e); t.prototype.setColorAnim = function() { this.colorEff = this.create(87, 347, "animSt"); this.colorEff.animations.add("colorEff", Phaser.Animation.generateFrameNames("bAnim_color_", 1, 11, ".png", 2), 20, !1); this.colorEff.events.onAnimationComplete.add(this.colorAnimEnd, this); this.colorEff.visible = !1 }; t.prototype.colorAnimEnd = function() { this.colorEff.visible = !1 }; t.prototype.showColorEff = function() { this.colorEff.visible = !0; this.colorEff.animations.play("colorEff") }; t.prototype.setClearAnim = function() { this.clearEff = this.create(84, 345, "animSt"); this.clearEff.animations.add("clearEff", Phaser.Animation.generateFrameNames("bAnim_clean_", 1, 29, ".png", 2), 20, !1); this.clearEff.events.onAnimationComplete.add(this.clearAnimEnd, this); this.clearEff.visible = !1 }; t.prototype.clearAnimEnd = function() { this.clearEff.visible = !1 }; t.prototype.showClearEff = function() { this.clearEff.visible = !0; this.clearEff.animations.play("clearEff") }; return t }(Phaser.Group); e.EffectsLr = t })(Brainie || (Brainie = {})); (function(e) { var t = function(e) { function t(t) { e.call(this, t, 16, 96, "gameAreaBg", 0) } __extends(t, e); return t }(Phaser.Sprite); e.GameBg = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(e, n) { t.call(this, e, n, "", !1); this.setMc() } __extends(n, t); n.prototype.setMc = function() { this.Btn_RESET_SELECTION = new e.ImgBtnBase(this.game, 39, 16, "Btn_RESET_SELECTION", "resetSelBtn_up.png", "resetSelBtn_dn.png"); this.add(this.Btn_RESET_SELECTION); this.Btn_RESET_SELECTION.events.onInputUp.add(this.resetClick, this); this.Btn_GAME_PAUSE = new e.ImgBtnBase(this.game, 484, 25, "Btn_GAME_PAUSE", "pauseBtn_up.png", "pauseBtn_dn.png"); this.add(this.Btn_GAME_PAUSE); this.Btn_GAME_PAUSE.events.onInputUp.add(this.pauseClick, this); this.resetTitle = new e.BrainieNormalText(this.game, this, 91, 55, mainFont, gameTexts[lang][6][0], gameTexts[lang][6][1], "#bd8379"); this.resetTitle.setAnchor(.5, .5); this.selectionTitle = new e.BrainieNormalText(this.game, this, 91, 77, mainFont, gameTexts[lang][7][0], gameTexts[lang][7][1], "#bd8379"); this.selectionTitle.setAnchor(.5, .5) }; n.prototype.resetClick = function() { // Play68.goHome() }; n.prototype.pauseClick = function() { brainieMain.gameCallback("GAME_PAUSE") }; n.prototype.enableButtons = function(e) { this.Btn_GAME_PAUSE.enableBtnInput(e); this.Btn_RESET_SELECTION.enableBtnInput(e) }; return n }(Phaser.Group); e.GameButtons = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(e, n) { t.call(this, e, n, "", !1); isStockAndroid ? (this.x = 339, this.y = 24) : (this.x = 346, this.y = 10); this.setMc() } __extends(n, t); n.prototype.setMc = function() { 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)) }; n.prototype.updateHands = function(e, t) { "undefined" === typeof e && (e = 0); "undefined" === typeof t && (t = 0); isStockAndroid ? (this.Hand1.scale.x = e, this.Hand2.scale.x = t) : (this.Hand1.angle = 360 * e, this.Hand2.angle = 360 * t) }; return n }(Phaser.Group); e.GameTimers = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(e, n) { t.call(this, e, n, "", !1); this.y = 690; this.setMc() } __extends(n, t); n.prototype.setMc = function() { this.fld_level = new e.BrainieNormalText(this.game, this, 577, 0, mainFont, "0", gameTexts[lang][10][1], "#c05c54"); this.fld_level.setAnchor(1, 0); this.fld_level.setText(gameTexts[lang][10][0] + ": 1") }; n.prototype.updateLevel = function(e) { "undefined" === typeof e && (e = 0); this.fld_level.setText(gameTexts[lang][10][0] + ": " + e.toString()) }; return n }(Phaser.Group); e.Levels = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(e, n) { t.call(this, e, n, "", !1); this.initScaleX = .3; this.initScaleY = .2; this.HIDE_TIME = 200; this.tempNum = 0; this.x = 243; this.y = 58; this.setMc(); this.resetBubble() } __extends(n, t); n.prototype.resetBubble = function() { this.hLbl.visible = !1; this.fld_num.setText(""); this.fld_num.visible = !0; this.bBg.scale.setTo(this.initScaleX, this.initScaleY); this.hLbl.scale.setTo(this.initScaleX, this.initScaleY); this.fld_num.scale.setTo(this.initScaleX, this.initScaleY); this.alpha = 0 }; n.prototype.hideLabel = function() { this.hLbl.visible = !1; this.fld_num.setText(""); this.fld_num.visible = !0; this.tryStopTweens(); this.tempTwn = game.add.tween(this); this.tempTwn.to({ alpha: 0 }, 200, Phaser.Easing.Sinusoidal.In, !0, 0, !1); this.tempTwnScl1 = game.add.tween(this.bBg.scale); this.tempTwnScl1.to({ x: this.initScaleX, y: this.initScaleY }, 200, Phaser.Easing.Sinusoidal.In, !0, 0, !1); this.tempTwnScl2 = game.add.tween(this.hLbl.scale); this.tempTwnScl2.to({ x: this.initScaleX, y: this.initScaleY }, 200, Phaser.Easing.Sinusoidal.In, !0, 0, !1); this.tempTwnScl3 = game.add.tween(this.fld_num.scale); this.tempTwnScl3.to({ x: this.initScaleX, y: this.initScaleY }, 200, Phaser.Easing.Sinusoidal.In, !0, 0, !1) }; n.prototype.tryStopTweens = function() { this.tempTwn && this.tempTwn.stop(); this.tempTwnScl1 && this.tempTwnScl1.stop(); this.tempTwnScl2 && this.tempTwnScl2.stop(); this.tempTwnScl3 && this.tempTwnScl3.stop() }; n.prototype.hintChange = function(e) { e ? (this.fld_num.visible = !0, this.hLbl.visible = !1) : (this.fld_num.visible = !1, this.hLbl.visible = !0) }; n.prototype.setMc = function() { this.bBg = this.create(0, 0, "mainSt", "numFldBg.png"); this.bBg.anchor.setTo(.5, .5); this.hLbl = new e.BrainieNormalText(this.game, this, 0, 2, mainFont, gameTexts[lang][8][0], gameTexts[lang][8][1], "#460c07"); this.hLbl.setAnchor(.5, .5); this.fld_num = new e.BrainieNormalText(this.game, this, 0, 2, mainFont, "0", 67, "#460c07"); this.fld_num.setAnchor(.5, .5); this.fld_num.setText(""); this.hLbl.visible = !1 }; n.prototype.showNumber = function(e) { this.tempNum = e; this.fld_num.visible = !0; this.hLbl.visible = !1; this.tryStopTweens(); this.tempTwn = game.add.tween(this); this.tempTwn.to({ alpha: 0 }, 210, Phaser.Easing.Sinusoidal.In, !1, 0, !1); this.tempTwn.onComplete.add(this.animHalf, this); this.tempTwn.start(0); this.tempTwnScl1 = game.add.tween(this.bBg.scale); this.tempTwnScl1.to({ x: this.initScaleX, y: this.initScaleY }, 200, Phaser.Easing.Sinusoidal.In, !0, 0, !1); this.tempTwnScl2 = game.add.tween(this.hLbl.scale); this.tempTwnScl2.to({ x: this.initScaleX, y: this.initScaleY }, 200, Phaser.Easing.Sinusoidal.In, !0, 0, !1); this.tempTwnScl3 = game.add.tween(this.fld_num.scale); this.tempTwnScl3.to({ x: this.initScaleX, y: this.initScaleY }, 200, Phaser.Easing.Sinusoidal.In, !0, 0, !1) }; n.prototype.animHalf = function() { this.fld_num.setText(this.tempNum.toString()); this.tryStopTweens(); this.tempTwn = game.add.tween(this); this.tempTwn.to({ alpha: 1 }, 400, Phaser.Easing.Back.Out, !0, 0, !1); this.tempTwnScl1 = game.add.tween(this.bBg.scale); this.tempTwnScl1.to({ x: 1, y: 1 }, 400, Phaser.Easing.Back.Out, !0, 0, !1); this.tempTwnScl2 = game.add.tween(this.hLbl.scale); this.tempTwnScl2.to({ x: 1, y: 1 }, 400, Phaser.Easing.Back.Out, !0, 0, !1); this.tempTwnScl3 = game.add.tween(this.fld_num.scale); this.tempTwnScl3.to({ x: 1, y: 1 }, 400, Phaser.Easing.Back.Out, !0, 0, !1) }; return n }(Phaser.Group); e.NumberBubble = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(e, n, r, i, s, o, u) { "undefined" === typeof r && (r = 1); "undefined" === typeof i && (i = 1); "undefined" === typeof s && (s = 0); "undefined" === typeof o && (o = 0); "undefined" === typeof u && (u = 0); t.call(this, e, n, "", !1); this.bxType = this.bxValue = 1; this.bxColor = this.bxRow = this.bxCol = 0; this.txTemp = ""; 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(" "); this.tempBoxID = 0; this.selected = !1; this.MAX_SPEED = 3; this.ELASTICITY = .6; this.GRAVITY = .1; this.goalPosition = this.moveSpeed = 0; this.bxValue = r; this.bxType = i; this.bxCol = s; this.bxRow = o; this.bxColor = u; this.x = brainieMain.BOX_SIZE * this.bxCol; this.setBg(); 5 != this.bxType && this.setNumber(); this.boxBg.inputEnabled = !0; this.boxBg.events.onInputDown.add(this.clickEvt, this) } __extends(n, t); n.prototype.enableBox = function(e) { this.boxBg.input.enabled = e }; n.prototype.destroyBox = function() { this.boxBg.events.onInputDown.remove(this.clickEvt, this); this.boxBg.destroy(); this.destroy() }; n.prototype.setNumber = function() { this.boxNumSelect = new e.BrainieBmText(this.game, this, brainieMain.BOX_SIZE / 2, 35, "salsa_box_2", "0", 33); this.boxNumSelect.setAnchor(.5, .5); this.boxNumSelect.visible = !1; this.boxNumDedelect = new e.BrainieBmText(this.game, this, brainieMain.BOX_SIZE / 2, 35, "salsa_box_1", "0", 33); this.boxNumDedelect.setAnchor(.5, .5); if (5 != this.bxType) { switch (this.bxType) { case 1: this.txTemp = ""; break; case 2: this.txTemp = "-"; break; case 3: this.txTemp = "*"; break; case 4: this.txTemp = "/" } this.txTemp += this.bxValue.toString(); this.boxNumSelect.setText(this.txTemp); this.boxNumDedelect.setText(this.txTemp) } }; n.prototype.setBg = function() { this.tempBoxID = this.bxColor - 1; this.boxBg = this.create(0, -17, "mainSt", this.boxFrames[this.tempBoxID]) }; n.prototype.setBomb = function(e) { this.tempBoxID = e ? 7 : 6; this.boxBg.frameName = this.boxFrames[this.tempBoxID] }; n.prototype.selectBox = function() { 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)) }; n.prototype.deselectBox = function(e) { "undefined" === typeof e && (e = !0); this.selected = !1; e && brainieMain.actualGame.boxEvent(this); 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")) }; n.prototype.clickEvt = function() { this.selected ? this.deselectBox(!0) : this.selectBox() }; n.prototype.dropBox = function() { this.y = 0; this.moveSpeed = this.MAX_SPEED; this.goalPosition = this.bxRow * brainieMain.BOX_SIZE }; n.prototype.moveDown = function() { this.bxRow++; this.moveSpeed = this.MAX_SPEED; this.goalPosition = this.bxRow * brainieMain.BOX_SIZE }; n.prototype.tryMove = function() { 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))) }; return n }(Phaser.Group); e.NumBox = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(e, n) { t.call(this, e, n, "", !1); this.lastScore = this.addScore = 0; this.y = 690; this.setMc() } __extends(n, t); n.prototype.setMc = function() { this.fld_score = new e.BrainieNormalText(this.game, this, 25, 0, mainFont, "0", gameTexts[lang][9][2], "#c05c54"); this.fld_scoreAdd = new e.BrainieNormalText(this.game, this, 150, 0, mainFont, "", gameTexts[lang][9][2], "#c05c54"); this.fld_scoreAdd.visible = !1 }; n.prototype.updateScore = function(e) { "undefined" === typeof e && (e = 0); var t = this; this.fld_score.setText(gameTexts[lang][9][0] + ": " + e.toString()); e != this.lastScore && (this.addScore = e - this.lastScore, setTimeout(function() { return t.showAddText() }, 50)); this.lastScore = e }; n.prototype.showAddText = function() { this.fld_scoreAdd.setText("+" + this.addScore.toString()); this.fld_scoreAdd.x = this.fld_score.x + 2 + this.fld_score.getWidth(); this.tempTwn && this.tempTwn.stop(); this.fld_scoreAdd.visible = !0; this.fld_scoreAdd.alpha = 1; this.tempTwn = game.add.tween(this.fld_scoreAdd); this.tempTwn.to({ alpha: 0 }, 500, Phaser.Easing.Linear.None, !1, 300, !1); this.tempTwn.onComplete.add(this.moveComplete, this); this.tempTwn.start(0) }; n.prototype.moveComplete = function() { this.fld_scoreAdd.visible = !1 }; return n }(Phaser.Group); e.ScoreLabel = t })(Brainie || (Brainie = {})); (function(e) { var t = function(e) { function t() { e.apply(this, arguments) } __extends(t, e); t.prototype.preload = function() { this.preloadBg = this.add.sprite(0, 0, "mainBg"); this.preloadBarBg = this.add.sprite(177, 340, "preloaderBg"); this.preloadBarFill = this.add.sprite(184, 346, "preloaderFill"); this.load.setPreloadSprite(this.preloadBarFill); this.load.bitmapFont("salsa_box_1", "img/salsa_box_1.png", "img/salsa_box_1.xml"); this.load.bitmapFont("salsa_box_2", "img/salsa_box_2.png", "img/salsa_box_2.xml"); this.load.image("gameAreaBg", "img/gameAreaBg.jpg"); this.load.image("helpBm", "img/helpBm.jpg"); this.load.atlasXML("mainSt", "img/mainSt.png", "img/mainSt.xml", null); this.load.atlasXML("animSt", "img/animSt.png", "img/animSt.xml", null); if (this.game.device.desktop && this.game.device.webAudio) 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"]) }; t.prototype.create = function() { this.preloadBarBg.kill(); this.preloadBarFill.kill(); this.preloadBg.kill(); this.game.state.start("GameMain", !0, !1) }; return t }(Phaser.State); e.Preloader = t })(Brainie || (Brainie = {})); (function(e) { var t = function(e) { function t(t) { e.call(this, t, 299, 242, "mainSt", 0); this.frameName = "logoBrainie.png"; this.anchor.setTo(222 / 441, 115 / 170) } __extends(t, e); t.prototype.showLogo = function(e) { this.tempTwn && this.tempTwn.stop(); this.tempTwnScl && this.tempTwnScl.stop(); e ? (this.visible = !0, this.alpha = 0, this.scale.setTo(.4, .3), this.tempTwn = game.add.tween(this), this.tempTwn.to({ alpha: 1 }, 600, Phaser.Easing.Back.Out, !1, brainieMain.MENU_FADE, !1), this.tempTwn.start(0), this.tempTwnScl = game.add.tween(this.scale), this.tempTwnScl.to({ x: 1, y: 1 }, 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({ alpha: 0 }, 300, Phaser.Easing.Sinusoidal.In, !1, 0, !1), this.tempTwn.start(0), this.tempTwnScl = game.add.tween(this.scale), this.tempTwnScl.to({ x: .4, y: .3 }, 300, Phaser.Easing.Sinusoidal.In, !1, 0, !1), this.tempTwnScl.onComplete.add(this.hideEnd, this)); this.tempTwnScl.start(0) }; t.prototype.hideEnd = function() { this.visible = !1 }; t.prototype.showEnd = function() {}; return t }(Phaser.Sprite); e.MainLogo = t })(Brainie || (Brainie = {})); (function(e) { var t = function(e) { function t(t, n) { e.call(this, t, n, "", !1); this.x = 511; this.y = 28; this.visible = !1; this.btnBg = this.create(0, 0, "mainSt", "sndBtn_up.png"); this.crossBm = this.create(0, 0, "mainSt", "sndBtn_cross.png"); this.crossBm.visible = !1; this.btnBg.inputEnabled = !0; this.btnBg.events.onInputDown.add(this.swDn, this); this.btnBg.events.onInputOut.add(this.up, this); this.btnBg.events.onInputUp.add(this.upClick, this) } __extends(t, e); t.prototype.showSwitch = function(e) { this.visible = this.btnBg.input.enabled = e }; t.prototype.swDn = function() { this.btnBg.frameName = "sndBtn_dn.png" }; t.prototype.upClick = function() { sndPlr.soundOn ? (sndPlr.soundOn = !1, this.crossBm.visible = !0) : (sndPlr.soundOn = !0, this.crossBm.visible = !1); this.up() }; t.prototype.up = function() { this.btnBg.frameName = "sndBtn_up.png" }; return t }(Phaser.Group); e.SoundSwitch = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(n, r) { t.call(this, n, r, "", !1); this.titleFld = new e.BrainieNormalText(this.game, this, 0, -30, mainFont, gameTexts[lang][14][0], gameTexts[lang][14][1], "#cea9b5"); this.titleFld.setAnchor(.5, 0); this.Btn_YES = new e.BtnBase(this.game, this, -135, 5, gameTexts[lang][15][0], !0, gameTexts[lang][15][1]); this.Btn_NO = new e.BtnBase(this.game, this, 5, 5, gameTexts[lang][16][0], !0, gameTexts[lang][16][1]); this.enableCont(!1) } __extends(n, t); n.prototype.enableCont = function(e) { this.Btn_YES.enableBtnInput(e); this.Btn_NO.enableBtnInput(e) }; return n }(Phaser.Group); e.SureCont = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(e, n) { t.call(this, e, n, "", !1); this.setDisabler(); this.setSoundSwitch() } __extends(n, t); n.prototype.setDisabler = function() { this.menuDisabler = this.create(-30, -30, "mainSt", "menuDisabler.png"); this.menuDisabler.scale.setTo((gW + 60) / 50, (gH + 60) / 50); this.menuDisabler.alpha = 0; this.menuDisabler.visible = !1; this.menuDisabler.inputEnabled = !0 }; n.prototype.showDisabler = function(e) { this.menuDisabler.visible = e; this.menuDisabler.input.enabled = e }; n.prototype.showMainMenu = function() { this.sndSw && this.sndSw.showSwitch(!0); this.scrnMainMenu = new e.Scrn_MainMenu(this.game, this); this.showDisabler(!0); this.scrnMainMenu.resetMenu(); this.scrnMainMenu.showContent() }; n.prototype.hideMainMenu = function() { this.sndSw && this.sndSw.showSwitch(!1); this.showDisabler(!1); this.scrnMainMenu.destroy() }; n.prototype.showPauseMenu = function() { this.sndSw && this.sndSw.showSwitch(!0); this.scrnPause = new e.Scrn_Pause(this.game, this); this.showDisabler(!0); this.scrnPause.showContent() }; n.prototype.hidePauseMenu = function() { this.sndSw && this.sndSw.showSwitch(!1); this.showDisabler(!1); this.scrnPause.destroy() }; n.prototype.showLevelMenu = function() { this.sndSw && this.sndSw.showSwitch(!0); this.scrnLevel = new e.Scrn_Level(this.game, this); this.showDisabler(!0); this.scrnLevel.showContent() }; n.prototype.hideLevelMenu = function() { this.sndSw && this.sndSw.showSwitch(!1); this.showDisabler(!1); this.scrnLevel.destroy() }; n.prototype.showEndMenu = function() { this.sndSw && this.sndSw.showSwitch(!0); this.scrnEnd = new e.Scrn_End(this.game, this); this.showDisabler(!0); this.scrnEnd.showContent() }; n.prototype.hideEndMenu = function() { this.sndSw && this.sndSw.showSwitch(!1); this.showDisabler(!1); this.scrnEnd.destroy() }; n.prototype.showHelp = function() { this.scrnHelp = new e.Scrn_Help(this.game, this); this.scrnHelp.showCont() }; n.prototype.hideHelp = function() { this.scrnHelp.destroy() }; n.prototype.setSoundSwitch = function() { sndPlr.soundEnabled && (this.sndSw = new e.SoundSwitch(this.game, this)) }; return n }(Phaser.Group); e.ScreensCont = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(n, r) { t.call(this, n, r, "", !1); this.scrnTitle = new e.BrainieNormalText(this.game, this, 300, 170, mainFont, gameTexts[lang][17][0], gameTexts[lang][17][1], "#cea9b5"); this.scrnTitle.setAnchor(.5, 0); this.scoreFld = new e.BrainieNormalText(this.game, this, 300, 245, mainFont, gameTexts[lang][9][0] + ": 0", gameTexts[lang][9][1], "#cea9b5"); this.scoreFld.setAnchor(.5, 0); this.Btn_GAME_BACKTOMAIN = new e.BtnBase(this.game, this, 34, 335, gameTexts[lang][18][0], !1, gameTexts[lang][18][1]); this.Btn_GAME_BACKTOMAIN.bgBm.events.onInputUp.add(this.backToMainClick, this); this.Btn_SHOW_HELP = new e.BtnBase(this.game, this, 305, 335, gameTexts[lang][19][0], !1, gameTexts[lang][19][1]); this.Btn_SHOW_HELP.bgBm.events.onInputUp.add(this.helpClick, this); this.Btn_MORE = new e.BtnBase(this.game, this, 169, 420, gameTexts[lang][25][0], !1, gameTexts[lang][25][1]); this.Btn_MORE.bgBm.events.onInputDown.add(this.showClick, this) } __extends(n, t); n.prototype.backToMainClick = function() { this.setButtons(!1); brainieMain.gameCallback("GAME_BACKTOMAIN") }; n.prototype.helpClick = function() { brainieMain.gameCallback("SHOW_HELP") }; n.prototype.showClick = function() { brainieMain.moreGamesCall() }; n.prototype.showContent = function() { this.scoreFld.setText(gameTexts[lang][9][0] + ": " + brainieMain.actualGame.score.toString()); this.setButtons(!1); this.tempTwn && this.tempTwn.stop(); this.alpha = 0; this.tempTwn = game.add.tween(this); this.tempTwn.to({ alpha: 1 }, brainieMain.MENU_FADE, Phaser.Easing.Linear.None, !1, 0, !1); this.tempTwn.onComplete.add(this.showContEnd, this); this.tempTwn.start(0) }; n.prototype.showContEnd = function() { this.setButtons(!0) }; n.prototype.setButtons = function(e) { this.Btn_GAME_BACKTOMAIN.enableBtnInput(e); this.Btn_MORE.enableBtnInput(e); this.Btn_SHOW_HELP.enableBtnInput(e) }; return n }(Phaser.Group); e.Scrn_End = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(n, r) { t.call(this, n, r, "", !1); this.setDisabler(); this.helpCont = this.game.add.group(); this.add(this.helpCont); this.helpBm = this.helpCont.create(10, 10, "helpBm"); this.hTx1 = new e.BrainieNormalText(this.game, this.helpCont, 47, 48, mainFont, gameTexts[lang][21][0], gameTexts[lang][21][1], "#784c5b", "left"); this.hTx2 = new e.BrainieNormalText(this.game, this.helpCont, 47, 235, mainFont, gameTexts[lang][22][0], gameTexts[lang][22][1], "#784c5b", "left"); this.hTx3 = new e.BrainieNormalText(this.game, this.helpCont, 47, 348, mainFont, gameTexts[lang][23][0], gameTexts[lang][23][1], "#784c5b", "left"); this.hTx4 = new e.BrainieNormalText(this.game, this.helpCont, 47, 534, mainFont, gameTexts[lang][24][0], gameTexts[lang][24][1], "#784c5b", "left"); this.Btn_CLOSE_HELP = new e.BtnBase(this.game, this.helpCont, 170, 602, gameTexts[lang][20][0], !1, gameTexts[lang][20][1]); this.Btn_CLOSE_HELP.bgBm.events.onInputUp.add(this.closeClick, this) } __extends(n, t); n.prototype.showCont = function() { this.enableDisabler(!0); this.Btn_CLOSE_HELP.enableBtnInput(!1); this.helpCont.y = gH; this.tempTwn = game.add.tween(this.helpCont); this.tempTwn.to({ y: 0 }, 500, Phaser.Easing.Sinusoidal.Out, !1, 0, !1); this.tempTwn.onComplete.add(this.showContEnd, this); this.tempTwn.start(0) }; n.prototype.showContEnd = function() { this.Btn_CLOSE_HELP.enableBtnInput(!0) }; n.prototype.closeClick = function() { this.Btn_CLOSE_HELP.enableBtnInput(!1); this.tempTwn = game.add.tween(this.helpCont); this.tempTwn.to({ y: gH }, 400, Phaser.Easing.Sinusoidal.In, !1, 0, !1); this.tempTwn.onComplete.add(this.closeEnd, this); this.tempTwn.start(0) }; n.prototype.closeEnd = function() { brainieMain.gameCallback("CLOSE_HELP") }; n.prototype.setDisabler = function() { this.disabler = this.create(-30, -30, "mainSt", "menuDisabler.png"); this.disabler.scale.setTo((gW + 60) / 50, (gH + 60) / 50); this.disabler.alpha = 0; this.disabler.visible = !1; this.disabler.inputEnabled = !0 }; n.prototype.enableDisabler = function(e) { this.disabler.visible = e; this.disabler.input.enabled = e }; return n }(Phaser.Group); e.Scrn_Help = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(n, r) { t.call(this, n, r, "", !1); this.scrnTitle = new e.BrainieNormalText(this.game, this, 300, 140, mainFont, gameTexts[lang][11][0], gameTexts[lang][11][1], "#cea9b5"); this.scrnTitle.setAnchor(.5, 0); this.Btn_GAME_NEXT_LEVEL = new e.BtnBase(this.game, this, 34, 335, gameTexts[lang][12][0], !1, gameTexts[lang][12][1]); this.Btn_GAME_NEXT_LEVEL.bgBm.events.onInputUp.add(this.nextClick, this); this.Btn_SHOW_HELP = new e.BtnBase(this.game, this, 305, 335, gameTexts[lang][19][0], !1, gameTexts[lang][19][1]); this.Btn_SHOW_HELP.bgBm.events.onInputUp.add(this.helpClick, this); this.Btns_GAME_END_LEVEL = new e.BtnBase(this.game, this, 169, 420, gameTexts[lang][13][0], !1, gameTexts[lang][13][1]); this.Btns_GAME_END_LEVEL.bgBm.events.onInputUp.add(this.endClick, this); this.sureCont = new e.SureCont(this.game, this); this.sureCont.x = this.Btns_GAME_END_LEVEL.x + 131; this.sureCont.y = this.Btns_GAME_END_LEVEL.y + 30; this.sureCont.Btn_YES.bgBm.events.onInputUp.add(this.yesEndClick, this); this.sureCont.Btn_NO.bgBm.events.onInputUp.add(this.noEndClick, this) } __extends(n, t); n.prototype.nextClick = function() { this.setButtons(!1); this.sureCont.enableCont(!1); brainieMain.gameCallback("GAME_NEXT_LEVEL") }; n.prototype.helpClick = function() { brainieMain.gameCallback("SHOW_HELP") }; n.prototype.endClick = function() { this.sureCont.visible = !0; this.sureCont.enableCont(!0); this.Btns_GAME_END_LEVEL.visible = !1 }; n.prototype.noEndClick = function() { this.sureCont.visible = !1; this.sureCont.enableCont(!1); this.Btns_GAME_END_LEVEL.visible = !0 }; n.prototype.yesEndClick = function() { this.setButtons(!1); this.sureCont.enableCont(!1); brainieMain.gameCallback("GAME_END_LEVEL") }; n.prototype.showContent = function() { this.setButtons(!1); this.sureCont.visible = !1; this.sureCont.enableCont(!1); this.Btns_GAME_END_LEVEL.visible = !0; this.tempTwn && this.tempTwn.stop(); this.alpha = 0; this.tempTwn = game.add.tween(this); this.tempTwn.to({ alpha: 1 }, brainieMain.MENU_FADE, Phaser.Easing.Linear.None, !1, 0, !1); this.tempTwn.onComplete.add(this.showContEnd, this); this.tempTwn.start(0) }; n.prototype.showContEnd = function() { this.setButtons(!0) }; n.prototype.setButtons = function(e) { this.Btn_GAME_NEXT_LEVEL.enableBtnInput(e); this.Btn_SHOW_HELP.enableBtnInput(e); this.Btns_GAME_END_LEVEL.enableBtnInput(e) }; return n }(Phaser.Group); e.Scrn_Level = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(e, n) { t.call(this, e, n, "", !1); this.setMain(); this.setMode() } __extends(n, t); n.prototype.showContent = function() { this.alpha = 0; this.tempTwn = game.add.tween(this); this.tempTwn.to({ alpha: 1 }, brainieMain.MENU_FADE, Phaser.Easing.Linear.None, !1, 0, !1); this.tempTwn.onComplete.add(this.showContEnd, this); this.tempTwn.start(0) }; n.prototype.showContEnd = function() { this.btnMainStart.enableBtnInput(!0); this.btnMainMore.enableBtnInput(!0); this.btnMainHelp.enableBtnInput(!0) }; n.prototype.resetMenu = function() { this.brainieLogo.showLogo(!0); this.mainMenuCont.visible = !0; this.modeMenuCont.visible = !1; this.disableButtons() }; n.prototype.disableButtons = function() { this.btnMainStart.enableBtnInput(!1); this.btnMainMore.enableBtnInput(!1); this.btnMainHelp.enableBtnInput(!1); this.Btn_GAME_CLASSIC.enableBtnInput(!1); this.Btn_GAME_ACTION.enableBtnInput(!1) }; n.prototype.setMain = function() { this.mainMenuCont = this.game.add.group(); this.add(this.mainMenuCont); this.btnMainStart = new e.BtnBase(this.game, this.mainMenuCont, 169, 310, gameTexts[lang][0][0], !1, gameTexts[lang][0][1]); this.btnMainStart.bgBm.events.onInputUp.add(this.startClick, this); this.btnMainHelp = new e.BtnBase(this.game, this.mainMenuCont, 169, this.btnMainStart.y + 83 + 83, gameTexts[lang][19][0], !1, gameTexts[lang][19][1]); this.btnMainHelp.bgBm.events.onInputUp.add(this.helpClick, this); this.brainieLogo = new e.MainLogo(this.game); this.add(this.brainieLogo); this.btnMainMore = new e.BtnBase(this.game, this.mainMenuCont, 169, this.btnMainStart.y + 83, gameTexts[lang][25][0], !1, gameTexts[lang][25][1]); this.btnMainMore.bgBm.events.onInputDown.add(this.moreClick, this) }; n.prototype.startClick = function() { this.btnMainStart.enableBtnInput(!1); this.btnMainMore.enableBtnInput(!1); this.btnMainHelp.enableBtnInput(!1); this.brainieLogo.showLogo(!1); this.tempTwn = game.add.tween(this.mainMenuCont); this.tempTwn.to({ alpha: 0 }, 300, Phaser.Easing.Linear.None, !1, 0, !1); this.tempTwn.onComplete.add(this.switchAnimPt2, this); this.tempTwn.start(0) }; n.prototype.switchAnimPt2 = function() { this.mainMenuCont.visible = !1; this.mainMenuCont.alpha = 1; this.modeMenuCont.visible = !0; this.modeMenuCont.alpha = 0; this.tempTwn = game.add.tween(this.modeMenuCont); this.tempTwn.to({ alpha: 1 }, 300, Phaser.Easing.Linear.None, !1, 0, !1); this.tempTwn.onComplete.add(this.switchAnimEnd, this); this.tempTwn.start(0) }; n.prototype.switchAnimEnd = function() { this.Btn_GAME_CLASSIC.enableBtnInput(!0); this.Btn_GAME_ACTION.enableBtnInput(!0) }; n.prototype.moreClick = function() { brainieMain.moreGamesCall() }; n.prototype.setMode = function() { this.modeMenuCont = this.game.add.group(); this.add(this.modeMenuCont); this.selectTitle = new e.BrainieNormalText(this.game, this.modeMenuCont, 300, 150, mainFont, gameTexts[lang][1][0], gameTexts[lang][1][1], "#cea9b5"); this.selectTitle.setAnchor(.5, 0); this.Btn_GAME_CLASSIC = new e.BtnBase(this.game, this.modeMenuCont, 169, 335, gameTexts[lang][2][0], !1, gameTexts[lang][2][1]); this.Btn_GAME_CLASSIC.bgBm.events.onInputUp.add(this.classicClick, this); this.Btn_GAME_ACTION = new e.BtnBase(this.game, this.modeMenuCont, 169, 420, gameTexts[lang][3][0], !1, gameTexts[lang][3][1]); this.Btn_GAME_ACTION.bgBm.events.onInputUp.add(this.actionClick, this) }; n.prototype.classicClick = function() { this.disableButtons(); brainieMain.gameCallback("Start_GAME_CLASSIC") }; n.prototype.actionClick = function() { this.disableButtons(); brainieMain.gameCallback("Start_GAME_ACTION") }; n.prototype.helpClick = function() { brainieMain.gameCallback("SHOW_HELP") }; return n }(Phaser.Group); e.Scrn_MainMenu = t })(Brainie || (Brainie = {})); (function(e) { var t = function(t) { function n(n, r) { t.call(this, n, r, "", !1); this.pauseTitle = new e.BrainieNormalText(this.game, this, 300, 195, mainFont, gameTexts[lang][4][0], gameTexts[lang][4][1], "#cea9b5"); this.pauseTitle.setAnchor(.5, 0); this.Btn_GAME_RESUME = new e.BtnBase(this.game, this, 34, 335, gameTexts[lang][5][0], !1, gameTexts[lang][5][1]); this.Btn_GAME_RESUME.bgBm.events.onInputUp.add(this.resumeClick, this); this.Btn_SHOW_HELP = new e.BtnBase(this.game, this, 305, 335, gameTexts[lang][19][0], !1, gameTexts[lang][19][1]); this.Btn_SHOW_HELP.bgBm.events.onInputUp.add(this.helpClick, this); this.Btns_GAME_END_PAUSE = new e.BtnBase(this.game, this, 305, 420, gameTexts[lang][13][0], !1, gameTexts[lang][13][1]); this.Btns_GAME_END_PAUSE.bgBm.events.onInputUp.add(this.endClick, this); this.Btn_MORE = new e.BtnBase(this.game, this, 34, 420, gameTexts[lang][25][0], !1, gameTexts[lang][25][1]); this.Btn_MORE.bgBm.events.onInputDown.add(this.moreClick, this); this.sureCont = new e.SureCont(this.game, this); this.sureCont.x = this.Btns_GAME_END_PAUSE.x + 131; this.sureCont.y = this.Btns_GAME_END_PAUSE.y + 30; this.sureCont.Btn_YES.bgBm.events.onInputUp.add(this.yesEndClick, this); this.sureCont.Btn_NO.bgBm.events.onInputUp.add(this.noEndClick, this) } __extends(n, t); n.prototype.moreClick = function() { brainieMain.moreGamesCall() }; n.prototype.resumeClick = function() { this.setButtons(!1); this.sureCont.enableCont(!1); brainieMain.gameCallback("GAME_RESUME") }; n.prototype.helpClick = function() { brainieMain.gameCallback("SHOW_HELP") }; n.prototype.endClick = function() { this.sureCont.visible = !0; this.sureCont.enableCont(!0); this.Btns_GAME_END_PAUSE.visible = !1 }; n.prototype.noEndClick = function() { this.sureCont.visible = !1; this.sureCont.enableCont(!1); this.Btns_GAME_END_PAUSE.visible = !0 }; n.prototype.yesEndClick = function() { this.setButtons(!1); this.sureCont.enableCont(!1); brainieMain.gameCallback("GAME_END_PAUSE") }; n.prototype.showContent = function() { this.setButtons(!1); this.sureCont.visible = !1; this.sureCont.enableCont(!1); this.Btns_GAME_END_PAUSE.visible = !0; this.tempTwn && this.tempTwn.stop(); this.alpha = 0; this.tempTwn = game.add.tween(this); this.tempTwn.to({ alpha: 1 }, brainieMain.MENU_FADE, Phaser.Easing.Linear.None, !1, 0, !1); this.tempTwn.onComplete.add(this.showContEnd, this); this.tempTwn.start(0) }; n.prototype.showContEnd = function() { this.setButtons(!0) }; n.prototype.setButtons = function(e) { this.Btn_GAME_RESUME.enableBtnInput(e); this.Btn_SHOW_HELP.enableBtnInput(e); this.Btn_MORE.enableBtnInput(e); this.Btns_GAME_END_PAUSE.enableBtnInput(e) }; return n }(Phaser.Group); e.Scrn_Pause = t })(Brainie || (Brainie = {}))