window.__require = function e(t, n, o) { function r(i, c) { if (!n[i]) { if (!t[i]) { var s = i.split("/"); s = s[s.length - 1]; if (!t[s]) { var u = "function" == typeof __require && __require; if (!c && u) return u(s, !0); if (a) return a(s, !0); throw new Error("Cannot find module '" + i + "'"); } } var p = n[i] = { exports: {} }; t[i][0].call(p.exports, function(e) { return r(t[i][1][e] || e); }, p, p.exports, e, t, n, o); } return n[i].exports; } for (var a = "function" == typeof __require && __require, i = 0; i < o.length; i++) r(o[i]); return r; }({ AudioConst: [ function(e, t, n) { "use strict"; cc._RF.push(t, "cc4cfzECmFE6KabaiuKVCDw", "AudioConst"); Object.defineProperty(n, "__esModule", { value: !0 }); var o = function() { function e() {} e.HomeMusic = "music_home"; e.GameplayMusic = "music_gameplay"; e.ButtonClick = "SFX_button"; e.CorrectChoice = "SFX_CorrectChoice"; e.WrongChoice = "SFX_WrongChoice"; e.ResultScreen = "SFX_ResultScreen"; return e; }(); n.default = o; cc._RF.pop(); }, {} ], AudioLibrary: [ function(e, t, n) { "use strict"; cc._RF.push(t, "4abc9ElxBtPKqTdb14OTRsl", "AudioLibrary"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = cc._decorator, i = a.ccclass, c = a.property, s = function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.bgmKeys = []; t.bgmClips = []; t.sfxKeys = []; t.sfxClips = []; return t; } t.prototype.getBGClipByKey = function(e) { var t = this.bgmKeys.indexOf(e); return -1 !== t ? this.bgmClips[t] : null; }; t.prototype.getSFXClipByKey = function(e) { var t = this.sfxKeys.indexOf(e); return -1 !== t ? this.sfxClips[t] : null; }; r([ c([ cc.String ]) ], t.prototype, "bgmKeys", void 0); r([ c({ type: [ cc.AudioClip ] }) ], t.prototype, "bgmClips", void 0); r([ c([ cc.String ]) ], t.prototype, "sfxKeys", void 0); r([ c({ type: [ cc.AudioClip ] }) ], t.prototype, "sfxClips", void 0); return t = r([ i ], t); }(cc.Component); n.default = s; cc._RF.pop(); }, {} ], AudioManager: [ function(e, t, n) { "use strict"; cc._RF.push(t, "123e7GGrYxDpp8bfvEJrMu6", "AudioManager"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = e("../events/GameEvents"), i = e("../gameState/GameState"), c = e("../interfaces/InterfaceManager"), s = e("./AudioConst"), u = e("./AudioLibrary"), p = cc._decorator, l = p.ccclass, f = p.property, h = function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.audioLibrary = null; t.musicSource = null; t.sfxSource = null; t.isCrossfading = !1; t.crossfadeDuration = 1; t.isMuted = !1; return t; } n = t; Object.defineProperty(t, "Instance", { get: function() { this._instance || (this._instance = new n()); return this._instance; }, enumerable: !0, configurable: !0 }); t.prototype.initialise = function() { var e = this; c.default.Instance.registerInterface(this); a.default.onGameStateChange.on(function(t) { var n = t.prevState, o = t.newState, r = t.isOverlayState; e.gameEventsOnOnGameStateChange(n, o, r); }); }; t.prototype.resolveDependencies = function() {}; t.prototype.terminate = function() {}; t.prototype.isTypeOfBootStrapListener = function() { return !0; }; t.prototype.getClassName = function() { return "AudioManager"; }; t.prototype.gameEventsOnOnGameStateChange = function(e, t, n) { switch (t) { case i.GameState.Home: this.playMusic(s.default.HomeMusic); this.isMuted || this.updateMusicVolume(1); break; case i.GameState.Gameplay: this.isMuted || this.updateMusicVolume(.25); break; case i.GameState.Result: this.playSFX(s.default.ResultScreen); this.isMuted || this.updateMusicVolume(1); } }; t.prototype.playMusic = function(e) { if (!this.isMuted) { var t = this.audioLibrary.getBGClipByKey(e); if (t) { if (!this.musicSource.clip || this.musicSource.clip.name !== t.name) if (this.musicSource.clip) this.crossFadeMusic(t); else { this.musicSource.clip = t; this.musicSource.volume = 1; this.musicSource.loop = !0; this.musicSource.play(); } } else console.error("No background music found for key: " + e); } }; t.prototype.crossFadeMusic = function(e) { var t = this; if (!this.isCrossfading && !this.isMuted) { this.isCrossfading = !0; var n = this.musicSource.volume, o = this.node.addComponent(cc.AudioSource); o.clip = e; o.volume = 0; o.loop = !0; o.play(); var r = this.crossfadeDuration / 30, a = 0; this.schedule(function() { var e = ++a / 30; t.musicSource.volume = n * (1 - e); o.volume = n * e; if (a >= 30) { t.unscheduleAllCallbacks(); t.musicSource.stop(); t.node.removeComponent(t.musicSource); t.musicSource = o; t.isCrossfading = !1; } }, r, 29); } }; t.prototype.playSFX = function(e) { if (!this.isMuted) { var t = this.audioLibrary.getSFXClipByKey(e); t ? cc.audioEngine.playEffect(t, !1) : console.error("No sound effect found for key: " + e); } }; t.prototype.updateSFXVolume = function(e) { this.sfxSource.volume = e; }; t.prototype.updateMusicVolume = function(e) { this.musicSource.volume = e; }; t.prototype.mute = function(e) { this.updateMusicVolume(e ? 0 : 1); this.updateMusicVolume(e ? 0 : 1); this.isMuted = e; }; var n; r([ f(u.default) ], t.prototype, "audioLibrary", void 0); r([ f(cc.AudioSource) ], t.prototype, "musicSource", void 0); r([ f(cc.AudioSource) ], t.prototype, "sfxSource", void 0); return t = n = r([ l ], t); }(cc.Component); n.default = h; cc._RF.pop(); }, { "../events/GameEvents": "GameEvents", "../gameState/GameState": "GameState", "../interfaces/InterfaceManager": "InterfaceManager", "./AudioConst": "AudioConst", "./AudioLibrary": "AudioLibrary" } ], BaseScreen: [ function(e, t, n) { "use strict"; cc._RF.push(t, "511fbIIVa9CebljzOLcL/fA", "BaseScreen"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = cc._decorator, i = a.ccclass, c = (a.property, function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.gameState = null; return t; } t.prototype.initialize = function() { this.onInit(); }; t.prototype.onInit = function() {}; t.prototype.activate = function() { for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t]; this.node.active = !0; this.onShow(); }; t.prototype.onShow = function() {}; t.prototype.deactivate = function() { this.node.active = !1; this.onHide(); }; t.prototype.onHide = function() {}; return t = r([ i ], t); }(cc.Component)); n.default = c; cc._RF.pop(); }, {} ], BaseTile: [ function(e, t, n) { "use strict"; cc._RF.push(t, "763ffnFveVAp4lAJSM2TP7h", "BaseTile"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = e("../../core/events/GameEvents"), i = cc._decorator, c = i.ccclass, s = i.property, u = function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.tileSprite = null; t.tileType = null; t.isInteractive = !1; return t; } t.prototype.onLoad = function() { this.node.on(cc.Node.EventType.TOUCH_END, this.onTapped, this); }; t.prototype.reset = function() { this.node.opacity = 255; this.node.scale = 1; this.setInteractive(!0); }; t.prototype.setInteractive = function(e) { this.isInteractive = e; e ? this.node.on(cc.Node.EventType.TOUCH_END, this.onTapped, this) : this.node.off(cc.Node.EventType.TOUCH_END, this.onTapped, this); }; t.prototype.onTapped = function() { if (this.isInteractive) { a.default.dispatchTileTapped(this.tileType, this.node); a.default.dispatchScoreChange(this.tileType); } }; t.prototype.onDisable = function() { this.setInteractive(!1); }; t.prototype.onDestroy = function() { this.node.off(cc.Node.EventType.TOUCH_END, this.onTapped, this); }; r([ s(cc.Sprite) ], t.prototype, "tileSprite", void 0); return t = r([ c ], t); }(cc.Component); n.default = u; cc._RF.pop(); }, { "../../core/events/GameEvents": "GameEvents" } ], BootStrap: [ function(e, t, n) { "use strict"; cc._RF.push(t, "c39f3uvHeRPyrJQZ40wJjgQ", "BootStrap"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = cc._decorator, i = a.ccclass, c = a.property, s = function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.allManagers = []; return t; } t.prototype.onLoad = function() { var e = this; this.allManagers.forEach(function(t) { e.getBootStrapListenerComponent(t).initialise(); }); }; t.prototype.start = function() { var e = this; this.allManagers.forEach(function(t) { e.getBootStrapListenerComponent(t).resolveDependencies(); }); }; t.prototype.onDestroy = function() { var e = this; this && this.allManagers && this.allManagers.forEach(function(t) { if (t && t.isValid) try { e.getBootStrapListenerComponent(t).terminate(); } catch (e) { console.error("Error processing manager:", t, e); } }); }; t.prototype.isBootStrapListener = function(e) { return "function" == typeof e.isTypeOfBootStrapListener; }; t.prototype.getBootStrapListenerComponent = function(e) { for (var t = 0, n = e.getComponents(cc.Component); t < n.length; t++) { var o = n[t]; if (this.isBootStrapListener(o)) return o; } return null; }; r([ c([ cc.Node ]) ], t.prototype, "allManagers", void 0); return t = r([ i ], t); }(cc.Component); n.default = s; cc._RF.pop(); }, {} ], CameraShake: [ function(e, t, n) { "use strict"; cc._RF.push(t, "ce9a6vcwhtKCr4quEQn2A0R", "CameraShake"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = e("../../core/events/GameEvents"), i = e("../Tile/TileType"), c = cc._decorator, s = c.ccclass, u = (c.property, function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.duration = .2; t.strength = 10; t.originalPosition = cc.v2(); return t; } t.prototype.onLoad = function() { this.originalPosition = this.node.getPosition(); }; t.prototype.start = function() { var e = this; a.default.onTileTapped.on(function(t) { var n = t.tiletype; e.gameEventsOnOnTileTapped(n); }); }; t.prototype.onDestroy = function() { var e = this; a.default.onTileTapped.off(function(t) { var n = t.tiletype; e.gameEventsOnOnTileTapped(n); }); }; t.prototype.triggerShake = function() { this.node.stopAllActions(); this.node.setPosition(this.originalPosition); for (var e = this.duration / 5, t = [], n = 0; n < 5; n++) { var o = (2 * Math.random() - 1) * this.strength, r = (2 * Math.random() - 1) * this.strength, a = cc.v2(this.originalPosition.x + o, this.originalPosition.y + r); t.push(cc.moveTo(e, a)); } t.push(cc.moveTo(e, this.originalPosition)); var i = cc.sequence(t); this.node.runAction(i); }; t.prototype.gameEventsOnOnTileTapped = function(e) { switch (e) { case i.TileType.BonePile: case i.TileType.SpikedCrystal: case i.TileType.Skull: this.triggerShake(); } }; return t = r([ s ], t); }(cc.Component)); n.default = u; cc._RF.pop(); }, { "../../core/events/GameEvents": "GameEvents", "../Tile/TileType": "TileType" } ], CountdownTimer: [ function(e, t, n) { "use strict"; cc._RF.push(t, "3e77dpWWNBM6KZlOMZ7J8JB", "CountdownTimer"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = e("../../core/events/GameEvents"), i = cc._decorator, c = i.ccclass, s = i.property, u = function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.startTime = 60; t.timeLeft = 0; t.isTimerRunning = !1; return t; } t.prototype.onLoad = function() { this.resetTimer(); }; t.prototype.update = function(e) { if (this.isTimerRunning) { this.timeLeft -= e; if (this.timeLeft <= 0) { this.timeLeft = 0; this.isTimerRunning = !1; a.default.dispatchonGameTimerComplete(); } } }; t.prototype.startTimer = function() { this.timeLeft = this.startTime; this.isTimerRunning = !0; }; t.prototype.pauseTimer = function() { this.isTimerRunning = !1; }; t.prototype.resumeTimer = function() { this.timeLeft > 0 && (this.isTimerRunning = !0); }; t.prototype.resetTimer = function() { this.timeLeft = this.startTime; this.isTimerRunning = !1; }; t.prototype.getFormattedTime = function() { var e = Math.floor(this.timeLeft), t = Math.floor(e / 60), n = e % 60; return this.pad(t) + ":" + this.pad(n); }; t.prototype.pad = function(e) { return e < 10 ? "0" + e : e.toString(); }; r([ s ], t.prototype, "startTime", void 0); return t = r([ c ], t); }(cc.Component); n.default = u; cc._RF.pop(); }, { "../../core/events/GameEvents": "GameEvents" } ], Dictionary: [ function(e, t, n) { "use strict"; cc._RF.push(t, "c3d8egeSApF2qD3c03DrzVj", "Dictionary"); Object.defineProperty(n, "__esModule", { value: !0 }); var o = function() { function e() { this._keys = []; this._values = []; } e.prototype.set = function(e, t) { var n = this._keys.indexOf(e); if (-1 === n) { this._keys.push(e); this._values.push(t); } else this._values[n] = t; }; e.prototype.get = function(e) { var t = this._keys.indexOf(e); return -1 === t ? void 0 : this._values[t]; }; e.prototype.has = function(e) { return -1 !== this._keys.indexOf(e); }; e.prototype.delete = function(e) { var t = this._keys.indexOf(e); if (-1 === t) return !1; this._keys.splice(t, 1); this._values.splice(t, 1); return !0; }; e.prototype.clear = function() { this._keys.length = 0; this._values.length = 0; }; Object.defineProperty(e.prototype, "size", { get: function() { return this._keys.length; }, enumerable: !0, configurable: !0 }); e.prototype.keys = function() { return this._keys.slice(); }; e.prototype.values = function() { return this._values.slice(); }; e.prototype.entries = function() { var e = this; return this._keys.map(function(t, n) { return [ t, e._values[n] ]; }); }; e.prototype.forEach = function(e) { for (var t = 0; t < this._keys.length; t++) e(this._values[t], this._keys[t]); }; return e; }(); n.Dictionary = o; cc._RF.pop(); }, {} ], EventEmitter: [ function(e, t, n) { "use strict"; cc._RF.push(t, "50a53O+Gm1GQruIFIBZMw35", "EventEmitter"); Object.defineProperty(n, "__esModule", { value: !0 }); var o = function() { function e() { this.listeners = []; } e.prototype.on = function(e) { this.listeners.push(e); }; e.prototype.off = function(e) { var t = this.listeners.indexOf(e); t > -1 && this.listeners.splice(t, 1); }; e.prototype.emit = function(e) { this.listeners.forEach(function(t) { return t(e); }); }; return e; }(); n.default = o; cc._RF.pop(); }, {} ], GameEvents: [ function(e, t, n) { "use strict"; cc._RF.push(t, "5f558jACx9NmpuJepW0Jte7", "GameEvents"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = e("./EventEmitter"), i = cc._decorator.ccclass, c = function(e) { o(t, e); function t() { return null !== e && e.apply(this, arguments) || this; } t.dispatchGameStateChanged = function(e, t, n) { this.onGameStateChange.emit({ prevState: e, newState: t, isOverlayState: n }); }; t.dispatchTileTapped = function(e, t) { this.onTileTapped.emit({ tiletype: e, tile: t }); }; t.dispatchScoreChange = function(e) { this.onScoreChange.emit({ tiletype: e }); }; t.dispatchonGameTimerComplete = function() { this.onGameTimerComplete.emit({}); }; t.dispatchonGameChanceOver = function() { this.onGameChanceOver.emit({}); }; t.onGameStateChange = new a.default(); t.onTileTapped = new a.default(); t.onScoreChange = new a.default(); t.onGameTimerComplete = new a.default(); t.onGameChanceOver = new a.default(); return t = r([ i ], t); }(cc.Component); n.default = c; cc._RF.pop(); }, { "./EventEmitter": "EventEmitter" } ], GameStateManager: [ function(e, t, n) { "use strict"; cc._RF.push(t, "05dc9k0flZMrqJhcCjlTz8F", "GameStateManager"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = cc._decorator, i = a.ccclass, c = (a.property, e("../events/GameEvents")), s = e("../interfaces/InterfaceManager"), u = e("./GameState"), p = function(e) { o(t, e); function t() { return null !== e && e.apply(this, arguments) || this; } t.prototype.forceChangeGameState = function(e) { this.setGameState(e); }; t.prototype.initialise = function() { s.default.Instance.registerInterface(this); }; t.prototype.resolveDependencies = function() { this.setGameStateToHomeScreen(); }; t.prototype.terminate = function() {}; t.prototype.isTypeOfBootStrapListener = function() { return !0; }; t.prototype.getClassName = function() { return "GameStateManager"; }; t.prototype.setGameStateToHomeScreen = function() { this.setGameState(u.GameState.Home); }; t.prototype.setGameState = function(e, t) { void 0 === t && (t = !1); if (this.currentGameState !== e) { c.default.dispatchGameStateChanged(this.currentGameState, e, t); this.currentGameState = e; } }; return t = r([ i ], t); }(cc.Component); n.GameStateManager = p; cc._RF.pop(); }, { "../events/GameEvents": "GameEvents", "../interfaces/InterfaceManager": "InterfaceManager", "./GameState": "GameState" } ], GameState: [ function(e, t, n) { "use strict"; cc._RF.push(t, "b499bRqYS9GprB2LP+Gi5OV", "GameState"); Object.defineProperty(n, "__esModule", { value: !0 }); (function(e) { e[e.None = 0] = "None"; e[e.Splash = 1] = "Splash"; e[e.Home = 2] = "Home"; e[e.Gameplay = 3] = "Gameplay"; e[e.Result = 4] = "Result"; e[e.Tutorial = 5] = "Tutorial"; })(n.GameState || (n.GameState = {})); cc._RF.pop(); }, {} ], GameplayManager: [ function(e, t, n) { "use strict"; cc._RF.push(t, "4f558Cn335P4bZ3Hbw0scsX", "GameplayManager"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = e("../../core/events/GameEvents"), i = e("../../core/gameState/GameState"), c = e("../../core/interfaces/InterfaceManager"), s = e("../Tile/TileType"), u = cc._decorator, p = u.ccclass, l = (u.property, function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.gameStateManager = null; t.tileGridManager = null; t.scoreManager = null; return t; } t.prototype.initialise = function() { var e = this; c.default.Instance.registerInterface(this); a.default.onGameStateChange.on(function(t) { var n = t.prevState, o = t.newState, r = t.isOverlayState; e.gameEventsOnOnGameStateChange(n, o, r); }); a.default.onTileTapped.on(function(t) { var n = t.tiletype; e.gameEventsOnOnTileTapped(n); }); }; t.prototype.resolveDependencies = function() { this.gameStateManager = c.default.Instance.getInterface("GameStateManager"); this.tileGridManager = c.default.Instance.getInterface("TileGridManager"); this.scoreManager = c.default.Instance.getInterface("ScoreManager"); }; t.prototype.terminate = function() { var e = this; a.default.onGameStateChange.off(function(t) { var n = t.prevState, o = t.newState, r = t.isOverlayState; e.gameEventsOnOnGameStateChange(n, o, r); }); a.default.onTileTapped.off(function(t) { var n = t.tiletype; e.gameEventsOnOnTileTapped(n); }); }; t.prototype.isTypeOfBootStrapListener = function() { return !0; }; t.prototype.getClassName = function() { return "GameplayManager"; }; t.prototype.setGameStatus = function(e) { this.isGameWon = e; this.gameStateManager.forceChangeGameState(i.GameState.Result); }; t.prototype.gameEventsOnOnGameStateChange = function(e, t, n) { switch (t) { case i.GameState.Gameplay: this.startGamePlay(); break; case i.GameState.Result: case i.GameState.Home: e == i.GameState.Gameplay && this.endGameplay(); } }; t.prototype.startGamePlay = function() { this.resetVars(); this.tileGridManager.loadGame(); }; t.prototype.endGameplay = function() { this.tileGridManager.resetGame(); this.resetVars(); }; t.prototype.resetVars = function() { this.chances = 5; this.scoreManager.resetScore(); }; t.prototype.gameEventsOnOnTileTapped = function(e) { switch (e) { case s.TileType.BonePile: this.chances = Math.max(0, this.chances - 2); 0 == this.chances && a.default.dispatchonGameChanceOver(); break; case s.TileType.SpikedCrystal: this.chances = Math.max(0, this.chances - 1); 0 == this.chances && a.default.dispatchonGameChanceOver(); break; case s.TileType.Skull: this.chances = 0; } }; t.prototype.getChanceCount = function() { return this.chances; }; return t = r([ p ], t); }(cc.Component)); n.default = l; cc._RF.pop(); }, { "../../core/events/GameEvents": "GameEvents", "../../core/gameState/GameState": "GameState", "../../core/interfaces/InterfaceManager": "InterfaceManager", "../Tile/TileType": "TileType" } ], GameplayScreen: [ function(e, t, n) { "use strict"; cc._RF.push(t, "084d0cAw0xEOISLUCZvr16o", "GameplayScreen"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = e("../../core/events/GameEvents"), i = e("../../core/gameState/GameState"), c = e("../../core/interfaces/InterfaceManager"), s = e("../../core/ui/BaseScreen"), u = e("../utils/CountdownTimer"), p = cc._decorator, l = p.ccclass, f = p.property, h = function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.timer = null; t.score = null; t.chance = null; t.remainingtime = null; t.gamePlayManager = null; t.scoreManager = null; return t; } t.prototype.onInit = function() { this.gameState = i.GameState.Gameplay; }; t.prototype.start = function() { var e = this; a.default.onScoreChange.on(function(t) { var n = t.tiletype; e.gameEventsOnScoreChange(n); }); }; t.prototype.onDestroy = function() { var e = this; a.default.onScoreChange.off(function(t) { var n = t.tiletype; e.gameEventsOnScoreChange(n); }); }; t.prototype.onShow = function() { e.prototype.onShow.call(this); this.gamePlayManager = c.default.Instance.getInterface("GameplayManager"); this.scoreManager = c.default.Instance.getInterface("ScoreManager"); }; t.prototype.onHide = function() { e.prototype.onHide.call(this); }; t.prototype.update = function() { this.remainingtime && this.remainingtime && (this.remainingtime.string = this.timer.getFormattedTime()); }; t.prototype.gameEventsOnScoreChange = function(e) { this.score.string = this.scoreManager.getScore().toString(); this.chance.string = this.gamePlayManager.getChanceCount().toString(); var t = parseInt(localStorage.getItem("score") || "0"); this.scoreManager.getScore() > t && localStorage.setItem("score", String(this.scoreManager.getScore())); }; r([ f(u.default) ], t.prototype, "timer", void 0); r([ f(cc.Label) ], t.prototype, "score", void 0); r([ f(cc.Label) ], t.prototype, "chance", void 0); r([ f(cc.Label) ], t.prototype, "remainingtime", void 0); return t = r([ l ], t); }(s.default); n.default = h; cc._RF.pop(); }, { "../../core/events/GameEvents": "GameEvents", "../../core/gameState/GameState": "GameState", "../../core/interfaces/InterfaceManager": "InterfaceManager", "../../core/ui/BaseScreen": "BaseScreen", "../utils/CountdownTimer": "CountdownTimer" } ], HomeScreen: [ function(e, t, n) { "use strict"; cc._RF.push(t, "04adavy3RlObLhlz4N2sw1s", "HomeScreen"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = e("../../core/audio/AudioConst"), i = e("../../core/gameState/GameState"), c = e("../../core/interfaces/InterfaceManager"), s = e("../../core/ui/BaseScreen"), u = cc._decorator, p = u.ccclass, l = u.property, f = function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.playButton = null; t.tutorialButton = null; t.musicButton = null; return t; } t.prototype.onInit = function() { this.gameState = i.GameState.Home; }; t.prototype.onShow = function() { e.prototype.onShow.call(this); this.gameStateManager = c.default.Instance.getInterface("GameStateManager"); this.audioManager = c.default.Instance.getInterface("AudioManager"); this.playButton && this.playButton.node.on(cc.Node.EventType.TOUCH_END, this.onPlayClicked, this); this.tutorialButton && this.tutorialButton.node.on(cc.Node.EventType.TOUCH_END, this.onTutorialClicked, this); this.musicButton && this.musicButton.node.on("toggle", this.onMusicClicked, this); }; t.prototype.onHide = function() { e.prototype.onHide.call(this); this.playButton && this.playButton.node.off(cc.Node.EventType.TOUCH_END, this.onPlayClicked, this); this.tutorialButton && this.tutorialButton.node.off(cc.Node.EventType.TOUCH_END, this.onTutorialClicked, this); this.musicButton && this.musicButton.node.off("toggle", this.onMusicClicked, this); }; t.prototype.onPlayClicked = function() { this.audioManager.playSFX(a.default.ButtonClick); this.gameStateManager.forceChangeGameState(i.GameState.Gameplay); }; t.prototype.onTutorialClicked = function() { this.audioManager.playSFX(a.default.ButtonClick); this.gameStateManager.forceChangeGameState(i.GameState.Tutorial); }; t.prototype.onMusicClicked = function() { this.audioManager.playSFX(a.default.ButtonClick); this.audioManager.mute(this.musicButton.isChecked); }; r([ l(cc.Button) ], t.prototype, "playButton", void 0); r([ l(cc.Button) ], t.prototype, "tutorialButton", void 0); r([ l(cc.Toggle) ], t.prototype, "musicButton", void 0); return t = r([ p ], t); }(s.default); n.default = f; cc._RF.pop(); }, { "../../core/audio/AudioConst": "AudioConst", "../../core/gameState/GameState": "GameState", "../../core/interfaces/InterfaceManager": "InterfaceManager", "../../core/ui/BaseScreen": "BaseScreen" } ], IAudioManager: [ function(e, t, n) { "use strict"; cc._RF.push(t, "c86d8FXez5BR6H1FiYw3pUl", "IAudioManager"); Object.defineProperty(n, "__esModule", { value: !0 }); cc._RF.pop(); }, {} ], IBase: [ function(e, t, n) { "use strict"; cc._RF.push(t, "1b478SQijZCV7HKlAmUK4Zt", "IBase"); Object.defineProperty(n, "__esModule", { value: !0 }); cc._RF.pop(); }, {} ], IBootStrapListener: [ function(e, t, n) { "use strict"; cc._RF.push(t, "534fbcXoblEkoYuof6y+CZw", "IBootStrapListener"); Object.defineProperty(n, "__esModule", { value: !0 }); cc._RF.pop(); }, {} ], IGameStateManager: [ function(e, t, n) { "use strict"; cc._RF.push(t, "05b35K8gPFEw7HR2ZcoDQW9", "IGameStateManager"); Object.defineProperty(n, "__esModule", { value: !0 }); cc._RF.pop(); }, {} ], IGameplayManager: [ function(e, t, n) { "use strict"; cc._RF.push(t, "b6139LaAmVJdqK+MdIjKMKH", "IGameplayManager"); Object.defineProperty(n, "__esModule", { value: !0 }); cc._RF.pop(); }, {} ], IUiManager: [ function(e, t, n) { "use strict"; cc._RF.push(t, "15e5ecY7UVBdYFow6lz/pI5", "IUiManager"); Object.defineProperty(n, "__esModule", { value: !0 }); var o = cc._decorator; o.ccclass, o.property; cc._RF.pop(); }, {} ], InterfaceManager: [ function(e, t, n) { "use strict"; cc._RF.push(t, "561d9eA/2hP/oADKkeMcX4e", "InterfaceManager"); var o = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var r = e("../utils/Dictionary"), a = cc._decorator, i = a.ccclass, c = (a.property, function() { function e() { this._interfaceDictionary = new r.Dictionary(); } t = e; Object.defineProperty(e, "Instance", { get: function() { this._instance || (this._instance = new t()); return this._instance; }, enumerable: !0, configurable: !0 }); e.prototype.registerInterface = function(e) { var t = e.getClassName(); this._interfaceDictionary.has(t) || this._interfaceDictionary.set(t, e); }; e.prototype.getInterface = function(e) { var t = this._interfaceDictionary.get(e); if (t) return t; }; var t; return e = t = o([ i ], e); }()); n.default = c; cc._RF.pop(); }, { "../utils/Dictionary": "Dictionary" } ], ResultScreen: [ function(e, t, n) { "use strict"; cc._RF.push(t, "6af31PJ8dxKwKdl4byG6WMF", "ResultScreen"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = e("../../core/audio/AudioConst"), i = e("../../core/gameState/GameState"), c = e("../../core/interfaces/InterfaceManager"), s = e("../../core/ui/BaseScreen"), u = cc._decorator, p = u.ccclass, l = u.property, f = function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.homeButton = null; t.restartButton = null; t.score = null; t.bestScore = null; t.gameStateManager = null; t.audioManager = null; t.scoreManager = null; return t; } t.prototype.onInit = function() { this.gameState = i.GameState.Result; }; t.prototype.onShow = function() { e.prototype.onShow.call(this); this.gameStateManager = c.default.Instance.getInterface("GameStateManager"); this.audioManager = c.default.Instance.getInterface("AudioManager"); this.scoreManager = c.default.Instance.getInterface("ScoreManager"); this.homeButton && this.homeButton.node.on(cc.Node.EventType.TOUCH_END, this.onHomeClicked, this); this.restartButton && this.restartButton.node.on(cc.Node.EventType.TOUCH_END, this.onRestartClicked, this); this.score.string = this.scoreManager.getScore().toString(); this.bestScore.string = parseInt(localStorage.getItem("score") || "0").toString(); }; t.prototype.onHide = function() { e.prototype.onHide.call(this); this.homeButton && this.homeButton.node.off(cc.Node.EventType.TOUCH_END, this.onHomeClicked, this); this.restartButton && this.restartButton.node.off(cc.Node.EventType.TOUCH_END, this.onRestartClicked, this); }; t.prototype.onHomeClicked = function() { this.audioManager.playSFX(a.default.ButtonClick); this.gameStateManager.forceChangeGameState(i.GameState.Home); }; t.prototype.onRestartClicked = function() { this.audioManager.playSFX(a.default.ButtonClick); this.gameStateManager.forceChangeGameState(i.GameState.Gameplay); }; r([ l(cc.Button) ], t.prototype, "homeButton", void 0); r([ l(cc.Button) ], t.prototype, "restartButton", void 0); r([ l(cc.Label) ], t.prototype, "score", void 0); r([ l(cc.Label) ], t.prototype, "bestScore", void 0); return t = r([ p ], t); }(s.default); n.default = f; cc._RF.pop(); }, { "../../core/audio/AudioConst": "AudioConst", "../../core/gameState/GameState": "GameState", "../../core/interfaces/InterfaceManager": "InterfaceManager", "../../core/ui/BaseScreen": "BaseScreen" } ], ScoreManager: [ function(e, t, n) { "use strict"; cc._RF.push(t, "4fcc8dmW45JLbzvA09Xw0iM", "ScoreManager"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = e("../../core/events/GameEvents"), i = e("../../core/interfaces/InterfaceManager"), c = e("../Tile/TileType"), s = cc._decorator, u = s.ccclass, p = (s.property, function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.score = 0; return t; } t.prototype.initialise = function() { var e = this; i.default.Instance.registerInterface(this); a.default.onScoreChange.on(function(t) { var n = t.tiletype; e.gameEventsOnScoreChange(n); }); }; t.prototype.resolveDependencies = function() {}; t.prototype.terminate = function() { var e = this; a.default.onScoreChange.on(function(t) { var n = t.tiletype; e.gameEventsOnScoreChange(n); }); }; t.prototype.isTypeOfBootStrapListener = function() { return !0; }; t.prototype.getClassName = function() { return "ScoreManager"; }; t.prototype.gameEventsOnScoreChange = function(e) { switch (e) { case c.TileType.Diamond: this.updateScore(500); break; case c.TileType.GreenStone: this.updateScore(100); break; case c.TileType.BonePile: case c.TileType.GreenStone: this.updateScore(-50); break; case c.TileType.SpikedCrystal: case c.TileType.Skull: } }; t.prototype.updateScore = function(e) { this.score = Math.max(0, this.score + e); }; t.prototype.resetScore = function() { this.score = 0; }; t.prototype.getScore = function() { return this.score; }; return t = r([ u ], t); }(cc.Component)); n.default = p; cc._RF.pop(); }, { "../../core/events/GameEvents": "GameEvents", "../../core/interfaces/InterfaceManager": "InterfaceManager", "../Tile/TileType": "TileType" } ], TileGridManager: [ function(e, t, n) { "use strict"; cc._RF.push(t, "813151XGj9NzpXno+dgpkMi", "TileGridManager"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = e("./TilePoolManager"), i = e("./BaseTile"), c = e("./TileType"), s = e("../../core/events/GameEvents"), u = e("../../core/interfaces/InterfaceManager"), p = e("../../core/gameState/GameState"), l = e("../utils/CountdownTimer"), f = e("../../core/audio/AudioConst"), h = cc._decorator, y = h.ccclass, d = h.property, m = function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.tilePoolManager = null; t.timer = null; t.gridRoot = null; t.columns = 4; t.rows = 5; t.tileSize = new cc.Vec2(150, 150); t.grid = []; t.rowTappedFlags = []; t.inputLocked = !1; t.gameOver = !1; t.gameStateManager = null; t.audioManager = null; return t; } t.prototype.initialise = function() { var e = this; u.default.Instance.registerInterface(this); s.default.onTileTapped.on(function(t) { var n = t.tiletype, o = t.tile; e.onTileTapped(n, o); }); s.default.onGameTimerComplete.on(function() { e.onGameTimerComplete(); }); s.default.onGameChanceOver.on(function() { e.onGameTimerComplete(); }); }; t.prototype.resolveDependencies = function() { this.tilePoolManager = u.default.Instance.getInterface("TilePoolManager"); this.gameStateManager = u.default.Instance.getInterface("GameStateManager"); this.audioManager = u.default.Instance.getInterface("AudioManager"); }; t.prototype.terminate = function() { var e = this; s.default.onTileTapped.off(function(t) { var n = t.tiletype, o = t.tile; e.onTileTapped(n, o); }); s.default.onGameTimerComplete.off(function() { e.onGameTimerComplete(); }); s.default.onGameChanceOver.off(function() { e.onGameTimerComplete(); }); }; t.prototype.isTypeOfBootStrapListener = function() { return !0; }; t.prototype.getClassName = function() { return "TileGridManager"; }; t.prototype.loadGame = function() { this.resetGame(); this.spawnInitialGrid(); this.updateRowInteractions(); this.gameOver = !1; this.timer.startTimer(); }; t.prototype.spawnInitialGrid = function() { for (var e = 0; e < this.rows; e++) this.spawnRowAt(e); }; t.prototype.spawnRowAt = function(e) { for (var t = [ c.TileType.GreenStone, c.TileType.Diamond ], n = [ c.TileType.Skull, c.TileType.BonePile, c.TileType.SpikedCrystal ], o = t[Math.floor(Math.random() * t.length)], r = Math.floor(Math.random() * this.columns), a = [], s = 0; s < this.columns; s++) { var u = s === r ? o : n[Math.floor(Math.random() * n.length)], p = this.tilePoolManager.getTile(u); p.parent = this.gridRoot; var l = (s - (this.columns - 1) / 2) * this.tileSize.x, f = e * this.tileSize.y; p.setPosition(l, f); var h = p.getComponent(i.default); h.tileType = u; h.reset(); a.push(p); } this.grid[e] = a; this.rowTappedFlags[e] = !1; }; t.prototype.onTileTapped = function(e, t) { var n = this; if (!this.inputLocked && !this.gameOver) { if (!this.rowTappedFlags[0]) { this.rowTappedFlags[0] = !0; this.updateRowInteractions(); var o = cc.sequence(cc.scaleTo(.05, 1.1), cc.scaleTo(.05, 1)); t.runAction(o); for (var r = 0, a = this.grid[0]; r < a.length; r++) { a[r].getComponent(i.default).setInteractive(!1); } e === c.TileType.GreenStone || e === c.TileType.Diamond ? this.audioManager.playSFX(f.default.CorrectChoice) : this.audioManager.playSFX(f.default.WrongChoice); if (e !== c.TileType.Skull) { this.inputLocked = !0; this.fadeAndRemoveRow(0, function() { n.shiftGridReferencesDown(); n.spawnRowAt(n.rows - 1); n.updateRowInteractions(); n.inputLocked = !1; }); } else { this.gameStateManager.forceChangeGameState(p.GameState.Result); this.gameOver = !0; } } } }; t.prototype.fadeAndRemoveRow = function(e, t) { for (var n = this, o = this.grid[e], r = 0, a = function(a) { var s = cc.fadeOut(.2), u = cc.sequence(s, cc.callFunc(function() { var c = a.getComponent(i.default); n.tilePoolManager.putTile(a, c.tileType); if (++r === o.length) { n.grid.splice(e, 1); n.rowTappedFlags.splice(e, 1); t(); } }, c)); a.runAction(u); }, c = this, s = 0, u = o; s < u.length; s++) { a(u[s]); } }; t.prototype.shiftGridReferencesDown = function() { for (var e = 0; e < this.grid.length; e++) for (var t = 0, n = this.grid[e]; t < n.length; t++) { var o = n[t], r = o.x, a = e * this.tileSize.y; o.setPosition(r, a); } }; t.prototype.updateRowInteractions = function() { for (var e = 0; e < this.grid.length; e++) for (var t = 0 === e, n = this.rowTappedFlags[e], o = 0, r = this.grid[e]; o < r.length; o++) { r[o].getComponent(i.default).setInteractive(t && !n); } }; t.prototype.resetGame = function() { for (var e = 0, t = this.grid; e < t.length; e++) for (var n = 0, o = t[e]; n < o.length; n++) { var r = o[n]; r.stopAllActions(); var a = r.getComponent(i.default); this.tilePoolManager.putTile(r, a.tileType); } this.grid = []; this.rowTappedFlags = []; this.inputLocked = !1; }; t.prototype.onGameTimerComplete = function() { this.gameOver = !0; this.inputLocked = !0; for (var e = 0, t = this.grid; e < t.length; e++) for (var n = 0, o = t[e]; n < o.length; n++) { var r = o[n]; r.stopAllActions(); r.getComponent(i.default).setInteractive(!1); } this.gameStateManager.forceChangeGameState(p.GameState.Result); }; r([ d(a.default) ], t.prototype, "tilePoolManager", void 0); r([ d(l.default) ], t.prototype, "timer", void 0); r([ d(cc.Node) ], t.prototype, "gridRoot", void 0); r([ d ], t.prototype, "columns", void 0); r([ d ], t.prototype, "rows", void 0); r([ d(cc.Vec2) ], t.prototype, "tileSize", void 0); return t = r([ y ], t); }(cc.Component); n.default = m; cc._RF.pop(); }, { "../../core/audio/AudioConst": "AudioConst", "../../core/events/GameEvents": "GameEvents", "../../core/gameState/GameState": "GameState", "../../core/interfaces/InterfaceManager": "InterfaceManager", "../utils/CountdownTimer": "CountdownTimer", "./BaseTile": "BaseTile", "./TilePoolManager": "TilePoolManager", "./TileType": "TileType" } ], TilePoolManager: [ function(e, t, n) { "use strict"; cc._RF.push(t, "ffc47yK4EFJ9J6T6TaBT+fZ", "TilePoolManager"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = e("../../core/interfaces/InterfaceManager"), i = cc._decorator, c = i.ccclass, s = i.property, u = function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.tilePrefabs = []; t.pools = []; return t; } t.prototype.initialise = function() { a.default.Instance.registerInterface(this); this.createPool(); }; t.prototype.resolveDependencies = function() {}; t.prototype.terminate = function() {}; t.prototype.isTypeOfBootStrapListener = function() { return !0; }; t.prototype.getClassName = function() { return "TilePoolManager"; }; t.prototype.createPool = function() { for (var e = 0; e < this.tilePrefabs.length; e++) { for (var t = new cc.NodePool(), n = 0; n < 10; n++) { var o = cc.instantiate(this.tilePrefabs[e]); t.put(o); } this.pools[e] = t; } }; t.prototype.getTile = function(e) { var t = this.pools[e]; return t && t.size() > 0 ? t.get() : cc.instantiate(this.tilePrefabs[e]); }; t.prototype.putTile = function(e, t) { var n = this.pools[t]; if (n) { e.removeFromParent(!1); n.put(e); } else e.destroy(); }; r([ s({ type: [ cc.Prefab ] }) ], t.prototype, "tilePrefabs", void 0); return t = r([ c ], t); }(cc.Component); n.default = u; cc._RF.pop(); }, { "../../core/interfaces/InterfaceManager": "InterfaceManager" } ], TileType: [ function(e, t, n) { "use strict"; cc._RF.push(t, "af4adITxspHgJDpCoJTJP7e", "TileType"); Object.defineProperty(n, "__esModule", { value: !0 }); (function(e) { e[e.GreenStone = 0] = "GreenStone"; e[e.Diamond = 1] = "Diamond"; e[e.SpikedCrystal = 2] = "SpikedCrystal"; e[e.BonePile = 3] = "BonePile"; e[e.Skull = 4] = "Skull"; })(n.TileType || (n.TileType = {})); cc._RF.pop(); }, {} ], TutorialScreen: [ function(e, t, n) { "use strict"; cc._RF.push(t, "f400are055HoI5MVT5w+0HO", "TutorialScreen"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = e("../../core/audio/AudioConst"), i = e("../../core/gameState/GameState"), c = e("../../core/interfaces/InterfaceManager"), s = e("../../core/ui/BaseScreen"), u = cc._decorator, p = u.ccclass, l = u.property, f = function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.homeButton = null; return t; } t.prototype.onInit = function() { this.gameState = i.GameState.Tutorial; }; t.prototype.onShow = function() { e.prototype.onShow.call(this); this.gameStateManager = c.default.Instance.getInterface("GameStateManager"); this.audioManager = c.default.Instance.getInterface("AudioManager"); this.homeButton && this.homeButton.node.on(cc.Node.EventType.TOUCH_END, this.onHomeClicked, this); }; t.prototype.onHide = function() { e.prototype.onHide.call(this); this.homeButton && this.homeButton.node.off(cc.Node.EventType.TOUCH_END, this.onHomeClicked, this); }; t.prototype.onHomeClicked = function() { this.audioManager.playSFX(a.default.ButtonClick); this.gameStateManager.forceChangeGameState(i.GameState.Home); }; r([ l(cc.Button) ], t.prototype, "homeButton", void 0); return t = r([ p ], t); }(s.default); n.default = f; cc._RF.pop(); }, { "../../core/audio/AudioConst": "AudioConst", "../../core/gameState/GameState": "GameState", "../../core/interfaces/InterfaceManager": "InterfaceManager", "../../core/ui/BaseScreen": "BaseScreen" } ], UiManager: [ function(e, t, n) { "use strict"; cc._RF.push(t, "0bb0b9bOGBLjJ8OHGVHG16B", "UiManager"); var o = this && this.__extends || function() { var e = function(t, n) { return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) { e.__proto__ = t; } || function(e, t) { for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); })(t, n); }; return function(t, n) { e(t, n); function o() { this.constructor = t; } t.prototype = null === n ? Object.create(n) : (o.prototype = n.prototype, new o()); }; }(), r = this && this.__decorate || function(e, t, n, o) { var r, a = arguments.length, i = a < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--) (r = e[c]) && (i = (a < 3 ? r(i) : a > 3 ? r(t, n, i) : r(t, n)) || i); return a > 3 && i && Object.defineProperty(t, n, i), i; }; Object.defineProperty(n, "__esModule", { value: !0 }); var a = e("../events/GameEvents"), i = e("../gameState/GameState"), c = e("../interfaces/InterfaceManager"), s = e("../utils/Dictionary"), u = e("./BaseScreen"), p = cc._decorator, l = p.ccclass, f = p.property, h = function(e) { o(t, e); function t() { var t = null !== e && e.apply(this, arguments) || this; t.assignableScreens = []; t.availableScreens = new s.Dictionary(); t.stateScreenMap = new s.Dictionary(); t.wasOverlayState = !1; return t; } t.prototype.initialise = function() { var e = this; this.configure(); c.default.Instance.registerInterface(this); this.stateScreenMap.set(i.GameState.Home, this.getScreen(i.GameState.Home)); this.stateScreenMap.set(i.GameState.Gameplay, this.getScreen(i.GameState.Gameplay)); this.stateScreenMap.set(i.GameState.Result, this.getScreen(i.GameState.Result)); this.stateScreenMap.set(i.GameState.Tutorial, this.getScreen(i.GameState.Tutorial)); a.default.onGameStateChange.on(function(t) { var n = t.prevState, o = t.newState, r = t.isOverlayState; e.gameEventsOnOnGameStateChange(n, o, r); }); }; t.prototype.resolveDependencies = function() {}; t.prototype.terminate = function() { var e = this; a.default.onGameStateChange.off(function(t) { var n = t.prevState, o = t.newState, r = t.isOverlayState; e.gameEventsOnOnGameStateChange(n, o, r); }); }; t.prototype.isTypeOfBootStrapListener = function() { return !0; }; t.prototype.getClassName = function() { return "UiManager"; }; t.prototype.activate = function(e) { this.availableScreens.get(e).activate(); }; t.prototype.deactivate = function(e) { this.availableScreens.get(e).deactivate(); }; t.prototype.getScreen = function(e) { return this.availableScreens.get(e); }; t.prototype.configure = function() { var e = this; this.availableScreens = new s.Dictionary(); this.assignableScreens.forEach(function(t) { var n = t.getComponent(u.default); n.deactivate(); n.initialize(); e.availableScreens.set(n.gameState, n); }); }; t.prototype.gameEventsOnOnGameStateChange = function(e, t, n) { if (!n) { var o = this.stateScreenMap.get(e); o && o.deactivate(); } if (!this.wasOverlayState) { var r = this.stateScreenMap.get(t); r && r.activate(); } this.wasOverlayState = n; }; r([ f([ cc.Node ]) ], t.prototype, "assignableScreens", void 0); return t = r([ l ], t); }(cc.Component); n.default = h; cc._RF.pop(); }, { "../events/GameEvents": "GameEvents", "../gameState/GameState": "GameState", "../interfaces/InterfaceManager": "InterfaceManager", "../utils/Dictionary": "Dictionary", "./BaseScreen": "BaseScreen" } ] }, {}, [ "AudioConst", "AudioLibrary", "AudioManager", "IAudioManager", "BootStrap", "IBootStrapListener", "EventEmitter", "GameEvents", "GameState", "GameStateManager", "IGameStateManager", "IBase", "InterfaceManager", "BaseScreen", "IUiManager", "UiManager", "Dictionary", "BaseTile", "TileGridManager", "TilePoolManager", "TileType", "GameplayManager", "IGameplayManager", "ScoreManager", "GameplayScreen", "HomeScreen", "ResultScreen", "TutorialScreen", "CameraShake", "CountdownTimer" ]);