game.min.js 137 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525
  1. function onLoad() {
  2. var a = {
  3. id: "576742227280293172"
  4. };
  5. window.GameAPI.loadAPI(function(a) {
  6. window.__SpilAPI = a, new game.Main
  7. }, a)
  8. }
  9. var __extends = this.__extends || function(a, b) {
  10. function c() {
  11. this.constructor = a
  12. }
  13. for (var d in b) b.hasOwnProperty(d) && (a[d] = b[d]);
  14. c.prototype = b.prototype, a.prototype = new c
  15. },
  16. utils;
  17. ! function(a) {
  18. var b = function(a) {
  19. function b(b) {
  20. a.call(this, b, b.stage, "FPS Meter"), this.initBackground(), this.initText(), this.setPosition(), this.game.time.advancedTiming = !0
  21. }
  22. return __extends(b, a), b.prototype.setPosition = function() {
  23. this.x = 0, this.position.y = this.game.scale.scaleMode === Phaser.ScaleManager.RESIZE ? game.Config.GAME_HEIGHT * game.Config.WORLD_SCALE - this.height : game.Config.GAME_HEIGHT - this.height
  24. }, b.prototype.initBackground = function() {
  25. var a = 84,
  26. b = this.game.add.bitmapData(a, 22);
  27. b.fill(0, 0, 0), b.rect(0, 0, a, 22), this.bg = new Phaser.Image(this.game, 0, 0, b), this.add(this.bg)
  28. }, b.prototype.initText = function() {
  29. var a = {
  30. font: "18px Consolas",
  31. fill: "#FFFFFF",
  32. align: "center"
  33. };
  34. this.statsText = this.game.add.text(6, 2, "0 fps", a, this)
  35. }, b.prototype.update = function() {
  36. var a = "FPS: " + this.game.time.fps;
  37. this.statsText.setText(a)
  38. }, b.prototype.destroy = function() {
  39. this.game.time.advancedTiming = !1, a.prototype.destroy.call(this)
  40. }, b
  41. }(Phaser.Group);
  42. a.FPSMeter = b
  43. }(utils || (utils = {}));
  44. var game;
  45. ! function(a) {
  46. var b = function() {
  47. function a() {}
  48. return a.GAME_WIDTH = 640, a.GAME_HEIGHT = 832, a.HALF_GAME_WIDTH = .5 * a.GAME_WIDTH, a.HALF_GAME_HEIGHT = .5 * a.GAME_HEIGHT, a.WORLD_SCALE = 1, a
  49. }();
  50. a.Config = b
  51. }(game || (game = {}));
  52. var game;
  53. ! function(a) {
  54. var b = function(b) {
  55. function c() {
  56. b.apply(this, arguments)
  57. }
  58. return __extends(c, b), c.prototype.init = function() {
  59. this.game.device.android && !this.game.device.chrome && (this.game.canvas.parentElement.style.overflow = "visible");
  60. var a = {
  61. font: "45px GrilledCheeseBTNToasted",
  62. fill: "#FFFFFF",
  63. align: "center"
  64. },
  65. b = this.add.text(0, 0, "0", a);
  66. b.setText("Loading..."), b.destroy()
  67. }, c.prototype.preload = function() {
  68. this.load.atlasJSONHash("preloader", "assets/graphics/preloader.png", "assets/graphics/preloader.json"), this.loadSpilLogo()
  69. }, c.prototype.loadSpilLogo = function() {
  70. var b = a.Main.spilAPI.Branding.getLogo();
  71. b.image && this.load.image("spilLogo", b.image)
  72. }, c.prototype.create = function() {
  73. this.setupStage(), this.detectWeakDevice(), this.addFPSMeter(), this.input.maxPointers = 1, this.game.state.start("Preloader", !0, !1)
  74. }, c.prototype.setupStage = function() {
  75. var a = this.game.scale;
  76. a.scaleMode = Phaser.ScaleManager.SHOW_ALL, a.pageAlignHorizontally = !0, a.pageAlignVertically = !0, this.game.device.desktop || a.forceOrientation(!1, !0), a.enterIncorrectOrientation.add(this.onEnterIncorrectOrientation, this), a.leaveIncorrectOrientation.add(this.onLeaveIncorrectOrientation, this), a.setScreenSize(!0), this.stage.disableVisibilityChange = !0, this.stage.backgroundColor = 11193204
  77. }, c.prototype.detectWeakDevice = function() {
  78. var b = !1;
  79. if (this.game.device.desktop === !1) {
  80. var c = detect.parse(window.navigator.userAgent);
  81. this.game.device.iOS && (c.os.major < 7 && (b = !0), c.browser.family.indexOf("Chrome") > -1 && (b = !0)), this.game.device.android && (c.browser.family.indexOf("Android") > -1 && (b = !0), c.browser.family.indexOf("Chrome Mobile") > -1 && c.browser.major <= 18 && (b = !0)), this.game.device.windowsPhone && c.browser.family.indexOf("IE") > -1 && (b = c.browser.major < 10)
  82. }
  83. a.Main.weakDevice = b
  84. }, c.prototype.addFPSMeter = function() {
  85. if (a.Main.development) {
  86. var b = new utils.FPSMeter(this.game);
  87. b.position.set(0, a.Config.GAME_HEIGHT - 22)
  88. }
  89. }, c.prototype.onEnterIncorrectOrientation = function() {
  90. document.getElementById("orientation").style.display = "block", document.body.style.marginBottom = "0px"
  91. }, c.prototype.onLeaveIncorrectOrientation = function() {
  92. document.getElementById("orientation").style.display = "none", document.body.style.marginBottom = "100px", this.game.device.android && !this.game.device.chrome && this.game.scale.setScreenSize(!0), this.game.time.events.repeat(500, 3, this.game.scale.setScreenSize, this)
  93. }, c.prototype.render = function() {}, c
  94. }(Phaser.State);
  95. a.Boot = b
  96. }(game || (game = {}));
  97. var game;
  98. ! function(a) {
  99. var b = function(b) {
  100. function c() {
  101. b.apply(this, arguments)
  102. }
  103. return __extends(c, b), c.prototype.create = function() {
  104. var b = this;
  105. a.Main.spilAPI.Branding.displaySplashScreen(function() {
  106. b.gotoMainMenu()
  107. }, a.Main.spilData)
  108. }, c.prototype.gotoMainMenu = function() {
  109. this.game.state.start("MainMenu", !0, !1, !0)
  110. }, c
  111. }(Phaser.State);
  112. a.SplashScreen = b
  113. }(game || (game = {}));
  114. var game;
  115. ! function(a) {
  116. var b = function(b) {
  117. function c(c, d) {
  118. b.call(this, c, d), this.overlayDuration = 400, this.active = !0;
  119. var e = utils.DrawUtil.createRectTexture(this.game, 1, 1, "#000000", "black_rect");
  120. this.overlay = new Phaser.Image(c, 0, 0, e), this.overlay.scale.set(a.Config.GAME_WIDTH, a.Config.GAME_HEIGHT), this.overlay.visible = !1, this.overlay.exists = !1, this.game.stage.addChild(this.overlay)
  121. }
  122. return __extends(c, b), c.prototype.changeState = function(a, b) {
  123. this.showOverlay(a, b)
  124. }, c.prototype.showOverlay = function(a, b) {
  125. var c = this;
  126. this.game.input.disabled = !0, this.overlayTween && this.overlayTween.isRunning && this.overlayTween.stop(), this.overlay.visible = !0, this.overlay.alpha = 0, this.overlayTween = this.game.add.tween(this.overlay).to({
  127. alpha: 1
  128. }, this.overlayDuration, Phaser.Easing.Cubic.Out, !0), this.overlayTween.onComplete.addOnce(function() {
  129. c.doChangeState(a, b)
  130. }, this)
  131. }, c.prototype.doChangeState = function(a, b) {
  132. var c = this;
  133. this.game.state.start(a, !0, !1, b), setTimeout(function() {
  134. c.hideOverlay()
  135. }, 100), setTimeout(function() {
  136. c.overlay.visible = !1, c.overlay.exists = !1
  137. }, 100 + this.overlayDuration)
  138. }, c.prototype.hideOverlay = function() {
  139. this.game.input.disabled = !1, this.overlayTween && this.overlayTween.isRunning && this.overlayTween.stop(), this.overlayTween = this.game.add.tween(this.overlay).to({
  140. alpha: 0
  141. }, this.overlayDuration, Phaser.Easing.Cubic.Out, !0)
  142. }, c
  143. }(Phaser.Plugin);
  144. a.StateTransition = b
  145. }(game || (game = {}));
  146. var game;
  147. ! function(a) {
  148. var b = function(b) {
  149. function c() {
  150. b.apply(this, arguments)
  151. }
  152. return __extends(c, b), c.prototype.preload = function() {
  153. this.stage.setBackgroundColor(15880535), this.initPreloadBar(), this.addLoadingText(), this.addPublisherLogo(), this.loadAssets()
  154. }, c.prototype.initPreloadBar = function() {
  155. if (a.Main.development === !1) {
  156. var b = this.add.image(0, 0, "preloader", "Preloader_Back0000");
  157. b.anchor.set(.5, .5), b.x = a.Config.HALF_GAME_WIDTH, b.y = a.Config.HALF_GAME_HEIGHT;
  158. var c = this.game.add.sprite(0, 0, "preloader", "Preloader_Front0000");
  159. c.x = a.Config.HALF_GAME_WIDTH - .5 * c.width - 1, c.y = a.Config.HALF_GAME_HEIGHT - .5 * c.height - 3, this.load.setPreloadSprite(c)
  160. }
  161. }, c.prototype.addLoadingText = function() {
  162. var b = {
  163. font: "45px GrilledCheeseBTNToasted",
  164. fill: "#FCDFE1",
  165. align: "center"
  166. };
  167. this.loadingText = this.game.add.text(0, 0, "0%", b), this.loadingText.anchor.set(.5, .5), this.loadingText.position.set(a.Config.HALF_GAME_WIDTH, a.Config.HALF_GAME_HEIGHT + 78), this.loadingText.setShadow(2, 2, "#E6212A", 2), this.loadingText.update()
  168. }, c.prototype.addPublisherLogo = function() {
  169. if (this.cache.checkImageKey("spilLogo")) {
  170. var b = a.Main.spilAPI.Branding.getLogo().action;
  171. this.publisherLogo = this.game.add.image(0, 0, "spilLogo"), this.publisherLogo.anchor.set(.5, .5), this.publisherLogo.scale.set(1.2, 1.2), this.publisherLogo.x = a.Config.HALF_GAME_WIDTH, this.publisherLogo.y = a.Config.HALF_GAME_HEIGHT - 70, this.publisherLogo.inputEnabled = !0, this.publisherLogo.events.onInputDown.add(b, this), this.publisherLogo.input.useHandCursor = !0
  172. }
  173. }, c.prototype.loadAssets = function() {
  174. this.game.device.ie && this.game.device.ieVersion <= 9 && (this.load.useXDomainRequest = !1), this.loadOtherAssets(), this.loadAudio(), this.loadGraphics()
  175. }, c.prototype.loadOtherAssets = function() {
  176. this.load.bitmapFont("timer", "assets/fonts/timer.png", "assets/fonts/timer.fnt", null, 1), this.load.bitmapFont("level_label", "assets/fonts/level_label.png", "assets/fonts/level_label.fnt", null, 1), this.load.bitmapFont("fruit_labels", "assets/fonts/fruit_labels.png", "assets/fonts/fruit_labels.fnt", null, 3), this.load.json("texts", "assets/texts.json")
  177. }, c.prototype.loadAudio = function() {
  178. this.game.sound.usingWebAudio && (this.load.audio("tap", ["assets/audio/TapSound.wav"], !0), this.load.audio("select_fruit", ["assets/audio/plop.ogg", "assets/audio/plop.m4a"], !0), this.load.audio("star_appear", ["assets/audio/star_appear.ogg", "assets/audio/star_appear.m4a"], !0), this.load.audio("level_up", ["assets/audio/level_up.ogg", "assets/audio/level_up.m4a"], !0), this.load.audio("game_over", ["assets/audio/Game_Over.ogg", "assets/audio/Game_Over.m4a"], !0), this.load.audio("clock", ["assets/audio/Ticking_Clock.ogg", "assets/audio/Ticking_Clock.m4a"], !0), this.load.audio("powerup", ["assets/audio/line_powerup.ogg", "assets/audio/line_powerup.m4a"], !0), this.load.audio("whoosh", ["assets/audio/whoosh.wav"], !0), this.load.audio("ohoho", ["assets/audio/ohoho.ogg", "assets/audio/ohoho.m4a"], !0), this.game.device.firefox === !1 ? (this.load.audio("star_move", ["assets/audio/star_move.ogg", "assets/audio/star_move.m4a"], !0), this.load.audio("whoosh_out", ["assets/audio/whoosh_out.wav"], !0)) : this.load.audio("star_move", ["assets/audio/star_move.m4a"], !0)), this.load.audio("main_loop", ["assets/audio/main_loop.ogg", "assets/audio/main_loop.m4a"], !0)
  179. }, c.prototype.loadGraphics = function() {
  180. this.load.atlasJSONHash("graphics_1", "assets/graphics/level_graphics.png", "assets/graphics/level_graphics.json"), this.load.atlasJSONHash("main_menu", "assets/graphics/main_menu.png", "assets/graphics/main_menu.json"), this.load.atlasJSONHash("buttons", "assets/graphics/buttons.png", "assets/graphics/buttons.json"), this.load.atlasJSONHash("tutorial", "assets/graphics/tutorial.png", "assets/graphics/tutorial.json"), this.load.atlasJSONHash("tutorial_hand", "assets/graphics/tutorial_hand.png", "assets/graphics/tutorial_hand.json")
  181. }, c.prototype.loadUpdate = function() {
  182. this.loadingText.setText(this.load.progress.toString() + "%")
  183. }, c.prototype.create = function() {
  184. this.initLanguage(), this.game.plugins.add(new a.StateTransition(this.game, this)), this.game.state.start("SplashScreen", !0, !1)
  185. }, c.prototype.initLanguage = function() {
  186. var b = this.game.cache.getJSON("texts");
  187. a.Main.language = "en", a.Main.texts = b[a.Main.language]
  188. }, c.prototype.getAvailableLanguages = function(a) {
  189. var b = [];
  190. for (var c in a) a.hasOwnProperty(c) && b.push(c);
  191. return b
  192. }, c
  193. }(Phaser.State);
  194. a.Preloader = b
  195. }(game || (game = {}));
  196. var game;
  197. ! function(a) {
  198. var b = function(a) {
  199. function b(b, c, d, e, f) {
  200. var g = this;
  201. a.call(this, b, c, d, e, f), this.callbackDelay = 20, this.callbackTimer = 0, this.clicked = !1, this._callback = new Phaser.Signal, this.anchor.set(.5, .5), this.inputEnabled = !0, this.game.device.desktop && (this.input.useHandCursor = !0), this.inputEnabled && this.events.onInputDown.add(function() {
  202. g.game.device.webAudio && g.game.sound.play("tap"), g.game.add.tween(g.scale).to({
  203. x: 1.2,
  204. y: .8
  205. }, 200, Phaser.Easing.Back.Out, !0).onComplete.addOnce(function() {
  206. g.clicked = !0, g.callbackTimer = 0, g.game.add.tween(g.scale).to({
  207. x: 1,
  208. y: 1
  209. }, 200, Phaser.Easing.Back.Out, !0)
  210. }, g)
  211. })
  212. }
  213. return __extends(b, a), b.prototype.setCallbackDelay = function(a) {
  214. this.callbackDelay = a
  215. }, b.prototype.update = function() {
  216. this.clicked && (this.callbackTimer += this.game.time.elapsed, this.callbackTimer >= this.callbackDelay && (this._callback.dispatch(), this.clicked = !1, this.callbackTimer = 0))
  217. }, b.prototype.destroy = function() {
  218. a.prototype.destroy.call(this), this._callback.dispose(), this._callback = null
  219. }, Object.defineProperty(b.prototype, "callback", {
  220. get: function() {
  221. return this._callback
  222. },
  223. enumerable: !0,
  224. configurable: !0
  225. }), b
  226. }(Phaser.Image);
  227. a.SimpleButton = b
  228. }(game || (game = {}));
  229. var game;
  230. ! function(a) {
  231. var b = function(a) {
  232. function b(b, c, d, e, f, g) {
  233. a.call(this, b, c, d, e, f), this.spriteSheet = e, this.textureKey1 = f, this.textureKey2 = g, this.activeTextureKey = this.textureKey1, this._state = 1, this.events.onInputUp.add(this.switchTextures, this, 2)
  234. }
  235. return __extends(b, a), b.prototype.switchTextures = function() {
  236. this.activeTextureKey = this.activeTextureKey === this.textureKey1 ? this.textureKey2 : this.textureKey1, this.loadTexture(this.spriteSheet, this.activeTextureKey), this._state = this.activeTextureKey === this.textureKey1 ? 1 : 2
  237. }, Object.defineProperty(b.prototype, "state", {
  238. get: function() {
  239. return this._state
  240. },
  241. enumerable: !0,
  242. configurable: !0
  243. }), b
  244. }(game.SimpleButton);
  245. a.ToggleButton = b
  246. }(game || (game = {}));
  247. var game;
  248. ! function(a) {
  249. var b = function(a) {
  250. function b(b, c) {
  251. a.call(this, b, c), this.addTitle(), this.addParticles(), this.animateParticles()
  252. }
  253. return __extends(b, a), b.prototype.animateParticles = function() {
  254. var a = this;
  255. this.particles.forEach(function(b) {
  256. var c = a.game.rnd.realInRange(4e3, 6e3);
  257. a.game.time.events.repeat(c, Number.MAX_VALUE, a.showParticle, a, b)
  258. })
  259. }, b.prototype.showParticle = function(a) {
  260. var b = this;
  261. a.visible = !0, a.exists = !0, a.scale.set(0, 0), a.alpha = 1, this.game.add.tween(a.scale).to({
  262. x: 1,
  263. y: 1
  264. }, 250, Phaser.Easing.Back.Out, !0).onComplete.addOnce(function() {
  265. b.hideParticle(a)
  266. })
  267. }, b.prototype.hideParticle = function(a) {
  268. this.game.add.tween(a).to({
  269. alpha: 0
  270. }, 200, Phaser.Easing.Linear.None, !0, 1500).onComplete.addOnce(function() {
  271. a.visible = !1, a.exists = !1
  272. })
  273. }, b.prototype.onInputDown = function(a) {
  274. Math.round(a.worldX - this.position.x), Math.round(a.worldY - this.position.y)
  275. }, b.prototype.addTitle = function() {
  276. this.title = this.game.add.image(0, 0, "main_menu", "Title0000", this), this.title.anchor.set(.5, .5)
  277. }, b.prototype.addParticles = function() {
  278. this.particles = [], this.addParticle(-240, -29), this.addParticle(-170, -20), this.addParticle(-191, 11), this.addParticle(-141, -20), this.addParticle(-83, -28), this.addParticle(-35, -20), this.addParticle(-56, 9), this.addParticle(-5, -34), this.addParticle(26, -34), this.addParticle(53, -16), this.addParticle(91, -33), this.addParticle(128, -19), this.addParticle(158, -19), this.addParticle(213, -19), this.addParticle(239, 21), this.addParticle(161, 18)
  279. }, b.prototype.addParticle = function(a, b) {
  280. var c = this.game.add.image(a, b, "main_menu", "Spark0000", this);
  281. c.anchor.set(.5, .5), this.particles.push(c)
  282. }, b
  283. }(Phaser.Group);
  284. a.MainMenuTitle = b
  285. }(game || (game = {}));
  286. var game;
  287. ! function(a) {
  288. var b = function(b) {
  289. function c() {
  290. b.apply(this, arguments), this.fromPreloader = !1
  291. }
  292. return __extends(c, b), c.prototype.init = function(a) {
  293. this.fromPreloader = a
  294. }, c.prototype.create = function() {
  295. this.addBackground(), this.addOtherImages(), this.addButtons(), this.addPublisherLogo(), this.initCredits(), this.initAnimation(), this.fromPreloader && (this.soundButton.input.enabled = !1, this.soundButton.switchTextures(), this.game.input.onTap.addOnce(this.onFirstTap, this), this.game.onBlur.add(this.onFocusLost, this), this.game.onFocus.add(this.onFocus, this))
  296. }, c.prototype.onFocusLost = function() {
  297. a.Main.wasMuted = this.game.sound.mute, this.game.sound.mute = !0
  298. }, c.prototype.onFocus = function() {
  299. a.Main.wasMuted === !1 && (this.game.sound.mute = !1)
  300. }, c.prototype.addBackground = function() {
  301. this.game.add.image(0, 0, "main_menu", "main_menu_bg")
  302. }, c.prototype.addOtherImages = function() {
  303. this.title = this.game.add.image(a.Config.HALF_GAME_WIDTH, 130, "main_menu", "Title0000"), this.title.anchor.set(.5, .5), this.santa = this.game.add.image(a.Config.HALF_GAME_WIDTH, a.Config.GAME_HEIGHT - 20, "main_menu", "Santa0000"), this.santa.anchor.set(.5, 1), this.santa.angle = -1
  304. }, c.prototype.addButtons = function() {
  305. var b = this,
  306. c = a.Config.HALF_GAME_HEIGHT - 70,
  307. d = 140;
  308. this.playButton = new a.SimpleButton(this.game, a.Config.HALF_GAME_WIDTH, c, "buttons", "Button_Play0000"), this.playButton.setCallbackDelay(250), this.playButton.callback.addOnce(this.hideAndStartGame, this);
  309. var e = 66;
  310. this.creditsButton = new a.SimpleButton(this.game, 0, 0, "buttons", "Button_Credits0000"), this.creditsButton.position.set(a.Config.GAME_WIDTH - e, a.Config.GAME_HEIGHT - e + 5), this.creditsButton.callback.add(this.toggleCredits, this), this.soundButton = new a.ToggleButton(this.game, this.playButton.x - d, this.playButton.y, "buttons", "Button_Music_On0000", "Button_Music_Off0000"), this.soundButton.callback.add(function() {
  311. b.game.sound.mute = !b.game.sound.mute
  312. }), this.game.sound.mute && this.soundButton.switchTextures();
  313. var f = a.Main.spilAPI.Branding.getLink("more_games").action;
  314. this.moreGamesButton = new a.SimpleButton(this.game, this.playButton.x + d, this.playButton.y, "buttons", "Button_MoreGames0000"), this.moreGamesButton.callback.add(f, this), this.buttons = [this.playButton, this.soundButton, this.moreGamesButton, this.creditsButton], this.buttons.forEach(function(a) {
  315. b.world.add(a)
  316. })
  317. }, c.prototype.addPublisherLogo = function() {
  318. if (this.cache.checkImageKey("spilLogo")) {
  319. var b = a.Main.spilAPI.Branding.getLogo().action;
  320. this.publisherLogo = this.game.add.image(0, 0, "spilLogo"), this.publisherLogo.anchor.set(.5, .5), this.publisherLogo.scale.set(1.2, 1.2), this.publisherLogo.x = 20 + .5 * this.publisherLogo.width, this.publisherLogo.y = this.creditsButton.y, this.publisherLogo.inputEnabled = !0, this.publisherLogo.events.onInputDown.add(b, this), this.publisherLogo.input.useHandCursor = !0
  321. }
  322. }, c.prototype.initCredits = function() {
  323. this.credits = this.game.add.image(0, 0, "main_menu", "CreditsBoard0000"), this.credits.position.set(Math.round(.5 * (a.Config.GAME_WIDTH - this.credits.width)), Math.round(.5 * (a.Config.GAME_HEIGHT - this.credits.height))), this.credits.visible = !1
  324. }, c.prototype.toggleCredits = function() {
  325. this.credits.visible ? this.hideCredits() : this.showCredits()
  326. }, c.prototype.hideCredits = function() {
  327. var a = this;
  328. this.game.add.tween(this.credits).to({
  329. y: this.credits.y + 200,
  330. alpha: 0
  331. }, 500, Phaser.Easing.Back.In, !0).onComplete.addOnce(function() {
  332. a.playButton.input.enabled = !0, a.creditsButton.input.enabled = !0, a.credits.visible = !1
  333. }, this)
  334. }, c.prototype.showCredits = function() {
  335. var b = this;
  336. this.credits.visible = !0, this.credits.alpha = 0, this.credits.y = Math.round(.5 * (a.Config.GAME_HEIGHT - this.credits.height)) + 200, this.game.add.tween(this.credits).to({
  337. y: this.credits.y - 200,
  338. alpha: 1
  339. }, 500, Phaser.Easing.Back.Out, !0), this.playButton.input.enabled = !1, this.creditsButton.input.enabled = !1, this.game.input.onTap.addOnce(function() {
  340. b.hideCredits()
  341. }, this)
  342. }, c.prototype.onFirstTap = function() {
  343. this.stage.disableVisibilityChange = !1, this.tryFullscreen(), this.startMusic()
  344. }, c.prototype.tryFullscreen = function() {
  345. this.game.device.android && (this.game.scale.startFullScreen(!0), this.game.scale.setScreenSize(!0))
  346. }, c.prototype.startMusic = function() {
  347. var a = this.game.device.android ? .66 : .33;
  348. this.game.sound.play("main_loop", a, !0), this.soundButton.switchTextures(), this.soundButton.input.enabled = !0
  349. }, c.prototype.initAnimation = function() {
  350. var a = this;
  351. this.title.y -= 250, this.title.scale.set(0, 1), this.game.add.tween(this.title).to({
  352. y: this.title.y + 250
  353. }, 600, Phaser.Easing.Back.Out, !0, 300), this.game.add.tween(this.title.scale).to({
  354. x: 1
  355. }, 600, Phaser.Easing.Back.Out, !0, 500).onComplete.addOnce(this.onTitleAnimationComplete, this), this.santa.scale.set(0, 0), this.game.add.tween(this.santa.scale).to({
  356. x: 1,
  357. y: 1
  358. }, 500, Phaser.Easing.Back.Out, !0, 1200).onComplete.addOnce(this.onPandaAnimationComplete, this);
  359. var b = 1500;
  360. this.buttons.forEach(function(c) {
  361. c.scale.set(0, 0), a.game.add.tween(c.scale).to({
  362. x: 1,
  363. y: 1
  364. }, 300, Phaser.Easing.Back.Out, !0, b), b += 200
  365. }), this.game.time.events.repeat(2e3, 1e3, this.shakePlayButton, this)
  366. }, c.prototype.shakePlayButton = function() {
  367. this.game.add.tween(this.playButton.scale).to({
  368. x: 1.1,
  369. y: .9
  370. }, 150, Phaser.Easing.Cubic.Out, !0, 0, 3, !0)
  371. }, c.prototype.onTitleAnimationComplete = function() {
  372. a.Main.weakDevice === !1 && this.game.add.tween(this.title).to({
  373. y: this.title.y + 8
  374. }, 600, Phaser.Easing.Sinusoidal.Out, !0, 0, 1e4, !0)
  375. }, c.prototype.onPandaAnimationComplete = function() {
  376. this.game.add.tween(this.santa.scale).to({
  377. y: .95
  378. }, 600, Phaser.Easing.Sinusoidal.Out, !0, 0, 1e4, !0), this.game.add.tween(this.santa).to({
  379. angle: 1
  380. }, 1200, Phaser.Easing.Sinusoidal.Out, !0, 0, 1e4, !0)
  381. }, c.prototype.hideAndStartGame = function() {
  382. this.playButton.input.enabled = !1, this.playButton.inputEnabled = !1, this.game.changeState(a.Main.gameStats.tutorialViewed ? "Level" : "Tutorial")
  383. }, c.prototype.destroy = function() {
  384. this.buttons = null
  385. }, c
  386. }(Phaser.State);
  387. a.MainMenu = b
  388. }(game || (game = {}));
  389. var utils;
  390. ! function(a) {
  391. var b = function() {
  392. function a() {}
  393. return a.distanceSquared = function(a, b, c, d) {
  394. var e = c - a,
  395. f = d - b;
  396. return e * e + f * f
  397. }, a.distance = function(b, c, d, e) {
  398. var f = a.distanceSquared(b, c, d, e);
  399. return Math.sqrt(f)
  400. }, a.realInRange = function(a, b) {
  401. return Math.random() * (b - a) + a
  402. }, a.integerInRange = function(b, c) {
  403. return Math.round(a.realInRange(b, c))
  404. }, a.DEG_TO_RAD = .017453292519943295, a.RAD_TO_DEG = 57.29577951308232, a
  405. }();
  406. a.MathUtil = b
  407. }(utils || (utils = {}));
  408. var utils;
  409. ! function(a) {
  410. var b = function() {
  411. function a(a) {
  412. void 0 === a && (a = null), this.itemsNum = 0, this.pointer = 0, a && a.length > 0 && this.setItems(a)
  413. }
  414. return a.prototype.setItems = function(a) {
  415. this.items = a, this.itemsNum = this.items.length
  416. }, a.prototype.getItem = function() {
  417. for (var a = 0; a < this.itemsNum; a++) {
  418. var b = this.items[a];
  419. if (b.alive === !1) return b.onRemoveFromPool(), b
  420. }
  421. return null
  422. }, a.prototype.getItemByProperty = function(a, b) {
  423. for (var c = 0; c < this.itemsNum; c++) {
  424. var d = this.items[c];
  425. if (d.alive === !1 && d[a] === b) return d.onRemoveFromPool(), d
  426. }
  427. return null
  428. }, a.prototype.returnItem = function(a) {
  429. a.alive = !1, a.onAddToPool()
  430. }, a.prototype.doReset = function() {
  431. for (var a = 0; a < this.itemsNum; a++) {
  432. var b = this.items[a];
  433. b.alive && b.onAddToPool()
  434. }
  435. }, a.prototype.destroy = function() {
  436. this.items.length = 0, this.items = null
  437. }, a
  438. }();
  439. a.ObjectPool = b
  440. }(utils || (utils = {}));
  441. var utils;
  442. ! function(a) {
  443. var b = function() {
  444. function a() {}
  445. return a.createRectTexture = function(a, b, c, d, e) {
  446. void 0 === d && (d = "#000000");
  447. var f = Phaser.Color.hexToColor(d),
  448. g = !!e,
  449. h = a.add.bitmapData(b, c, e, g);
  450. return h.fill(f.r, f.g, f.b), h
  451. }, a.createCircleTexture = function(a, b, c, d) {
  452. void 0 === c && (c = "#000000");
  453. var e = Phaser.Color.hexToColor(c),
  454. f = !!d,
  455. g = a.add.bitmapData(2 * b, 2 * b, d, f);
  456. return g.circle(.5 * b, .5 * b, b), g.fill(e.r, e.g, e.b), g
  457. }, a
  458. }();
  459. a.DrawUtil = b
  460. }(utils || (utils = {}));
  461. var game;
  462. ! function(a) {
  463. var b = function(a) {
  464. function b(b, c, d) {
  465. a.call(this, b, c), this.initImage(d), this.initText()
  466. }
  467. return __extends(b, a), b.prototype.initImage = function(a) {
  468. this.image = this.game.add.image(0, 0, "level_graphics", a, this)
  469. }, b.prototype.initText = function() {
  470. this.textLabel = this.game.add.bitmapText(0, 0, "digits", "0", 30, this), this.textLabel.position.set(55, 6)
  471. }, b.prototype.updateText = function(a) {
  472. this.textLabel.setText(a.toString())
  473. }, b
  474. }(Phaser.Group);
  475. a.Label = b
  476. }(game || (game = {}));
  477. var game;
  478. ! function(a) {
  479. var b = function(b) {
  480. function c(a, c) {
  481. b.call(this, a, c), this.allCollected = !1, this.initFruitImage(), this.initCheckImage(), this.initText()
  482. }
  483. return __extends(c, b), c.prototype.setMinitask = function(a) {
  484. this.minitask = a, this.minitask.updatedSignal.add(this.updateText, this), this.minitask.completeSignal.addOnce(this.setAllCollected, this), this.reset(), this.updateFruitImage(), this.updateText(this.minitask.itemsToComplete)
  485. }, c.prototype.reset = function() {
  486. this.allCollected = !1, this.hideCheckImage(), this.text.visible = !0, this.fruitImage.alpha = 1
  487. }, c.prototype.hideCheckImage = function() {
  488. this.checkImage.exists = !1, this.checkImage.visible = !1
  489. }, c.prototype.updateFruitImage = function() {
  490. var b = a.ItemType[this.minitask.fruitType] + "_Task0000";
  491. this.fruitImage.loadTexture("graphics_1", b)
  492. }, c.prototype.initFruitImage = function() {
  493. this.fruitImage = this.game.add.image(0, 0, "graphics_1", "Figure_10000", this), this.fruitImage.anchor.set(.5, .5)
  494. }, c.prototype.initCheckImage = function() {
  495. this.checkImage = this.game.add.image(10, 17, "graphics_1", "Check0000", this), this.checkImage.anchor.set(.5, .5), this.checkImage.exists = !1, this.checkImage.visible = !1
  496. }, c.prototype.initText = function() {
  497. this.text = this.game.add.bitmapText(7, 2, "fruit_labels", "0", 28, this)
  498. }, c.prototype.updateText = function(a) {
  499. this.text.setText(a.toString())
  500. }, c.prototype.setAllCollected = function() {
  501. this.allCollected === !1 && (this.allCollected = !0, this.fruitImage.alpha = .4, this.text.visible = !1, this.showCheckedImage())
  502. }, c.prototype.showCheckedImage = function() {
  503. this.checkImage.exists = !0, this.checkImage.visible = !0, this.checkImage.scale.set(0, 0), this.game.add.tween(this.checkImage.scale).to({
  504. x: 1,
  505. y: 1
  506. }, 300, Phaser.Easing.Back.Out, !0)
  507. }, c.prototype.destroy = function() {
  508. this.fruitImage = null, this.checkImage = null, this.text = null, this.minitask && (this.minitask = null)
  509. }, c
  510. }(Phaser.Group);
  511. a.FruitLabel = b
  512. }(game || (game = {}));
  513. var game;
  514. ! function(a) {
  515. ! function(a) {
  516. a[a.Figure_1 = 0] = "Figure_1", a[a.Figure_2 = 1] = "Figure_2", a[a.Figure_3 = 2] = "Figure_3", a[a.Figure_4 = 3] = "Figure_4", a[a.Figure_5 = 4] = "Figure_5"
  517. }(a.ItemType || (a.ItemType = {}));
  518. a.ItemType
  519. }(game || (game = {}));
  520. var game;
  521. ! function(a) {
  522. var b = function() {
  523. function a(a, b) {
  524. this._itemsToComplete = 0, this._collectedItems = 0, this._complete = !1, this._fruitType = a, this._itemsToComplete = b, this._updatedSignal = new Phaser.Signal, this._completeSignal = new Phaser.Signal
  525. }
  526. return a.prototype.addCollectedItems = function(a) {
  527. this._complete === !1 && (this._collectedItems += a, this._updatedSignal.dispatch(this._itemsToComplete - this._collectedItems), this._collectedItems >= this._itemsToComplete && (this._complete = !0, this._completeSignal.dispatch()))
  528. }, a.prototype.destroy = function() {
  529. this._updatedSignal.dispose(), this._updatedSignal = null, this._completeSignal.dispose(), this._completeSignal = null
  530. }, Object.defineProperty(a.prototype, "updatedSignal", {
  531. get: function() {
  532. return this._updatedSignal
  533. },
  534. enumerable: !0,
  535. configurable: !0
  536. }), Object.defineProperty(a.prototype, "completeSignal", {
  537. get: function() {
  538. return this._completeSignal
  539. },
  540. enumerable: !0,
  541. configurable: !0
  542. }), Object.defineProperty(a.prototype, "fruitType", {
  543. get: function() {
  544. return this._fruitType
  545. },
  546. enumerable: !0,
  547. configurable: !0
  548. }), Object.defineProperty(a.prototype, "itemsToComplete", {
  549. get: function() {
  550. return this._itemsToComplete
  551. },
  552. enumerable: !0,
  553. configurable: !0
  554. }), Object.defineProperty(a.prototype, "complete", {
  555. get: function() {
  556. return this._complete
  557. },
  558. enumerable: !0,
  559. configurable: !0
  560. }), a
  561. }();
  562. a.MiniTask = b
  563. }(game || (game = {}));
  564. var game;
  565. ! function(a) {
  566. var b = function(b) {
  567. function c(a, c) {
  568. b.call(this, a, c), this.initLabels()
  569. }
  570. return __extends(c, b), c.prototype.initLabels = function() {
  571. this.labels = [];
  572. for (var b = 0, c = 84, d = 5, e = 0; d > e; e++) {
  573. var f = new a.FruitLabel(this.game, this);
  574. f.position.set(b, 0), f.exists = !1, f.visible = !1, this.labels.push(f), b += c
  575. }
  576. }, c.prototype.syncWithTask = function(a) {
  577. for (var b = this.labels.length, c = 0; b > c; c++) {
  578. var d = this.labels[c],
  579. e = a[c];
  580. e ? (d.setMinitask(e), d.exists = !0, d.visible = !0) : (d.exists = !1, d.visible = !1)
  581. }
  582. }, c.prototype.updateFruitLabel = function(a, b) {
  583. var c = this.getLabelByType(a);
  584. c && c.updateText(b)
  585. }, c.prototype.setAsChecked = function(a) {
  586. var b = this.getLabelByType(a);
  587. b && b.setAllCollected()
  588. }, c.prototype.getLabelByType = function(a) {
  589. for (var b = this.labels.length, c = 0; b > c; c++) {
  590. var d = this.labels[c];
  591. if (d.type === a) return d
  592. }
  593. return null
  594. }, c.prototype.destroy = function() {
  595. this.labels = null
  596. }, c
  597. }(Phaser.Group);
  598. a.FruitLabelCollection = b
  599. }(game || (game = {}));
  600. var game;
  601. ! function(a) {
  602. var b = function(b) {
  603. function c(c) {
  604. b.call(this, c, 0, 0, "graphics_1", "Santa0000"), this.anchor.set(.5, 1), a.Main.weakDevice === !1 && this.game.add.tween(this.scale).to({
  605. y: 1.05
  606. }, 700, Phaser.Easing.Sinusoidal.Out, !0, 0, Number.MAX_VALUE, !0)
  607. }
  608. return __extends(c, b), c.prototype.initAnimations = function() {
  609. this.idleAnim = this.addAnimation("idle", 0, 0), this.openMouthAnim = this.addAnimation("open_mouth", 1, 1), this.chewAnim = this.addAnimation("chew", 2, 35), this.chewAnim.onComplete.add(this.onChewComplete, this), this.play("idle")
  610. }, c.prototype.addAnimation = function(a, b, c) {
  611. var d = Phaser.Animation.generateFrameNames("Panda", b, c, "", 4),
  612. e = this.animations.add(a, d, 60);
  613. return e
  614. }, c.prototype.onChewComplete = function() {}, c.prototype.openMouth = function() {
  615. this.game.sound.usingWebAudio && Math.random() < .4 && this.game.sound.play("ohoho", .33)
  616. }, c.prototype.chew = function() {}, c.prototype.isMouthOpen = function() {
  617. return !1
  618. }, c.prototype.destroy = function() {
  619. b.prototype.destroy.call(this, !0)
  620. }, c
  621. }(Phaser.Sprite);
  622. a.Panda = b
  623. }(game || (game = {}));
  624. var game;
  625. ! function(a) {
  626. var b = function(a) {
  627. function b(b, c) {
  628. a.call(this, b, c, "task_timer"), this.initIcon(), this.initText(), this.tickSound = this.game.add.sound("clock", .33, 3)
  629. }
  630. return __extends(b, a), b.prototype.initIcon = function() {
  631. this.icon = this.game.add.image(0, 0, "graphics_1", "Timer0000", this), this.icon.anchor.set(.5, .5)
  632. }, b.prototype.initText = function() {
  633. this.text = this.game.add.bitmapText(.5 * this.icon.width + 4, -10, "timer", "00:00", 30, this)
  634. }, b.prototype.setTimer = function(a) {
  635. this.timer && (this.timer = null), this.timer = a, this.timer.secondPassedSignal.add(this.onSecondPassed, this), this.timer.stopSignal.add(this.onTimerStop, this), this.updateText(this.timer.remainingSeconds)
  636. }, b.prototype.onTimerStop = function() {
  637. this.tickSound.stop()
  638. }, b.prototype.onSecondPassed = function(a) {
  639. this.updateText(a), 10 >= a ? (this.playTickSound(), this.game.add.tween(this.text).to({
  640. y: this.text.y + 3
  641. }, 100, Phaser.Easing.Back.Out, !0, 0, 3, !0)) : this.tickSound.stop()
  642. }, b.prototype.playTickSound = function() {
  643. this.tickSound.isPlaying === !1 && this.tickSound.play()
  644. }, b.prototype.updateText = function(a) {
  645. var b = Math.floor(a / 60),
  646. c = a % 60,
  647. d = 10 > b ? "0" + b.toString() : b.toString(),
  648. e = 10 > c ? "0" + c.toString() : c.toString(),
  649. f = d + ":" + e;
  650. this.text.setText(f)
  651. }, b.prototype.destroy = function() {
  652. this.removeTimer(), this.tickSound.stop(), this.text = null, this.icon = null
  653. }, b.prototype.removeTimer = function() {
  654. this.timer = null
  655. }, b
  656. }(Phaser.Group);
  657. a.TaskTimerView = b
  658. }(game || (game = {}));
  659. var game;
  660. ! function(a) {
  661. var b = function(b) {
  662. function c(a, c) {
  663. b.call(this, a, c, "complete_board"), this.hideDuration = 600, this.exists = !1, this.visible = !1, this._playAgainSignal = new Phaser.Signal, this.initBack(), this.initTitleText(), this.initTextContent(), this.initButtons()
  664. }
  665. return __extends(c, b), c.prototype.initBack = function() {
  666. this.back = this.game.add.image(0, 0, "graphics_1", "TaskBoard_Back0000", this), this.back.anchor.set(.5, .5)
  667. }, c.prototype.initTitleText = function() {
  668. var b = a.Main.texts.game_over,
  669. c = {
  670. font: "48px GrilledCheeseBTNToasted",
  671. fill: "#FFFFFF",
  672. align: "center"
  673. };
  674. this.titleText = new Phaser.Text(this.game, 0, -106, b, c), this.titleText.anchor.set(.5, .5), this.titleText.setShadow(2, 2, "#666666", 2), this.add(this.titleText)
  675. }, c.prototype.initTextContent = function() {
  676. this.addText(a.Main.texts.max_level, -40), this.maxLevelText = this.addText("10", -5), this.addText(a.Main.texts.scores, 60), this.pointsText = this.addText("10450", 95)
  677. }, c.prototype.addText = function(a, b) {
  678. var c = {
  679. font: "34px GrilledCheeseBTNToasted",
  680. fill: "#FFFFFF",
  681. align: "center"
  682. },
  683. d = new Phaser.Text(this.game, 0, b, a, c);
  684. return d.anchor.set(.5, .5), d.setShadow(2, 2, "#666666", 2), this.add(d), d
  685. }, c.prototype.initButtons = function() {
  686. var b = this,
  687. c = 80,
  688. d = this.back.y + .5 * this.back.height + 20;
  689. this.playAgainButton = new a.SimpleButton(this.game, -c, d, "buttons", "Button_Restart0000"), this.playAgainButton.callback.add(this.onPlayAgainButtonClick, this), this.quitButton = new a.SimpleButton(this.game, c, d, "buttons", "Button_Menu0000"), this.quitButton.callback.add(this.onQuitButtonClick, this), this.buttons = [this.playAgainButton, this.quitButton], this.buttons.forEach(function(a) {
  690. a.exists = !1, a.visible = !1, b.add(a)
  691. })
  692. }, c.prototype.onPlayAgainButtonClick = function() {
  693. this.hide()
  694. }, c.prototype.onQuitButtonClick = function() {
  695. this.game.sound.play("main_loop", .33, !0), this.game.changeState("MainMenu")
  696. }, c.prototype.show = function(a, b) {
  697. this.exists = !0, this.visible = !0, this.maxLevelText.setText(a.toString()), this.pointsText.setText(b.toString()), this.showBoard(), this.showButtons()
  698. }, c.prototype.showBoard = function() {
  699. this.alpha = 0, this.position.set(a.Config.HALF_GAME_WIDTH, a.Config.HALF_GAME_HEIGHT - 50), this.game.add.tween(this).to({
  700. alpha: 1
  701. }, 100, Phaser.Easing.Linear.None, !0), this.game.add.tween(this.position).to({
  702. y: a.Config.HALF_GAME_HEIGHT
  703. }, 1500, Phaser.Easing.Cubic.Out, !0)
  704. }, c.prototype.showButtons = function() {
  705. var a = this,
  706. b = 1200;
  707. this.buttons.forEach(function(c) {
  708. c.exists = !0, c.visible = !0, c.alpha = 0, a.game.add.tween(c).to({
  709. alpha: 1
  710. }, 500, Phaser.Easing.Cubic.Out, !0, b), b += 200
  711. })
  712. }, c.prototype.hide = function() {
  713. var b = 100;
  714. this.game.add.tween(this).to({
  715. alpha: 0
  716. }, b, Phaser.Easing.Linear.None, !0, this.hideDuration - b), this.game.add.tween(this.position).to({
  717. y: a.Config.HALF_GAME_HEIGHT - 200
  718. }, this.hideDuration, Phaser.Easing.Back.In, !0).onComplete.addOnce(this.onHideComplete, this)
  719. }, c.prototype.onHideComplete = function() {
  720. this._playAgainSignal.dispatch(), this.exists = !1, this.visible = !1
  721. }, c.prototype.destroy = function() {
  722. b.prototype.destroy.call(this, !0, !1), this.buttons = null, this._playAgainSignal.dispose(), this._playAgainSignal = null
  723. }, Object.defineProperty(c.prototype, "playAgainSignal", {
  724. get: function() {
  725. return this._playAgainSignal
  726. },
  727. enumerable: !0,
  728. configurable: !0
  729. }), c
  730. }(Phaser.Group);
  731. a.GameOverBoard = b
  732. }(game || (game = {}));
  733. var game;
  734. ! function(a) {
  735. var b = function(b) {
  736. function c(c) {
  737. b.call(this, c, 0, 0, a.Main.texts.level_complete, {
  738. font: "94px GrilledCheeseBTNToasted",
  739. fill: "#F41F24",
  740. align: "center"
  741. }), this.showDelay = 650, this.showDuration = 500, this.waitDelay = 750, this.hideDuration = 400, this.stroke = "#FFFFFF", this.strokeThickness = 12, this.setShadow(2, 2, "#B4151A", 3), this.exists = !1, this.visible = !1, this.anchor.set(.5, .5), this.position.set(a.Config.HALF_GAME_WIDTH, a.Config.HALF_GAME_HEIGHT), this._hideCompleteSignal = new Phaser.Signal
  742. }
  743. return __extends(c, b), c.prototype.show = function() {
  744. this.game.time.events.add(this.showDelay, this.doShow, this)
  745. }, c.prototype.doShow = function() {
  746. this.game.sound.usingWebAudio && this.game.sound.play("level_up", .5), this.exists = !0, this.visible = !0, this.y = a.Config.HALF_GAME_HEIGHT + 100, this.alpha = 0, this.scale.set(0, 1), this.game.add.tween(this).to({
  747. alpha: 1
  748. }, 200, Phaser.Easing.Linear.None, !0), this.game.add.tween(this).to({
  749. y: a.Config.HALF_GAME_HEIGHT
  750. }, this.showDuration, Phaser.Easing.Back.Out, !0), this.game.add.tween(this.scale).to({
  751. x: 1
  752. }, this.showDuration, Phaser.Easing.Back.Out, !0).onComplete.addOnce(this.wait, this)
  753. }, c.prototype.wait = function() {
  754. this.game.time.events.add(this.waitDelay, this.hide, this)
  755. }, c.prototype.hide = function() {
  756. this.game.sound.usingWebAudio && this.game.sound.play("whoosh_out", .33);
  757. var b = 100,
  758. c = this.hideDuration - b;
  759. this.game.add.tween(this).to({
  760. alpha: 0
  761. }, b, Phaser.Easing.Linear.None, !0, c), this.game.add.tween(this).to({
  762. y: a.Config.HALF_GAME_HEIGHT - 100
  763. }, this.hideDuration, Phaser.Easing.Back.In, !0).onComplete.addOnce(this.onHideComplete, this)
  764. }, c.prototype.onHideComplete = function() {
  765. var a = this;
  766. this.exists = !1, this.visible = !1, this.game.time.events.add(400, function() {
  767. a._hideCompleteSignal.dispatch()
  768. }, this)
  769. }, c.prototype.destroy = function() {
  770. b.prototype.destroy.call(this, !0), this._hideCompleteSignal.dispose(), this._hideCompleteSignal = null
  771. }, Object.defineProperty(c.prototype, "hideCompleteSignal", {
  772. get: function() {
  773. return this._hideCompleteSignal
  774. },
  775. enumerable: !0,
  776. configurable: !0
  777. }), c
  778. }(Phaser.Text);
  779. a.LevelUpFX = b
  780. }(game || (game = {}));
  781. var game;
  782. ! function(a) {
  783. var b = function(b) {
  784. function c(c, d) {
  785. b.call(this, c, d, "task_board"), this.showDuration = 400, this.waitDelay = 2e3, this.hideDuration = 400, this.exists = !1, this.visible = !1, this._hideCompleteSignal = new Phaser.Signal, this.x = a.Config.HALF_GAME_WIDTH, this.initBack(), this.addLevelLabel(), this.initText(), this.initFruitLabels()
  786. }
  787. return __extends(c, b), c.prototype.initBack = function() {
  788. this.back = this.game.add.image(0, 0, "graphics_1", "TaskBoard_Back0000", this), this.back.anchor.set(.5, .5)
  789. }, c.prototype.addLevelLabel = function() {
  790. var b = a.Main.texts.level,
  791. c = {
  792. font: "48px GrilledCheeseBTNToasted",
  793. fill: "#FFFFFF",
  794. align: "center"
  795. };
  796. this.levelLabel = this.game.add.text(0, -110, b, c, this), this.levelLabel.anchor.set(.5, .5), this.levelLabel.setShadow(2, 2, "#666666"), this.add(this.levelLabel), this.game.device.firefox && (this.levelLabel.y += 10)
  797. }, c.prototype.initText = function() {
  798. var b = a.Main.texts.task_board,
  799. c = {
  800. font: "32px GrilledCheeseBTNToasted",
  801. fill: "#FFFFFF",
  802. align: "center"
  803. };
  804. this.text = this.game.add.text(0, -15, b, c, this), this.text.anchor.set(.5, .5), this.text.wordWrap = !0, this.text.wordWrapWidth = .8 * this.back.width, this.text.setShadow(2, 2, "#666666"), this.add(this.text), this.game.device.firefox === !1 && (this.text.y += 10)
  805. }, c.prototype.initFruitLabels = function() {
  806. var b = 0,
  807. c = 80,
  808. d = 4;
  809. this.labelsGroup = this.game.add.group(this), this.labels = [];
  810. for (var e = 0; d > e; e++) {
  811. var f = new a.FruitLabel(this.game, this.labelsGroup);
  812. f.position.set(b, 55), f.exists = !1, this.labelsGroup.add(f), this.labels.push(f), b += c
  813. }
  814. }, c.prototype.show = function(b, c) {
  815. this.game.sound.usingWebAudio && this.game.sound.play("whoosh", .33), this.exists = !0, this.visible = !0, this.updateLevelLabel(c), this.updateLabels(b), this.position.y = a.Config.HALF_GAME_HEIGHT + 100, this.alpha = 0, this.scale.set(0, 1), this.game.add.tween(this.scale).to({
  816. x: 1
  817. }, this.showDuration, Phaser.Easing.Back.Out, !0), this.game.add.tween(this).to({
  818. alpha: 1
  819. }, 200, Phaser.Easing.Linear.None, !0), this.game.add.tween(this.position).to({
  820. y: a.Config.HALF_GAME_HEIGHT
  821. }, this.showDuration, Phaser.Easing.Back.Out, !0).onComplete.addOnce(this.wait, this)
  822. }, c.prototype.updateLevelLabel = function(b) {
  823. var c = a.Main.texts.level + " " + b.toString();
  824. this.levelLabel.setText(c)
  825. }, c.prototype.updateLabels = function(a) {
  826. for (var b = 0; b < this.labels.length; b++) {
  827. var c = this.labels[b],
  828. d = a.miniTasks[b];
  829. d ? (c.exists = !0, c.visible = !0, c.setMinitask(d)) : (c.exists = !1, c.visible = !1)
  830. }
  831. this.alignLabels()
  832. }, c.prototype.alignLabels = function() {
  833. var a = 60,
  834. b = this.labels.reduce(function(a, b) {
  835. return b.visible && a++, a
  836. }, 0),
  837. c = b * a,
  838. d = .5 * -c;
  839. this.labelsGroup.position.set(d, 30)
  840. }, c.prototype.wait = function() {
  841. this.game.time.events.add(this.waitDelay, this.hide, this)
  842. }, c.prototype.hide = function() {
  843. this.game.sound.usingWebAudio && this.game.sound.play("whoosh_out", .33), this.game.add.tween(this).to({
  844. alpha: 0
  845. }, 100, Phaser.Easing.Linear.None, !0, 300), this.game.add.tween(this.position).to({
  846. y: a.Config.HALF_GAME_HEIGHT - 100
  847. }, this.hideDuration, Phaser.Easing.Back.In, !0).onComplete.addOnce(this.onHideComplete, this)
  848. }, c.prototype.onHideComplete = function() {
  849. this.exists = !1, this.visible = !1, this._hideCompleteSignal.dispatch()
  850. }, c.prototype.destroy = function() {
  851. b.prototype.destroy.call(this, !0, !1), this.labels = null, this._hideCompleteSignal.dispose(), this._hideCompleteSignal = null
  852. }, Object.defineProperty(c.prototype, "hideCompleteSignal", {
  853. get: function() {
  854. return this._hideCompleteSignal
  855. },
  856. enumerable: !0,
  857. configurable: !0
  858. }), c
  859. }(Phaser.Group);
  860. a.TaskBoard = b
  861. }(game || (game = {}));
  862. var game;
  863. ! function(a) {
  864. var b = function(b) {
  865. function c(c, d) {
  866. b.call(this, c, d, "pause_board"), this.initBack(), this.initText(), this.initButtons(), this.position.set(a.Config.HALF_GAME_WIDTH, a.Config.HALF_GAME_HEIGHT), this.exists = !1, this.visible = !1
  867. }
  868. return __extends(c, b), c.prototype.initBack = function() {
  869. var a = this.game.add.image(0, 0, "graphics_1", "TaskBoard_Back0000", this);
  870. a.anchor.set(.5, .5)
  871. }, c.prototype.initText = function() {
  872. var b = a.Main.texts.pause,
  873. c = {
  874. font: "56px GrilledCheeseBTNToasted",
  875. fill: "#FFFFFF",
  876. align: "center"
  877. },
  878. d = new Phaser.Text(this.game, 0, -54, b, c);
  879. d.anchor.set(.5, .5), d.setShadow(3, 3, "#4A93A5", 2), this.add(d), this.game.device.firefox === !1 ? d.lineSpacing = 0 : d.position.y += 10
  880. }, c.prototype.initButtons = function() {
  881. var b = this,
  882. c = 96,
  883. d = 120;
  884. this._resumeButton = new a.SimpleButton(this.game, 0, c, "buttons", "Button_Resume0000"), this.soundButton = new a.ToggleButton(this.game, this._resumeButton.x + d, c, "buttons", "Button_Music_On0000", "Button_Music_Off0000"), this.soundButton.callback.add(function() {
  885. b.game.sound.mute = !b.game.sound.mute
  886. }), this.game.sound.mute && this.soundButton.switchTextures(), this.menuButton = new a.SimpleButton(this.game, this._resumeButton.x - d, c, "buttons", "Button_Menu0000"), this.menuButton.callback.addOnce(this.gotoMainMenu, this), this.buttons = [this.menuButton, this._resumeButton, this.soundButton], this.buttons.forEach(function(a) {
  887. b.add(a)
  888. })
  889. }, c.prototype.gotoMainMenu = function() {
  890. this.game.changeState("MainMenu")
  891. }, c.prototype.show = function() {
  892. this.game.sound.usingWebAudio && this.game.sound.play("whoosh", .33), this.exists = !0, this.visible = !0, this.position.y = a.Config.HALF_GAME_HEIGHT + 200, this.alpha = 0, this.game.add.tween(this).to({
  893. alpha: 1
  894. }, 200, Phaser.Easing.Linear.None, !0), this.game.add.tween(this.position).to({
  895. y: a.Config.HALF_GAME_HEIGHT
  896. }, 500, Phaser.Easing.Back.Out, !0).onComplete.addOnce(this.onShowComplete, this)
  897. }, c.prototype.onShowComplete = function() {}, c.prototype.hide = function() {
  898. this.game.sound.usingWebAudio && this.game.sound.play("whoosh_out", .33), this.game.add.tween(this).to({
  899. alpha: 0
  900. }, 100, Phaser.Easing.Linear.None, !0, 400), this.game.add.tween(this.position).to({
  901. y: a.Config.HALF_GAME_HEIGHT - 200
  902. }, 500, Phaser.Easing.Back.In, !0).onComplete.addOnce(this.onHideComplete, this)
  903. }, c.prototype.onHideComplete = function() {
  904. this.exists = !1, this.visible = !1
  905. }, c.prototype.destroy = function() {
  906. b.prototype.destroy.call(this, !0, !1), this.buttons = null
  907. }, Object.defineProperty(c.prototype, "resumeButton", {
  908. get: function() {
  909. return this._resumeButton
  910. },
  911. enumerable: !0,
  912. configurable: !0
  913. }), c
  914. }(Phaser.Group);
  915. a.PauseBoard = b
  916. }(game || (game = {}));
  917. var game;
  918. ! function(a) {
  919. var b = function(b) {
  920. function c(a) {
  921. b.call(this, a, a.world, "gui"), this._restartSignal = new Phaser.Signal, this._pauseSignal = new Phaser.Signal, this.addSanta(), this.addBag(), this.initFruitLabels(), this.addTimer(), this.addLevelLabel(), this.addPauseButton(), this.addGameCompleteBoard(), this.addLevelUpFX(), this.addTaskBoard(), this.addPauseBoard(), this.addRestartOverlay()
  922. }
  923. return __extends(c, b), c.prototype.addRestartOverlay = function() {
  924. var a = utils.DrawUtil.createRectTexture(this.game, 1, 1, "#FFFFFF");
  925. this.restartOverlay = this.game.add.image(0, 0, a, null, this), this.restartOverlay.scale.set(game.Config.GAME_WIDTH, game.Config.GAME_HEIGHT), this.restartOverlay.exists = !1, this.restartOverlay.visible = !1
  926. }, c.prototype.showRestartOverlay = function() {
  927. var a = this;
  928. this.restartOverlay.exists = !0, this.restartOverlay.visible = !0, this.restartOverlay.alpha = 0, this.game.add.tween(this.restartOverlay).to({
  929. alpha: 1
  930. }, 100, Phaser.Easing.Linear.None, !0).onComplete.addOnce(function() {
  931. a.game.add.tween(a.restartOverlay).to({
  932. alpha: 0
  933. }, 800, Phaser.Easing.Linear.None, !0, 300).onComplete.addOnce(function() {
  934. a.restartOverlay.exists = !1, a.restartOverlay.visible = !1
  935. })
  936. })
  937. }, c.prototype.addSanta = function() {
  938. this._santa = new game.Panda(this.game), this._santa.position.set(80, 152), this.game.world.addAt(this._santa, 1)
  939. }, c.prototype.addBag = function() {
  940. this._bag = this.game.make.image(0, 0, "graphics_1", "Bag0000"), this._bag.position.set(this._santa.x + 70, 148), this._bag.anchor.set(.5, 1), this.game.world.addAt(this._bag, 1)
  941. }, c.prototype.addTimer = function() {
  942. this.timer = new game.TaskTimerView(this.game, this), this.timer.position.set(234, 30)
  943. }, c.prototype.addLevelLabel = function() {
  944. if ("en" === a.Main.language) {
  945. var b = this.game.add.bitmapText(0, 0, "level_label", "Level 1", 28, this);
  946. b.position.set(this.timer.x + this.timer.width + 6, 18), this.levelLabel = b
  947. } else {
  948. var c = {
  949. font: "28px GrilledCheeseBTNToasted",
  950. fill: "#FFFFFF",
  951. align: "center"
  952. },
  953. d = this.game.add.text(0, 28, "", c, this);
  954. d.anchor.set(.5, .5), d.stroke = "#296B98", d.setShadow(2, 2, "#296B98", 1), d.strokeThickness = 5, d.position.set(this.timer.x + this.timer.width + 46, 38), this.levelLabel = d
  955. }
  956. this.updateLevelLabel(1)
  957. }, c.prototype.addPauseButton = function() {
  958. var a = this;
  959. this.pauseButton = new game.SimpleButton(this.game, game.Config.GAME_WIDTH - 64, this._santa.y - 75, "buttons", "Button_Pause0000"), this.pauseButton.callback.add(function() {
  960. a._pauseSignal.dispatch("pause")
  961. }, this), this.add(this.pauseButton)
  962. }, c.prototype.initFruitLabels = function() {
  963. this._fruitsLabels = new game.FruitLabelCollection(this.game, this), this._fruitsLabels.position.set(235, 94)
  964. }, c.prototype.syncWithTask = function(a, b) {
  965. this.timer.setTimer(a.timer), this._fruitsLabels.syncWithTask(a.miniTasks), this.updateLevelLabel(b)
  966. }, c.prototype.updateLevelLabel = function(b) {
  967. var c = a.Main.texts.level + b.toString();
  968. this.levelLabel.setText(c)
  969. }, c.prototype.addGameCompleteBoard = function() {
  970. this.gameOverBoard = new game.GameOverBoard(this.game, this), this.gameOverBoard.position.set(game.Config.HALF_GAME_WIDTH, game.Config.HALF_GAME_HEIGHT), this.gameOverBoard.playAgainSignal.add(this._restartSignal.dispatch, this._restartSignal)
  971. }, c.prototype.gotoMainMenu = function() {
  972. this.game.changeState("main_menu")
  973. }, c.prototype.addLevelUpFX = function() {
  974. this._levelUpFX = new game.LevelUpFX(this.game), this.add(this._levelUpFX)
  975. }, c.prototype.addTaskBoard = function() {
  976. this._taskBoard = new game.TaskBoard(this.game, this), this.add(this._taskBoard), this._taskBoard.position.set(game.Config.HALF_GAME_WIDTH, 500)
  977. }, c.prototype.addPauseBoard = function() {
  978. var a = this;
  979. this.pauseBoard = new game.PauseBoard(this.game, this), this.pauseBoard.resumeButton.callback.add(function() {
  980. a._pauseSignal.dispatch("resume")
  981. }, this)
  982. }, c.prototype.hidePauseButton = function() {
  983. this.pauseButton.inputEnabled = !1, this.game.add.tween(this.pauseButton).to({
  984. alpha: 0
  985. }, 200, Phaser.Easing.Linear.None, !0)
  986. }, c.prototype.showPauseButton = function() {
  987. this.pauseButton.inputEnabled = !0, this.game.add.tween(this.pauseButton).to({
  988. alpha: 1
  989. }, 100, Phaser.Easing.Linear.None, !0)
  990. }, c.prototype.onPause = function() {
  991. this.hidePauseButton(), this.pauseBoard.show()
  992. }, c.prototype.onResume = function() {
  993. this.showPauseButton(), this.pauseBoard.hide()
  994. }, c.prototype.onGameOver = function(a, b) {
  995. this.hidePauseButton(), this.gameOverBoard.show(a, b)
  996. }, c.prototype.onRestart = function() {
  997. this.showRestartOverlay(), this.showPauseButton()
  998. }, c.prototype.destroy = function() {
  999. b.prototype.destroy.call(this, !0, !1), this._restartSignal.dispose(), this._restartSignal = null, this._pauseSignal.dispose(), this._pauseSignal = null
  1000. }, Object.defineProperty(c.prototype, "santa", {
  1001. get: function() {
  1002. return this._santa
  1003. },
  1004. enumerable: !0,
  1005. configurable: !0
  1006. }), Object.defineProperty(c.prototype, "bag", {
  1007. get: function() {
  1008. return this._bag
  1009. },
  1010. enumerable: !0,
  1011. configurable: !0
  1012. }), Object.defineProperty(c.prototype, "restartSignal", {
  1013. get: function() {
  1014. return this._restartSignal
  1015. },
  1016. enumerable: !0,
  1017. configurable: !0
  1018. }), Object.defineProperty(c.prototype, "pauseSignal", {
  1019. get: function() {
  1020. return this._pauseSignal
  1021. },
  1022. enumerable: !0,
  1023. configurable: !0
  1024. }), Object.defineProperty(c.prototype, "taskBoard", {
  1025. get: function() {
  1026. return this._taskBoard
  1027. },
  1028. enumerable: !0,
  1029. configurable: !0
  1030. }), Object.defineProperty(c.prototype, "levelUpFX", {
  1031. get: function() {
  1032. return this._levelUpFX
  1033. },
  1034. enumerable: !0,
  1035. configurable: !0
  1036. }), c
  1037. }(Phaser.Group);
  1038. a.LevelGUI = b
  1039. }(game || (game = {}));
  1040. var game;
  1041. ! function(a) {
  1042. var b = function() {
  1043. function a() {
  1044. this.level = 1, this.points = 0, this.maxChain = 0
  1045. }
  1046. return a.prototype.doReset = function() {
  1047. this.points = 0, this.maxChain = 0
  1048. }, a
  1049. }();
  1050. a.RoundResult = b
  1051. }(game || (game = {}));
  1052. var game;
  1053. ! function(a) {
  1054. var b = function(a) {
  1055. function b(b, c, d, e) {
  1056. a.call(this, b, 0, 0, "graphics_1", c), this.item = null, this._row = d, this._column = e
  1057. }
  1058. return __extends(b, a), b.prototype.isFree = function() {
  1059. return null === this.item
  1060. }, Object.defineProperty(b.prototype, "column", {
  1061. get: function() {
  1062. return this._column
  1063. },
  1064. enumerable: !0,
  1065. configurable: !0
  1066. }), Object.defineProperty(b.prototype, "row", {
  1067. get: function() {
  1068. return this._row
  1069. },
  1070. enumerable: !0,
  1071. configurable: !0
  1072. }), b.WIDTH = 84, b.HEIGHT = 84, b
  1073. }(Phaser.Image);
  1074. a.Cell = b
  1075. }(game || (game = {}));
  1076. var game;
  1077. ! function(a) {
  1078. var b = function(b) {
  1079. function c(a, c) {
  1080. b.call(this, a, c, "grid"), this._rows = 8, this._columns = 7, this.initCells(), this.addFrame()
  1081. }
  1082. return __extends(c, b), c.prototype.initCells = function() {
  1083. this.cells = [];
  1084. for (var a = !0, b = 0; b < this._rows; b++)
  1085. for (var c = 0; c < this._columns; c++) {
  1086. var d = a ? "Dark_Cell0000" : "Bright_Cell0000";
  1087. a = !a, this.addCell(b, c, d)
  1088. }
  1089. }, c.prototype.addCell = function(b, c, d) {
  1090. var e = b * this._columns + c;
  1091. if (this.cells[e]) return null;
  1092. var f = new game.Cell(this.game, d, b, c);
  1093. return f.x = a.Cell.WIDTH * c, f.y = a.Cell.HEIGHT * b, this.cells[e] = f, this.add(f), f
  1094. }, c.prototype.addFrame = function() {
  1095. var a = this.game.add.image(0, 0, "graphics_1", "Board_Frame0000", this);
  1096. a.x = -26, a.y = -24
  1097. }, c.prototype.getCellAt = function(a, b) {
  1098. var c = a * this._columns + b;
  1099. return this.cells[c]
  1100. }, c.prototype.getFreeCell = function() {
  1101. for (var a = 0; a < this.cells.length; a++) {
  1102. var b = this.cells[a];
  1103. if (b.isFree()) return b
  1104. }
  1105. return null
  1106. }, c.prototype.getFreeCellsNum = function() {
  1107. var a = 0;
  1108. return this.cells.forEach(function(b) {
  1109. b.isFree() && a++
  1110. }), a
  1111. }, c.prototype.getCellUnderPoint = function(a, b) {
  1112. var c = a - this.position.x,
  1113. d = b - this.position.y,
  1114. e = Math.floor(d / game.Cell.WIDTH),
  1115. f = Math.floor(c / game.Cell.HEIGHT);
  1116. return this.getCellAt(e, f)
  1117. }, c.prototype.getWidth = function() {
  1118. var a = this.cells[0].x,
  1119. b = this.cells[this.cells.length - 1].x + this.cells[this.cells.length - 1].width;
  1120. return b - a
  1121. }, c.prototype.getHeight = function() {
  1122. var a = this.cells[0].y,
  1123. b = this.cells[this.cells.length - 1].y + this.cells[this.cells.length - 1].height;
  1124. return b - a
  1125. }, c.prototype.destroy = function() {
  1126. b.prototype.destroy.call(this, !0, !1), this.cells = null
  1127. }, Object.defineProperty(c.prototype, "rows", {
  1128. get: function() {
  1129. return this._rows
  1130. },
  1131. enumerable: !0,
  1132. configurable: !0
  1133. }), Object.defineProperty(c.prototype, "columns", {
  1134. get: function() {
  1135. return this._columns
  1136. },
  1137. enumerable: !0,
  1138. configurable: !0
  1139. }), c
  1140. }(Phaser.Group);
  1141. a.Grid = b
  1142. }(game || (game = {}));
  1143. var game;
  1144. ! function(a) {
  1145. var b = function(b) {
  1146. function c(c, d) {
  1147. var e = a.ItemType[d];
  1148. this.normalTexture = e + "0000", this.highlightedTexture = e + "_Highlighted0000", b.call(this, c, 0, 0, "graphics_1", this.normalTexture), this.anchor.set(.5, .5)
  1149. }
  1150. return __extends(c, b), c.prototype.setNormalTexture = function() {
  1151. this.loadTexture("graphics_1", this.normalTexture)
  1152. }, c.prototype.setHighlightedTexture = function() {
  1153. this.loadTexture("graphics_1", this.highlightedTexture)
  1154. }, c
  1155. }(Phaser.Image);
  1156. a.ItemBody = b
  1157. }(game || (game = {}));
  1158. var game;
  1159. ! function(a) {
  1160. var b = function(a) {
  1161. function b(b) {
  1162. a.call(this, b, 0, 0, "graphics_1", "FutureBonus_10000"), this._activateSignal = new Phaser.Signal, this.anchor.set(.5, .5), this.pulseTween = this.game.add.tween(this.scale).to({
  1163. x: .8,
  1164. y: .8
  1165. }, 500, Phaser.Easing.Sinusoidal.Out, !0, 0, Number.MAX_VALUE, !0), this.pulseTween.pause(), this.alive = !1, this.exists = !1, this.visible = !1
  1166. }
  1167. return __extends(b, a), b.prototype.activate = function() {
  1168. this._activateSignal.dispatch(this), this.onAddToPool()
  1169. }, b.prototype.onAddToPool = function() {
  1170. this.alive = !1, this.exists = !1, this.visible = !1, this.pulseTween.pause()
  1171. }, b.prototype.onRemoveFromPool = function() {
  1172. this.alive = !0, this.exists = !0, this.visible = !0, this.pulseTween.resume()
  1173. }, b.prototype.destroy = function() {
  1174. a.prototype.destroy.call(this, !0), this.pulseTween && (this.pulseTween.stop(), this.pulseTween = null), this._activateSignal.dispose(), this._activateSignal = null
  1175. }, Object.defineProperty(b.prototype, "activateSignal", {
  1176. get: function() {
  1177. return this._activateSignal
  1178. },
  1179. enumerable: !0,
  1180. configurable: !0
  1181. }), b
  1182. }(Phaser.Image);
  1183. a.FuturePowerUp = b
  1184. }(game || (game = {}));
  1185. var game;
  1186. ! function(a) {
  1187. var b = function(a) {
  1188. function b(b) {
  1189. a.call(this, b, 0, 0, "graphics_1", "ItemBonus0000"), this.followItem = !1, this.exists = !1, this.visible = !1, this.alive = !1, this.anchor.set(.5, .5), this._activateSignal = new Phaser.Signal, this.initPulseTween()
  1190. }
  1191. return __extends(b, a), b.prototype.initPulseTween = function() {
  1192. this.scale.set(.85, 1), this.pulseTween = this.game.add.tween(this.scale).to({
  1193. x: 1,
  1194. y: .85
  1195. }, 500, Phaser.Easing.Sinusoidal.Out, !1, 0, 1e3, !0)
  1196. }, b.prototype.init = function(a) {
  1197. this.angle = this.game.rnd.normal() > 0 ? 0 : 90, this._item = a, this.position.set(this._item.x, this._item.y), this.parent.sendToBack(this), this.followItem = !0, this.show()
  1198. }, b.prototype.show = function() {
  1199. this.alpha = 0, this.game.add.tween(this).to({
  1200. alpha: 1
  1201. }, 100, Phaser.Easing.Linear.None, !0), this.startPulseTween()
  1202. }, b.prototype.startPulseTween = function() {
  1203. this.scale.set(.85, 1), this.pulseTween.isRunning ? this.pulseTween.resume() : this.pulseTween.start()
  1204. }, b.prototype.activate = function() {
  1205. this._activateSignal.dispatch(this), this.pulseTween.pause(), this.followItem = !1, this.hide()
  1206. }, b.prototype.hide = function() {
  1207. this.game.add.tween(this).to({
  1208. alpha: 0
  1209. }, 200, Phaser.Easing.Linear.None, !0, 200), this.game.add.tween(this.scale).to({
  1210. x: 3,
  1211. y: 2.5
  1212. }, 300, Phaser.Easing.Back.Out, !0).onComplete.addOnce(this.onAddToPool, this)
  1213. }, b.prototype.update = function() {
  1214. this.exists && this.followItem && (this.y = this._item.y)
  1215. }, b.prototype.returnToPool = function() {
  1216. this.onAddToPool()
  1217. }, b.prototype.onAddToPool = function() {
  1218. this.exists = !1, this.visible = !1, this.alive = !1
  1219. }, b.prototype.onRemoveFromPool = function() {
  1220. this.exists = !0, this.visible = !0, this.alive = !0
  1221. }, b.prototype.destroy = function() {
  1222. a.prototype.destroy.call(this, !0), this.pulseTween.stop(), this.pulseTween = null, this._activateSignal.dispose(), this._activateSignal = null, this._item = null
  1223. }, Object.defineProperty(b.prototype, "activateSignal", {
  1224. get: function() {
  1225. return this._activateSignal
  1226. },
  1227. enumerable: !0,
  1228. configurable: !0
  1229. }), Object.defineProperty(b.prototype, "linkedItem", {
  1230. get: function() {
  1231. return this._item
  1232. },
  1233. enumerable: !0,
  1234. configurable: !0
  1235. }), b
  1236. }(Phaser.Image);
  1237. a.PowerUp = b
  1238. }(game || (game = {}));
  1239. var game;
  1240. ! function(a) {
  1241. var b = function(b) {
  1242. function c(a, c) {
  1243. b.call(this, a, 0, 0, "graphics_1"), this.futurePowerUp = null, this.powerUp = null, this.alive = !1, this.dropDistance = 0, this.collected = !1, this.alive = !1, this.exists = !1, this.visible = !1, this.anchor.set(.5, .5), this._itemType = c, this._collectCompleteSignal = new Phaser.Signal, this.initTextures(), this.setNormalTexture(), this.initTweens()
  1244. }
  1245. return __extends(c, b), c.prototype.initTextures = function() {
  1246. var b = a.ItemType[this._itemType];
  1247. this.normalTexture = b + "0000", this.highlightedTexture = b + "_Highlighted0000"
  1248. }, c.prototype.setNormalTexture = function() {
  1249. this.loadTexture("graphics_1", this.normalTexture)
  1250. }, c.prototype.setHighlightedTexture = function() {
  1251. this.loadTexture("graphics_1", this.highlightedTexture)
  1252. }, c.prototype.initTweens = function() {
  1253. this.collectTween = this.game.add.tween(this.scale).to({
  1254. x: 0,
  1255. y: 0
  1256. }, 300, Phaser.Easing.Back.In), this.collectTween.onComplete.add(this.onCollectComplete, this), this.scale.set(0, 0), this.showOnGridTween = this.game.add.tween(this.scale).to({
  1257. x: 1,
  1258. y: 1
  1259. }, 500, Phaser.Easing.Back.Out, !1, 200), this.scale.set(1, 1), this.removeFromGridTween = this.game.add.tween(this.scale).to({
  1260. x: 0,
  1261. y: 0
  1262. }, 500, Phaser.Easing.Back.In), this.removeFromGridTween.onComplete.add(this.onAddToPool, this), this.highlightTween = this.game.add.tween(this.scale).to({
  1263. x: 1.2,
  1264. y: .8
  1265. }, 100, Phaser.Easing.Cubic.Out).to({
  1266. x: 1,
  1267. y: 1
  1268. }, 300, Phaser.Easing.Back.Out), this.scale.set(1, 1)
  1269. }, c.prototype.highlight = function() {
  1270. this.setHighlightedTexture(), a.Main.weakDevice === !1 && this.highlightTween.start()
  1271. }, c.prototype.unhighlight = function() {
  1272. null === this.powerUp && this.setNormalTexture(), this.futurePowerUp && (this.futurePowerUp.onAddToPool(), this.futurePowerUp = null)
  1273. }, c.prototype.showOnGrid = function(a) {
  1274. a === !1 && (this.scale.set(0, 0), this.showOnGridTween.start())
  1275. }, c.prototype.collectToPanda = function(a) {
  1276. this.onCollectStart(), this.unhighlight();
  1277. var b = utils.MathUtil.distance(this.position.x, this.position.y, a.x, a.y),
  1278. c = Phaser.Math.clamp(b, 400, 800);
  1279. this.game.add.tween(this).to({
  1280. x: a.x,
  1281. y: a.y - 56
  1282. }, c, Phaser.Easing.Back.In, !0), this.game.add.tween(this.scale).to({
  1283. x: .33,
  1284. y: .33
  1285. }, 300, Phaser.Easing.Back.In, !0, c - 250).onComplete.addOnce(this.onCollectComplete, this)
  1286. }, c.prototype.collect = function() {
  1287. this.onCollectStart(), this.collectTween.start()
  1288. }, c.prototype.onCollectStart = function() {
  1289. this.collected = !0, this.futurePowerUp && (this.futurePowerUp.activate(), this.futurePowerUp = null), this.powerUp && (this.powerUp.activate(), this.powerUp = null)
  1290. }, c.prototype.onCollectComplete = function() {
  1291. this._collectCompleteSignal.dispatch(this), this.onAddToPool()
  1292. }, c.prototype.moveTo = function(a) {
  1293. this.game.add.tween(this).to({
  1294. y: a
  1295. }, 500, Phaser.Easing.Cubic.Out, !0)
  1296. }, c.prototype.setFuturePowerUp = function(a) {
  1297. null === this.futurePowerUp && (this.futurePowerUp = a)
  1298. }, c.prototype.hasPowerUp = function() {
  1299. return null !== this.powerUp
  1300. }, c.prototype.setPowerUp = function(a) {
  1301. null === this.powerUp && (this.powerUp = a, this.setHighlightedTexture())
  1302. }, c.prototype.linkCell = function(a) {
  1303. this.cell && this.clearCell(), this.cell = a, this.cell.item = this
  1304. }, c.prototype.clearCell = function() {
  1305. this.cell && (this.cell.item = null, this.cell = null)
  1306. }, c.prototype.removeFromGrid = function(a) {
  1307. this.clearCell(), a ? this.onAddToPool() : this.removeFromGridTween.start()
  1308. }, c.prototype.collectToBasket = function() {
  1309. var a = 100 * this.cell.row + 100 * this.cell.column;
  1310. this.clearCell(), this.game.add.tween(this).to({
  1311. alpha: 0
  1312. }, 100, Phaser.Easing.Linear.None, !0, a + 200), this.game.add.tween(this.scale).to({
  1313. x: 1.5,
  1314. y: 1.5
  1315. }, 300, Phaser.Easing.Back.In, !0, a).onComplete.addOnce(this.onAddToPool, this)
  1316. }, c.prototype.onAddToPool = function() {
  1317. this.alive = !1, this.exists = !1, this.visible = !1, this.futurePowerUp && (this.futurePowerUp.onAddToPool(), this.futurePowerUp = null), this.powerUp && (this.powerUp.returnToPool(), this.powerUp = null)
  1318. }, c.prototype.onRemoveFromPool = function() {
  1319. this.alive = !0, this.exists = !0, this.visible = !0, this.collected = !1, this.alpha = 1, this.scale.set(1, 1), this.setNormalTexture()
  1320. }, c.prototype.destroy = function() {
  1321. b.prototype.destroy.call(this, !0), this._collectCompleteSignal.dispose(), this._collectCompleteSignal = null, this.futurePowerUp = null, this.powerUp = null, this.clearCell(), this.destroyTweens()
  1322. }, c.prototype.destroyTweens = function() {
  1323. this.showOnGridTween.stop(), this.showOnGridTween = null, this.collectTween.stop(), this.collectTween = null, this.highlightTween.stop(), this.highlightTween = null, this.removeFromGridTween.stop(), this.removeFromGridTween = null
  1324. }, Object.defineProperty(c.prototype, "itemType", {
  1325. get: function() {
  1326. return this._itemType
  1327. },
  1328. enumerable: !0,
  1329. configurable: !0
  1330. }), Object.defineProperty(c.prototype, "collectCompleteSignal", {
  1331. get: function() {
  1332. return this._collectCompleteSignal
  1333. },
  1334. enumerable: !0,
  1335. configurable: !0
  1336. }), c.RADIUS = 40, c.RADIUS_SQUARED = c.RADIUS * c.RADIUS, c.CONTACT_RADIUS = 120, c.CONTACT_RADIUS_SQUARED = c.CONTACT_RADIUS * c.CONTACT_RADIUS, c.ITEM_TYPES = [0, 1, 2, 3, 4], c
  1337. }(Phaser.Image);
  1338. a.Item = b
  1339. }(game || (game = {}));
  1340. var game;
  1341. ! function(a) {
  1342. var b = function() {
  1343. function b(a, b) {
  1344. this._game = a, this.itemsLayer = b, this.initItems()
  1345. }
  1346. return b.prototype.initItems = function() {
  1347. var b = this;
  1348. this.items = [];
  1349. var c = 20,
  1350. d = [0, 1, 2, 3, 4];
  1351. d.forEach(function(d) {
  1352. for (var e = 0; c > e; e++) {
  1353. var f = new a.Item(b._game, d);
  1354. b.itemsLayer.add(f), b.items.push(f)
  1355. }
  1356. })
  1357. }, b.prototype.getItem = function(b) {
  1358. var c = this.getAvailableItem(b);
  1359. return null === c && (c = new a.Item(this._game, b), this.items.push(c), this.itemsLayer.add(c)), c.onRemoveFromPool(), c
  1360. }, b.prototype.getAvailableItem = function(a) {
  1361. for (var b = this.items.length, c = 0; b > c; c++) {
  1362. var d = this.items[c];
  1363. if (d.exists === !1 && d.itemType === a) return d
  1364. }
  1365. return null
  1366. }, b.prototype.returnItem = function(a) {
  1367. a.onAddToPool()
  1368. }, b.prototype.doReset = function() {
  1369. for (var a = this.items.length, b = 0; a > b; b++) {
  1370. var c = this.items[b];
  1371. c.exists && this.returnItem(c)
  1372. }
  1373. }, b.prototype.destroy = function() {
  1374. this._game = null, this.itemsLayer = null, this.items.length = 0, this.items = null
  1375. }, b
  1376. }();
  1377. a.ItemsPool = b
  1378. }(game || (game = {}));
  1379. var game;
  1380. ! function(a) {
  1381. var b = function() {
  1382. function a(a, b) {
  1383. this.game = a, this.grid = b, this.itemRnd = new Phaser.RandomDataGenerator([10])
  1384. }
  1385. return a.prototype.setAllowedItemTypes = function(a) {
  1386. this.allowedItemTypes = a
  1387. }, a.prototype.setAddItemCallback = function(a, b) {
  1388. this.addItemCallback = a, this.addItemCallbackContext = b
  1389. }, a.prototype.generateItems = function(a, b) {
  1390. for (var c = 0; a > c; c++) {
  1391. var d = b ? b : this.itemRnd.pick(this.allowedItemTypes);
  1392. this.dispatchAddItemCallback(d)
  1393. }
  1394. }, a.prototype.dispatchAddItemCallback = function(a) {
  1395. this.addItemCallback.call(this.addItemCallbackContext, a)
  1396. }, a.prototype.destroy = function() {
  1397. this.game = null, this.grid = null, this.itemRnd = null, this.addItemCallback = null, this.addItemCallbackContext = null, this.allowedItemTypes = null
  1398. }, a
  1399. }();
  1400. a.ItemsGenerator = b
  1401. }(game || (game = {}));
  1402. var game;
  1403. ! function(a) {
  1404. var b = function(a) {
  1405. function b() {
  1406. a.call(this)
  1407. }
  1408. return __extends(b, a), b
  1409. }(utils.ObjectPool);
  1410. a.ChainLinksPool = b
  1411. }(game || (game = {}));
  1412. var game;
  1413. ! function(a) {
  1414. var b = function(b) {
  1415. function c(a) {
  1416. b.call(this, a, 0, 0, "graphics_1", "Chain_Link0000"), this.anchor.set(.5, .5), this.exists = !1, this.visible = !1, this.initTween()
  1417. }
  1418. return __extends(c, b), c.prototype.initTween = function() {
  1419. this.scale.set(0, 1), this.showTween = this.game.add.tween(this.scale).to({
  1420. x: 1
  1421. }, 150, Phaser.Easing.Linear.None), this.scale.set(1, 1)
  1422. }, c.prototype.show = function() {
  1423. this.visible = !0, this.exists = !0, a.Main.weakDevice === !1 && (this.scale.set(0, 1), this.showTween.start())
  1424. }, c.prototype.hide = function() {
  1425. this.exists = !1, this.visible = !1
  1426. }, c.prototype.destroy = function() {
  1427. b.prototype.destroy.call(this, !0), this.showTween.stop(), this.showTween = null
  1428. }, c
  1429. }(Phaser.Image);
  1430. a.ChainLink = b
  1431. }(game || (game = {}));
  1432. var game;
  1433. ! function(a) {
  1434. var b = function() {
  1435. function a(a, b, c) {
  1436. this.stack = [], this.foundChain = [], this.game = a, this.grid = b, this.items = c
  1437. }
  1438. return a.prototype.getPossibleMove = function() {
  1439. for (var a = this.items.length, b = 0; a > b; b++) {
  1440. var c = this.items[b],
  1441. d = this.getPossibleChain(c);
  1442. if (d && d.length >= 3) return d
  1443. }
  1444. return null
  1445. }, a.prototype.getPossibleChain = function(a) {
  1446. this.stack.length = 0, this.stack.push(a), this.foundChain.length = 0;
  1447. for (var b = a.itemType; this.stack.length > 0;) {
  1448. var c = this.stack.pop();
  1449. if (this.foundChain.push(c), this.foundChain.length > 2) return this.foundChain;
  1450. this.putInStack(c, b, -1, -1), this.putInStack(c, b, -1, 0), this.putInStack(c, b, -1, 1), this.putInStack(c, b, 0, 1), this.putInStack(c, b, 1, 1), this.putInStack(c, b, 1, 0), this.putInStack(c, b, 1, -1), this.putInStack(c, b, 0, -1)
  1451. }
  1452. return null
  1453. }, a.prototype.putInStack = function(a, b, c, d) {
  1454. var e = this.getItem(a, c, d);
  1455. e && this.itemGoodForChain(e, b) && this.stack.push(e)
  1456. }, a.prototype.getItem = function(a, b, c) {
  1457. var d = a.cell,
  1458. e = d.row + b,
  1459. f = d.column + c;
  1460. return e >= 0 && e < this.grid.rows && f >= 0 && f < this.grid.columns ? this.grid.getCellAt(e, f).item : void 0
  1461. }, a.prototype.itemGoodForChain = function(a, b) {
  1462. return a.itemType === b && -1 === this.foundChain.indexOf(a)
  1463. }, a.prototype.destroy = function() {
  1464. this.game = null, this.grid = null, this.items = null, this.stack = null, this.foundChain = null
  1465. }, a
  1466. }();
  1467. a.FindChainStrategy = b
  1468. }(game || (game = {}));
  1469. var game;
  1470. ! function(a) {
  1471. var b = function() {
  1472. function a(a, b) {
  1473. this.totalSeconds = 0, this.passedSeconds = 0, this._remainingSeconds = 0, this.paused = !1, this.game = a, this.totalSeconds = Math.floor(b / 1e3), this._remainingSeconds = this.totalSeconds, this._secondPassedSignal = new Phaser.Signal, this._completeSignal = new Phaser.Signal, this._stopSignal = new Phaser.Signal
  1474. }
  1475. return a.prototype.start = function() {
  1476. this.timerEvent = this.game.time.events.repeat(1e3, Number.MAX_VALUE, this.onSecondPassed, this)
  1477. }, a.prototype.addSeconds = function(a) {
  1478. this.timerEvent && (this.totalSeconds += a)
  1479. }, a.prototype.onSecondPassed = function() {
  1480. this.paused === !1 && (this.passedSeconds++, this._remainingSeconds = this.totalSeconds - this.passedSeconds, this._secondPassedSignal.dispatch(this._remainingSeconds), this._remainingSeconds <= 0 && (this.stopTimer(), this._completeSignal.dispatch()))
  1481. }, a.prototype.stopTimer = function() {
  1482. this.timerEvent && (this.game.time.events.remove(this.timerEvent), this.timerEvent = null, this._stopSignal.dispatch())
  1483. }, a.prototype.onPause = function() {
  1484. this.paused = !0, this._stopSignal.dispatch()
  1485. }, a.prototype.onResume = function() {
  1486. this.paused = !1
  1487. }, a.prototype.destroy = function() {
  1488. this.stopTimer(), this._secondPassedSignal.dispose(), this._secondPassedSignal = null, this._completeSignal.dispose(), this._completeSignal = null, this._stopSignal.dispose(), this._stopSignal = null
  1489. }, Object.defineProperty(a.prototype, "remainingSeconds", {
  1490. get: function() {
  1491. return this._remainingSeconds
  1492. },
  1493. enumerable: !0,
  1494. configurable: !0
  1495. }), Object.defineProperty(a.prototype, "secondPassedSignal", {
  1496. get: function() {
  1497. return this._secondPassedSignal
  1498. },
  1499. enumerable: !0,
  1500. configurable: !0
  1501. }), Object.defineProperty(a.prototype, "completeSignal", {
  1502. get: function() {
  1503. return this._completeSignal
  1504. },
  1505. enumerable: !0,
  1506. configurable: !0
  1507. }), Object.defineProperty(a.prototype, "stopSignal", {
  1508. get: function() {
  1509. return this._stopSignal
  1510. },
  1511. enumerable: !0,
  1512. configurable: !0
  1513. }), a
  1514. }();
  1515. a.TaskTimer = b
  1516. }(game || (game = {}));
  1517. var game;
  1518. ! function(a) {
  1519. var b = function() {
  1520. function b(b, c, d, e) {
  1521. this._isComplete = !1, this.game = b, this.miniTasks = c, this._completeSignal = new Phaser.Signal, this._timer = new a.TaskTimer(this.game, d), this.allowedItemTypes = e
  1522. }
  1523. return b.prototype.hasItemType = function(a) {
  1524. return this.miniTasks.some(function(b) {
  1525. return b.fruitType === a
  1526. })
  1527. }, b.prototype.onItemCollected = function(a) {
  1528. var b = this.getMiniTask(a.itemType);
  1529. b && b.addCollectedItems(1)
  1530. }, b.prototype.onCollectCycleComplete = function() {
  1531. this.allMinitasksComplete() && (this._isComplete = !0, this._completeSignal.dispatch())
  1532. }, b.prototype.getMiniTask = function(a) {
  1533. for (var b = this.miniTasks.length, c = 0; b > c; c++) {
  1534. var d = this.miniTasks[c];
  1535. if (d.fruitType === a) return d
  1536. }
  1537. return null
  1538. }, b.prototype.allMinitasksComplete = function() {
  1539. return this.miniTasks.every(function(a) {
  1540. return a.complete
  1541. })
  1542. }, b.prototype.destroy = function() {
  1543. this.game = null, this._completeSignal.dispose(), this._completeSignal = null, this.destroyMinitasks(), this.destroyTimer()
  1544. }, b.prototype.destroyMinitasks = function() {
  1545. this.miniTasks.forEach(function(a) {
  1546. a.destroy()
  1547. }), this.miniTasks = null
  1548. }, b.prototype.destroyTimer = function() {
  1549. this._timer.destroy(), this._timer = null
  1550. }, Object.defineProperty(b.prototype, "completeSignal", {
  1551. get: function() {
  1552. return this._completeSignal
  1553. },
  1554. enumerable: !0,
  1555. configurable: !0
  1556. }), Object.defineProperty(b.prototype, "timer", {
  1557. get: function() {
  1558. return this._timer
  1559. },
  1560. enumerable: !0,
  1561. configurable: !0
  1562. }), Object.defineProperty(b.prototype, "isComplete", {
  1563. get: function() {
  1564. return this._isComplete
  1565. },
  1566. enumerable: !0,
  1567. configurable: !0
  1568. }), b
  1569. }();
  1570. a.Task = b
  1571. }(game || (game = {}));
  1572. var game;
  1573. ! function(a) {
  1574. var b = function() {
  1575. function b(b) {
  1576. this.game = b, this.rnd = new Phaser.RandomDataGenerator([2]), this.fruitTypes = a.Item.ITEM_TYPES.slice(0)
  1577. }
  1578. return b.prototype.generateTask = function(b) {
  1579. var c = this.getAllowedItemTypes(b),
  1580. d = this.getTypesNum(b),
  1581. e = this.createMinitasks(c, d, b),
  1582. f = this.getTime(b);
  1583. return new a.Task(this.game, e, f, c)
  1584. }, b.prototype.getTypesNum = function(a) {
  1585. var b = 1;
  1586. return b = 2 >= a ? 2 : 4 >= a ? 3 : 4
  1587. }, b.prototype.createMinitasks = function(b, c, d) {
  1588. for (var e = [], f = this.getTypesForMinitasks(b, c), g = 0; c > g; g++) {
  1589. var h = f[g],
  1590. i = this.getFruitsNum(d),
  1591. j = new a.MiniTask(h, i);
  1592. e.push(j)
  1593. }
  1594. return e
  1595. }, b.prototype.getTypesForMinitasks = function(a, b) {
  1596. var c = a.slice(0);
  1597. Phaser.Utils.shuffle(c);
  1598. var d = c.slice(0, b);
  1599. return d
  1600. }, b.prototype.getFruitsNum = function(a) {
  1601. var b = 4,
  1602. c = 3,
  1603. d = 21,
  1604. e = b + a * c + this.game.rnd.integerInRange(-3, 3);
  1605. return e > d && (e = d), e
  1606. }, b.prototype.getTime = function(a) {
  1607. var b = 15e4,
  1608. c = 15e3,
  1609. d = 3e4,
  1610. e = b - a * c;
  1611. return d > e && (e = d), e
  1612. }, b.prototype.getAllowedItemTypes = function(a) {
  1613. var b = 4;
  1614. return b = 2 >= a ? 4 : 4 >= a ? 5 : 6, this.fruitTypes.slice(0, b)
  1615. }, b.prototype.destroy = function() {
  1616. this.game = null, this.rnd = null, this.fruitTypes = null
  1617. }, b
  1618. }();
  1619. a.TaskGenerator = b
  1620. }(game || (game = {}));
  1621. var game;
  1622. ! function(a) {
  1623. var b = function(b) {
  1624. function c(c) {
  1625. b.call(this, c, 0, 0, "graphics_1", "BonusStar0000"), this.exists = !1, this.visible = !1, this.alive = !1, this.anchor.set(.5, .5), this._requestItemSignal = new Phaser.Signal, this._moveCompleteSignal = new Phaser.Signal, a.Main.weakDevice === !1 && this.initEmitter()
  1626. }
  1627. return __extends(c, b), c.prototype.initEmitter = function() {
  1628. this.emitter = this.game.add.emitter(0, 0, 15), this.emitter.makeParticles("graphics_1", "StarParticle0000"), this.emitter.setScale(1.5, .25, 1.5, .25, 1e3), this.emitter.setXSpeed(-50, 50), this.emitter.setYSpeed(10, 20), this.emitter.gravity = 150, this.emitter.lifespan = 1e3
  1629. }, c.prototype.show = function() {
  1630. this.scale.set(0, 0), this.game.add.tween(this.scale).to({
  1631. x: 1.2,
  1632. y: 1.2
  1633. }, 300, Phaser.Easing.Back.Out, !0), this.game.add.tween(this).to({
  1634. y: this.y - 30
  1635. }, 800, Phaser.Easing.Back.Out, !0).onComplete.addOnce(this._requestItemSignal.dispatch, this._requestItemSignal)
  1636. }, c.prototype.moveToItem = function(a, b) {
  1637. var c = utils.MathUtil.distance(this.x, this.y, a, b),
  1638. d = Phaser.Math.clamp(c, 300, 1e3);
  1639. this.game.add.tween(this).to({
  1640. x: a,
  1641. y: b,
  1642. angle: 360
  1643. }, d, Phaser.Easing.Back.In, !0).onComplete.addOnce(this.onMoveComplete, this), this.game.sound.usingWebAudio && this.game.sound.play("star_move", .2)
  1644. }, c.prototype.onMoveComplete = function() {
  1645. var a = 100,
  1646. b = 300;
  1647. this.game.add.tween(this.scale).to({
  1648. x: 3,
  1649. y: 3
  1650. }, b, Phaser.Easing.Back.In, !0), this.game.add.tween(this).to({
  1651. alpha: 0
  1652. }, a, Phaser.Easing.Linear.None, !0, b - a).onComplete.addOnce(this.onHideComplete, this)
  1653. }, c.prototype.onHideComplete = function() {
  1654. this._moveCompleteSignal.dispatch(this), this.onAddToPool()
  1655. }, c.prototype.update = function() {
  1656. this.exists && this.emitter && (this.emitter.emitX = this.x, this.emitter.emitY = this.y + 15, this.emitter.emitParticle())
  1657. }, c.prototype.returnToPool = function() {
  1658. this.onAddToPool()
  1659. }, c.prototype.onAddToPool = function() {
  1660. this.exists = !1, this.visible = !1, this.alive = !1, this._requestItemSignal.active = !1, this._moveCompleteSignal.active = !1, this.emitter && (this.emitter.forEachExists(function(a) {
  1661. a.exists = !1
  1662. }, this), this.emitter.kill())
  1663. }, c.prototype.onRemoveFromPool = function() {
  1664. this.exists = !0, this.visible = !0, this.alive = !0, this._requestItemSignal.active = !0, this._moveCompleteSignal.active = !0, this.alpha = 1, this.emitter && this.emitter.revive()
  1665. }, c.prototype.destroy = function() {
  1666. b.prototype.destroy.call(this, !0), this.emitter && (this.emitter.destroy(!0, !1), this.emitter = null), this._requestItemSignal.dispose(), this._requestItemSignal = null, this._moveCompleteSignal.dispose(), this._moveCompleteSignal = null
  1667. }, Object.defineProperty(c.prototype, "requestItemSignal", {
  1668. get: function() {
  1669. return this._requestItemSignal
  1670. },
  1671. enumerable: !0,
  1672. configurable: !0
  1673. }), Object.defineProperty(c.prototype, "moveCompleteSignal", {
  1674. get: function() {
  1675. return this._moveCompleteSignal
  1676. },
  1677. enumerable: !0,
  1678. configurable: !0
  1679. }), c
  1680. }(Phaser.Image);
  1681. a.StarPowerUp = b
  1682. }(game || (game = {}));
  1683. var game;
  1684. ! function(a) {
  1685. var b = function(a) {
  1686. function b(b, c) {
  1687. a.call(this, b, c), this.alive = !1, this._completeSignal = new Phaser.Signal, this.initArrows(), this.hideArrows()
  1688. }
  1689. return __extends(b, a), b.prototype.initArrows = function() {
  1690. this.arrow1 = this.game.add.image(0, 0, "graphics_1", "PowerUp_Line0000", this), this.arrow1.anchor.set(.5, .5), this.arrow2 = this.game.add.image(0, 0, "graphics_1", "PowerUp_Line0000", this), this.arrow2.anchor.set(.5, .5), this.arrow2.angle = 180
  1691. }, b.prototype.launch = function() {
  1692. this.showArrows()
  1693. }, b.prototype.showArrows = function() {
  1694. this.arrow1.visible = !0, this.arrow1.exists = !0, this.arrow1.alpha = 1, this.arrow2.visible = !0, this.arrow2.exists = !0, this.arrow2.alpha = 1
  1695. }, b.prototype.launchArrow = function(a, b, c) {
  1696. var d = Phaser.Math.distance(a.x, a.y, b, c),
  1697. e = this.getTweenDuration(d),
  1698. f = this.game.add.tween(a).to({
  1699. x: b,
  1700. y: c
  1701. }, e, Phaser.Easing.Linear.None, !0);
  1702. return f.duration = e, this.game.add.tween(a).to({
  1703. alpha: 0
  1704. }, .3 * e, Phaser.Easing.Linear.None, !0, .7 * e), f
  1705. }, b.prototype.getTweenDuration = function(a) {
  1706. return .8 * a
  1707. }, b.prototype.onComplete = function() {
  1708. this._completeSignal.dispatch(), this.hide()
  1709. }, b.prototype.hide = function() {
  1710. this.hideArrows(), this.onAddToPool()
  1711. }, b.prototype.hideArrows = function() {
  1712. this.arrow1.visible = !1, this.arrow1.exists = !1, this.arrow2.visible = !1, this.arrow2.exists = !1
  1713. }, b.prototype.onAddToPool = function() {
  1714. this.exists = !1, this.visible = !1, this.alive = !1
  1715. }, b.prototype.onRemoveFromPool = function() {
  1716. this.exists = !0, this.visible = !0, this.alive = !0
  1717. }, b.prototype.destroy = function() {
  1718. a.prototype.destroy.call(this, !0, !1), this.arrow1 = null, this.arrow2 = null, this._completeSignal.dispose(), this._completeSignal = null
  1719. }, Object.defineProperty(b.prototype, "completeSignal", {
  1720. get: function() {
  1721. return this._completeSignal
  1722. },
  1723. enumerable: !0,
  1724. configurable: !0
  1725. }), b
  1726. }(Phaser.SpriteBatch);
  1727. a.PowerUpFX = b
  1728. }(game || (game = {}));
  1729. var game;
  1730. ! function(a) {
  1731. var b = function(b) {
  1732. function c(a, c) {
  1733. b.call(this, a, c), this.orientation = "horizontal"
  1734. }
  1735. return __extends(c, b), c.prototype.launch = function(c, d) {
  1736. b.prototype.launch.call(this, c, d), this.arrow1.y = d, this.arrow1.x = c;
  1737. var e = this.launchArrow(this.arrow1, 0, d);
  1738. this.arrow2.y = d, this.arrow2.x = c;
  1739. var f = this.launchArrow(this.arrow2, a.Config.GAME_WIDTH, d);
  1740. e.duration > f.duration ? e.onComplete.addOnce(this.onComplete, this) : f.onComplete.addOnce(this.onComplete, this)
  1741. }, c
  1742. }(a.PowerUpFX);
  1743. a.HorizontalPowerUpFX = b
  1744. }(game || (game = {}));
  1745. var game;
  1746. ! function(a) {
  1747. var b = function(b) {
  1748. function c(a, c) {
  1749. b.call(this, a, c), this.orientation = "vertical"
  1750. }
  1751. return __extends(c, b), c.prototype.initArrows = function() {
  1752. b.prototype.initArrows.call(this), this.arrow1.angle = -90, this.arrow2.angle = 90
  1753. }, c.prototype.launch = function(c, d) {
  1754. b.prototype.launch.call(this, c, d), this.arrow1.y = d, this.arrow1.x = c;
  1755. var e = this.launchArrow(this.arrow1, c, a.Config.GAME_HEIGHT);
  1756. this.arrow2.y = d, this.arrow2.x = c;
  1757. var f = this.launchArrow(this.arrow2, c, 0);
  1758. e.duration > f.duration ? e.onComplete.addOnce(this.onComplete, this) : f.onComplete.addOnce(this.onComplete, this)
  1759. }, c
  1760. }(a.PowerUpFX);
  1761. a.VerticalPowerUpFX = b
  1762. }(game || (game = {}));
  1763. var game;
  1764. ! function(a) {
  1765. var b = function(a) {
  1766. function b(b, c, d) {
  1767. a.call(this, b, c, d, "tutorial_hand"), this.hidden = !1, this.initAnimation(), this.startTweens()
  1768. }
  1769. return __extends(b, a), b.prototype.initAnimation = function() {
  1770. this.animations.add("release", Phaser.Animation.generateFrameNames("Tutorial_Hand", 0, 0, "", 4)), this.animations.add("main", Phaser.Animation.generateFrameNames("Tutorial_Hand", 0, 23, "", 4)), this.play("main", 30, !1)
  1771. }, b.prototype.startTweens = function() {
  1772. var a = this;
  1773. this.hidden || (this.position.set(295, 410), this.alpha = 1, this.play("main", 30, !1), this.game.add.tween(this).to({
  1774. x: 115,
  1775. y: 580
  1776. }, 1300, Phaser.Easing.Linear.None, !0, 750).onComplete.addOnce(function() {
  1777. a.hidden === !1 && (a.game.time.events.add(600, a.startTweens, a), a.play("release", 30, !1))
  1778. }))
  1779. }, b.prototype.hideAndDestroy = function() {
  1780. this.hidden = !0, this.animations.stop(), this.game.add.tween(this).to({
  1781. alpha: 0
  1782. }, 200, Phaser.Easing.Linear.None, !0).onComplete.addOnce(this.destroy, this)
  1783. }, b
  1784. }(Phaser.Sprite);
  1785. a.TutorHand = b
  1786. }(game || (game = {}));
  1787. var game;
  1788. ! function(a) {
  1789. var b = function(a) {
  1790. function b(b, c) {
  1791. var d = {
  1792. font: "26px GrilledCheeseBTNToasted",
  1793. fill: "#296B98",
  1794. align: "center"
  1795. };
  1796. a.call(this, b, 0, 0, c, d), this.stroke = "#FFFFFF", this.strokeThickness = 8, this.anchor.set(.5, .5), this.initTweens(), this.exists = !1, this.visible = !1, this.alive = !1
  1797. }
  1798. return __extends(b, a), b.prototype.initTweens = function() {
  1799. this.scale.set(0, 0), this.showTween = this.game.add.tween(this.scale).to({
  1800. x: 1,
  1801. y: 1
  1802. }, 500, Phaser.Easing.Back.Out), this.hideTween = this.game.add.tween(this).to({
  1803. alpha: 0
  1804. }, 200, Phaser.Easing.Linear.None, !1, 600), this.hideTween.onComplete.add(this.onAddToPool, this)
  1805. }, b.prototype.updateValue = function(a) {
  1806. this.setText("+" + a)
  1807. }, b.prototype.show = function() {
  1808. this.exists = !0, this.visible = !0, this.alpha = 1, this.scale.set(0, 0), this.showTween.start(), this.hideTween.start()
  1809. }, b.prototype.onAddToPool = function() {
  1810. this.exists = !1, this.visible = !1, this.alive = !1
  1811. }, b.prototype.onRemoveFromPool = function() {
  1812. this.exists = !0, this.visible = !0, this.alive = !0
  1813. }, b.prototype.destroy = function() {
  1814. a.prototype.destroy.call(this, !0), this.showTween.stop(), this.showTween = null, this.hideTween.stop(), this.hideTween = null
  1815. }, b
  1816. }(Phaser.Text);
  1817. a.PointsFX = b
  1818. }(game || (game = {}));
  1819. var game;
  1820. ! function(a) {
  1821. var b = function(a) {
  1822. function b(b, c) {
  1823. var d = {
  1824. font: "35px GrilledCheeseBTNToasted",
  1825. fill: "#FBAF05",
  1826. align: "center"
  1827. };
  1828. a.call(this, b, 0, 0, c, d), this.stroke = "#FFFFFF", this.strokeThickness = 11, this.anchor.set(.5, .5), this.initTweens(), this.exists = !1, this.visible = !1
  1829. }
  1830. return __extends(b, a), b.prototype.initTweens = function() {
  1831. this.scale.set(0, 0), this.showTween = this.game.add.tween(this.scale).to({
  1832. x: 1,
  1833. y: 1
  1834. }, 800, Phaser.Easing.Elastic.Out), this.hideTween = this.game.add.tween(this).to({
  1835. alpha: 0
  1836. }, 200, Phaser.Easing.Linear.None, !1, 900), this.hideTween.onComplete.add(this.onHideComplete, this)
  1837. }, b.prototype.show = function() {
  1838. this.exists = !0, this.visible = !0, this.alpha = 1, this.scale.set(0, 0), this.showTween.start(), this.hideTween.start(), this.game.add.tween(this).to({
  1839. y: this.y - 30
  1840. }, 300, Phaser.Easing.Back.In, !0, 700)
  1841. }, b.prototype.onHideComplete = function() {
  1842. this.exists = !1, this.visible = !1
  1843. }, b.prototype.destroy = function() {
  1844. a.prototype.destroy.call(this, !0), this.showTween.stop(), this.showTween = null, this.hideTween.stop(), this.hideTween = null
  1845. }, b
  1846. }(Phaser.Text);
  1847. a.TextFX = b
  1848. }(game || (game = {}));
  1849. var game;
  1850. ! function(a) {
  1851. var b = function(b) {
  1852. function c(a, c) {
  1853. b.call(this, a, c, "bonus_time_fx"), this.initIcon(), this.initText(), this.exists = !1, this.visible = !1
  1854. }
  1855. return __extends(c, b), c.prototype.initIcon = function() {
  1856. this.icon = this.game.add.image(-26, 0, "graphics_1", "BigTimer0000", this), this.icon.anchor.set(.5, .5)
  1857. }, c.prototype.initText = function() {
  1858. this.text = this.game.add.bitmapText(this.icon.x + .5 * this.icon.width, -25, "timer", "+10", 50, this)
  1859. }, c.prototype.show = function(a, b) {
  1860. this.exists = !0, this.visible = !0, this.text.setText(b), this.setPosition(a), this.alpha = 0, this.scale.set(0, 1), this.game.add.tween(this).to({
  1861. alpha: 1
  1862. }, 200, Phaser.Easing.Linear.None, !0, 200), this.game.add.tween(this).to({
  1863. y: this.y - 118
  1864. }, 400, Phaser.Easing.Back.Out, !0, 200), this.game.add.tween(this.scale).to({
  1865. x: 1
  1866. }, 1200, Phaser.Easing.Elastic.Out, !0, 200).onComplete.addOnce(this.hide, this)
  1867. }, c.prototype.setPosition = function(b) {
  1868. var c = 110,
  1869. d = Phaser.Math.clamp(b.x, c, a.Config.GAME_WIDTH - c);
  1870. this.position.set(d, b.y)
  1871. }, c.prototype.hide = function() {
  1872. var a = 400,
  1873. b = 100,
  1874. c = a - b;
  1875. this.game.add.tween(this).to({
  1876. alpha: 0
  1877. }, b, Phaser.Easing.Linear.None, !0, c), this.game.add.tween(this).to({
  1878. y: this.y - 50
  1879. }, a, Phaser.Easing.Back.In, !0).onComplete.addOnce(this.onHideComplete, this)
  1880. }, c.prototype.onHideComplete = function() {
  1881. this.exists = !1, this.visible = !1
  1882. }, c
  1883. }(Phaser.Group);
  1884. a.BonusTimeFX = b
  1885. }(game || (game = {}));
  1886. var game;
  1887. ! function(a) {
  1888. var b = function(b) {
  1889. function c(a, c) {
  1890. b.call(this, a, 0, 0, "splashes"), this.itemType = c, this.initAnimation(), this.anchor.set(.5, .5), this.scale.set(1.2, 1.2)
  1891. }
  1892. return __extends(c, b), c.prototype.initAnimation = function() {
  1893. var b = "Splash_" + a.ItemType[this.itemType],
  1894. c = Phaser.Animation.generateFrameNames(b, 0, 19, "", 4),
  1895. d = this.animations.add("main", c, 60, !1);
  1896. d.onComplete.addOnce(this.hide, this), d.play()
  1897. }, c.prototype.hide = function() {
  1898. this.exists = !1, this.visible = !1, this.game.time.events.add(100, this.destroy, this)
  1899. }, c
  1900. }(Phaser.Sprite);
  1901. a.FruitSplash = b
  1902. }(game || (game = {}));
  1903. var game;
  1904. ! function(a) {
  1905. var b = function(b) {
  1906. function c(a, c) {
  1907. b.call(this, a, c), this.addMonkey(), this.addBasket(), this._dispatchFruitsComplete = new Phaser.Signal, this.exists = !1, this.visible = !1
  1908. }
  1909. return __extends(c, b), c.prototype.addMonkey = function() {
  1910. this.monkey = this.game.add.image(0, 0, "graphics_1", "Bag0000", this), this.monkey.anchor.set(.5, .5)
  1911. }, c.prototype.addBasket = function() {
  1912. this.basket = this.game.add.image(-5, 55, "graphics_1", "Bag0000", this), this.basket.anchor.set(.5, .5)
  1913. }, c.prototype.show = function() {
  1914. this.position.y = a.Config.GAME_HEIGHT - 94, this.scale.set(0, 0), this.game.add.tween(this.scale).to({
  1915. x: 1,
  1916. y: 1
  1917. }, 1e3, Phaser.Easing.Elastic.Out, !0)
  1918. }, c.prototype.hide = function() {
  1919. this.game.add.tween(this).to({
  1920. y: a.Config.GAME_HEIGHT + 100
  1921. }, 300, Phaser.Easing.Back.In, !0).onComplete.addOnce(this.onHideComplete, this)
  1922. }, c.prototype.shakeBasket = function() {
  1923. a.Main.weakDevice === !1 && (this.basket.angle = -3, this.game.add.tween(this.basket).to({
  1924. angle: 3
  1925. }, 150, Phaser.Easing.Sinusoidal.Out, !0, 0, 11, !0))
  1926. }, c.prototype.collectFruits = function() {
  1927. this.show(), this.game.time.events.add(1800, this.hide, this)
  1928. }, c.prototype.dispatchFruits = function() {
  1929. this.show(), this.game.time.events.add(300, this.shakeBasket, this), this.game.time.events.add(2400, this.onDispatchComplete, this)
  1930. }, c.prototype.onDispatchComplete = function() {
  1931. this.game.time.events.add(500, this._dispatchFruitsComplete.dispatch, this), this.hide()
  1932. }, c.prototype.onHideComplete = function() {
  1933. this.exists = !1, this.visible = !1
  1934. }, Object.defineProperty(c.prototype, "dispatchFruitsComplete", {
  1935. get: function() {
  1936. return this._dispatchFruitsComplete
  1937. },
  1938. enumerable: !0,
  1939. configurable: !0
  1940. }), c
  1941. }(Phaser.Group);
  1942. a.Monkey = b
  1943. }(game || (game = {}));
  1944. var game;
  1945. ! function(a) {
  1946. var b = function(a) {
  1947. function b(b, c, d, e) {
  1948. a.call(this, b, c, d, "graphics_1", e), this.k = .1, this.rad = .1, this.speed = .5, this.k = -Math.PI + Math.random() * Math.PI, this.k *= .5, this.rad = 0
  1949. }
  1950. return __extends(b, a), b.prototype.update = function() {
  1951. this.rad += this.k / 180 * Math.PI, this.x -= Math.cos(this.rad), this.y += this.speed
  1952. }, b
  1953. }(Phaser.Image);
  1954. a.SnowParticle = b
  1955. }(game || (game = {}));
  1956. var game;
  1957. ! function(a) {
  1958. var b = function(b) {
  1959. function c(a, c) {
  1960. b.call(this, a, c), this.bottomBound = 130, this.addParticles()
  1961. }
  1962. return __extends(c, b), c.prototype.addParticles = function() {
  1963. this.particles = [];
  1964. for (var b = 0; 40 > b; b++) {
  1965. var c = this.game.rnd.realInRange(40, a.Config.GAME_WIDTH - 40),
  1966. d = this.game.rnd.realInRange(0, this.bottomBound),
  1967. e = "SnowParticle_" + this.game.rnd.integerInRange(1, 3) + "0000",
  1968. f = new a.SnowParticle(this.game, c, d, e);
  1969. this.add(f), this.particles.push(f)
  1970. }
  1971. }, c.prototype.update = function() {
  1972. var a = this;
  1973. this.particles.forEach(function(b) {
  1974. b.update(), b.y > a.bottomBound && (b.y = -5, b.alpha = a.game.rnd.realInRange(.5, 1))
  1975. })
  1976. }, c
  1977. }(Phaser.SpriteBatch);
  1978. a.SnowFall = b
  1979. }(game || (game = {}));
  1980. var game;
  1981. ! function(a) {
  1982. var b = function(b) {
  1983. function c() {
  1984. b.apply(this, arguments), this.chainItemType = null, this.lastItemInChain = null, this.pointerDown = !1, this.pointerEnabled = !0, this.debugRenderFlag = !1
  1985. }
  1986. return __extends(c, b), c.prototype.init = function() {
  1987. this.pointerEnabled = !0, this.pointerDown = !1, this.chain = [], this.chainItemType = null, this.lastItemInChain = null, this.activeItems = [], this.chainLinks = [], this.chainLinkPos = new Phaser.Point, this.shuffleDuration = 200, this.firstGridFill = !0, this.level = 1, this.chainCollected = !1, this.powerUpsActivated = 0, this.powerUpsCompleted = 0, this.gameOver = !1
  1988. }, c.prototype.create = function() {
  1989. this.initRoundResult(), this.addLayers(), this.itemsPool = new a.ItemsPool(this.game, this.itemsLayer), this.findChainStrategy = new a.FindChainStrategy(this.game, this.grid, this.activeItems), this.initChainLinks(), this.initItemsGenerator(), this.taskGenerator = new a.TaskGenerator(this.game), this.addGUI(), this.setNewTask(), this.addItems(), this.initStarsPool(), this.initPowerUpsPool(), this.initPowerUpFxsPool(), this.initFuturePowerUpsPool(), this.addBonusTimeFX(), this.addMonkey(), this.initKeyCallbacks(), this.game.input.onDown.add(this.onPointerDown, this), this.game.input.onUp.add(this.onPointerUp, this), a.Main.weakDevice ? (this.addTutorHand(), this.currentTask.timer.start()) : (this.pointerEnabled = !1, this.activeItems.forEach(function(a) {
  1990. a.visible = !1
  1991. }), this.game.time.events.add(600, this.dispatchItemsFromMonkey, this), this.game.time.events.add(2600, this.addTutorHand, this))
  1992. }, c.prototype.addTutorHand = function() {
  1993. this.tutorHand = new a.TutorHand(this.game, 295, 410), this.itemsLayer.add(this.tutorHand)
  1994. }, c.prototype.initStarsPool = function() {
  1995. for (var b = [], c = 3, d = 0; c > d; d++) {
  1996. var e = new a.StarPowerUp(this.game);
  1997. this.topLayer.add(e), b.push(e)
  1998. }
  1999. this.starsPool = new utils.ObjectPool(b)
  2000. }, c.prototype.initPowerUpsPool = function() {
  2001. for (var b = [], c = 8, d = 0; c > d; d++) {
  2002. var e = new a.PowerUp(this.game);
  2003. this.itemsLayer.add(e), b.push(e)
  2004. }
  2005. this.powerUpsPool = new utils.ObjectPool(b)
  2006. }, c.prototype.initPowerUpFxsPool = function() {
  2007. for (var b = [], c = 8, d = 0; c > d; d++) {
  2008. var e = 4 > d ? new a.VerticalPowerUpFX(this.game, this.topLayer) : new a.HorizontalPowerUpFX(this.game, this.topLayer);
  2009. this.topLayer.add(e), b.push(e)
  2010. }
  2011. this.powerUpFxsPool = new utils.ObjectPool(b)
  2012. }, c.prototype.initFuturePowerUpsPool = function() {
  2013. for (var b = [], c = 4, d = 0; c > d; d++) {
  2014. var e = new a.FuturePowerUp(this.game);
  2015. this.itemsLayer.addAt(e, 0), b.push(e)
  2016. }
  2017. this.futurePowerUpsPool = new utils.ObjectPool(b)
  2018. }, c.prototype.initRoundResult = function() {
  2019. this.roundResult = new a.RoundResult, this.roundResult.level = this.level
  2020. }, c.prototype.addLayers = function() {
  2021. this.addBackground(), this.addGrid(), this.itemsLayer = this.game.add.spriteBatch(this.world, "objects_layer"), this.topLayer = this.game.add.group(this.world, "above_items")
  2022. }, c.prototype.addBackground = function() {
  2023. var b = this.game.add.image(0, 0, "graphics_1", "BG_Sky", this.world);
  2024. b.anchor.set(.5, .5), b.x = a.Config.HALF_GAME_WIDTH, b.y = a.Config.HALF_GAME_HEIGHT - 1
  2025. }, c.prototype.addSnowfall = function() {
  2026. if (a.Main.weakDevice === !1) {
  2027. var b = new a.SnowFall(this.game, this.world);
  2028. this.world.add(b)
  2029. }
  2030. }, c.prototype.addGrid = function() {
  2031. this.grid = new a.Grid(this.game, this.world), this.grid.cacheAsBitmap = !0, this.grid.position.set(.5 * (a.Config.GAME_WIDTH - this.grid.getWidth()), .5 * (a.Config.GAME_HEIGHT - this.grid.getHeight()) + 64)
  2032. }, c.prototype.addBonusTimeFX = function() {
  2033. this.bonusTimeFX = new a.BonusTimeFX(this.game, this.topLayer), this.bonusTimeFX.position.set(a.Config.HALF_GAME_WIDTH, a.Config.HALF_GAME_HEIGHT)
  2034. }, c.prototype.addMonkey = function() {
  2035. this.monkey = new a.Monkey(this.game, this.topLayer), this.monkey.position.set(a.Config.GAME_WIDTH - 146, a.Config.GAME_HEIGHT - 96), this.monkey.visible = !1, this.world.addAt(this.monkey, 4)
  2036. }, c.prototype.initChainLinks = function() {
  2037. var b = 20;
  2038. this.chainLinks = [];
  2039. for (var c = 0; b > c; c++) {
  2040. var d = new a.ChainLink(this.game);
  2041. this.itemsLayer.add(d), this.chainLinks.push(d)
  2042. }
  2043. }, c.prototype.setNewTask = function() {
  2044. this.currentTask && (this.currentTask.destroy(), this.currentTask = null), this.currentTask = this.taskGenerator.generateTask(this.level), this.currentTask.timer.completeSignal.addOnce(this.onGameOver, this), this.gui.syncWithTask(this.currentTask, this.level), this.itemsGenerator.setAllowedItemTypes(this.currentTask.allowedItemTypes)
  2045. }, c.prototype.onTaskCompleteStageOne = function() {
  2046. this.gameOver || (this.currentTask.timer.onPause(), this.disableInput(), this.gui.hidePauseButton(), this.gui.levelUpFX.hideCompleteSignal.addOnce(this.onTaskCompleteStageTwo, this), this.gui.levelUpFX.show())
  2047. }, c.prototype.disableInput = function() {
  2048. this.pointerEnabled = !1, this.pointerDown = !1
  2049. }, c.prototype.activateAllPowerUps = function() {
  2050. this.powerUpsPool.items.forEach(function(a) {
  2051. a.alive && a.activate()
  2052. })
  2053. }, c.prototype.onTaskCompleteStageTwo = function() {
  2054. var a = this.powerUpsPool.items.some(function(a) {
  2055. return a.alive
  2056. });
  2057. a ? (this.activateAllPowerUps(), this.game.time.events.add(1200, this.collectFruitsToBasket, this), this.game.time.events.add(3e3, this.onTaskCompleteStageThree, this)) : (this.collectFruitsToBasket(), this.game.time.events.add(2e3, this.onTaskCompleteStageThree, this))
  2058. }, c.prototype.collectFruitsToBasket = function() {
  2059. var b = a.Config.HALF_GAME_WIDTH,
  2060. c = a.Config.GAME_HEIGHT;
  2061. this.monkey.collectFruits(), this.activeItems.forEach(function(a) {
  2062. a.collectToBasket(b, c)
  2063. }), this.activeItems.length = 0
  2064. }, c.prototype.removeAllItems = function(a) {
  2065. this.activeItems.forEach(function(b) {
  2066. b.removeFromGrid(a)
  2067. }), this.activeItems.length = 0
  2068. }, c.prototype.getItemsOverMonkey = function() {
  2069. var a = [];
  2070. return a.push(this.grid.getCellAt(6, 5)), a.push(this.grid.getCellAt(6, 6)), a.push(this.grid.getCellAt(7, 4)), a.push(this.grid.getCellAt(7, 5)), a.push(this.grid.getCellAt(7, 6)), a
  2071. }, c.prototype.onTaskCompleteStageThree = function() {
  2072. this.showAds()
  2073. }, c.prototype.showAds = function() {
  2074. var b = this;
  2075. a.Main.spilAPI.GameBreak.request(function() {
  2076. b.pauseGameForAds()
  2077. }, function() {
  2078. b.resumeGameAfterAds()
  2079. })
  2080. }, c.prototype.pauseGameForAds = function() {
  2081. a.Main.wasPaused = !0, a.Main.wasMuted = this.game.sound.mute, this.game.paused = !0
  2082. }, c.prototype.resumeGameAfterAds = function() {
  2083. a.Main.wasPaused && (a.Main.wasPaused = !1, this.game.paused = !1), this.calculateAndSaveResult(), this.roundResult.doReset(), this.level++, this.setNewTask(), this.gui.taskBoard.hideCompleteSignal.addOnce(this.onTaskBoardHide, this), this.gui.taskBoard.show(this.currentTask, this.level)
  2084. }, c.prototype.onTaskBoardHide = function() {
  2085. this.chain.length = 0, this.addItems(), this.dispatchItemsFromMonkey()
  2086. }, c.prototype.dispatchItemsFromMonkey = function() {
  2087. var a = this;
  2088. this.monkey.dispatchFruits(), this.monkey.dispatchFruitsComplete.addOnce(this.onMonkeyDispatchComplete, this), this.activeItems.forEach(function(b) {
  2089. var c = 150 * (b.cell.column + b.cell.row);
  2090. b.visible = !1, b.scale.set(0, 0), a.game.add.tween(b.scale).to({
  2091. x: 1,
  2092. y: 1
  2093. }, 400, Phaser.Easing.Back.Out, !0, c).onStart.addOnce(function() {
  2094. b.visible = !0
  2095. })
  2096. })
  2097. }, c.prototype.onMonkeyDispatchComplete = function() {
  2098. this.currentTask.timer.start(), this.pointerEnabled = !0, this.gui.showPauseButton()
  2099. }, c.prototype.onGameOver = function() {
  2100. this.gameOver = !0, this.disableInput(), this.fadeInAllItems(), this.hideAllChainLinks(), this.gui.onGameOver(this.level, a.Main.gameStats.totalPoints), this.game.sound.stopAll(), this.game.sound.usingWebAudio && this.game.sound.play("game_over")
  2101. }, c.prototype.calculateAndSaveResult = function() {
  2102. var b = 100,
  2103. c = this.currentTask.timer.remainingSeconds * b,
  2104. d = this.roundResult.points + c,
  2105. e = a.Main.gameStats.totalPoints + d;
  2106. a.Main.gameStats.updatePoints(e)
  2107. }, c.prototype.initItemsGenerator = function() {
  2108. this.itemsGenerator = new a.ItemsGenerator(this.game, this.grid), this.itemsGenerator.setAddItemCallback(this.addItem, this)
  2109. }, c.prototype.addItem = function(a) {
  2110. var b = this.grid.getFreeCell();
  2111. if (b) {
  2112. var c = this.grid.position.x + b.x + .5 * b.width,
  2113. d = this.grid.position.y + b.y + .5 * b.height,
  2114. e = this.itemsPool.getItem(a);
  2115. e.position.set(c, d), e.linkCell(b), e.showOnGrid(this.firstGridFill), this.activeItems.push(e)
  2116. }
  2117. }, c.prototype.addItems = function() {
  2118. var a = this.grid.columns * this.grid.rows;
  2119. this.itemsGenerator.generateItems(a), this.firstGridFill = !1
  2120. }, c.prototype.addGUI = function() {
  2121. this.gui = new a.LevelGUI(this.game), this.gui.pauseSignal.add(this.togglePause, this), this.gui.restartSignal.add(this.restartGame, this)
  2122. }, c.prototype.togglePause = function(a) {
  2123. "pause" === a ? this.pauseGame() : "resume" === a && this.resumeGame()
  2124. }, c.prototype.pauseGame = function() {
  2125. this.pointerEnabled = !1, this.currentTask.timer.onPause(), this.gui.onPause()
  2126. }, c.prototype.resumeGame = function() {
  2127. this.pointerEnabled = !0, this.currentTask.timer.onResume(), this.gui.onResume()
  2128. }, c.prototype.restartGame = function() {
  2129. a.Main.gameStats.updatePoints(0), this.level = 1, this.setNewTask(), this.removeAllItems(!0), this.destoyAllPowerUps(), this.addItems(), this.currentTask.timer.start(), this.gui.onRestart(), this.pointerEnabled = !0, this.gameOver = !1, this.game.sound.play("main_loop", .33, !0)
  2130. }, c.prototype.destoyAllPowerUps = function() {
  2131. this.starsPool.items.forEach(function(a) {
  2132. a.returnToPool()
  2133. }), this.powerUpsPool.items.forEach(function(a) {
  2134. a.returnToPool()
  2135. }), this.futurePowerUpsPool.items.forEach(function(a) {
  2136. a.onAddToPool()
  2137. })
  2138. }, c.prototype.initKeyCallbacks = function() {
  2139. a.Main.development && (this.game.input.keyboard.addKey(Phaser.Keyboard.D).onDown.add(this.toggleDebugRender, this), this.game.input.keyboard.addKey(Phaser.Keyboard.F).onDown.add(this.findPossibleMoves, this), this.game.input.keyboard.addKey(Phaser.Keyboard.S).onDown.add(this.shuffleItems, this), this.game.input.keyboard.addKey(Phaser.Keyboard.T).onDown.add(this.onTaskCompleteStageOne, this), this.game.input.keyboard.addKey(Phaser.Keyboard.O).onDown.add(this.onGameOver, this))
  2140. }, c.prototype.findPossibleMoves = function() {
  2141. var a = this,
  2142. b = this.findChainStrategy.getPossibleMove();
  2143. b && b.forEach(function(b) {
  2144. a.game.add.tween(b.scale).to({
  2145. x: .66,
  2146. y: .66
  2147. }, 666, Phaser.Easing.Back.Out, !0, 0, 1, !0)
  2148. })
  2149. }, c.prototype.toggleDebugRender = function() {
  2150. this.debugRenderFlag = !this.debugRenderFlag
  2151. }, c.prototype.onRoundEnd = function() {
  2152. this.saveResult()
  2153. }, c.prototype.saveResult = function() {}, c.prototype.onPointerDown = function() {
  2154. this.pointerEnabled && (this.pointerDown = !0, this.chain.length = 0, this.chainItemType = null, this.lastItemInChain = null)
  2155. }, c.prototype.onPointerUp = function() {
  2156. this.pointerEnabled && (this.pointerDown = !1, this.hideAllChainLinks(), this.fadeInAllItems(), this.chain.length > 2 ? (this.pointerEnabled = !1, this.chainCollected = !1, this.powerUpsActivated = 0, this.powerUpsCompleted = 0, this.collectItems()) : this.unhighlightChainItems())
  2157. }, c.prototype.collectItems = function() {
  2158. var a = this.currentTask.hasItemType(this.chainItemType);
  2159. a && this.gui.santa.openMouth(), this.checkForTimeBonus(), this.lastItemInChain.collectCompleteSignal.addOnce(this.onChainCollected, this), this.collectItemsInChain()
  2160. }, c.prototype.collectItemsInChain = function() {
  2161. var a = this,
  2162. b = 0;
  2163. this.chain.forEach(function(c) {
  2164. a.collectItem(c), b += 50
  2165. })
  2166. }, c.prototype.collectItem = function(a, b) {
  2167. if (void 0 === b && (b = !1), !a.collected) {
  2168. var c = this.currentTask.hasItemType(a.itemType);
  2169. b || c === !1 ? a.collect() : (this.itemsLayer.bringToTop(a), a.collectToPanda(this.gui.bag.position)), a.clearCell(), this.removeFromActiveItems(a), this.currentTask.onItemCollected(a), this.roundResult.points += 100
  2170. }
  2171. }, c.prototype.onChainCollected = function() {
  2172. this.chainCollected = !0, this.gui.santa.isMouthOpen() && this.gui.santa.chew(), this.chainCollected && this.powerUpsCompleted === this.powerUpsActivated && this.onCollectComplete()
  2173. }, c.prototype.checkForTimeBonus = function() {
  2174. if (this.chain.length >= 8) {
  2175. var a = this.chain.length;
  2176. this.currentTask.timer.addSeconds(a), this.bonusTimeFX.show(this.lastItemInChain.position, "+" + a.toString())
  2177. }
  2178. }, c.prototype.onPowerUpComplete = function() {
  2179. this.currentTask.isComplete || (this.powerUpsCompleted++, this.chainCollected && this.powerUpsCompleted === this.powerUpsActivated && this.onCollectComplete())
  2180. }, c.prototype.onCollectComplete = function() {
  2181. this.moveItems(), this.refillGrid(), this.currentTask.onCollectCycleComplete(), this.currentTask.isComplete ? this.onTaskCompleteStageOne() : this.checkPossibleMoves()
  2182. }, c.prototype.moveItems = function() {
  2183. this.resetDropDistances(), this.setDropDistances(), this.doMoveItems()
  2184. }, c.prototype.resetDropDistances = function() {
  2185. this.activeItems.forEach(function(a) {
  2186. a.dropDistance = 0
  2187. })
  2188. }, c.prototype.setDropDistances = function() {
  2189. for (var a = this.grid.cells.length, b = 0; a > b; b++) {
  2190. var c = this.grid.cells[b];
  2191. c.isFree() && this.increaseDropDistanceForColumn(c.row, c.column)
  2192. }
  2193. }, c.prototype.increaseDropDistanceForColumn = function(b, c) {
  2194. for (var d = b - 1; d >= 0; d--) {
  2195. var e = this.grid.getCellAt(d, c);
  2196. e.item && (e.item.dropDistance += a.Cell.HEIGHT)
  2197. }
  2198. }, c.prototype.doMoveItems = function() {
  2199. for (var a = this.grid.cells.length, b = a - 1; b >= 0; b--) {
  2200. var c = this.grid.cells[b],
  2201. d = c.item;
  2202. if (d && d.dropDistance > 0) {
  2203. var e = d.position.y + d.dropDistance,
  2204. f = this.grid.getCellUnderPoint(d.position.x, e);
  2205. d.linkCell(f), d.moveTo(e)
  2206. }
  2207. }
  2208. }, c.prototype.refillGrid = function() {
  2209. var a = this.grid.getFreeCellsNum();
  2210. this.itemsGenerator.generateItems(a)
  2211. }, c.prototype.checkPossibleMoves = function() {
  2212. var a = this.findChainStrategy.getPossibleMove();
  2213. a ? this.pointerEnabled = !0 : (this.shuffleItems(), this.game.time.events.add(this.shuffleDuration + 50, this.checkPossibleMoves, this))
  2214. }, c.prototype.shuffleItems = function() {
  2215. this.removeRandomItems(), this.game.time.events.add(this.shuffleDuration, this.refillGrid, this)
  2216. }, c.prototype.removeRandomItems = function() {
  2217. for (var a = Math.floor(this.activeItems.length / 3), b = 0; a > b; b++) {
  2218. var c = this.game.rnd.pick(this.activeItems);
  2219. c.removeFromGrid(!1), this.removeFromActiveItems(c)
  2220. }
  2221. }, c.prototype.unhighlightChainItems = function() {
  2222. for (var a = this.chain.length, b = 0; a > b; b++) this.chain[b].unhighlight()
  2223. }, c.prototype.removeFromActiveItems = function(a) {
  2224. var b = this.activeItems.indexOf(a);
  2225. b > -1 && this.activeItems.splice(b, 1)
  2226. }, c.prototype.update = function() {
  2227. this.selectItems()
  2228. }, c.prototype.selectItems = function() {
  2229. if (this.pointerDown) {
  2230. var a = this.getItemUnderPoint(this.game.input.activePointer.worldX, this.game.input.activePointer.worldY);
  2231. if (a) {
  2232. var b = null === this.chainItemType || this.chainItemType === a.itemType,
  2233. c = -1 === this.chain.indexOf(a),
  2234. d = this.lastItemInChain ? this.isDistanceFits(this.lastItemInChain, a) : !0;
  2235. if (b && c === !1) {
  2236. var e = this.chain.indexOf(a);
  2237. if (e === this.chain.length - 2) return this.lastItemInChain.unhighlight(), this.chain.splice(e + 1, 1), this.lastItemInChain = a, void this.hideLastUsedChainLink()
  2238. }
  2239. b && c && d && (this.addItemToChain(a), this.chain.length > 1 && this.showNewChainLink())
  2240. }
  2241. }
  2242. }, c.prototype.addItemToChain = function(a) {
  2243. this.tutorHand && (this.tutorHand.hideAndDestroy(), this.tutorHand = null), this.game.sound.usingWebAudio && this.game.sound.play("select_fruit", .2), a.highlight(), this.chain.push(a), this.lastItemInChain = a;
  2244. var b = this.chain.length;
  2245. 1 === b && (this.chainItemType = a.itemType, this.fadeOutSomeItems(this.chainItemType)), b > 0 && b % 6 === 0 && this.addFuturePowerUp(a)
  2246. }, c.prototype.fadeOutSomeItems = function(a) {
  2247. this.activeItems.forEach(function(b) {
  2248. b.itemType !== a && (b.alpha = .33)
  2249. })
  2250. }, c.prototype.fadeInAllItems = function() {
  2251. this.activeItems.forEach(function(a) {
  2252. a.alpha = 1
  2253. })
  2254. }, c.prototype.addFuturePowerUp = function(a) {
  2255. var b = this.futurePowerUpsPool.getItem();
  2256. b && (b.x = a.x, b.y = a.y, b.activateSignal.addOnce(this.onFuturePowerupActivated, this), a.setFuturePowerUp(b), a.hasPowerUp() && (b.visible = !1))
  2257. }, c.prototype.onFuturePowerupActivated = function(a) {
  2258. var b = this.starsPool.getItem();
  2259. b && (b.position.set(a.x, a.y), b.requestItemSignal.addOnce(this.onStarRequest, this), b.show(), this.game.sound.usingWebAudio && this.game.sound.play("star_appear", .2))
  2260. }, c.prototype.onStarRequest = function(a) {
  2261. var b = this.findItemForPowerUp();
  2262. b ? (a.moveCompleteSignal.addOnce(this.addPowerUp, this), a.moveToItem(b.x, b.y)) : a.returnToPool()
  2263. }, c.prototype.findItemForPowerUp = function() {
  2264. for (var a = 0; a++ <= 100;) {
  2265. var b = this.game.rnd.pick(this.activeItems);
  2266. if (b.hasPowerUp() === !1) return b
  2267. }
  2268. return null
  2269. }, c.prototype.addPowerUp = function(a) {
  2270. var b = this.getItemUnderPoint(a.x, a.y);
  2271. if (b && b.hasPowerUp() === !1) {
  2272. var c = this.powerUpsPool.getItem();
  2273. c && (c.activateSignal.addOnce(this.applyPowerUp, this), c.init(b), b.setPowerUp(c))
  2274. }
  2275. }, c.prototype.applyPowerUp = function(a) {
  2276. var b = this,
  2277. c = this.getItemsAffectedByPowerUp(a);
  2278. c.forEach(function(c) {
  2279. var d = Phaser.Math.distance(a.x, a.y, c.x, c.y),
  2280. e = .7 * d;
  2281. b.game.time.events.add(e, function() {
  2282. b.collectItem(c, !0)
  2283. }, b)
  2284. }), this.showPowerUpFX(a.x, a.y, a.angle), this.game.sound.usingWebAudio && this.game.sound.play("powerup", .4)
  2285. }, c.prototype.getItemsAffectedByPowerUp = function(a) {
  2286. var b = a.linkedItem,
  2287. c = b.cell,
  2288. d = 0 === a.angle ? this.getItemsInRow(c.row) : this.getItemsInColumn(c.column);
  2289. return d
  2290. }, c.prototype.showPowerUpFX = function(a, b, c) {
  2291. var d = this.getPowerUpFx(c);
  2292. d && (d.completeSignal.addOnce(this.onPowerUpComplete, this), d.launch(a, b), this.powerUpsActivated++)
  2293. }, c.prototype.getPowerUpFx = function(a) {
  2294. var b = 0 === a ? this.powerUpFxsPool.getItemByProperty("orientation", "horizontal") : this.powerUpFxsPool.getItemByProperty("orientation", "vertical");
  2295. return b
  2296. }, c.prototype.getItemsInRow = function(a) {
  2297. for (var b = [], c = 0; c < this.grid.columns; c++) {
  2298. var d = this.grid.getCellAt(a, c),
  2299. e = d.item;
  2300. e && b.push(e)
  2301. }
  2302. return b
  2303. }, c.prototype.getItemsInColumn = function(a) {
  2304. for (var b = [], c = 0; c < this.grid.rows; c++) {
  2305. var d = this.grid.getCellAt(c, a),
  2306. e = d.item;
  2307. e && b.push(e)
  2308. }
  2309. return b
  2310. }, c.prototype.hideLastUsedChainLink = function() {
  2311. for (var a = this.chainLinks.length; --a > -1;)
  2312. if (this.chainLinks[a].visible === !0) return void this.chainLinks[a].hide()
  2313. }, c.prototype.showNewChainLink = function() {
  2314. var a = this.getUnusedLink();
  2315. if (a) {
  2316. var b = this.chain.length,
  2317. c = this.chain[b - 1],
  2318. d = this.chain[b - 2];
  2319. Phaser.Point.interpolate(c.position, d.position, .5, this.chainLinkPos), a.position.set(this.chainLinkPos.x, this.chainLinkPos.y), a.rotation = Phaser.Point.angle(d.position, c.position) + .5 * Math.PI, a.show(), this.itemsLayer.sendToBack(a)
  2320. }
  2321. }, c.prototype.getUnusedLink = function() {
  2322. for (var a = this.chainLinks.length, b = 0; a > b; b++)
  2323. if (this.chainLinks[b].visible === !1) return this.chainLinks[b];
  2324. return null
  2325. }, c.prototype.hideAllChainLinks = function() {
  2326. for (var a = this.chainLinks.length, b = 0; a > b; b++) this.chainLinks[b].hide()
  2327. }, c.prototype.getItemUnderPoint = function(b, c) {
  2328. for (var d = this.activeItems.length, e = 0; d > e; e++) {
  2329. var f = this.activeItems[e],
  2330. g = utils.MathUtil.distanceSquared(f.position.x, f.position.y, b, c);
  2331. if (g < a.Item.RADIUS_SQUARED) return f
  2332. }
  2333. return null
  2334. }, c.prototype.isDistanceFits = function(b, c) {
  2335. var d = utils.MathUtil.distanceSquared(b.position.x, b.position.y, c.position.x, c.position.y);
  2336. return d < a.Item.CONTACT_RADIUS_SQUARED
  2337. }, c.prototype.shutdown = function() {
  2338. this.roundResult = null, this.activeItems = null, this.itemsGenerator.destroy(), this.itemsGenerator = null, this.chain = null, this.chainLinks = null, this.chainLinkPos = null, this.findChainStrategy.destroy(), this.findChainStrategy = null, this.taskGenerator.destroy(), this.taskGenerator = null, this.currentTask.destroy(), this.currentTask = null, this.monkey = null, this.removeKeyCallbacks(), this.destroyPools()
  2339. }, c.prototype.removeKeyCallbacks = function() {}, c.prototype.destroyPools = function() {
  2340. this.itemsPool.destroy(), this.itemsPool = null, this.starsPool.destroy(), this.starsPool = null, this.powerUpFxsPool.destroy(), this.powerUpFxsPool = null, this.powerUpsPool.destroy(), this.powerUpsPool = null, this.futurePowerUpsPool.destroy(), this.futurePowerUpsPool = null
  2341. }, c
  2342. }(Phaser.State);
  2343. a.Level = b
  2344. }(game || (game = {}));
  2345. var utils;
  2346. ! function(a) {
  2347. var b = function() {
  2348. function a() {
  2349. this._enabled = !0, this.init()
  2350. }
  2351. return a.prototype.init = function() {
  2352. try {
  2353. this.localStorage = window.localStorage, this.localStorage.setItem("testKey", "testData"), this.localStorage.removeItem("testKey")
  2354. } catch (a) {
  2355. this._enabled = !1
  2356. }
  2357. }, a.prototype.saveValue = function(a, b) {
  2358. if (this._enabled) {
  2359. var c = JSON.stringify(b);
  2360. this.localStorage.setItem(a, c)
  2361. }
  2362. }, a.prototype.getValue = function(a) {
  2363. return this.localStorage.getItem(a)
  2364. }, a.prototype.remove = function(a) {
  2365. this._enabled && this.localStorage.removeItem(a)
  2366. }, a.prototype.clear = function() {
  2367. this._enabled && this.localStorage.clear()
  2368. }, Object.defineProperty(a.prototype, "enabled", {
  2369. get: function() {
  2370. return this._enabled
  2371. },
  2372. enumerable: !0,
  2373. configurable: !0
  2374. }), a
  2375. }();
  2376. a.LocalStorageWrapper = b
  2377. }(utils || (utils = {}));
  2378. var game;
  2379. ! function(a) {
  2380. var b = function() {
  2381. function b() {
  2382. this._totalPoints = 0, this._tutorialViewed = !1, this.load()
  2383. }
  2384. return b.prototype.load = function() {
  2385. this._totalPoints = this.getNumericValue("points"), this._tutorialViewed = Boolean(a.Main.storage.getValue("tutorial"))
  2386. }, b.prototype.setTutorialViewed = function(b) {
  2387. this._tutorialViewed = b, a.Main.storage.saveValue("tutorial", b)
  2388. }, b.prototype.updatePoints = function(b) {
  2389. b >= 0 && (this._totalPoints = b, a.Main.storage.saveValue("points", this._totalPoints))
  2390. }, b.prototype.getNumericValue = function(b) {
  2391. var c = parseInt(a.Main.storage.getValue(b));
  2392. return isNaN(c) ? 0 : c
  2393. }, b.prototype.clearAll = function() {
  2394. this.updatePoints(0), this.setTutorialViewed(!1)
  2395. }, Object.defineProperty(b.prototype, "totalPoints", {
  2396. get: function() {
  2397. return this._totalPoints
  2398. },
  2399. enumerable: !0,
  2400. configurable: !0
  2401. }), Object.defineProperty(b.prototype, "tutorialViewed", {
  2402. get: function() {
  2403. return this._tutorialViewed
  2404. },
  2405. enumerable: !0,
  2406. configurable: !0
  2407. }), b
  2408. }();
  2409. a.GameStats = b
  2410. }(game || (game = {}));
  2411. var game;
  2412. ! function(a) {
  2413. var b = function(b) {
  2414. function c(c, d) {
  2415. b.call(this, c, d), this.currentFrame = null, this.tutorialTexts = a.Main.texts.tutorial, this.initBack(), this.initFrames(), this.initText(), this.currentFrame = this.frames[0], this.currentFrame.exists = !0, this.currentFrame.visible = !0, this.updateText()
  2416. }
  2417. return __extends(c, b), c.prototype.initBack = function() {
  2418. this.back = this.game.add.image(0, 0, "tutorial", "Tutorial_Board0000", this), this.back.anchor.set(.5, .5)
  2419. }, c.prototype.initFrames = function() {
  2420. this.frames = [];
  2421. for (var a = 1; 4 >= a; a++) {
  2422. var b = "Tutorial_" + a.toString() + "0000",
  2423. c = this.game.add.image(0, -70, "tutorial", b, this);
  2424. c.visible = !1, c.exists = !1, c.anchor.set(.5, .5), this.add(c), this.frames.push(c)
  2425. }
  2426. }, c.prototype.initText = function() {
  2427. var a = {
  2428. font: "34px GrilledCheeseBTNToasted",
  2429. fill: "#FFFFFF",
  2430. align: "center"
  2431. };
  2432. this.text = new Phaser.Text(this.game, 0, 130, "", a), this.text.anchor.set(.5, .5), this.text.setShadow(2, 2, "#666666", 2), this.text.wordWrap = !0, this.text.wordWrapWidth = .7 * this.back.width, this.add(this.text)
  2433. }, c.prototype.isLastFrame = function() {
  2434. var a = this.frames.indexOf(this.currentFrame);
  2435. return a >= this.frames.length - 1
  2436. }, c.prototype.gotoNextFrame = function() {
  2437. this.hideCurrentFrame()
  2438. }, c.prototype.hideCurrentFrame = function() {
  2439. this.game.add.tween(this.currentFrame).to({
  2440. alpha: 0
  2441. }, 200, Phaser.Easing.Linear.None, !0), this.game.add.tween(this.text).to({
  2442. alpha: 0
  2443. }, 200, Phaser.Easing.Linear.None, !0).onComplete.addOnce(this.onCurrentFrameHideComplete, this)
  2444. }, c.prototype.onCurrentFrameHideComplete = function() {
  2445. this.currentFrame.exists = !1, this.currentFrame.visible = !1, this.setNewFrame(), this.updateText(), this.showNewFrame()
  2446. }, c.prototype.setNewFrame = function() {
  2447. var a = this.frames.indexOf(this.currentFrame),
  2448. b = a + 1,
  2449. c = this.frames[b];
  2450. c.exists = !0, c.visible = !0, c.alpha = 0, this.currentFrame = c
  2451. }, c.prototype.updateText = function() {
  2452. var a = this.frames.indexOf(this.currentFrame),
  2453. b = this.tutorialTexts[a];
  2454. this.text.setText(b)
  2455. }, c.prototype.showNewFrame = function() {
  2456. this.game.add.tween(this.currentFrame).to({
  2457. alpha: 1
  2458. }, 200, Phaser.Easing.Linear.None, !0), this.game.add.tween(this.text).to({
  2459. alpha: 1
  2460. }, 200, Phaser.Easing.Linear.None, !0)
  2461. }, c.prototype.destroy = function() {
  2462. b.prototype.destroy.call(this, !0, !1), this.tutorialTexts = null, this.frames = null, this.currentFrame = null
  2463. }, c
  2464. }(Phaser.Group);
  2465. a.TutorialBoard = b
  2466. }(game || (game = {}));
  2467. var game;
  2468. ! function(a) {
  2469. var b = function(b) {
  2470. function c() {
  2471. b.apply(this, arguments)
  2472. }
  2473. return __extends(c, b), c.prototype.create = function() {
  2474. this.game.add.image(0, 0, "main_menu", "main_menu_bg"), this.addBoard(), this.addButton(), this.startAnimation()
  2475. }, c.prototype.addBoard = function() {
  2476. this.board = new a.TutorialBoard(this.game, this.world), this.board.position.set(a.Config.HALF_GAME_WIDTH, 380)
  2477. }, c.prototype.addButton = function() {
  2478. this.nextButton = new a.SimpleButton(this.game, a.Config.HALF_GAME_WIDTH, 730, "buttons", "Button_Resume0000"), this.nextButton.callback.add(this.onNextButtonClick, this), this.world.add(this.nextButton)
  2479. }, c.prototype.onNextButtonClick = function() {
  2480. var a = this;
  2481. this.nextButton.input.enabled = !1, this.game.time.events.add(250, function() {
  2482. a.nextButton.input.enabled = !0
  2483. }, this), this.board.isLastFrame() ? this.hideAndStartGame() : this.board.gotoNextFrame()
  2484. }, c.prototype.hideAndStartGame = function() {
  2485. a.Main.gameStats.setTutorialViewed(!0), this.game.changeState("Level")
  2486. }, c.prototype.startAnimation = function() {
  2487. var a = 200,
  2488. b = 400,
  2489. c = 60;
  2490. this.board.alpha = 0, this.board.position.y -= c, this.game.add.tween(this.board.position).to({
  2491. y: this.board.position.y + c
  2492. }, b, Phaser.Easing.Back.Out, !0, a), this.game.add.tween(this.board).to({
  2493. alpha: 1
  2494. }, 200, Phaser.Easing.Linear.None, !0, a), this.nextButton.position.y += c, this.nextButton.alpha = 0, this.game.add.tween(this.nextButton.position).to({
  2495. y: this.nextButton.position.y - c
  2496. }, b, Phaser.Easing.Back.Out, !0, a), this.game.add.tween(this.nextButton).to({
  2497. alpha: 1
  2498. }, 200, Phaser.Easing.Linear.None, !0, a)
  2499. }, c
  2500. }(Phaser.State);
  2501. a.Tutorial = b
  2502. }(game || (game = {})), window.addEventListener("load", onLoad, !1);
  2503. var game;
  2504. ! function(a) {
  2505. var b = function(b) {
  2506. function c() {
  2507. var d = {
  2508. width: a.Config.GAME_WIDTH,
  2509. height: a.Config.GAME_HEIGHT,
  2510. renderer: Phaser.CANVAS,
  2511. parent: "gameContainer",
  2512. transparent: !1,
  2513. antialias: !0,
  2514. enableDebug: c.development
  2515. };
  2516. b.call(this, d), c.spilAPI = window.__SpilAPI, c.storage = new utils.LocalStorageWrapper, c.gameStats = new a.GameStats, this.state.add("Boot", a.Boot, !0), this.state.add("SplashScreen", a.SplashScreen, !1), this.state.add("Preloader", a.Preloader, !1), this.state.add("MainMenu", a.MainMenu, !1), this.state.add("Tutorial", a.Tutorial, !1), this.state.add("Level", a.Level, !1)
  2517. }
  2518. return __extends(c, b), c.prototype.changeState = function(a, b) {
  2519. this.stateTransitionPlugin || (this.stateTransitionPlugin = this.plugins.plugins[0]), this.stateTransitionPlugin.changeState(a, b)
  2520. }, c.spilData = {
  2521. id: "576742227280293172"
  2522. }, c.development = !1, c.wasPaused = !1, c.wasMuted = !1, c.weakDevice = !1, c.language = "en", c
  2523. }(Phaser.Game);
  2524. a.Main = b
  2525. }(game || (game = {}));