Hello fam,
I've developed a switchem bot upon request in thread http://forum.logicalgamers.com/publi...-switchem.html but it has some weird tendencies of not exactly following the refil pattern of gaia and I cant figure where its wrong. It fills correctly once the board fills initially and falls, then after the first move it seems correct most the time, but after that it gets off track and the board no longer represents what gaia's board does.
Code is below, its pure python3.7, no pip requirements.
To test whether things are working correctly Ive been running the bot in LOCAL_PLAY mode, which is a variable you'll see in the run.py code.
Open switchem in your browser, open dev tools in that window.
When you click play you'll see a request made to the gsi, 14000.
This response will give you an array 'startData', place that array on line 17 where it says startData = and has my old data.
Run the bot and it will spit out what moves you should make (Please note, the first row is row 0 NOT 1! so 4 really is row 5, etc.)
If you make these moves you should have the same score as the bot reports. Youll notice after the first couple moves you get off track.
Any solution will be appreciated! This was just a fun side project for me.
The bot can run live if you set LOCAL_PLAY = False, itll ask for your gaia user/pass.
Gaia's switchem game is a javascript/html5 game. Posted the game code below as well.
gaiaonline.py
run.pyCode:from urllib.request import HTTPCookieProcessor, ProxyHandler, build_opener import hashlib import urllib import re import json from http.cookiejar import CookieJar class GaiaLoginError(Exception): pass class GaiaOnline: def __init__(self, username=None, password=None, proxy=None): self.username = username self.password = password self.cookies = CookieJar() if proxy is None: self.opener = build_opener(HTTPCookieProcessor(self.cookies)) else: self.opener = build_opener(ProxyHandler(proxy), HTTPCookieProcessor(self.cookies)) self.opener.addheaders = [ ('User-Agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'), ('Accept', 'ttext/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3'), ('Accept-Language', 'en-US,en;q=0.8'), ('Connection', 'keep-alive'), ('Cache-Control', 'no-cache'), ('Referrer', 'https://www.gaiaonline.com/')] self.login() def request(self, act, url, post_data): if act == False: response = self.opener.open(url) return response.read().decode("utf-8") else: edata = urllib.parse.urlencode(post_data) response = self.opener.open(url, edata.encode('utf-8')) return response.read().decode("utf-8") def get(self, URL): if "https" not in URL: URL = "https://www.gaiaonline.com" + str(URL) return self.request(False, URL, "") def post(self, URL, pdata): if "https" not in URL: URL = "https://www.gaiaonline.com" + str(URL) return self.request(True, URL, pdata) def clear(self): self.cookies._cookies.clear() def between(self, sParse, start, finish): x = re.compile(start + "([^>]+)" + finish) i = x.findall(sParse) return i def login(self): source = self.get("/auth/login/") inputPattern = re.compile("<input([^>]+)>") inputs = inputPattern.findall(source) fieldPattern = re.compile("([a-zA-Z0-9\-\_]+)\=\"([^\"]{0,})\"") fieldList = {} for y in range(0, len(inputs)): fields = fieldPattern.findall(inputs[y]) name = "" val = "" for z in range(0, len(fields)): if fields[z][0] == "name": name = fields[z][1] elif fields[z][0] == "value": val = fields[z][1] try: fieldList[name] = val except: pass fieldList['username'] = self.username hasher = hashlib.md5() hasher.update(self.password.encode('utf-8')) r = hasher.hexdigest() hasher = hashlib.md5() hasher.update((r + fieldList['token']).encode('utf-8')) fieldList['chap'] = hasher.hexdigest() fieldList['password'] = '' fieldList['signInButton'] = '' fieldList['redirect'] = 'https://www.gaiaonline.com/' del fieldList['autologin'] login = self.post('/auth/login/', fieldList) if login.find('Log Out') == -1: raise GaiaLoginError() def getGold(self): data = json.loads(self.get('/mobileapp/userdata/1.6/list')) return int(data['gold']) def getSID(self): data = json.loads(self.get('/chat/gsi/index.php?&v=json&m=[[109,[]]]')) return data[0][2] def getAID(self): data = json.loads(self.get('/chat/gsi/index.php?&v=json&m=[[107,[]]]')) return data[0][2]['gaia_id'] def getGsi(self, gid, *params): params = json.dumps(list(params)) url = f'/chat/gsi/index.php?&v=json&m=[[{gid},{params}]]'.replace(' ', '') return json.loads(self.get(url)) def getDailyCandy(self, id): return json.loads(self.get(f'/dailycandy/pretty/?action=issue&list_id={id}&_view=json'))
Code:from gaiaonline import GaiaOnline import copy import ssl import time ssl._create_default_https_context = ssl._create_unverified_context LOCAL_PLAY = False if not LOCAL_PLAY: username = input('Username: ') from getpass import getpass password = getpass('Password: ') go = GaiaOnline(username, password) sid = go.getSID() gameData = go.getGsi(14000, 9, sid)[0][2] print('gameData', gameData) PlayID = gameData['playID'] startData = gameData['startData'] else: startData = {"LevelData":{"level":0,"blockString":"","ts":0},"targetScore":"2000","maxMoves":"30"} CurrentLevel = startData['LevelData']['level'] BlockString = startData['LevelData']['blockString'] MaxMoves = startData['maxMoves'] TargetScore = int(startData['targetScore']) Score = 0 MoveString = '' MovesLeft = 30 StartGrid = [[0 for x in range(8)] for y in range(8)] CurrentIndex = 0 def PrintGrid(grid): tg = copy.deepcopy(grid) res = ['P', 'O', 'Y', 'G', 'B', '6', '7', '8'] for x in range(8): for y in range(8): try: tg[x][y] = res[int(tg[x][y]) - 1] except ValueError: pass for x in range(len(tg)): print(tg[x]) def CalculateScore(grid, index_delta): global BlockString tid = copy.copy(index_delta) temp_grid = copy.deepcopy(grid) # Find all matches of 3 or more and replace with x's FILLER = ' ' before = copy.deepcopy(grid) for x in range(8): for y in range(8): current = grid[x][y] if x - 1 >= 0 and x + 1 < 8: north = grid[x - 1][y] south = grid[x + 1][y] if current == north and current == south: temp_grid[x][y] = FILLER temp_grid[x - 1][y] = FILLER temp_grid[x + 1][y] = FILLER for i in range(x + 2, 8): n = grid[i][y] if current != n: break temp_grid[i][y] = FILLER if y - 1 >= 0 and y + 1 < 8: west = grid[x][y - 1] east = grid[x][y + 1] if current == west and current == east: temp_grid[x][y] = FILLER temp_grid[x][y - 1] = FILLER temp_grid[x][y + 1] = FILLER for i in range(y + 2, 8): n = grid[x][i] if current != n: break temp_grid[x][i] = FILLER after_combos = copy.deepcopy(temp_grid) # Fall through x's while(True): moved = 0 for x in range(7, -1, -1): for y in range(7, -1, -1): if temp_grid[x][y] == FILLER: for i in range(x, 0, -1): if temp_grid[i - 1][y] != FILLER: moved += 1 temp_grid[i][y] = temp_grid[i - 1][y] temp_grid[i - 1][y] = FILLER if moved == 0: break after_fall = copy.deepcopy(temp_grid) # Fill Blanks score = 0 for y in range(7, -1, -1): for x in range(7, -1, -1): if temp_grid[x][y] == FILLER: score += 20 tid += 1 if tid >= len(BlockString): tid = 0 temp_grid[x][y] = BlockString[tid] return score, tid, temp_grid CurrentIndex = -1 for x in range(8): for y in range(8): CurrentIndex += 1 StartGrid[x][y] = BlockString[CurrentIndex] CurrentGrid = StartGrid while(True): score, n_id, n_grid = CalculateScore(CurrentGrid, CurrentIndex) if score == 0: break Score += score CurrentIndex = n_id CurrentGrid = n_grid print('Start Grid') PrintGrid(CurrentGrid) print('Start Score', Score) while(True): highscore = 0 highscore_swap = [[0,0], [0,1]] highest_index_delta = 0 highest_grid = CurrentGrid highest_changes = [] for x in range(7, -1, -1): for y in range(7, -1, -1): for direction in [(1, 0), (-1, 0), (0, 1), (0, -1)]: if x + direction[0] > 7 or x + direction[0] < 0: continue if y + direction[1] > 7 or y + direction[1] < 0: continue temp_grid = copy.deepcopy(CurrentGrid) gem1 = copy.copy(temp_grid[x][y]) gem2 = copy.copy(temp_grid[x + direction[0]][y + direction[1]]) temp_grid[x][y] = gem2 temp_grid[x + direction[0]][y + direction[1]] = gem1 t_score = 0 t_index_delta = copy.copy(CurrentIndex) while(True): score, t_index_delta, temp_grid = CalculateScore(temp_grid, t_index_delta) if score == 0: break t_score += score if t_score > highscore: highscore = t_score highscore_swap[0] = copy.deepcopy([x, y]) # Gem 1 location highscore_swap[1] = copy.deepcopy([x + direction[0], y + direction[1]]) # Gem 2 location highest_index_delta = copy.copy(t_index_delta) highest_grid = copy.deepcopy(temp_grid) gem1_index = (highscore_swap[0][0] * 8) + highscore_swap[0][1] gem2_index = (highscore_swap[1][0] * 8) + highscore_swap[1][1] MovesLeft -= 1 MoveString += f'{gem1_index}|{gem2_index}|0|' CurrentGrid = highest_grid Score += highscore CurrentIndex += highest_index_delta print('Move', highscore_swap[0], 'to', highscore_swap[1], 'for', highscore, 'points now totalling', Score) PrintGrid(CurrentGrid) # print('NewGrid') # PrintGrid(CurrentGrid) # print('New score', score) # print('Total score', Score) if Score >= TargetScore: # if MovesLeft == 0: totalMoves = int(MaxMoves) - MovesLeft print('Total Moves', totalMoves) print('Moves Left', MovesLeft) print('End Score', Score) print('End Grid') PrintGrid(CurrentGrid) print('MoveString', MoveString) if LOCAL_PLAY: break time.sleep(totalMoves * 9) submit = go.getGsi(14008, PlayID, MoveString, sid)[0][2] print(submit) if submit['over']: break startData = submit['startData'] print('startData', startData) PlayID = submit['playCode'] CurrentLevel = startData['LevelData']['level'] BlockString = startData['LevelData']['blockString'] MaxMoves = startData['maxMoves'] TargetScore = int(startData['targetScore']) Score = 0 MoveString = '' MovesLeft = int(MaxMoves) CurrentIndex = -1 StartGrid = [[0 for x in range(8)] for y in range(8)] for x in range(8): for y in range(8): CurrentIndex += 1 StartGrid[x][y] = BlockString[CurrentIndex] CurrentGrid = copy.deepcopy(StartGrid) while(True): score, n_id, n_grid = CalculateScore(CurrentGrid, CurrentIndex) if score == 0: break Score += score CurrentIndex = n_id CurrentGrid = n_grid print('Start Grid') PrintGrid(StartGrid) print('Start Score', Score) print('Starting level', CurrentLevel)
Gaia's 23.js game code
Code:!function(t) { var e = {}; function i(o) { if (e[o]) return e[o].exports; var n = e[o] = { i: o, l: !1, exports: {} }; return t[o].call(n.exports, n, n.exports, i), n.l = !0, n.exports } i.m = t, i.c = e, i.d = function(t, e, o) { i.o(t, e) || Object.defineProperty(t, e, { enumerable: !0, get: o }) } , i.r = function(t) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t, "__esModule", { value: !0 }) } , i.t = function(t, e) { if (1 & e && (t = i(t)), 8 & e) return t; if (4 & e && "object" == typeof t && t && t.__esModule) return t; var o = Object.create(null); if (i.r(o), Object.defineProperty(o, "default", { enumerable: !0, value: t }), 2 & e && "string" != typeof t) for (var n in t) i.d(o, n, function(e) { return t[e] } .bind(null, n)); return o } , i.n = function(t) { var e = t && t.__esModule ? function() { return t.default } : function() { return t } ; return i.d(e, "a", e), e } , i.o = function(t, e) { return Object.prototype.hasOwnProperty.call(t, e) } , i.p = "", i(i.s = 0) }([function(t, e, i) { "use strict"; function o(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } i.r(e); var n = function() { function t() { !function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, t) } var e, i, n; return e = t, n = [{ key: "scaleToGameW", value: function(t, e, i) { t.displayWidth = i.sys.game.config.width * e, t.scaleY = t.scaleX } }, { key: "scaleToGameH", value: function(t, e, i) { t.displayHeight = i.sys.game.config.height * e, t.scaleX = t.scaleY } }, { key: "centerH", value: function(t, e) { t.x = e.sys.game.config.width / 2 - t.displayWidth / 2 } }, { key: "centerV", value: function(t, e) { t.y = e.sys.game.config.height / 2 - t.displayHeight / 2 } }, { key: "center2", value: function(t, e) { t.x = e.sys.game.config.width / 2 - t.displayWidth / 2, t.y = e.sys.game.config.height / 2 - t.displayHeight / 2 } }, { key: "center", value: function(t, e) { t.x = e.sys.game.config.width / 2, t.y = e.sys.game.config.height / 2 } }, { key: "centerX", value: function(t) { return t.sys.game.config.width / 2 } }, { key: "getYPer", value: function(t, e) { return t.sys.game.config.height * e } }, { key: "getXPer", value: function(t, e) { return t.sys.game.config.width * e } }, { key: "scaleImageToSize", value: function(t, e, i) { var o = e / t.width , n = i / t.height , r = o; r > n && (r = n), t.setScale(r) } }, { key: "scaleImageToWidth", value: function(t, e) { var i = e / t.width; t.setScale(i) } }, { key: "alignToTopLeft", value: function(t) { t.x = t.displayWidth / 2, t.y = t.displayHeight / 2 } }, { key: "alignToTopRight", value: function(t, e) { t.x = e.sys.game.config.width - t.displayWidth / 2, t.y = t.displayHeight / 2 } }, { key: "alignToLBottomLeft", value: function(t, e) { t.x = t.displayWidth / 2, t.y = e.sys.game.config.height - t.displayHeight / 2 } }, { key: "alignToLBottomRight", value: function(t, e) { t.x = e.sys.game.config.width - t.displayWidth / 2, t.y = e.sys.game.config.height - t.displayHeight / 2 } }], (i = null) && o(e.prototype, i), n && o(e, n), t }(); function r(t) { return (r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function s(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function a(t, e) { return !e || "object" !== r(e) && "function" != typeof e ? l(t) : e } function c(t) { return (c = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function l(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t } function h(t, e) { return (h = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var u = null , f = function(t) { function e() { var t; return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), u || (t = a(this, c(e).call(this)), u = l(t)), a(t, u) } var i, o, n; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && h(t, e) }(e, Phaser.Events.EventEmitter), i = e, n = [{ key: "getInstance", value: function() { return u || (u = new e), u } }], (o = null) && s(i.prototype, o), n && s(i, n), e }(); function y(t) { return (y = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function p(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function d(t) { return (d = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function g(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t } function m(t, e) { return (m = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var b = function(t) { function e(t) { var i, o, n; return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), o = this, (i = !(n = d(e).call(this, t.scene, 0, 0, t.text)) || "object" !== y(n) && "function" != typeof n ? g(o) : n).config = t, i.setOrigin(.5, .5), t.x && (i.x = t.x), t.y && (i.y = t.y), t.scale && Align.scaleToGameW(g(i), t.scale), t.textStyle || (t.textStyle = { fontSize: "16px", color: "#ff0000" }), t.textStyle && (t.textStyle.style && i.setStyle(t.textStyle.style), t.textStyle.stroke && (t.textStyle.strokeThick ? i.setStroke(t.textStyle.stroke, t.textStyle.strokeThick) : i.setStroke(t.textStyle.stroke, 4)), t.textStyle.shadow && i.setShadow(4, 4, t.shadow, 2, !1, !0)), t.event && (i.setInteractive(), i.on("pointerdown", i.onDown, g(i))), i.scene.add.existing(g(i)), i } var i, o, n; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && m(t, e) }(e, Phaser.GameObjects.Text), i = e, (o = [{ key: "onDown", value: function() { f.getInstance().emit(this.config.event, this.config) } }, { key: "sceneChanged", value: function() { this.destroy() } }]) && p(i.prototype, o), n && p(i, n), e }(); function v(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } var k = function() { function t(e) { !function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, t), this.config = e, e.scene && (e.rows || (e.rows = 5), e.cols || (e.cols = 5), this.scene = e.scene, e.height || (e.height = this.scene.sys.game.config.height), e.width || (e.width = this.scene.sys.game.config.width), this.cw = e.width / e.cols, this.ch = e.height / e.rows, this.startX = 0, this.startY = 0, e.startX && (this.startX = e.startX), e.startY && (this.startY = e.startY)) } var e, i, o; return e = t, (i = [{ key: "show", value: function() { this.graphics = this.scene.add.graphics(), this.graphics.lineStyle(2, 16711680); for (var t = 0; t < this.config.width; t += this.cw) this.graphics.moveTo(this.startX + t, this.startY), this.graphics.lineTo(this.startX + t, this.startY + this.config.height); for (t = 0; t < this.config.height; t += this.ch) this.graphics.moveTo(this.startX, this.startY + t), this.graphics.lineTo(this.startX + this.config.width, this.startY + t); return this.graphics.strokePath(), this.graphics } }, { key: "placeAt", value: function(t, e, i) { var o = this.startX + this.cw * t + this.cw / 2 , n = this.startY + this.ch * e + this.ch / 2; return i.x = o, i.y = n, { x: o, y: n, sx: this.startX, sy: this.startY } } }, { key: "placeAtIndex", value: function(t, e) { var i = Math.floor(t / this.config.cols) , o = t - i * this.config.cols; return this.placeAt(o, i, e) } }, { key: "showNumbers", value: function() { this.show(); for (var t = 0, e = 0; e < this.config.rows; e++) for (var i = 0; i < this.config.cols; i++) { var o = this.scene.add.text(0, 0, t, { color: "#ff0000" }); o.setOrigin(.5, .5), this.placeAtIndex(t, o), t++ } } }, { key: "showPos", value: function() { this.show(); for (var t = 0; t < this.config.rows; t++) for (var e = 0; e < this.config.cols; e++) { var i = "x:" + e + "\ny:" + t , o = this.scene.add.text(0, 0, i, { color: "#ff0000", fontSize: 16, fontStyle: "bold", backgroundColor: "#000000" }); o.setOrigin(.5, .5), this.placeAt(e, t, o) } } }, { key: "findNearestIndex", value: function(t, e) { var i = Math.floor(e / this.ch) , o = Math.floor(t / this.cw); return i * this.config.cols + o } }, { key: "getPosByIndex", value: function(t) { var e = Math.floor(t / this.config.cols) , i = t - e * this.config.cols; return { x: this.cw * i + this.cw / 2, y: this.ch * e + this.ch / 2 } } }]) && v(e.prototype, i), o && v(e, o), t }(); function w(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } var S = null , O = function() { function t() { !function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, t), null == S && (S = this), this._score = 0, this.soundOn = !0, this.musicOn = !0, this.emitter = f.getInstance(), this.cardSize = .3, this.props = [], this.lists = [], this.powerUps = [], this.COLOR_BOMB = 10015307, this.SHUFFLE_BOMB = 10015313, this.COLUMN_BOMB = 10015309, this.ROW_BOMB = 10015311, this.powerUps[this.COLOR_BOMB] = [], this.powerUps[this.SHUFFLE_BOMB] = [], this.powerUps[this.COLUMN_BOMB] = [], this.powerUps[this.ROW_BOMB] = [], window.model = this } var e, i, o; return e = t, o = [{ key: "getInstance", value: function() { return null == S && (S = new t), S } }], (i = [{ key: "getPowerUpCount", value: function(t) { return this.powerUps[t].length } }, { key: "getPowerSerial", value: function(t) { return this.getPowerUpCount(t) > 0 ? this.powerUps[t].pop() : -1 } }, { key: "getGameSetting", value: function(t) { return "1" == this.getProp("gamesettings").substr(t, 1) } }, { key: "setProp", value: function(t, e) { e = e.replace("http://", "https://"), this.props[t] = e } }, { key: "getProp", value: function(t) { return this.props[t] } }, { key: "toggleMusic", value: function() { this.musicOn = !this.musicOn, this.emitter.emit("MUSIC_STAT_CHANGED") } }, { key: "toggleSound", value: function() { this.soundOn = !this.soundOn } }, { key: "getStars", value: function() { return 3 } }, { key: "score", set: function(t) { this._score = t, this.emitter.emit("SCORE_UPDATED") }, get: function() { return this._score } }]) && w(e.prototype, i), o && w(e, o), t }(); var _ = function t(e) { !function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, t), this.scene = e.scene; var i = this.scene.sys.game , o = this.scene.add.image(i.config.width / 2, i.config.height / 2, e.key); o.displayWidth = i.config.width, o.displayHeight = i.config.height }; function x(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } var P, T = null, E = function() { function t(e) { !function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, t), null == T && (T = this), this.setConstants(e) } var e, i, o; return e = t, o = [{ key: "getInstance", value: function(e) { return null == T && (T = new t(e)), window.textStyles = T, T } }], (i = [{ key: "setConstants", value: function(e) { this.width = e, t.SIZE_VERY_LARGE = e / 5, t.SIZE_LARGE = e / 10, t.SIZE_MED3 = e / 15, t.SIZE_MED = e / 20, t.SIZE_MED2 = e / 25, t.SIZE_SMALL = e / 30, t.SIZE_SMALL2 = e / 40, t.SIZE_SMALL3 = e / 45, t.MAIN_FONT = "Fredoka One", this.styles = [], this.styles[t.DEFAULT] = { style: { color: "#ffffff", fontSize: t.SIZE_MED } }, this.setDefaults() } }, { key: "getSize", value: function(t) { return this.width / t } }, { key: "getStyle", value: function(e) { return this.styles.hasOwnProperty(e) || (e = t.DEFAULT), this.styles[e] } }, { key: "addStyle", value: function(t, e) { this.styles[t] = e } }, { key: "regSimple", value: function(e, i) { var o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : t.SIZE_MED , n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : t.MAIN_FONT , r = { style: { color: i, fontSize: o, fontFamily: n } }; this.styles[e] = r } }, { key: "regAdvanced", value: function(e, i) { var o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : t.SIZE_MED , n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : t.MAIN_FONT , r = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : "#ff0000" , s = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 4; arguments.length > 6 && void 0 !== arguments[6] && arguments[6], this.styles[e] = { stroke: r, strokeThick: s, style: { color: i, fontSize: o, fontFamily: n } } } }, { key: "setDefaults", value: function() { this.styles.DEFAULT = { style: { color: "#ffffff", fontSize: t.SIZE_MED, font: t.MAIN_FONT } }, this.styles.PURPLE = { stroke: "#1D1F9C", strokeThick: 4, style: { color: "#1D1F9C", fontSize: t.SIZE_MED, fontFamily: t.MAIN_FONT } }, this.styles.TOAST_BAR = { shadow: "#000000", stroke: "#ff0000", strokeThick: 4, style: { color: "#ffffff", fontSize: t.SIZE_MED, fontFamily: t.MAIN_FONT } }, this.styles.CLOCK = { style: { color: "#ffffff", fontSize: t.SIZE_MED, fontFamily: t.MAIN_FONT } }, this.styles.CLOCK2 = { style: { color: "#000000", fontSize: t.SIZE_MED2, fontFamily: t.MAIN_FONT } }, this.styles.TITLE_TEXT = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_MED, color: "white" } }, this.styles.POINT_BOX = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_LARGE, color: "red" }, shadow: "#000000", stroke: "#ff0000", strokeThickness: 4 }, this.styles.POWER_UP_TEXT = { style: { fontFamily: "Fredoka One", fontSize: t.SIZE_SMALL, color: "white" }, stroke: "#000000", strokeThickness: 2 }, this.styles.POWER_UP_TEXT_NAME = { style: { fontFamily: "Fredoka One", fontSize: t.SIZE_SMALL2, color: "white" }, stroke: "#000000", strokeThickness: 2 }, this.styles.POWER_UP_TEXT_DESC = { style: { fontFamily: "Fredoka One", fontSize: t.SIZE_SMALL, color: "white", wordWrap: { width: this.width / 3, useAdvancedWrap: !0 } }, stroke: "#000000", strokeThickness: 2 }, this.styles.SCORE = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_LARGE, color: "#ffffff" } }, this.styles.SMALL_SCORE = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_MED, color: "#ffffff" } }, this.styles.BLACK = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_MED, color: "#000000" } }, this.styles.POINTS = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_VERY_LARGE, color: "#ff0000" } }, this.styles.WHITE = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_MED, color: "#ffffff" } }, this.styles.WHITE_SMALL = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_SMALL, color: "#ffffff" } }, this.styles.BLACK_SMALL = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_SMALL, color: "#000000" } }, this.styles.WHITE_SMALL2 = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_SMALL2, color: "#ffffff" } }, this.styles.WHITE_SMALL3 = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_SMALL3, color: "#ffffff" } }, this.styles.ERR = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_SMALL2, color: "#ff0000" } }, this.styles.SMALL_LABEL = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_SMALL, color: "#ffffff" } }, this.styles.BLACK_SMALL2 = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_SMALL3, color: "#000000" } }, this.styles.BUTTON_STYLE = { style: { fontFamily: t.MAIN_FONT, fontSize: t.SIZE_MED2, color: "#ffffff" } } } }]) && x(e.prototype, i), o && x(e, o), t }(); function C(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } var I, G = function() { function t() { !function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, t) } var e, i, o; return e = t, o = [{ key: "getInstance", value: function(e) { return null == P && ((P = new t).scene = e.scene, P.model = O.getInstance(), P.emitter = f.getInstance(), P.emitter.on("PLAY_SOUND", P.playSound.bind(P)), P.emitter.on("MUSIC_CHANGED", P.musicChanged, P)), P } }], (i = [{ key: "musicChanged", value: function() { this.background && (0 == this.model.musicOn ? this.background.stop() : this.background.play()) } }, { key: "playSound", value: function(t) { 1 == this.model.soundOn && this.scene.sound.add(t).play() } }, { key: "setBackgroundMusic", value: function(t) { 1 == this.model.musicOn && (this.background = this.scene.sound.add(t, { volume: .5, loop: !0 }), this.background.play()) } }]) && C(e.prototype, i), o && C(e, o), t }(); function j(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } var A = function() { function t() { !function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, t), this.model = O.getInstance(), this.mm = G.getInstance(), this.emitter = f.getInstance(), this.emitter.on("TOGGLE_MUSIC", this.toggleMusic.bind(this)), this.emitter.on("TOGGLE_SOUND", this.toggleSound.bind(this)), this.emitter.on("SET_SCORE", this.setScore.bind(this)), this.emitter.on("UP_POINTS", this.upPoints.bind(this)) } var e, i, o; return e = t, o = [{ key: "getInstance", value: function() { return null == I && (I = new t), I } }], (i = [{ key: "toggleMusic", value: function() { this.model.toggleMusic(), this.mm.musicChanged() } }, { key: "toggleSound", value: function() { this.model.toggleSound() } }, { key: "setScore", value: function(t) { this.model.score = t } }, { key: "upPoints", value: function(t) { var e = this.model.score; e += t, this.model.score = e } }]) && j(e.prototype, i), o && j(e, o), t }(); function M(t) { return (M = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function L(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function F(t, e) { return !e || "object" !== M(e) && "function" != typeof e ? R(t) : e } function B(t) { return (B = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function R(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t } function D(t, e) { return (D = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var N = function(t) { function e(t) { var i; if (function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), !t.scene) return console.log("missing scene!"), F(i); (i = F(this, B(e).call(this, t.scene))).scene = t.scene, i.emitter = f.getInstance(); var o = .1; return t.scale && (o = t.scale), i.back = i.scene.add.image(0, 0, t.backKey), i.onIcon = i.scene.add.image(0, 0, t.onIcon), i.offIcon = i.scene.add.image(0, 0, t.offIcon), n.scaleToGameW(i.back, o, i.scene), n.scaleToGameW(i.onIcon, o / 2, i.scene), n.scaleToGameW(i.offIcon, o / 2, i.scene), i.add(i.back), i.add(i.onIcon), i.add(i.offIcon), 0 != t.value && (t.value = !0), i.value = t.value, t.event && (i.event = t.event), t.callback && (i.callback = callback), i.setIcons(), i.back.setInteractive(), i.back.on("pointerdown", i.toggle, R(i)), t.x && (i.x = t.x), t.y && (i.y = t.y), i.setSize(i.back.displayWidth, i.back.displayHeight), i.scene.add.existing(R(i)), i } var i, o, r; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && D(t, e) }(e, Phaser.GameObjects.Container), i = e, (o = [{ key: "toggle", value: function() { this.value = !this.value, this.setIcons(), this.event && this.emitter.emit(this.event, this.value), this.callback && this.callback(this.value) } }, { key: "setIcons", value: function() { 1 == this.value ? (this.onIcon.visible = !0, this.offIcon.visible = !1) : (this.onIcon.visible = !1, this.offIcon.visible = !0) } }]) && L(i.prototype, o), r && L(i, r), e }(); function U(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } var W = function() { function t() { !function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, t), this._x = 0, this._y = 0, this._oldX = 0, this._oldY = 0, this._visible = !0, this._displayWidth = 0, this._displayHeight = 0, this.children = [], this.childIndex = -1, this.isPosBlock = !0, this._depth = 1, this._alpha = 1 } var e, i, o; return e = t, (i = [{ key: "setChildDepth", value: function(t) { var e = 100 * this._depth + t.childIndex; null == t.scene && (t.scene = gw.model.currentScene), t.depth = e, null != t.nextChild && this.setChildDepth(t.nextChild) } }, { key: "add", value: function(t) { this.childIndex++, t.childIndex = this.childIndex, this.children.push(t), this.buildList() } }, { key: "removeChild", value: function(t) { this.children.splice(t.childIndex, 1), this.buildList(); for (var e = this.children.length, i = 0; i < e; i++) this.children[i].childIndex = i; this.childIndex = e } }, { key: "buildList", value: function() { var t = this.children.length; if (t > 1) for (var e = 1; e < t; e++) this.children[e - 1].nextChild = this.children[e]; this.children[t - 1].nextChild = null } }, { key: "willRender", value: function() {} }, { key: "setSize", value: function(t, e) { this._displayWidth = t, this._displayHeight = e } }, { key: "setXY", value: function(t, e) { this.x = t, this.y = e, this.updatePositions() } }, { key: "setScrollFactor", value: function(t) { this.children.length > 0 && this.updateChildScroll(this.children[0], t) } }, { key: "updateChildScroll", value: function(t, e) { t.setScrollFactor(e), t.nextChild && t.nextChild.setScrollFactor(e) } }, { key: "updateChildAlpha", value: function(t, e) { t.alpha = e, 1 == t.isPosBlock && (t.alpha = e), null != t.nextChild && this.updateChildAlpha(t.nextChild, e) } }, { key: "updateChildVisible", value: function(t, e) { t.visible = e, 1 == t.isPosBlock && (t.visible = e), null != t.nextChild && this.updateChildVisible(t.nextChild, e) } }, { key: "updateChildPos", value: function(t) { t.y = t.y - this._oldY + this._y, t.x = t.x - this._oldX + this._x, 1 == t.isPosBlock && t.updatePositions(), null != t.nextChild && this.updateChildPos(t.nextChild), this._oldX = this._x, this._oldY = this._y } }, { key: "updatePositions", value: function() { this.children && this.children.length > 0 && this.updateChildPos(this.children[0]) } }, { key: "getRelPos", value: function(t) { return { x: t.x - this.x, y: t.y - this.y } } }, { key: "once", value: function(t, e, i) {} }, { key: "getChildren", value: function(t, e) { t.push(e), e.isPosBlock && e.children.length > 0 && e.getChildren(t, e.children[0]), e.nextChild && this.getChildren(t, e.nextChild) } }, { key: "getAllChildren", value: function() { var t = []; return this.children.length > 0 && this.getChildren(t, this.children[0]), t } }, { key: "getChildAt", value: function(t) { return this.children[t] } }, { key: "setMask", value: function(t) { this.getAllChildren().forEach(function(e) { e.setMask(t) } .bind(this)) } }, { key: "destroy", value: function() { var t = this.getAllChildren(); this.childIndex = -1; for (var e = t.length, i = 0; i < e; i++) t[i].destroy(); this.children.length = 0, t.length = 0 } }, { key: "depth", set: function(t) { this._depth = t, this.children.length > 0 && this.setChildDepth(this.children[0]) }, get: function() { return this._depth } }, { key: "x", set: function(t) { this._oldX = this._x, this._x = t, this.updatePositions() }, get: function() { return this._x } }, { key: "y", set: function(t) { this._oldY = this._y, this._y = t, this.updatePositions() }, get: function() { return this._y } }, { key: "displayWidth", get: function() { return this._displayWidth } }, { key: "displayHeight", get: function() { return this._displayHeight } }, { key: "visible", set: function(t) { this._visible != t && (this._visible = t, this.children.length > 0 && this.updateChildVisible(this.children[0], t)) }, get: function() { return this._visible } }, { key: "alpha", set: function(t) { this._alpha != t && (this._alpha = t, this.children.length > 0 && this.updateChildAlpha(this.children[0], t)) }, get: function() { return this._alpha } }]) && U(e.prototype, i), o && U(e, o), t }(); function z(t) { return (z = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function H(t, e) { return !e || "object" !== z(e) && "function" != typeof e ? function(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t }(t) : e } function X(t) { return (X = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function Y(t, e) { return (Y = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var Z = function(t) { function e(t) { var i; !function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), (i = H(this, X(e).call(this, t.scene))).scene = t.scene; var o = O.getInstance(); i.back = i.scene.add.image(0, 0, "panelBack"), n.scaleToGameW(i.back, .6, i.scene), i.add(i.back); var r = new N({ scene: i.scene, backKey: "toggle2", onIcon: "musicOn", offIcon: "musicOff", event: "TOGGLE_MUSIC", scale: .2, value: o.musicOn, x: 0, y: 0 }); i.add(r); var s = new N({ scene: i.scene, backKey: "toggle2", onIcon: "sfxOn", offIcon: "sfxOff", event: "TOGGLE_SOUND", value: o.soundOn, scale: .2, x: 0, y: 0 }); return i.add(s), r.x = i.back.x - .25 * i.back.displayWidth, s.x = i.back.x + .25 * i.back.displayWidth, i } return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && Y(t, e) }(e, t), e }(W); function V(t) { return (V = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function K(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function J(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t } function q(t, e, i) { return (q = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(t, e, i) { var o = function(t, e) { for (; !Object.prototype.hasOwnProperty.call(t, e) && null !== (t = Q(t)); ) ; return t }(t, e); if (o) { var n = Object.getOwnPropertyDescriptor(o, e); return n.get ? n.get.call(i) : n.value } } )(t, e, i || t) } function Q(t) { return (Q = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function tt(t, e) { return (tt = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var et = function(t) { function e(t) { var i, o, r; !function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), o = this, (i = !(r = Q(e).call(this, t.scene)) || "object" !== V(r) && "function" != typeof r ? J(o) : r).scene = t.scene; var s = t.effectNumber , a = t.effect; if (console.log("imageKey=" + a), i.image = i.scene.add.sprite(0, 0, a), i.add(i.image), t.scale && n.scaleToGameW(i.image, t.scale, t.scene), t.forever || (t.forever = !1), s < 11) i.maxScale = 1, t.maxScale && (i.maxScale = t.maxScale), i.time = 500, t.time && (i.time = t.time), i.scene.tweens.add({ targets: i.image, duration: i.time, scaleX: i.maxScale, scaleY: i.maxScale, alpha: 0, angle: 180, onComplete: i.destroy.bind(J(i)) }); else { var c = "effect_anim_" + a; if (console.log("key=" + c), !i.scene.anims.anims.has(c)) { var l = i.scene.anims.generateFrameNumbers(a); i.scene.anims.create({ key: c, frames: l, frameRate: 64, repeat: 0 }) } i.image.play(c), 0 == t.forever && i.image.on("animationcomplete", i.destroy, J(i)) } return t.x && (i.x = t.x), t.y && (i.y = t.y), i } var i, o, r; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && tt(t, e) }(e, t), i = e, (o = [{ key: "destroy", value: function() { q(Q(e.prototype), "destroy", this).call(this) } }]) && K(i.prototype, o), r && K(i, r), e }(W); function it(t) { return (it = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function ot(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function nt(t, e) { return !e || "object" !== it(e) && "function" != typeof e ? function(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t }(t) : e } function rt(t) { return (rt = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function st(t, e) { return (st = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var at = function(t) { function e(t) { return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), nt(this, rt(e).call(this, t)) } var i, o, r; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && st(t, e) }(e, Phaser.Scene), i = e, (o = [{ key: "preload", value: function() {} }, { key: "create", value: function() { this.mm = G.getInstance({ scene: this }), this.controller = A.getInstance(), this.model = O.getInstance(), this.emitter = f.getInstance(), this.textStyles = E.getInstance(this.sys.game.config.width), this.gw = this.sys.game.config.width, this.gh = this.sys.game.config.height } }, { key: "setBackground", value: function(t) { return new _({ scene: this, key: t }) } }, { key: "placeImage", value: function(t, e, i) { var o, r = arguments.length > 3 && void 0 !== arguments[3] && arguments[3]; return o = 0 == r ? this.add.sprite(0, 0, t) : this.physics.add.sprite(0, 0, t), isNaN(e) ? this.aGrid.placeAt(e.x, e.y, o) : this.aGrid.placeAtIndex(e, o), -1 != i && n.scaleToGameW(o, i, this), o } }, { key: "placeText", value: function(t, e, i) { var o = this.textStyles.getStyle(i) , n = new b({ scene: this, text: t, textStyle: o }); return isNaN(e) ? this.aGrid.placeAt(e.x, e.y, n) : this.aGrid.placeAtIndex(e, n), n } }, { key: "placeAtIndex", value: function(t, e) { this.aGrid.placeAtIndex(t, e, this) } }, { key: "placeAt", value: function(t, e, i) { this.aGrid.placeAt(t, e, i, this) } }, { key: "makeAlignGrid", value: function() { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 11 , e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 11; this.aGrid = new k({ scene: this, rows: t, cols: e }) } }, { key: "makeGear", value: function() { var t = this.add.image(0, 0, "gear"); n.scaleToGameW(t, .1, this), this.aGrid.placeAtIndex(110, t), t.setInteractive(), t.on("pointerdown", this.toggleSoundPanel.bind(this)) } }, { key: "makeSoundPanel", value: function() { this.soundPanel = new Z({ scene: this }), n.center(this.soundPanel, this), this.soundPanel.visible = !1, this.soundPanel.depth = 2e3 } }, { key: "toggleSoundPanel", value: function() { this.soundPanel.visible = !this.soundPanel.visible } }, { key: "placeEffect", value: function(t, e, i) { var o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : .2; console.log(i), new et({ scene: this, effect: i, scale: o, x: t, y: e }) } }, { key: "getStyle", value: function(t) { return this.textStyles.getStyle(t) } }, { key: "update", value: function() {} }]) && ot(i.prototype, o), r && ot(i, r), e }(); function ct(t) { return (ct = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function lt(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function ht(t) { return (ht = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function ut(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t } function ft(t, e) { return (ft = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var yt = function(t) { function e(t) { var i, o, r; return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), o = this, (i = !(r = ht(e).call(this, t.scene, 0, 0, t.key)) || "object" !== ct(r) && "function" != typeof r ? ut(o) : r).config = t, i.scene = t.scene, i.type = "gem", i.fallHeight = t.fallHeight, i.grid = t.grid, i.color = t.color, window.gem = ut(i), n.scaleToGameW(ut(i), t.scale, t.scene), i.scene.add.existing(ut(i)), i.north = null, i.south = null, i.east = null, i.west = null, i.removeFlag = !1, i.fallCount = 0, 0 == i.color && (i.alpha = .5), i } var i, o, r; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && ft(t, e) }(e, Phaser.GameObjects.Sprite), i = e, (o = [{ key: "reset", value: function() { this.x = this.ox, this.y = this.oy } }, { key: "checkRow", value: function() { this.east && this.west && this.color == this.east.color && this.color == this.west.color && (this.visible = !1, this.east.visible = !1, this.west.visible = !1, this.grid[this.row][this.col] = 0, this.grid[this.row][this.col - 1] = 0, this.grid[this.row][this.col + 1] = 0, this.removeFlag = !0, this.west.removeFlag = !0, this.east.removeFlag = !0, this.scene.matchFound = !0), this.east && this.east.checkRow() } }, { key: "checkCol", value: function() { this.north && this.south && this.color == this.north.color && this.color == this.south.color && (this.visible = !1, this.north.visible = !1, this.south.visible = !1, this.grid[this.row][this.col] = 0, this.grid[this.row - 1][this.col] = 0, this.grid[this.row + 1][this.col] = 0, this.removeFlag = !0, this.south.removeFlag = !0, this.north.removeFlag = !0, this.scene.matchFound = !0), this.south && this.south.checkCol() } }, { key: "setColor", value: function(t) { this.color = t, this.setTexture("icon" + t), this.setInteractive(), n.scaleToGameW(this, this.config.scale, this.config.scene), this.scene.tweens.add({ targets: this, duration: 300, y: this.oy }) } }, { key: "setColor2", value: function(t) { this.color = t, this.setTexture("icon" + t), this.setInteractive(), n.scaleToGameW(this, this.config.scale, this.config.scene) } }, { key: "fall", value: function() { this.fallCount > 0 && (this.scene.tweens.add({ targets: this, duration: 200, y: this.y + this.fallHeight * this.fallCount }), this.fallCount = 0), this.south && this.south.fall() } }, { key: "strikeColor", value: function(t) { this.color == t && (this.grid[this.row][this.col] = 0, this.removeFlag = !0, this.visible = !1), this.next ? this.next.strikeColor(t) : this.scene.strikeColors() } }, { key: "checkEffect", value: function() { 1 == this.removeFlag && this.scene.placeEffect(this.x, this.y, "matcheffect"), this.next && this.next.checkEffect() } }]) && lt(i.prototype, o), r && lt(i, r), e }(); function pt(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } var dt = function() { function t() { !function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, t) } var e, i, o; return e = t, (i = [{ key: "callGsi", value: function(t, e) { for (var i = O.getInstance(), o = i.mainServer + "chat/gsi/gateway2.php", n = [], r = arguments.length, s = new Array(r > 2 ? r - 2 : 0), a = 2; a < r; a++) s[a - 2] = arguments[a]; for (var c = 0, l = s; c < l.length; c++) { var h = l[c]; n.push(h) } var u = [[t, n]] , f = (new Date).getTime() , y = { m: JSON.stringify(u), v: "json", X: parseInt(f) }; $.ajax({ type: "post", url: o, dataType: "text", data: y, success: function(t) { e && e(t) }, error: function(t, e) {} }) } }]) && pt(e.prototype, i), o && pt(e, o), t }(); function gt(t) { return (gt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function mt(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function bt(t, e) { return !e || "object" !== gt(e) && "function" != typeof e ? function(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t }(t) : e } function vt(t) { return (vt = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function kt(t, e) { return (kt = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var wt = function(t) { function e(t) { var i; return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), (i = bt(this, vt(e).call(this))).scene = t.scene, i.config = t, i.gw = i.scene.sys.game.config.width, i.gh = i.scene.sys.game.config.height, i.textStyles = E.getInstance(i.gw), i } var i, o, r; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && kt(t, e) }(e, t), i = e, (o = [{ key: "initPos", value: function() { this.config.x && (this.x = this.config.x), this.config.y && (this.y = this.config.y), this.config.grid && (this.pgrid = this.config.grid, this.pgrid.placeAtIndex(this.config.pos, this)) } }, { key: "setAlignGrid", value: function(t, e) { if (this.back) { var i = this.back.x - this.back.displayWidth / 2 , o = this.back.y - this.back.displayHeight / 2; this.aGrid = new k({ scene: this.scene, rows: t, cols: e, width: this.back.displayWidth, height: this.back.displayHeight, startX: i, startY: o }) } else console.log("Back Not Set") } }, { key: "fixGrid", value: function() { var t = this.back.x - this.back.displayWidth / 2 , e = this.back.y - this.back.displayHeight / 2; this.aGrid.startX = t, this.aGrid.startY = e } }, { key: "showGrid", value: function() { this.fixGrid(), this.aGrid.show() } }, { key: "showGridNumbers", value: function() { this.fixGrid(), this.aGrid.showNumbers(this.back.x - this.back.displayWidth / 2, this.back.y - this.back.displayHeight / 2) } }, { key: "setBack", value: function(t) { var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1; this.back = this.scene.add.image(0, 0, t), -1 != e && this.scale(this.back, e), this.add(this.back), this.initPos() } }, { key: "scale", value: function(t, e) { n.scaleToGameW(t, e, this.scene) } }, { key: "scaleToBackW", value: function(t, e) { t.displayWidth = this.back.displayWidth * per, t.scaleY = t.scaleX } }, { key: "scaleToBackH", value: function(t, e) { t.displayHeight = this.back.displayHeight * per, t.scaleX = t.scaleY } }, { key: "placeImage", value: function(t, e, i) { var o = this.scene.add.sprite(0, 0, t); return this.aGrid.placeAtIndex(e, o), -1 != i && n.scaleToGameW(o, i, this.scene), this.add(o), o } }, { key: "placeText", value: function(t, e, i) { var o = this.textStyles.getStyle(i) , n = new b({ scene: this.scene, text: t, textStyle: o }); return this.add(n), this.aGrid.placeAtIndex(e, n), n } }]) && mt(i.prototype, o), r && mt(i, r), e }(W); function St(t) { return (St = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function Ot(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function _t(t) { return (_t = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function xt(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t } function Pt(t, e) { return (Pt = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var Tt = function(t) { function e(t) { var i, o, n; return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), o = this, (i = !(n = _t(e).call(this, t)) || "object" !== St(n) && "function" != typeof n ? xt(o) : n).config = t, i.scene = t.scene, i.model = O.getInstance(), i.setBack(t.key, .33), i.back.displayHeight = i.back.displayWidth, i.setAlignGrid(3, 3), i.placeImage(t.imageKey, .1, .1), i.countText = i.placeText(t.name + " X " + t.q, 1.5, "POWER_UP_TEXT_NAME"), i.placeText(t.description, 4, "POWER_UP_TEXT_DESC"), i.placeText("Click To Use", 7, "POWER_UP_TEXT"), t.backColor ? t.backColor = t.backColor.replace("#", "0x") : t.backColor = "#2ecc71", i.back.setTint(t.backColor), i.back.setInteractive(), i.back.on("pointerdown", i.pressMe.bind(xt(i))), i } var i, o, n; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && Pt(t, e) }(e, t), i = e, (o = [{ key: "updateData", value: function() { console.log("updateData"); var t = this.model.getPowerUpCount(this.config.powerUp); this.countText.setText(this.config.name + "X " + t, 1.5, "POWER_UP_TEXT_NAME") } }, { key: "pressMe", value: function() { this.config.callback && this.config.callback(this.config.powerUp) } }]) && Ot(i.prototype, o), n && Ot(i, n), e }(wt); function Et(t) { return (Et = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function Ct(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function It(t) { return (It = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function Gt(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t } function jt(t, e) { return (jt = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var At = function(t) { function e(t) { var i, o, n; return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), t.key, o = this, (i = !(n = It(e).call(this, { scene: t.scene })) || "object" !== Et(n) && "function" != typeof n ? Gt(o) : n).config = t, i.scene = t.scene, t.scale || (t.scale = .4), i.setBack(t.key, t.scale), i.setAlignGrid(3, 3), i.text1 = i.placeText(t.text, 4, t.textStyle), t.x && (i.x = t.x), t.y && (i.y = t.y), t.callback && (i.callback = t.callback, i.back.setInteractive(), i.back.on("pointerup", i.pressed, Gt(i))), i.setSize(i.back.displayWidth, i.back.displayHeight), i } var i, o, n; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && jt(t, e) }(e, t), i = e, (o = [{ key: "centerV", value: function() { this.text1.y = this.back.y + this.back.displayHeight / 2 - this.text1.displayHeight / 2 } }, { key: "sceneChanged", value: function() { this.back.off("pointerup", this.pressed, this), this.back.off("pointerover", this.over, this), this.back.off("pointerout", this.out, this) } }, { key: "over", value: function() { this.y -= 5 } }, { key: "out", value: function() { this.y += 5 } }, { key: "pressed", value: function() { this.callback(this) } }]) && Ct(i.prototype, o), n && Ct(i, n), e }(wt); function Mt(t) { return (Mt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function Lt(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function Ft(t) { return (Ft = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function Bt(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t } function Rt(t, e) { return (Rt = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var Dt = function(t) { function e(t) { var i, o, n; !function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), o = this, (i = !(n = Ft(e).call(this, t)) || "object" !== Mt(n) && "function" != typeof n ? Bt(o) : n).config = t, i.scene = t.scene, i.setBack(t.key, .8), i.back.displayHeight = 1.25 * i.back.displayWidth, i.model = O.getInstance(); var r = i.model.colorArray[1]; r = r.replace("#", "0x"), i.back.setTint(r), i.setAlignGrid(5, 5); var s = new Tt({ scene: i.scene, name: "Shuffle Bomb", powerUp: i.model.SHUFFLE_BOMB, key: "panelBack", imageKey: "shufflebomb", description: i.model.getProp("shuffletext"), q: i.model.getPowerUpCount(i.model.SHUFFLE_BOMB), backColor: i.model.colorArray[0], callback: t.powerCallback }); i.add(s), i.aGrid.placeAt(.8, .75, s); var a = new Tt({ scene: i.scene, name: "Color Bomb", powerUp: i.model.COLOR_BOMB, key: "panelBack", imageKey: "colorbomb", description: i.model.getProp("colortext"), q: i.model.getPowerUpCount(i.model.COLOR_BOMB), backColor: i.model.colorArray[0], callback: t.powerCallback }); i.add(a), i.aGrid.placeAt(3.2, .75, a); var c = new Tt({ scene: i.scene, name: "Row Bomb", powerUp: i.model.ROW_BOMB, key: "panelBack", imageKey: "rowbomb", description: i.model.getProp("rowtext"), q: i.model.getPowerUpCount(i.model.ROW_BOMB), backColor: i.model.colorArray[0], callback: t.powerCallback }); i.add(c), i.aGrid.placeAt(.8, 2.6, c); var l = new Tt({ scene: i.scene, name: "Colomn Bomb", key: "panelBack", powerUp: i.model.COLUMN_BOMB, imageKey: "colbomb", description: i.model.getProp("columntext"), q: i.model.getPowerUpCount(i.model.COLUMN_BOMB), backColor: i.model.colorArray[0], callback: t.powerCallback }); i.add(l), i.aGrid.placeAt(3.2, 2.6, l); var h = new At({ scene: i.scene, textStyle: "BUTTON_STYLE", key: "button", text: "CLOSE", callback: i.closeMe.bind(Bt(i)) }); return i.add(h), i.aGrid.placeAtIndex(22, h), i.boxes = [s, a, c, l], i } var i, o, n; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && Rt(t, e) }(e, t), i = e, (o = [{ key: "openMe", value: function() { for (var t = 0; t < this.boxes.length; t++) this.boxes[t].updateData(); this.visible = !0 } }, { key: "closeMe", value: function() { this.config.closeCallback() } }]) && Lt(i.prototype, o), n && Lt(i, n), e }(wt); function Nt(t) { return (Nt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function Ut(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function Wt(t) { return (Wt = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function zt(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t } function Ht(t, e) { return (Ht = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var Xt = function(t) { function e(t) { var i, o, n; !function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), o = this, (i = !(n = Wt(e).call(this, t)) || "object" !== Nt(n) && "function" != typeof n ? zt(o) : n).config = t, i.scene = t.scene, i.setBack(t.key, .7), i.back.displayHeight = .5 * i.scene.gh, i.model = O.getInstance(); var r = i.model.colorArray[1]; r = r.replace("#", "0x"), i.back.setTint(r), i.setAlignGrid(3, 3), i.placeImage("coin", 1, .2); var s = new At({ scene: i.scene, textStyle: "BUTTON_STYLE", key: "button", text: "Close", scale: .4, callback: i.closePanel.bind(zt(i)) }); return i.add(s), i.aGrid.placeAtIndex(7, s), i.prizeText = i.placeText("You got xxxx platinum!", 4, "WHITE"), i } var i, o, n; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && Ht(t, e) }(e, t), i = e, (o = [{ key: "setData", value: function(t) { this.prizeText.setText("You got " + t + " platinum!"), this.visible = !0 } }, { key: "closePanel", value: function() { this.visible = !1, this.config.closeCallback && this.config.closeCallback() } }]) && Ut(i.prototype, o), n && Ut(i, n), e }(wt); function Yt(t) { return (Yt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function Zt(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function Vt(t, e) { return !e || "object" !== Yt(e) && "function" != typeof e ? function(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t }(t) : e } function Kt(t, e, i) { return (Kt = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(t, e, i) { var o = function(t, e) { for (; !Object.prototype.hasOwnProperty.call(t, e) && null !== (t = Jt(t)); ) ; return t }(t, e); if (o) { var n = Object.getOwnPropertyDescriptor(o, e); return n.get ? n.get.call(i) : n.value } } )(t, e, i || t) } function Jt(t) { return (Jt = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function qt(t, e) { return (qt = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var $t = function(t) { function e() { return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), Vt(this, Jt(e).call(this, "SceneMain")) } var i, o, r; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && qt(t, e) }(e, t), i = e, (o = [{ key: "preload", value: function() {} }, { key: "create", value: function() { Kt(Jt(e.prototype), "create", this).call(this), this.makeAlignGrid(11, 11), window.scene = this, this.clickLock = !0, this.powerIndex = 0, this.overFlag = !1, this.verifyFlag = !1, this.bg = this.setBackground("background"), this.dataString = this.model.blockString, this.dataIndex = -1, this.dataArray = this.dataString.split(""), this.moveString = "", this.score = 0, this.swapFlag = !1, this.gemGroup = this.add.group(), this.gemCount = 5, this.startX = parseFloat(this.model.getProp("gridx")), this.startY = parseFloat(this.model.getProp("gridy")), this.rows = 8, this.cols = 8, this.firstGem = null, this.gemSize = parseFloat(this.model.getProp("gemsize")), this.rowMulti = 1, this.colMulti = 1, this.selectedSize = .1, this.grid = [], this.gemGrid = []; for (var t = 0; t < this.rows; t++) this.grid[t] = [], this.gemGrid[t] = []; this.centerPanel = this.placeImage("panelBack", 60, .9), this.centerPanel.displayHeight = .75 * this.gh; var i = this.model.colorArray[2]; i = i.replace("#", "0x"), this.centerPanel.setTint(i); var o = parseFloat(this.model.getProp("centerpanely")); this.placeAt(5, o, this.centerPanel), this.makeUi(), this.setValues(), this.makeBoard(), this.input.on("gameobjectdown", this.iconDown.bind(this)), this.input.on("gameobjectup", this.iconClick.bind(this)), this.time.addEvent({ delay: 1e3, callback: this.checkAll.bind(this), loop: !1 }), this.updateText(), this.timer1 = this.time.addEvent({ delay: 2e3, callback: this.showSelected.bind(this), loop: !0 }) } }, { key: "getNextVal", value: function() { return this.dataIndex++, this.dataIndex > this.dataArray.length - 1 && (this.dataIndex = 0), this.dataArray[this.dataIndex] } }, { key: "checkAll", value: function() { this.matchFound = !1; for (var t = 0; t < this.rows; t++) this.checkRow(t); for (var e = 0; e < this.rows; e++) this.checkCol(e); 1 == this.matchFound ? (this.swapFlag = !1, this.doFalls()) : 1 == this.swapFlag ? this.swapBack(this.gem2, this.gem1) : (this.gem1 && (this.model.movesLeft--, this.updateText(), this.moveString += this.gem1.index + "|" + this.gem2.index + "|0|"), this.makeBoard(), this.clickLock = !1) } }, { key: "setValues", value: function() { for (var t = 0; t < this.rows; t++) for (var e = 0; e < this.cols; e++) { var i = this.getNextVal(); this.grid[t][e] = i } } }, { key: "makeBoard", value: function() { if (1 != this.overFlag) { this.gemGroup.clear(!0, !0); for (var t = 0, e = 0; e < this.rows; e++) { for (var i = 0; i < this.cols; i++) { var o = this.grid[e][i] , r = new yt({ grid: this.grid, scene: this, key: "icon" + o, scale: this.gemSize, fallHeight: this.aGrid.ch, color: o }); this.placeAt(this.startX + i * this.colMulti, this.startY + e * this.rowMulti, r), r.setInteractive(), n.scaleToGameW(r, this.gemSize, this), r.row = e, r.col = i, r.ox = r.x, r.oy = r.y, r.index = t, r.dir = 1, t++, this.gemGroup.add(r), this.gemGrid[e][i] = r } 0 == this.model.movesLeft && (this.clickLock = !0, this.verifyGame()) } this.mapBoard(), 1 == this.matchFound ? (this.fillFlag = !0, this.fillBlanks()) : 1 == this.fillFlag && (this.fillFlag = !1, this.makeBoard()) } } }, { key: "mapBoard", value: function() { var t = null; this.startGem = null; for (var e = 0; e < this.rows; e++) for (var i = 0; i < this.cols; i++) { var o = this.getGemAt(e, i); t && (t.next = o, o.prev = t), t = o, null == this.startGem && (this.startGem = o), e > 0 && (o.north = this.getGemAt(e - 1, i)), e < this.rows - 1 && (o.south = this.getGemAt(e + 1, i)), i > 0 && (o.west = this.getGemAt(e, i - 1)), i < this.cols - 1 && (o.east = this.getGemAt(e, i + 1)) } } }, { key: "displayGrid", value: function() { for (var t = 0; t < this.rows; t++) { for (var e = "", i = 0; i < this.cols; i++) e += this.getGemValue(t, i) + ""; console.log(e) } console.log("_____") } }, { key: "fillBlanks", value: function() { if (1 != this.overFlag) { for (var t = 0, e = this.rows - 1; e > -1; e--) for (var i = this.cols - 1; i > -1; i--) { var o = this.getGemAt(i, e); if (0 == o.color) { o.y = this.aGrid.ch * o.row - this.gh; var n = this.getNextVal(); t++, this.setGemValue(i, e, n), o.setColor(n), o.alpha = 1 } } var r = 20 * t; this.model.score += r, this.updateText(), this.model.score < this.model.targetScore - 1 ? 1 == this.matchFound && this.time.addEvent({ delay: 400, callback: this.checkAll.bind(this), callbackScope: this, loop: !1 }) : (console.log("VERIFY"), this.gem1 && (this.moveString += this.gem1.index + "|" + this.gem2.index + "|0|"), this.verifyGame()) } } }, { key: "iconDown", value: function(t, e) { if (1 != this.clickLock && "gem" == e.type) if (this.placeEffect(t.x, t.y, "clickeffect"), 0 == this.powerIndex) this.downGem && n.scaleToGameW(this.downGem, this.gemSize, this), this.downGem = e, n.scaleToGameW(this.downGem, this.selectedSize, this); else switch (this.powerIndex) { case 1: this.doRemoveColor(e.color); break; case 2: this.doRemoveRow(e); break; case 3: this.doRemoveCol(e) } } }, { key: "iconClick", value: function(t, e) { if (1 != this.clickLock && "gem" == e.type && 0 == this.powerIndex) { if (this.placeEffect(t.x, t.y, "clickeffect"), this.mm.playSound("clicksound"), this.downGem && (n.scaleToGameW(this.downGem, this.gemSize, this), this.downGem != e && (console.log("swipe"), this.firstGem = this.downGem)), null == this.firstGem) return this.firstGem = e, void n.scaleToGameW(this.firstGem, this.selectedSize, this); if (e == this.firstGem) return n.scaleToGameW(this.firstGem, this.gemSize, this), void (this.firstGem = null); if (e.row != this.firstGem.row && e.col != this.firstGem.col) return n.scaleToGameW(this.firstGem, this.gemSize, this), void (this.firstGem = null); var i = Math.abs(e.row - this.firstGem.row) , o = Math.abs(e.col - this.firstGem.col); if (i > 1 || o > 1) return n.scaleToGameW(this.firstGem, this.gemSize, this), void (this.firstGem = null); this.downGem && n.scaleToGameW(this.downGem, this.gemSize, this), this.clickLock = !0, this.swapGems(this.firstGem, e), this.firstGem = null, this.downGem = null } } }, { key: "getGemAt", value: function(t, e) { return this.gemGrid[t][e] } }, { key: "getGemValue", value: function(t, e) { return this.grid[t][e] } }, { key: "setGemValue", value: function(t, e, i) { this.grid[t][e] = i } }, { key: "dropDownGrid", value: function() { for (var t = 0; t < this.rows - 1; t++) for (var e = 0; e < this.cols; e++) { var i = this.grid[t][e]; this.grid[t + 1][e], 0 == i && (this.grid[t + 1][e] = i, this.grid[t][e] = 0) } } }, { key: "checkRow", value: function(t) { this.getGemAt(t, 0).checkRow() } }, { key: "checkCol", value: function(t) { this.getGemAt(0, t).checkCol() } }, { key: "getFallCount", value: function() { this.mm.playSound("matchsound"); for (var t = 0; t < this.rows; t++) for (var e = 0; e < this.cols; e++) { var i = this.getGemAt(t, e); 1 == i.removeFlag ? (this.placeEffect(i.x, i.y, "matcheffect"), i.fallCount = 0) : i.fallCount = this.checkHoles(t, e) } } }, { key: "checkHoles", value: function(t, e) { for (var i = 0, o = t + 1; o < this.rows; o++) 1 == this.getGemAt(o, e).removeFlag && i++; return i } }, { key: "doEffects", value: function() { this.startGem.checkEffect() } }, { key: "doFalls", value: function() { this.getFallCount(); for (var t = 0; t < this.cols; t++) this.getGemAt(0, t).fall(); this.fallCols() } }, { key: "fallCols", value: function() { for (var t = 0; t < this.cols; t++) this.fallCol(t); this.time.addEvent({ delay: 400, callback: this.makeBoard.bind(this), loop: !1 }) } }, { key: "fallCol", value: function(t) { for (var e = 0; e < this.rows; e++) for (var i = this.rows - 1; i > 0; i--) { var o = this.getGemValue(i, t) , n = (this.getGemAt(i, t), this.getGemValue(i - 1, t)); 0 == o && n && (this.setGemValue(i - 1, t, o), this.setGemValue(i, t, n)) } } }, { key: "swapGems", value: function(t, e) { this.swapFlag = !0, this.gem1 = t, this.gem2 = e, n.scaleToGameW(t, this.gemSize, this), n.scaleToGameW(e, this.gemSize, this), this.tweens.add({ targets: t, duration: 200, y: e.y, x: e.x }), this.tweens.add({ targets: e, duration: 200, y: t.y, x: t.x, onComplete: this.swapDone.bind(this) }); var i = this.grid[t.row][t.col]; this.grid[t.row][t.col] = this.grid[e.row][e.col], this.grid[e.row][e.col] = i } }, { key: "swapBack", value: function(t, e) { this.swapFlag = !1, this.gem1 = t, this.gem2 = e, this.tweens.add({ targets: t, duration: 200, y: e.y, x: e.x }), this.tweens.add({ targets: e, duration: 200, y: t.y, x: t.x, onComplete: this.swapBackDone.bind(this) }); var i = this.grid[t.row][t.col]; this.grid[t.row][t.col] = this.grid[e.row][e.col], this.grid[e.row][e.col] = i } }, { key: "swapDone", value: function() { var t = this.gem1.color , e = this.gem2.color; this.gem1.setColor2(e), this.gem2.setColor2(t), this.gem1.reset(), this.gem2.reset(), this.time.addEvent({ delay: 300, callback: this.checkAll.bind(this), loop: !1 }) } }, { key: "swapBackDone", value: function() { var t = this.gem1.color , e = this.gem2.color; this.gem1.setColor2(e), this.gem2.setColor2(t), this.gem1.reset(), this.gem2.reset(), this.clickLock = !1 } }, { key: "makeUi", value: function() { Kt(Jt(e.prototype), "makeSoundPanel", this).call(this), Kt(Jt(e.prototype), "makeGear", this).call(this), this.placeImage("scoreback", 1, .3), this.scoreText = this.placeText("0", { x: 1, y: .1 }, "SMALL_SCORE"), this.placeImage("scoreback", 5, .3), this.targetScore = this.placeText("Target: " + this.model.targetScore, { y: .1, x: 5 }, "SMALL_SCORE"), this.placeImage("scoreback", 9, .3), this.movesText = this.placeText("Moves:" + this.model.movesLeft, { y: .1, x: 9 }, "SMALL_SCORE"), this.powerPanel = new Dt({ scene: this, key: "panelBack", closeCallback: this.hidePanel.bind(this), powerCallback: this.usePowerUp.bind(this) }), this.placeAtIndex(60, this.powerPanel), this.powerPanel.depth = 1e3, this.powerPanel.visible = !1; var t = parseFloat(this.model.getProp("powerbuttonpos")); this.btnShow = new At({ scene: this, textStyle: "BUTTON_STYLE", key: "button", text: "POWER UPS", scale: .4, callback: this.showPowerUps.bind(this) }), this.placeAtIndex(t, this.btnShow), this.btnShow.back.setInteractive(!1), this.btnShow.alpha = .5, this.btnCancel = new At({ scene: this, textStyle: "BUTTON_STYLE", key: "button", text: "CANCEL", scale: .4, callback: this.cancelPowerUp.bind(this) }), this.placeAtIndex(t, this.btnCancel), this.btnCancel.visible = !1, this.statText = this.placeText("power up text here", 115, "SMALL_WHITE"), this.statText.visible = !1, this.placeText("score", { y: -.3, x: 1 }, "SMALL_LABEL"), this.placeText("target score", { y: -.3, x: 5 }, "SMALL_LABEL"), this.placeText("moves left", { y: -.3, x: 9 }, "SMALL_LABEL"), this.prizePanel = new Xt({ scene: this, key: "panelBack", closeCallback: this.prizeClosed.bind(this) }), this.aGrid.placeAtIndex(60, this.prizePanel), this.prizePanel.visible = !1 } }, { key: "prizeClosed", value: function() { 1 != this.overFlag && this.time.addEvent({ delay: 2e3, callback: this.newLevel.bind(this), loop: !1 }) } }, { key: "cancelPowerUp", value: function() { this.btnCancel.visible = !1, this.powerIndex = 0, this.btnShow.visible = !0, this.btnShow.alpha = 1, this.statText.visible = !1 } }, { key: "showPowerUps", value: function() { 1 == this.clickLock || this.btnShow.alpha < 1 || (console.log("show"), this.clickLock = !0, this.powerPanel.openMe(), this.btnShow.visible = !1) } }, { key: "hidePanel", value: function() { this.clickLock = !1, this.powerPanel.visible = !1, this.btnShow.visible = !0 } }, { key: "updateText", value: function() { this.targetScore.setText(this.model.targetScore), this.movesText.setText(this.model.movesLeft), this.scoreText.setText(this.model.score) } }, { key: "verifyGame", value: function() { 1 != this.overFlag && (console.log("vf=" + this.verifyFlag), 1 != this.verifyFlag && (this.verifyFlag = !0, console.log("verifyGame"), (new dt).callGsi(14008, this.verifyDone.bind(this), this.model.playID, this.moveString, this.model.sid))) } }, { key: "verifyDone", value: function(t) { var e = (t = JSON.parse(t))[0][2]; console.log(e); var i = e.startData; if (1 == parseInt(e.over)) return this.overFlag = !0, void this.outOfMoves(); this.verifyFlag = !1, this.model.blockString = i.LevelData.blockString, this.dataIndex = -1, this.dataString = this.model.blockString, this.dataArray = this.dataString.split(""), this.model.maxMoves = i.maxMoves, this.model.targetScore = i.targetScore, this.model.movesLeft = this.model.maxMoves, this.model.score = 0, this.gemGroup.clear(!0, !0), this.moveString = "", this.model.playID = e.playCode, this.gem1 = null, this.gem2 = null, this.firstGem = null, 0 == e.prize ? this.time.addEvent({ delay: 2e3, callback: this.newLevel.bind(this), loop: !1 }) : (this.mm.playSound("paysound"), this.prizePanel.setData(e.prize)) } }, { key: "usePowerUp", value: function(t) { if (console.log(t), this.model.getPowerUpCount(t) > 0) { switch (console.log("use"), this.powerPanel.visible = !1, t) { case this.model.SHUFFLE_BOMB: console.log("shuffle"), this.powerIndex = 0, this.time.addEvent({ delay: 2e3, callback: this.doShuffle.bind(this), loop: !1 }); break; case this.model.COLOR_BOMB: console.log("color bomb"), this.btnCancel.visible = !0, this.statText.visible = !0, this.statText.setText(this.model.getProp("colorstat")), this.powerIndex = 1; break; case this.model.ROW_BOMB: console.log("row bomb"), this.btnCancel.visible = !0, this.statText.visible = !0, this.statText.setText(this.model.getProp("rowstat")), this.powerIndex = 2; break; case this.model.COLUMN_BOMB: console.log("col bomb"), this.btnCancel.visible = !0, this.statText.visible = !0, this.statText.setText(this.model.getProp("colstat")), this.powerIndex = 3 } this.clickLock = !1 } else this.clickLock = !0 } }, { key: "doShuffle", value: function() { this.moveString += "-6|0|" + this.model.getPowerSerial(this.model.SHUFFLE_BOMB) + "|", this.setValues(), this.makeBoard(), this.time.addEvent({ delay: 2e3, callback: this.checkAll.bind(this), loop: !1 }) } }, { key: "doRemoveColor", value: function(t) { this.clickLock = !0, console.log("remove color " + t), this.startGem.strikeColor(t), this.moveString += "-7|" + t + "|" + this.model.getPowerSerial(this.model.COLOR_BOMB) + "|" } }, { key: "strikeColors", value: function() { this.matchFound = !0, this.doFalls(), this.powerIndex = 0, this.cancelPowerUp() } }, { key: "doRemoveRow", value: function(t) { this.clickLock = !0, this.moveString += "-4|" + t.row + "|" + this.model.getPowerSerial(this.model.ROW_BOMB) + "|", console.log("remove " + t.row); for (var e = 0; e < this.cols; e++) { var i = this.getGemAt(t.row, e); i.visible = !1, this.setGemValue(t.row, e, 0), this.placeEffect(i.x, i.y, "matcheffect") } this.strikeColors() } }, { key: "doRemoveCol", value: function(t) { this.clickLock = !0, this.moveString += "-5|" + t.col + "|" + this.model.getPowerSerial(this.model.COLUMN_BOMB) + "|", console.log("remove " + t.col); for (var e = 0; e < this.rows; e++) { var i = this.getGemAt(e, t.col); i.visible = !1, this.setGemValue(e, t.col, 0), this.placeEffect(i.x, i.y, "matcheffect") } this.strikeColors() } }, { key: "showSelected", value: function() { this.firstGem && this.tweens.add({ targets: this.firstGem, duration: 500, angle: 360 }) } }, { key: "outOfMoves", value: function() { this.timer1.remove(), this.scene.start("SceneOver") } }, { key: "newLevel", value: function() { this.mm.playSound("levelup"), this.updateText(), this.setValues(), this.makeBoard() } }, { key: "update", value: function() { 0 == this.clickLock ? this.btnShow && (this.btnShow.back.setInteractive(), this.btnShow.alpha = 1, this.btnShow.visible = !0) : this.btnShow && (this.btnShow.back.setInteractive(!1), this.btnShow.alpha = .5) } }]) && Zt(i.prototype, o), r && Zt(i, r), e }(at); function Qt(t) { return (Qt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function te(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function ee(t, e) { return !e || "object" !== Qt(e) && "function" != typeof e ? function(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t }(t) : e } function ie(t, e, i) { return (ie = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(t, e, i) { var o = function(t, e) { for (; !Object.prototype.hasOwnProperty.call(t, e) && null !== (t = oe(t)); ) ; return t }(t, e); if (o) { var n = Object.getOwnPropertyDescriptor(o, e); return n.get ? n.get.call(i) : n.value } } )(t, e, i || t) } function oe(t) { return (oe = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function ne(t, e) { return (ne = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var re = function(t) { function e() { return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), ee(this, oe(e).call(this, "SceneData")) } var i, o, n; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && ne(t, e) }(e, t), i = e, (o = [{ key: "preload", value: function() {} }, { key: "create", value: function() { ie(oe(e.prototype), "create", this).call(this), this.model.mainServer = "https://" + document.getElementById("ms").innerText + "/", this.linkCode = document.getElementById("linkCode").innerText, this.model.linkCode = this.linkCode, this.getSid() } }, { key: "getSid", value: function() { if (this.model.local = !1, 1 == this.model.local) { var t = document.getElementById("sid").innerText; this.model.sid = t, this.getTemplateData() } else (new dt).callGsi(109, this.gotSid.bind(this)) } }, { key: "gotSid", value: function(t) { t = JSON.parse(t), console.log(t), 0 != t[0][1] ? (this.model.sid = t[0][2], this.getTemplateData()) : console.log("not logged in") } }, { key: "getTemplateData", value: function() { (new dt).callGsi(19001, this.gotTemplateData.bind(this), 6) } }, { key: "gotTemplateData", value: function(t) { for (var e = (t = (t = JSON.parse(t))[0][2]).props, i = e.length, o = 0; o < i; o++) { var n = e[o] , r = n.propname , s = n.defvalue; this.model.setProp(r, s) } this.getGameData() } }, { key: "getGameData", value: function() { (new dt).callGsi(19004, this.gotData.bind(this), this.linkCode) } }, { key: "gotData", value: function(t) { for (var e = (t = (t = JSON.parse(t))[0][2]).gameData, i = JSON.parse(e), o = i.length, n = 0; n < o; n++) { var r = i[n] , s = r.property , a = r.value; this.model.setProp(s, a) } this.scene.start("SceneLoad") } }, { key: "update", value: function() {} }]) && te(i.prototype, o), n && te(i, n), e }(at); function se(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } var ae = function() { function t(e) { !function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, t), this.scene = e.scene, this.x = 0, this.y = 0, e.x && (this.x = e.x), e.y && (this.y = e.y), this.size = 5, e.size && (this.size = e.size), this.dist = 150, e.dist && (this.dist = e.dist), this.duration = 1e3, e.duration && (this.duration = e.duration), this.maxDist = 300, e.maxDist && (this.maxDist = e.maxDist), this.color = 16777215, e.color && (this.color = e.color), this.n = 25, e.count && (this.n = e.count); for (var i = 0; i < this.n; i++) { var o = this.scene.add.sprite(this.x, this.y, "effectColorStars") , n = Phaser.Math.Between(0, 14); o.setFrame(n), o.setOrigin(.5, .5); var r = Phaser.Math.Between(50, this.maxDist) , s = Phaser.Math.Between(1, 100) / 100; o.scaleX = s, o.scaleY = s; var a = i * (360 / this.n) , c = this.x + r * Math.cos(a) , l = this.y + r * Math.sin(a); this.scene.tweens.add({ targets: o, duration: this.duration, alpha: 0, y: l, x: c, onComplete: this.tweenDone, onCompleteParams: [{ scope: this }] }) } } var e, i, o; return e = t, o = [{ key: "preload", value: function(t, e) { t.load.spritesheet("effectColorStars", e, { frameWidth: 26, frameHeight: 26 }) } }], (i = [{ key: "tweenDone", value: function(t, e, i) { e[0].destroy() } }]) && se(e.prototype, i), o && se(e, o), t }(); function ce(t) { return (ce = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function le(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function he(t, e) { return !e || "object" !== ce(e) && "function" != typeof e ? fe(t) : e } function ue(t) { return (ue = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function fe(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t } function ye(t, e) { return (ye = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var pe = function(t) { function e(t) { var i; return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), t.scene ? ((i = he(this, ue(e).call(this, t.scene))).scene = t.scene, t.color || (t.color = 16711680), t.width || (t.width = 200), t.height || (t.height = t.width / 4), i.graphics = i.scene.add.graphics(), i.graphics.fillStyle(t.color, 1), i.graphics.fillRect(0, 0, t.width, t.height), i.add(i.graphics), i.graphics.x = -t.width / 2, i.graphics.y = -t.height / 2, t.x && (i.x = t.x), t.y && (i.y = t.y), i.scene.add.existing(fe(i)), i) : (console.log("missing scene!"), he(i)) } var i, o, n; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && ye(t, e) }(e, Phaser.GameObjects.Container), i = e, (o = [{ key: "setPercent", value: function(t) { this.graphics.scaleX = t } }, { key: "setTweenPer", value: function(t) { this.timeTween = this.scene.tweens.add({ targets: this.graphics, duration: 980, scaleX: t }) } }]) && le(i.prototype, o), n && le(i, n), e }(); function de(t) { return (de = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function ge(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function me(t, e) { return !e || "object" !== de(e) && "function" != typeof e ? function(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t }(t) : e } function be(t, e, i) { return (be = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(t, e, i) { var o = function(t, e) { for (; !Object.prototype.hasOwnProperty.call(t, e) && null !== (t = ve(t)); ) ; return t }(t, e); if (o) { var n = Object.getOwnPropertyDescriptor(o, e); return n.get ? n.get.call(i) : n.value } } )(t, e, i || t) } function ve(t) { return (ve = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function ke(t, e) { return (ke = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var we = function(t) { function e() { return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), me(this, ve(e).call(this, "SceneLoad")) } var i, o, r; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && ke(t, e) }(e, t), i = e, (o = [{ key: "preload", value: function() { for (var t in be(ve(e.prototype), "create", this).call(this), this.bar2 = new pe({ scene: this, height: .1 * this.sys.game.config.height, width: .8 * this.sys.game.config.width, color: 16777215 }), this.bar = new pe({ scene: this, height: .1 * this.sys.game.config.height, width: .8 * this.sys.game.config.width }), n.center(this.bar, this), n.center(this.bar2, this), this.load.on("progress", this.onProgress, this), this.common = "https://graphics.gaiaonline.com/images/games/gamemaker/", this.model.props) { var i = this.model.getProp(t) , o = this.checkType(i); 1 == o && this.load.image(t, i), 2 == o && this.load.audio(t, i) } ae.preload(this, this.common + "effects/colorStars.png"); var r = this.model.getProp("matcheffect"); this.loadEffect("matcheffect", r); var s = this.model.getProp("clickeffect"); this.loadEffect("clickeffect", s); for (var a = ["gear", "musicOff", "musicOn", "sfxOn", "sfxOff", "iconLock", "iconHome", "iconNext", "iconPrev"], c = 0; c < a.length; c++) this.loadIcon(a[c]); this.loadToggle(2), this.model.colorArray = this.model.getProp("colors").split("~") } }, { key: "checkType", value: function(t) { return t.indexOf(".jpg") > 0 || t.indexOf(".png") > 0 ? 1 : t.indexOf(".mp3") > 0 || t.indexOf(".wav") > 0 || t.indexOf(".ogg") > 0 || t.indexOf(".m4a") > 0 ? 2 : 0 } }, { key: "onProgress", value: function(t) { Math.floor(100 * t), this.bar.setPercent(t) } }, { key: "loadIcon", value: function(t) { this.load.image(t, this.common + "ui/icons/" + t + ".png") } }, { key: "loadToggle", value: function(t) { this.load.image("toggle" + t, this.common + "ui/toggles/" + t + ".png") } }, { key: "loadButton", value: function(t, e, i) { this.load.image(t, this.common + "ui/buttons/" + e + "/" + i + ".png") } }, { key: "loadEffect", value: function(t, e) { console.log("load effect " + t + " " + e); var i = !1 , o = 0 , n = 0 , r = "fx1/" + e; e > 10 && e < 81 && (r = "fx2/" + (e - 10), i = !0, o = 256, n = 256), e > 80 && (r = "fx3/" + (e - 80), i = !0, o = 100, n = 100), r += ".png", 1 == i ? this.load.spritesheet(t, this.common + "effects/" + r, { frameWidth: o, frameHeight: n }) : this.load.image(t, this.common + "effects/" + r) } }, { key: "create", value: function() { this.scene.start("SceneTitle") } }, { key: "update", value: function() {} }]) && ge(i.prototype, o), r && ge(i, r), e }(at); function Se(t) { return (Se = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function Oe(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function _e(t, e) { return !e || "object" !== Se(e) && "function" != typeof e ? function(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t }(t) : e } function xe(t, e, i) { return (xe = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(t, e, i) { var o = function(t, e) { for (; !Object.prototype.hasOwnProperty.call(t, e) && null !== (t = Pe(t)); ) ; return t }(t, e); if (o) { var n = Object.getOwnPropertyDescriptor(o, e); return n.get ? n.get.call(i) : n.value } } )(t, e, i || t) } function Pe(t) { return (Pe = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function Te(t, e) { return (Te = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var Ee = function(t) { function e() { return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), _e(this, Pe(e).call(this, "SceneTitle")) } var i, o, n; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && Te(t, e) }(e, t), i = e, (o = [{ key: "preload", value: function() { xe(Pe(e.prototype), "preload", this).call(this) } }, { key: "create", value: function() { xe(Pe(e.prototype), "create", this).call(this), this.mm.setBackgroundMusic("backgroundmusic"), this.bg = this.setBackground("titlebackground"), this.makeAlignGrid(11, 11); var t = new At({ scene: this, textStyle: "BUTTON_STYLE", key: "button", text: "START GAME", callback: this.startGame.bind(this) }); this.aGrid.placeAtIndex(104, t), this.makeUi(), this.input.on("pointerdown", this.test.bind(this)) } }, { key: "test", value: function(t) { this.placeEffect(t.x, t.y, "clickeffect") } }, { key: "makeUi", value: function() { xe(Pe(e.prototype), "makeSoundPanel", this).call(this), xe(Pe(e.prototype), "makeGear", this).call(this) } }, { key: "startGame", value: function() { this.scene.start("SceneGameData") } }, { key: "update", value: function() {} }]) && Oe(i.prototype, o), n && Oe(i, n), e }(at); function Ce(t) { return (Ce = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function Ie(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function Ge(t, e) { return !e || "object" !== Ce(e) && "function" != typeof e ? function(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t }(t) : e } function je(t, e, i) { return (je = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(t, e, i) { var o = function(t, e) { for (; !Object.prototype.hasOwnProperty.call(t, e) && null !== (t = Ae(t)); ) ; return t }(t, e); if (o) { var n = Object.getOwnPropertyDescriptor(o, e); return n.get ? n.get.call(i) : n.value } } )(t, e, i || t) } function Ae(t) { return (Ae = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function Me(t, e) { return (Me = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var Le = function(t) { function e() { return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), Ge(this, Ae(e).call(this, "SceneOver")) } var i, o, n; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && Me(t, e) }(e, t), i = e, (o = [{ key: "preload", value: function() {} }, { key: "create", value: function() { je(Ae(e.prototype), "create", this).call(this), this.setBackground("background"), this.makeAlignGrid(11, 11), this.placeText(this.model.getProp("outofmoves"), 27, "TITLE_TEXT"); var t = new At({ scene: this, textStyle: "BUTTON_STYLE", key: "button", text: "Play Again", callback: this.playAgain.bind(this) }); this.aGrid.placeAtIndex(104, t), this.makeUi() } }, { key: "makeUi", value: function() { je(Ae(e.prototype), "makeSoundPanel", this).call(this), je(Ae(e.prototype), "makeGear", this).call(this) } }, { key: "playAgain", value: function() { this.scene.start("SceneGameData") } }, { key: "update", value: function() {} }]) && Ie(i.prototype, o), n && Ie(i, n), e }(at); function Fe(t) { return (Fe = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) { return typeof t } : function(t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t } )(t) } function Be(t, e) { for (var i = 0; i < e.length; i++) { var o = e[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(t, o.key, o) } } function Re(t, e) { return !e || "object" !== Fe(e) && "function" != typeof e ? function(t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t }(t) : e } function De(t, e, i) { return (De = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(t, e, i) { var o = function(t, e) { for (; !Object.prototype.hasOwnProperty.call(t, e) && null !== (t = Ne(t)); ) ; return t }(t, e); if (o) { var n = Object.getOwnPropertyDescriptor(o, e); return n.get ? n.get.call(i) : n.value } } )(t, e, i || t) } function Ne(t) { return (Ne = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t) } )(t) } function Ue(t, e) { return (Ue = Object.setPrototypeOf || function(t, e) { return t.__proto__ = e, t } )(t, e) } var We = function(t) { function e() { return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), Re(this, Ne(e).call(this, "SceneGameData")) } var i, o, n; return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), e && Ue(t, e) }(e, t), i = e, (o = [{ key: "create", value: function() { De(Ne(e.prototype), "create", this).call(this), this.makeAlignGrid(11, 11), this.model.score = 0, this.getStartData() } }, { key: "getStartData", value: function() { (new dt).callGsi(14e3, this.gotStartData.bind(this), 9, this.model.sid) } }, { key: "gotStartData", value: function(t) { if (t = (t = JSON.parse(t))[0][2], console.log(t), -1 == t.playID) return console.log("ERROR!"), this.placeText(t.startData, 60, "WHITE_SMALL3"), void this.emitter.emit("TOGGLE_MUSIC"); this.model.blockString = t.startData.LevelData.blockString, this.model.playID = t.playID, this.model.maxMoves = t.startData.maxMoves, this.model.targetScore = t.startData.targetScore, this.model.movesLeft = this.model.maxMoves, this.getPowerUps() } }, { key: "getPowerUps", value: function() { (new dt).callGsi(13103, this.gotPowerUps.bind(this), this.model.sid) } }, { key: "gotPowerUps", value: function(t) { for (var e in t = (t = JSON.parse(t))[0][2]) { var i = t[e].serials; this.model.powerUps[e] = i } this.scene.start("SceneMain") } }]) && Be(i.prototype, o), n && Be(i, n), e }(at) , ze = navigator.userAgent.indexOf("Mobile"); -1 == ze && (ze = navigator.userAgent.indexOf("Tablet")); var He = 480 , Xe = 640; -1 != ze && (He = window.innerWidth, Xe = window.innerHeight); var Ye = { type: Phaser.AUTO, width: He, height: Xe, parent: "phaser-game", scene: [re, we, Ee, We, $t, Le] }; new Phaser.Game(Ye) } ]);
Results 1 to 3 of 3
Thread: GaiaOnline Switchem Bot
- 19 May. 2020 04:14pm #1
GaiaOnline Switchem Bot
- 24 May. 2020 01:02am #2
- 01 Jun. 2020 04:15pm #3
- Join Date
- Apr. 2013
- Location
- Minnesota
- Posts
- 1,325
- Reputation
- 114
- LCash
- 0.00
nice work ~
https://discord.gg/TvN6xUb ~ chat on discord pls.