From 4ff06bfd248aad296fee9ac66af46ee83e147e55 Mon Sep 17 00:00:00 2001 From: Hadik Date: Tue, 15 Oct 2019 11:50:55 +0200 Subject: [PATCH 1/5] New method playerEnterToGameRoom, playerExitGameRoom And support for subscribe modal popup by showSubscribeDialog --- gamee/dist/gamee-js.js | 44 ++++++++++++++++++++++++++++++++-- gamee/dist/gamee-js.js.map | 2 +- gamee/dist/gamee-js.min.js | 4 ++-- gamee/dist/gamee-js.min.js.map | 2 +- gamee/src/core.js | 16 ++++++++++++- gamee/src/gameeAPI.js | 27 +++++++++++++++++++++ package.json | 2 +- 7 files changed, 89 insertions(+), 8 deletions(-) diff --git a/gamee/dist/gamee-js.js b/gamee/dist/gamee-js.js index 26da8d0..3c9607b 100644 --- a/gamee/dist/gamee-js.js +++ b/gamee/dist/gamee-js.js @@ -1,4 +1,4 @@ -/*! @preserve build time 2019-08-27 08:54:59 */ +/*! @preserve build time 2019-10-15 09:07:55 */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -329,7 +329,7 @@ var core = exports.core = function () { /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */ var internals = { - VERSION: "2.4.0", // version of the gamee library + VERSION: "2.4.1", // version of the gamee library CAPABILITIES: ["ghostMode", "saveState", "replay", "socialData", "rewardedAds", "coins", "logEvents", "playerData", "share", "gems"], // supported capabilities variant: 0, // for automating communication with server soundUnlocked: false, @@ -606,6 +606,14 @@ var core = exports.core = function () { }); }; + core.playerEnterToGameRoom = function () { + this.native.createRequest('playerEnterToGameRoom'); + }; + + core.playerExitGameRoom = function () { + this.native.createRequest('playerExitGameRoom'); + }; + core.purchaseItemWithCoins = function (options, cb, oldMethod) { if (!cache.capabilities.coins) throw "Coins purchases not supported, you must add the capability on gamee.Init"; @@ -688,6 +696,12 @@ var core = exports.core = function () { }); }; + core.showSubscribeDialog = function (cb) { + this.native.createRequest("showSubscribeDialog", function (responseData) { + cb(null, responseData); + }); + }; + core.requestPlayerData = function (cb, userID) { if (!cache.capabilities.playerData) throw "Player Data not supported, you must add the capability on gamee.Init"; @@ -1188,6 +1202,22 @@ Gamee.prototype = function () { _core.core.requestPlayerSaveState(userID, cb); }, + /* + * playerEnterToGameRoom + * @member of Gamee + */ + playerEnterToGameRoom: function playerEnterToGameRoom() { + _core.core.playerEnterToGameRoom(); + }, + + /* + * playerExitGameRoom + * @member of Gamee + */ + playerExitGameRoom: function playerExitGameRoom() { + _core.core.playerExitGameRoom(); + }, + /* *purchaseItem *@member of Gamee @@ -1263,6 +1293,16 @@ Gamee.prototype = function () { _core.core.showRewardedVideo(cb); }, + /* + * showSubscribeDialog + * @member of Gamee + * @param{Gamee~showSubscribeDialog} cb + */ + showSubscribeDialog: function showSubscribeDialog(cb) { + (0, _core.validateDataType)(cb, "function", "cb", "gamee.showSubscribeDialog"); + _core.core.showSubscribeDialog(cb); + }, + /** *requestPlayerData *@member of Gamee diff --git a/gamee/dist/gamee-js.js.map b/gamee/dist/gamee-js.js.map index ebc572a..85b363d 100644 --- a/gamee/dist/gamee-js.js.map +++ b/gamee/dist/gamee-js.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 16f37751307f6bb82f86","webpack:///./gamee/libs/shims.js","webpack:///./gamee/src/core.js","webpack:///./gamee/src/gameeAPI.js","webpack:///./gamee/src/platform_bridge.js","webpack:///./gamee/libs/bullet.js","webpack:///./gamee/src/game_controllers.js","webpack:///./gamee/src/index.js","webpack:///(webpack)/buildin/global.js"],"names":["CustomEmitter","wrapKeyEvent","shimCustomEvent","ce","window","CustomEvent","preventDefault","defaultPrevented","Error","e","event","params","evt","origPrevent","bubbles","cancelable","detail","undefined","document","createEvent","initCustomEvent","call","Object","defineProperty","get","prototype","Event","win","doc","addEventListener","docHijack","p","old","v","addListen","addEvent","on","fn","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","i","length","Element","all","eventTarget","createDocumentFragment","delegate","method","bind","forEach","ev","keyCode","which","controllers","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","core","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","silentMode","allOk","cap","Array","isArray","indexOf","native","createRequest","version","controller","responseData","error","platform","requestController","enableKeyboard","_bindKeyboardTriggers","err","global","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","hasOwnProperty","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","purchaseItemWithCoins","options","oldMethod","coins","propertiesList","property","isSilentModeEnabled","console","log","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","requestPlayerData","playerData","startSignal","ghostMode","mainController","opts","createController","additionalController","gameeNative","apply","arguments","_keydown","_keyup","btn","controllerTypes","buttons","remapButton","OneButtonController","TwoButtonController","FourButtonController","FiveButtonController","SixButtonController","FourArrowController","TouchController","JoystickController","JoystickButtonController","TwoArrowsTwoButtonsController","TwoArrowsOneButtonController","TwoActionButtonsController","registerPlatform","platformAPI","DataTypeException","expected","present","argument","message","validateDataType","testedInput","expectedType","originMethod","GameeEmitter","Gamee","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","result","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","PostMessageBridge","MobileBridge","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","requests","_init","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","endpoint","_gameeWin","create","constructor","JSON","stringify","_resolveAPICall","response","postMessage","opt_data","device","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","parse","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","Controller","key","_pressed","isDown","buttonAlias","addButton","gamee","keyCodes","oldName","newName","name","x","y","position","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","loadScript","url","head","getElementsByTagName","script","createElement","src","onreadystatechange","onload","appendChild"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;QC6BgBA,a,GAAAA,a;QAoBAC,Y,GAAAA,Y;AAjHhB;;;AAGA,CAAC,SAASC,eAAT,GAA2B;AAC3B,KAAI;AACH,MAAIC,KAAK,IAAIC,OAAOC,WAAX,CAAuB,MAAvB,CAAT;AACAF,KAAGG,cAAH;AACA,MAAIH,GAAGI,gBAAH,KAAwB,IAA5B,EAAkC;AACjC;AACA;AACA,SAAM,IAAIC,KAAJ,CAAU,2BAAV,CAAN;AACA;AACD,EARD,CAQE,OAAOC,CAAP,EAAU;AACX,MAAIJ,cAAc,SAAdA,WAAc,CAAUK,KAAV,EAAiBC,MAAjB,EAAyB;AAC1C,OAAIC,GAAJ,EAASC,WAAT;AACAF,YAASA,UAAU;AAClBG,aAAS,KADS;AAElBC,gBAAY,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jD,KAAR,CAAc,0CAAd;AACH;AACDyL,6BAAiB,uCAAsB/R,OAAOmS,MAA7B,CAAjB;AACA;AACJ,aAAK,KAAL;AACIJ,6BAAiB,kCAAiB,KAAjB,CAAjB;AACA;AACJ,aAAK,SAAL;AACIA,6BAAiB,kCAAiB,SAAjB,CAAjB;AACA;AACJ;AACI,kBAAM,6BAAN;AAdR;AAgBA,WAAOA,cAAP;AACH,CA/CoB,EAArB;;AAiDA,WAAKpE,WAAL;AACA,WAAK1H,MAAL,GAAc8L,cAAd;;AAEA,6BAAYvF,OAAZ,GAAsB+E,MAAM/E,OAA5B;;AAGA,SAAS6F,UAAT,CAAqBC,GAArB,EAA0BzE,QAA1B,EAAoC;AAChC;AACA,QAAI0E,OAAOzR,SAAS0R,oBAAT,CAA8B,MAA9B,EAAsC,CAAtC,CAAX;AACA,QAAIC,SAAS3R,SAAS4R,aAAT,CAAuB,QAAvB,CAAb;AACAD,WAAOE,GAAP,GAAaL,GAAb;;AAEA;AACA;AACAG,WAAOG,kBAAP,GAA4B/E,QAA5B;AACA4E,WAAOI,MAAP,GAAgBhF,QAAhB;;AAEA;AACA0E,SAAKO,WAAL,CAAiBL,MAAjB;AACH,C;;;;;;ACvFD;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"gamee-js.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 16f37751307f6bb82f86","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.0\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 2b97e13ed7e1fd3e15e5","webpack:///./gamee/libs/shims.js","webpack:///./gamee/src/core.js","webpack:///./gamee/src/gameeAPI.js","webpack:///./gamee/src/platform_bridge.js","webpack:///./gamee/libs/bullet.js","webpack:///./gamee/src/game_controllers.js","webpack:///./gamee/src/index.js","webpack:///(webpack)/buildin/global.js"],"names":["CustomEmitter","wrapKeyEvent","shimCustomEvent","ce","window","CustomEvent","preventDefault","defaultPrevented","Error","e","event","params","evt","origPrevent","bubbles","cancelable","detail","undefined","document","createEvent","initCustomEvent","call","Object","defineProperty","get","prototype","Event","win","doc","addEventListener","docHijack","p","old","v","addListen","addEvent","on","fn","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","i","length","Element","all","eventTarget","createDocumentFragment","delegate","method","bind","forEach","ev","keyCode","which","controllers","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","core","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","silentMode","allOk","cap","Array","isArray","indexOf","native","createRequest","version","controller","responseData","error","platform","requestController","enableKeyboard","_bindKeyboardTriggers","err","global","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","hasOwnProperty","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","playerEnterToGameRoom","playerExitGameRoom","purchaseItemWithCoins","options","oldMethod","coins","propertiesList","property","isSilentModeEnabled","console","log","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","showSubscribeDialog","requestPlayerData","playerData","startSignal","ghostMode","mainController","opts","createController","additionalController","gameeNative","apply","arguments","_keydown","_keyup","btn","controllerTypes","buttons","remapButton","OneButtonController","TwoButtonController","FourButtonController","FiveButtonController","SixButtonController","FourArrowController","TouchController","JoystickController","JoystickButtonController","TwoArrowsTwoButtonsController","TwoArrowsOneButtonController","TwoActionButtonsController","registerPlatform","platformAPI","DataTypeException","expected","present","argument","message","validateDataType","testedInput","expectedType","originMethod","GameeEmitter","Gamee","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","result","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","PostMessageBridge","MobileBridge","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","requests","_init","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","endpoint","_gameeWin","create","constructor","JSON","stringify","_resolveAPICall","response","postMessage","opt_data","device","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","parse","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","Controller","key","_pressed","isDown","buttonAlias","addButton","gamee","keyCodes","oldName","newName","name","x","y","position","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","loadScript","url","head","getElementsByTagName","script","createElement","src","onreadystatechange","onload","appendChild"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;QC6BgBA,a,GAAAA,a;QAoBAC,Y,GAAAA,Y;AAjHhB;;;AAGA,CAAC,SAASC,eAAT,GAA2B;AAC3B,KAAI;AACH,MAAIC,KAAK,IAAIC,OAAOC,WAAX,CAAuB,MAAvB,CAAT;AACAF,KAAGG,cAAH;AACA,MAAIH,GAAGI,gBAAH,KAAwB,IAA5B,EAAkC;AACjC;AACA;AACA,SAAM,IAAIC,KAAJ,CAAU,2BAAV,CAAN;AACA;AACD,EARD,CAQE,OAAOC,CAAP,EAAU;AACX,MAAIJ,cAAc,SAAdA,WAAc,CAAUK,KAAV,EAAiBC,MAAjB,EAAyB;AAC1C,OAAIC,GAAJ,EAASC,WAAT;AACAF,YAASA,UAAU;AAClBG,aAAS,KADS;AAElBC,gBAAY,KAFM;AAGlBC,YAAQC;AAHU,IAAnB;;AAMAL,SAAMM,SAASC,WAAT,CAAqB,aAArB,CAAN;AACAP,OAAIQ,eAAJ,CAAoBV,KAApB,EAA2BC,OAAOG,OAAlC,EAA2CH,OAAOI,UAAlD,EAA8DJ,OAAOK,MAArE;AACAH,iBAAcD,IAAIN,cAAlB;AACAM,OAAIN,cAAJ,GAAqB,YAAY;AA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;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"gamee-js.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 2b97e13ed7e1fd3e15e5","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnterToGameRoom = function () {\n this.native.createRequest('playerEnterToGameRoom');\n };\n\n core.playerExitGameRoom = function () {\n this.native.createRequest('playerExitGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnterToGameRoom\n * @member of Gamee\n */\n playerEnterToGameRoom: function () {\n core.playerEnterToGameRoom()\n },\n\n /*\n * playerExitGameRoom\n * @member of Gamee\n */\n playerExitGameRoom: function () {\n core.playerExitGameRoom()\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function (cb){\n validateDataType(cb,\"function\",\"cb\",\"gamee.showSubscribeDialog\");\n core.showSubscribeDialog(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file diff --git a/gamee/dist/gamee-js.min.js b/gamee/dist/gamee-js.min.js index 9aae4dd..dfa41c4 100644 --- a/gamee/dist/gamee-js.min.js +++ b/gamee/dist/gamee-js.min.js @@ -1,3 +1,3 @@ -/*! @preserve build time 2019-08-27 08:54:59 */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,function(){return function(t){function __webpack_require__(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,__webpack_require__),n.l=!0,n.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.i=function(t){return t},__webpack_require__.d=function(t,e,o){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=6)}([function(t,e,o){"use strict";function CustomEmitter(){function delegate(e){this[e]=t[e].bind(t)}var t=document.createDocumentFragment();["addEventListener","dispatchEvent","removeEventListener"].forEach(delegate,this)}function wrapKeyEvent(t){return function(e){return e&&e.keyCode||(e||(e=window.event),e.which&&(e.keyCode=e.which)),t(e)}}Object.defineProperty(e,"__esModule",{value:!0}),e.CustomEmitter=CustomEmitter,e.wrapKeyEvent=wrapKeyEvent,function(){try{var t=new window.CustomEvent("test");if(t.preventDefault(),!0!==t.defaultPrevented)throw new Error("Could not prevent default")}catch(t){var e=function(t,e){var o,n;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},o=document.createEvent("CustomEvent"),o.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n=o.preventDefault,o.preventDefault=function(){n.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},o};e.prototype=window.Event.prototype,window.CustomEvent=e}}(),function(t,e){function docHijack(t){var o=e[t];e[t]=function(t){return addListen(o(t))}}function addEvent(e,o,n){return(n=this).attachEvent("on"+e,function(e){e=e||t.event,e.preventDefault=e.preventDefault||function(){e.returnValue=!1},e.stopPropagation=e.stopPropagation||function(){e.cancelBubble=!0},o.call(n,e)})}function addListen(t,e){if(e=t.length)for(;e--;)t[e].addEventListener=addEvent;else t.addEventListener=addEvent;return t}t.addEventListener||(addListen([e,t]),"Element"in t?t.Element.prototype.addEventListener=addEvent:(e.attachEvent("onreadystatechange",function(){addListen(e.all)}),docHijack("getElementsByTagName"),docHijack("getElementById"),docHijack("createElement"),addListen(e.all)))}(window,document)},function(t,e,o){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.validateDataType=e.DataTypeException=e.core=void 0;var n="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},r=o(5),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e.default=t,e}(r),i=o(0);!function(){var t=function(t){var e=new t;if("suspended"===e.state){var o=function resume(){if(/(iPhone|iPad)/i.test(navigator.userAgent)){var t=e.createBuffer(1,1,44100),o=e.createBufferSource();o.buffer=t,o.connect(e.destination),o.start(0),o.disconnect()}e.resume(),setTimeout(function(){"running"===e.state&&document.body.removeEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),resume,!1)},0)};document.body.addEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),o,!1)}return e};try{void 0!==window.AudioContext?window.AudioContext=t.bind(null,window.AudioContext):"undefined"!=typeof webkitAudioContext&&(window.webkitAudioContext=t.bind(null,window.webkitAudioContext))}catch(t){setTimeout(function(){throw t},0)}}();var u=(e.core=function(){function createController(t,e){var o,n;if(!u[t])throw new Error("Unsupported controller type, "+t);if(e=e||{},n=new u[t],e.enableKeyboard&&n.enableKeyboard(r),e.buttons)for(o in e.buttons)n.remapButton(o,e.buttons[o]);return n}var e=function(){},o={},n={VERSION:"2.4.0",CAPABILITIES:["ghostMode","saveState","replay","socialData","rewardedAds","coins","logEvents","playerData","share","gems"],variant:0,soundUnlocked:!1,onReady:e,onGameStart:e},r={};r.gameeInit=function(t,e,a,i){var u=(arguments.length>4&&void 0!==arguments[4]&&arguments[4],!0),s={};if(void 0!==a&&Array.isArray(a))for(var l=0;l100)throw"Percentage passed to gameLoadingProgress out of bounds or not a number.";e>t&&(t=e,this.native.createRequest("gameLoadingProgress",{percentage:e}))}}(),r.gameReady=function(){this.native.createRequest("gameReady")},r.updateScore=function(t,e){if("number"!=typeof t)throw"Score passed to updateScore is not a number.";var o={score:parseInt(t,10)};e&&(o.ghostSign=!0),this.native.createRequest("updateScore",o)},r.gameOver=function(t,e,o){o=void 0!==o&&o;var n={};if(t){if(t.hasOwnProperty("variant")||(t.variant=""),!t.hasOwnProperty("data"))throw"Replay data must have `data` property";n.replayData=t}n.hideOverlay=o,e&&(n.state=e),r.native.createRequest("gameOver",n)},r.gameSave=function(t,e){if(!o.capabilities.saveState)throw"Save State not supported, you must add the capability on gamee.Init";r.native.createRequest("saveState",{state:t,share:e})},r.requestSocial=function(t,e){if(!o.capabilities.socialData)throw"Social Data not supported, you must add the capability on gamee.Init";this.native.createRequest("requestSocial",e,function(e){t(null,e)})},r.logEvent=function(t,e){if(!o.capabilities.logEvents)throw"Log Events not supported, you must add the capability on gamee.Init";this.native.createRequest("logEvent",{eventName:t,eventValue:e},function(t){if(t)throw t})},r.requestBattleData=function(t){this.native.createRequest("requestBattleData",void 0,function(e){t(null,e)})},r.requestPlayerReplay=function(t,e){if(!o.capabilities.replay)throw"Replays not supported, you must add the capability on gamee.Init";this.native.createRequest("requestPlayerReplay",{userID:t},function(t){e(null,t)})},r.requestPlayerSaveState=function(t,e){this.native.createRequest("requestPlayerSaveState",{userID:t},function(t){e(null,t)})},r.purchaseItemWithCoins=function(t,e,n){if(!o.capabilities.coins)throw"Coins purchases not supported, you must add the capability on gamee.Init";if(t){["coinsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase Options must have `"+e+"` property"})}this.isSilentModeEnabled();var r="purchaseItemWithCoins";void 0!==n&&!0===n&&(r="purchaseItem"),this.native.createRequest(r,t,function(t){e(null,t)})},r.purchaseItemWithGems=function(t,e){if(!o.capabilities.gems)throw"Gems purchases not supported, you must add the capability on gamee.Init";if(t){["gemsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("purchaseItemWithGems",t,function(t){e(null,t)})},r.share=function(t,e){if(!o.capabilities.share)throw"Share option not supported, you must add the capability on gamee.Init";if(t){["destination"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Share Options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("share",t,function(t){e(null,t)})},r.loadRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("loadRewardedVideo",function(e){t(null,e)})},r.showRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("showRewardedVideo",function(e){t(null,e)})},r.requestPlayerData=function(t,e){if(!o.capabilities.playerData)throw"Player Data not supported, you must add the capability on gamee.Init";var n=void 0;e&&(n={userID:e}),this.native.createRequest("requestPlayerData",n,function(e){t(null,e)})},r.startSignal=function(t){var e;return t.replay&&!o.capabilities.replay&&(e="Game doesn't support replay. "),t.ghostMode&&!o.capabilities.ghostMode&&(e="Game doesn't support ghost Mode. "),e},r.controller={mainController:null,requestController:function(t,e){if("FullScreen"===t)return null;var o=createController(t,e);return this.mainController=o,o},additionalController:function(t,e){var o=createController(t,e);return gameeNative.additionalController(t),o},trigger:function(){if(!this.mainController)throw new Error("No controller present");this.mainController.trigger.apply(this.mainController,arguments)}},r._keydown=function(e){t.addEventListener("keydown",(0,i.wrapKeyEvent)(e))},r._keyup=function(e){t.addEventListener("keyup",(0,i.wrapKeyEvent)(e))};var u={OneButton:a.OneButtonController,TwoButtons:a.TwoButtonController,FourButtons:a.FourButtonController,FiveButtons:a.FiveButtonController,SixButtons:a.SixButtonController,FourArrows:a.FourArrowController,Touch:a.TouchController,Joystick:a.JoystickController,JoystickWithButton:a.JoystickButtonController,TwoArrowsTwoButtons:a.TwoArrowsTwoButtonsController,TwoArrowsOneButton:a.TwoArrowsOneButtonController,TwoActionButtons:a.TwoActionButtonsController};return r.registerPlatform=function(t){},r.isSilentModeEnabled=function(){return o.silentMode},r}(),e.DataTypeException=function(t,e,o,n){this.expected=t,this.present=e,this.method=n,this.argument=o,this.message="Invalid data type in method "+this.method+", argument "+this.argument+" is expected to be "+this.expected+", but found "+this.present});e.validateDataType=function(t,e,o,r){switch(e){case"array":if(!Array.isArray(t))throw new u(e,void 0===t?"undefined":n(t),o,r);break;default:if((void 0===t?"undefined":n(t))!==e)throw new u(e,void 0===t?"undefined":n(t),o,r)}}}).call(e,o(7))},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Gamee=e.GameeEmitter=void 0;var n=o(1),r=o(0),a=e.GameeEmitter=function(){r.CustomEmitter.call(this)};(e.Gamee=function(t){this.emitter=new a,this._platform=t}).prototype=function(){var t=function(t){if(t)throw"Error "+t.toString()};return{_controller:n.core.controller,gameInit:function(t,e,o,r){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];(0,n.validateDataType)(t,"string","controllType","gamee.updateScore"),(0,n.validateDataType)(e,"object","controllOpts","gamee.gameInit"),(0,n.validateDataType)(o,"array","capabilities","gamee.gameInit"),(0,n.validateDataType)(r,"function","cb","gamee.gameInit"),(0,n.validateDataType)(a,"boolean","silentMode","gamee.gameInit"),n.core.gameeInit(t,e,o,r,a)},gameLoadingProgress:function(e,o){(0,n.validateDataType)(e,"number","percentage","gamee.gameLoadingProgress"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameLoadingProgress"),n.core.gameLoadingProgress(e),o(null)},gameReady:function(e){e=e||t,(0,n.validateDataType)(e,"function","opt_cb","gamee.gameReady"),n.core.gameReady(),e(null)},gameSave:function(e,o,r){(0,n.validateDataType)(e,"string","data","gamee.gameSave"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_share","gamee.gameSave"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.gameSave"),n.core.gameSave(e,!1),r(null)},getPlatform:function(){return this._platform},updateScore:function(e,o,r){(0,n.validateDataType)(e,"number","score","gamee.updateScore"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_ghostSign","gamee.updateScore"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.updateScore"),n.core.updateScore(e,o),r(null)},gameOver:function(e,o,r,a){"function"==typeof e?o=e:void 0!==e&&(0,n.validateDataType)(e,"object","opt_replayData","gamee.gameOver"),void 0!==a&&(0,n.validateDataType)(a,"boolean","opt_hideOverlay","gamee.gameOver"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameOver"),n.core.gameOver(e,r,a),o(null)},requestSocial:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestSocial"),n.core.requestSocial(function(e,o){var n=o.hasOwnProperty("socialData")?o:{socialData:o};t(null,n)},e)},logEvent:function(t,e){(0,n.validateDataType)(t,"string","eventName","gamee.logEvent"),!t||t.length>24||((0,n.validateDataType)(e,"string","eventValue","gamee.logEvent"),!e||e.length>160||n.core.logEvent(t,e))},requestBattleData:function(t){(0,n.validateDataType)(t,"function","cb","gamee.requestBattleData"),n.core.requestBattleData(t)},requestPlayerReplay:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerReplay"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerReplay"),n.core.requestPlayerReplay(t,e)},requestPlayerSaveState:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerSaveState"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerSaveState"),n.core.requestPlayerSaveState(t,e)},purchaseItem:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItem"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItem"),n.core.purchaseItemWithCoins(t,e,!0)},purchaseItemWithCoins:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithCoins"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithCoins"),n.core.purchaseItemWithCoins(t,e)},purchaseItemWithGems:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithGems"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithGems"),n.core.purchaseItemWithGems(t,e)},share:function(t,e){(0,n.validateDataType)(t,"object","shareDetails","gamee.share"),(0,n.validateDataType)(e,"function","cb","gamee.share"),n.core.share(t,e)},loadRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.loadRewardedVideo"),n.core.loadRewardedVideo(t)},showRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showRewardedVideo"),n.core.showRewardedVideo(t)},requestPlayerData:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestPlayerData"),void 0!==e&&(0,n.validateDataType)(e,"number","userId","gamee.requestPlayerData"),n.core.requestPlayerData(t,e)}}}()},function(t,e,o){"use strict";function PlatformBridge(){this.requests={},this.platform="",this._init()}function PostMessageBridge(t){this._gameeWin=t,PlatformBridge.call(this),this.platform="web"}function MobileBridge(t){this.device=t,PostMessageBridge.call(this),this.platform="mobile"}Object.defineProperty(e,"__esModule",{value:!0}),e.PlatformAPI=void 0;var n="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};e.PlatformBridge=PlatformBridge,e.PostMessageBridge=PostMessageBridge,e.MobileBridge=MobileBridge;var r=o(1),a=e.PlatformAPI={emitter:null,pause:function(t){var e=new CustomEvent("pause",{detail:{callback:t}});this.emitter.dispatchEvent(e)},resume:function(t){var e=new CustomEvent("resume",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostShow:function(t){var e=new CustomEvent("ghostShow",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostHide:function(t){var e=new CustomEvent("ghostHide",{detail:{callback:t}});this.emitter.dispatchEvent(e)},mute:function(t){var e=new CustomEvent("mute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},unmute:function(t){var e=new CustomEvent("unmute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},start:function(t,e){var o=new CustomEvent("start",{detail:{callback:e}}),n=r.core.startSignal(t);if(n)return void e(n);t.replay&&(o.detail.opt_replay=!0),t.ghostMode&&(o.detail.opt_ghostMode=!0),t.resetState&&(o.detail.opt_resetState=!0),t.replayData&&(o.detail.replayData=t.replayData),this.emitter.dispatchEvent(o)}};PlatformBridge.prototype={instCount:0,_init:function(){},createRequest:function(t,e,o){if(this.validateMethod(t)){"function"==typeof e&&(o=e,e=void 0);var n=this.instCount++;void 0!==o&&(this.requests[n]=o);var r={request:{method:t,messageId:n,data:null}};this.doCall(r,e)}},validateMethod:function(t){return"gameLoadingProgress"!==t},doCall:function(t,e){throw"Not implemented"},_callback:function(t,e){var o=this.requests[t];delete this.requests[t],o&&o(e)},doResponse:function(t,e){throw"Not implemented"}},PostMessageBridge.prototype=Object.create(PlatformBridge.prototype),PostMessageBridge.prototype.constructor=PostMessageBridge,PostMessageBridge.prototype._init=function(){window.addEventListener("message",function(t){var e;if("object"===n(t.detail)&&null!==typeof t.detail)e=t.detail;else{if("object"!==n(t.data))return;e=t.data}if(r.core.isSilentModeEnabled(),e.request&&e.request.method&&void 0!==e.request.messageId)this._resolveAPICall(e.request.method,e.request.messageId,e.request.data);else if(e.response&&void 0!==e.response.messageId){if(e.error)throw e.error;this._callback(e.response.messageId,e.response.data)}}.bind(this),!1)},PostMessageBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),this._gameeWin.postMessage(t,"*")},PostMessageBridge.prototype.doResponse=function(t,e){var o={version:this.version,response:{messageId:t}};e&&(o.data=e),this._gameeWin.postMessage(o,"*")},PostMessageBridge.prototype._resolveAPICall=function(t,e,o){var n=this.doResponse.bind(this,e);switch(t){case"pause":a.pause(n);break;case"resume":a.resume(n);break;case"mute":a.mute(n);break;case"unmute":a.unmute(n);break;case"ghostShow":a.ghostShow(n);break;case"ghostHide":a.ghostHide(n);break;case"start":if(!o)throw"Method _start missing params";a.start(o,n);break;default:r.core.isSilentModeEnabled()}},MobileBridge.prototype=Object.create(PostMessageBridge.prototype),MobileBridge.prototype.constructor=MobileBridge,MobileBridge.prototype._init=function(){if(PostMessageBridge.prototype._init.call(this),"ios"===this.device)this._gameeWin=webkit.messageHandlers.callbackHandler;else{if("android"!==this.device)throw"Unknown device used in webkit bridge";this._gameeWin=_toDevice}window._triggerMessage=function(t){try{t=JSON.parse(t)}catch(e){throw"Couldn't parse message from native app: \n"+t+"\n"+e}r.core.isSilentModeEnabled(),this.dispatchEvent(new CustomEvent("message",{detail:t}))}.bind(window)},MobileBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),"android"===this.device&&(t=JSON.stringify(t)),this._gameeWin.postMessage(t,"*")}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){var t=this,e={};t.on=function(t,o,n){if(!(arguments.length<2||"string"!=typeof t||"function"!=typeof o)){var r=o.toString();void 0!==e[t]?void 0===e[t].callbacks[r]?e[t].callbacks[r]={cb:o,once:!!n}:"boolean"==typeof n&&(e[t].callbacks[r].once=n):(e[t]={callbacks:{}},e[t].callbacks[r]={cb:o,once:!!n})}},t.once=function(e,o){t.on(e,o,!0)},t.off=function(t,o){if("string"==typeof t&&void 0!==e[t])if("function"==typeof o){var n=o.toString(),r=e[t].callbacks[n];void 0!==r&&delete e[t].callbacks[n]}else delete e[t]},t.trigger=function(o,n){if("string"==typeof o&&void 0!==e[o])for(var r in e[o].callbacks){var a=e[o].callbacks[r];"function"==typeof a.cb&&a.cb(n),"boolean"==typeof a.once&&!0===a.once&&t.off(o,a.cb)}}};e.Bullet=new n},function(t,e,o){"use strict";function Button(t,e){var o=this;r.call(this),this._pressed=!0,this.key=t,this.keyCode=e,this.on("keydown",function(){o._pressed=!0}),this.on("keyup",function(){o._pressed=!1})}function Controller(){var t=this;r.call(this),this.buttons={},this.buttonAlias={},this.on("$keydown",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keydown",e)}),this.on("$keyup",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keyup",e)}),this.on("keydown",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keydown")}),this.on("keyup",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keyup")})}function OneButtonController(){Controller.call(this),this.addButton(new Button("button",32))}function TwoButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39))}function TwoActionButtonsController(){Controller.call(this),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function FiveButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32))}function SixButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function TwoArrowsOneButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function TwoArrowsTwoButtonsController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourArrowController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40))}function TouchController(){var t=this;Controller.call(this),this.on("$touchstart",function(e){t.trigger("touchstart",e)}),this.on("$touchend",function(e){t.trigger("touchend",e)}),this.on("$touchmove",function(e){t.trigger("touchmove",e)}),this.on("$touchleave",function(e){t.trigger("touchleave",e)}),this.on("$touchcancel",function(e){t.trigger("touchcancel",e)})}function JoystickController(){var t=this;Controller.call(this),this.x=0,this.y=0,this.on("$change",function(e){t.x=e.position.x,t.y=e.position.y,t.trigger("change",e)})}function JoystickButtonController(){JoystickController.call(this),this.addButton(new Button("button",32))}Object.defineProperty(e,"__esModule",{value:!0}),e.BulletClass=void 0,e.Button=Button,e.Controller=Controller,e.OneButtonController=OneButtonController,e.TwoButtonController=TwoButtonController,e.TwoActionButtonsController=TwoActionButtonsController,e.FourButtonController=FourButtonController,e.FiveButtonController=FiveButtonController,e.SixButtonController=SixButtonController,e.TwoArrowsOneButtonController=TwoArrowsOneButtonController,e.TwoArrowsTwoButtonsController=TwoArrowsTwoButtonsController,e.FourArrowController=FourArrowController,e.TouchController=TouchController,e.JoystickController=JoystickController,e.JoystickButtonController=JoystickButtonController;var n=o(4),r=e.BulletClass=n.Bullet.constructor;Button.prototype=Object.create(r.constructor.prototype),Button.constructor=Button,Button.prototype.isDown=function(){return this._pressed},Controller.prototype=Object.create(r.constructor.prototype),Controller.constructor=Controller,Controller.prototype.addButton=function(t){this.buttons[t.key]=t},Controller.prototype.enableKeyboard=function(t){var e,o,n={},r=this;for(e in this.buttons)o=this.buttons[e],o.keyCode&&(n[o.keyCode]=o);t._keydown(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keydown",{button:e.key}))}),t._keyup(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keyup",{button:e.key}))})},Controller.prototype.remapButton=function(t,e){if(e.name&&(e=e.name),!this.buttons[t])throw Error("Button "+t+" was not found in controller");this.buttonAlias[t]=e.name,this.buttons[e.name]=this.buttons[t],delete this.buttons[t]},OneButtonController.prototype=Object.create(Controller.prototype),OneButtonController.prototype.constructor=OneButtonController,TwoButtonController.prototype=Object.create(Controller.prototype),TwoButtonController.prototype.constructor=TwoButtonController,TwoActionButtonsController.prototype=Object.create(Controller.prototype),TwoActionButtonsController.prototype.constructor=TwoActionButtonsController,FourButtonController.prototype=Object.create(Controller.prototype),FourButtonController.prototype.constructor=FourButtonController,FiveButtonController.prototype=Object.create(Controller.prototype),FiveButtonController.prototype.constructor=FiveButtonController,SixButtonController.prototype=Object.create(Controller.prototype),SixButtonController.prototype.constructor=SixButtonController,TwoArrowsOneButtonController.prototype=Object.create(Controller.prototype),TwoArrowsOneButtonController.prototype.constructor=TwoArrowsOneButtonController,TwoArrowsTwoButtonsController.prototype=Object.create(Controller.prototype),TwoArrowsTwoButtonsController.prototype.constructor=TwoArrowsTwoButtonsController,FourArrowController.prototype=Object.create(Controller.prototype),FourArrowController.prototype.constructor=FourArrowController,TouchController.prototype=Object.create(TouchController.prototype),TouchController.prototype.constructor=TouchController,JoystickController.prototype=Object.create(Controller.prototype),JoystickController.prototype.constructor=JoystickController,JoystickButtonController.prototype=Object.create(JoystickController.prototype),JoystickButtonController.prototype.constructor=JoystickButtonController},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.gamee=void 0,o(0);var n=o(2),r=o(1),a=o(3),i=e.gamee=void 0,u=function(){var t,o="web",r=navigator.userAgent.toLowerCase();switch(/iphone|ipod|ipad/.test(r)?o=window.self!==window.top?"web":"ios":/gamee\/[0-9\.]+$/.test(r)?o="android":window.parent?o="web":window.parent&&window.parent.gameeSimulator&&(o="web"),e.gamee=i=new n.Gamee(o),window.gamee=i,o){case"web":window.parent,window,t=new a.PostMessageBridge(window.parent);break;case"ios":t=new a.MobileBridge("ios");break;case"android":t=new a.MobileBridge("android");break;default:throw"Can't identify the platform"}return t}();r.core.PlatformAPI=a.PlatformAPI,r.core.native=u,a.PlatformAPI.emitter=i.emitter},function(t,e){var o;o=function(){return this}();try{o=o||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(o=window)}t.exports=o}])}); +/*! @preserve build time 2019-10-15 09:07:55 */ +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,function(){return function(t){function __webpack_require__(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,__webpack_require__),n.l=!0,n.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.i=function(t){return t},__webpack_require__.d=function(t,e,o){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=6)}([function(t,e,o){"use strict";function CustomEmitter(){function delegate(e){this[e]=t[e].bind(t)}var t=document.createDocumentFragment();["addEventListener","dispatchEvent","removeEventListener"].forEach(delegate,this)}function wrapKeyEvent(t){return function(e){return e&&e.keyCode||(e||(e=window.event),e.which&&(e.keyCode=e.which)),t(e)}}Object.defineProperty(e,"__esModule",{value:!0}),e.CustomEmitter=CustomEmitter,e.wrapKeyEvent=wrapKeyEvent,function(){try{var t=new window.CustomEvent("test");if(t.preventDefault(),!0!==t.defaultPrevented)throw new Error("Could not prevent default")}catch(t){var e=function(t,e){var o,n;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},o=document.createEvent("CustomEvent"),o.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n=o.preventDefault,o.preventDefault=function(){n.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},o};e.prototype=window.Event.prototype,window.CustomEvent=e}}(),function(t,e){function docHijack(t){var o=e[t];e[t]=function(t){return addListen(o(t))}}function addEvent(e,o,n){return(n=this).attachEvent("on"+e,function(e){e=e||t.event,e.preventDefault=e.preventDefault||function(){e.returnValue=!1},e.stopPropagation=e.stopPropagation||function(){e.cancelBubble=!0},o.call(n,e)})}function addListen(t,e){if(e=t.length)for(;e--;)t[e].addEventListener=addEvent;else t.addEventListener=addEvent;return t}t.addEventListener||(addListen([e,t]),"Element"in t?t.Element.prototype.addEventListener=addEvent:(e.attachEvent("onreadystatechange",function(){addListen(e.all)}),docHijack("getElementsByTagName"),docHijack("getElementById"),docHijack("createElement"),addListen(e.all)))}(window,document)},function(t,e,o){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.validateDataType=e.DataTypeException=e.core=void 0;var n="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},r=o(5),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e.default=t,e}(r),i=o(0);!function(){var t=function(t){var e=new t;if("suspended"===e.state){var o=function resume(){if(/(iPhone|iPad)/i.test(navigator.userAgent)){var t=e.createBuffer(1,1,44100),o=e.createBufferSource();o.buffer=t,o.connect(e.destination),o.start(0),o.disconnect()}e.resume(),setTimeout(function(){"running"===e.state&&document.body.removeEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),resume,!1)},0)};document.body.addEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),o,!1)}return e};try{void 0!==window.AudioContext?window.AudioContext=t.bind(null,window.AudioContext):"undefined"!=typeof webkitAudioContext&&(window.webkitAudioContext=t.bind(null,window.webkitAudioContext))}catch(t){setTimeout(function(){throw t},0)}}();var u=(e.core=function(){function createController(t,e){var o,n;if(!u[t])throw new Error("Unsupported controller type, "+t);if(e=e||{},n=new u[t],e.enableKeyboard&&n.enableKeyboard(r),e.buttons)for(o in e.buttons)n.remapButton(o,e.buttons[o]);return n}var e=function(){},o={},n={VERSION:"2.4.1",CAPABILITIES:["ghostMode","saveState","replay","socialData","rewardedAds","coins","logEvents","playerData","share","gems"],variant:0,soundUnlocked:!1,onReady:e,onGameStart:e},r={};r.gameeInit=function(t,e,a,i){var u=(arguments.length>4&&void 0!==arguments[4]&&arguments[4],!0),s={};if(void 0!==a&&Array.isArray(a))for(var l=0;l100)throw"Percentage passed to gameLoadingProgress out of bounds or not a number.";e>t&&(t=e,this.native.createRequest("gameLoadingProgress",{percentage:e}))}}(),r.gameReady=function(){this.native.createRequest("gameReady")},r.updateScore=function(t,e){if("number"!=typeof t)throw"Score passed to updateScore is not a number.";var o={score:parseInt(t,10)};e&&(o.ghostSign=!0),this.native.createRequest("updateScore",o)},r.gameOver=function(t,e,o){o=void 0!==o&&o;var n={};if(t){if(t.hasOwnProperty("variant")||(t.variant=""),!t.hasOwnProperty("data"))throw"Replay data must have `data` property";n.replayData=t}n.hideOverlay=o,e&&(n.state=e),r.native.createRequest("gameOver",n)},r.gameSave=function(t,e){if(!o.capabilities.saveState)throw"Save State not supported, you must add the capability on gamee.Init";r.native.createRequest("saveState",{state:t,share:e})},r.requestSocial=function(t,e){if(!o.capabilities.socialData)throw"Social Data not supported, you must add the capability on gamee.Init";this.native.createRequest("requestSocial",e,function(e){t(null,e)})},r.logEvent=function(t,e){if(!o.capabilities.logEvents)throw"Log Events not supported, you must add the capability on gamee.Init";this.native.createRequest("logEvent",{eventName:t,eventValue:e},function(t){if(t)throw t})},r.requestBattleData=function(t){this.native.createRequest("requestBattleData",void 0,function(e){t(null,e)})},r.requestPlayerReplay=function(t,e){if(!o.capabilities.replay)throw"Replays not supported, you must add the capability on gamee.Init";this.native.createRequest("requestPlayerReplay",{userID:t},function(t){e(null,t)})},r.requestPlayerSaveState=function(t,e){this.native.createRequest("requestPlayerSaveState",{userID:t},function(t){e(null,t)})},r.playerEnterToGameRoom=function(){this.native.createRequest("playerEnterToGameRoom")},r.playerExitGameRoom=function(){this.native.createRequest("playerExitGameRoom")},r.purchaseItemWithCoins=function(t,e,n){if(!o.capabilities.coins)throw"Coins purchases not supported, you must add the capability on gamee.Init";if(t){["coinsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase Options must have `"+e+"` property"})}this.isSilentModeEnabled();var r="purchaseItemWithCoins";void 0!==n&&!0===n&&(r="purchaseItem"),this.native.createRequest(r,t,function(t){e(null,t)})},r.purchaseItemWithGems=function(t,e){if(!o.capabilities.gems)throw"Gems purchases not supported, you must add the capability on gamee.Init";if(t){["gemsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("purchaseItemWithGems",t,function(t){e(null,t)})},r.share=function(t,e){if(!o.capabilities.share)throw"Share option not supported, you must add the capability on gamee.Init";if(t){["destination"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Share Options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("share",t,function(t){e(null,t)})},r.loadRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("loadRewardedVideo",function(e){t(null,e)})},r.showRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("showRewardedVideo",function(e){t(null,e)})},r.showSubscribeDialog=function(t){this.native.createRequest("showSubscribeDialog",function(e){t(null,e)})},r.requestPlayerData=function(t,e){if(!o.capabilities.playerData)throw"Player Data not supported, you must add the capability on gamee.Init";var n=void 0;e&&(n={userID:e}),this.native.createRequest("requestPlayerData",n,function(e){t(null,e)})},r.startSignal=function(t){var e;return t.replay&&!o.capabilities.replay&&(e="Game doesn't support replay. "),t.ghostMode&&!o.capabilities.ghostMode&&(e="Game doesn't support ghost Mode. "),e},r.controller={mainController:null,requestController:function(t,e){if("FullScreen"===t)return null;var o=createController(t,e);return this.mainController=o,o},additionalController:function(t,e){var o=createController(t,e);return gameeNative.additionalController(t),o},trigger:function(){if(!this.mainController)throw new Error("No controller present");this.mainController.trigger.apply(this.mainController,arguments)}},r._keydown=function(e){t.addEventListener("keydown",(0,i.wrapKeyEvent)(e))},r._keyup=function(e){t.addEventListener("keyup",(0,i.wrapKeyEvent)(e))};var u={OneButton:a.OneButtonController,TwoButtons:a.TwoButtonController,FourButtons:a.FourButtonController,FiveButtons:a.FiveButtonController,SixButtons:a.SixButtonController,FourArrows:a.FourArrowController,Touch:a.TouchController,Joystick:a.JoystickController,JoystickWithButton:a.JoystickButtonController,TwoArrowsTwoButtons:a.TwoArrowsTwoButtonsController,TwoArrowsOneButton:a.TwoArrowsOneButtonController,TwoActionButtons:a.TwoActionButtonsController};return r.registerPlatform=function(t){},r.isSilentModeEnabled=function(){return o.silentMode},r}(),e.DataTypeException=function(t,e,o,n){this.expected=t,this.present=e,this.method=n,this.argument=o,this.message="Invalid data type in method "+this.method+", argument "+this.argument+" is expected to be "+this.expected+", but found "+this.present});e.validateDataType=function(t,e,o,r){switch(e){case"array":if(!Array.isArray(t))throw new u(e,void 0===t?"undefined":n(t),o,r);break;default:if((void 0===t?"undefined":n(t))!==e)throw new u(e,void 0===t?"undefined":n(t),o,r)}}}).call(e,o(7))},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Gamee=e.GameeEmitter=void 0;var n=o(1),r=o(0),a=e.GameeEmitter=function(){r.CustomEmitter.call(this)};(e.Gamee=function(t){this.emitter=new a,this._platform=t}).prototype=function(){var t=function(t){if(t)throw"Error "+t.toString()};return{_controller:n.core.controller,gameInit:function(t,e,o,r){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];(0,n.validateDataType)(t,"string","controllType","gamee.updateScore"),(0,n.validateDataType)(e,"object","controllOpts","gamee.gameInit"),(0,n.validateDataType)(o,"array","capabilities","gamee.gameInit"),(0,n.validateDataType)(r,"function","cb","gamee.gameInit"),(0,n.validateDataType)(a,"boolean","silentMode","gamee.gameInit"),n.core.gameeInit(t,e,o,r,a)},gameLoadingProgress:function(e,o){(0,n.validateDataType)(e,"number","percentage","gamee.gameLoadingProgress"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameLoadingProgress"),n.core.gameLoadingProgress(e),o(null)},gameReady:function(e){e=e||t,(0,n.validateDataType)(e,"function","opt_cb","gamee.gameReady"),n.core.gameReady(),e(null)},gameSave:function(e,o,r){(0,n.validateDataType)(e,"string","data","gamee.gameSave"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_share","gamee.gameSave"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.gameSave"),n.core.gameSave(e,!1),r(null)},getPlatform:function(){return this._platform},updateScore:function(e,o,r){(0,n.validateDataType)(e,"number","score","gamee.updateScore"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_ghostSign","gamee.updateScore"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.updateScore"),n.core.updateScore(e,o),r(null)},gameOver:function(e,o,r,a){"function"==typeof e?o=e:void 0!==e&&(0,n.validateDataType)(e,"object","opt_replayData","gamee.gameOver"),void 0!==a&&(0,n.validateDataType)(a,"boolean","opt_hideOverlay","gamee.gameOver"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameOver"),n.core.gameOver(e,r,a),o(null)},requestSocial:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestSocial"),n.core.requestSocial(function(e,o){var n=o.hasOwnProperty("socialData")?o:{socialData:o};t(null,n)},e)},logEvent:function(t,e){(0,n.validateDataType)(t,"string","eventName","gamee.logEvent"),!t||t.length>24||((0,n.validateDataType)(e,"string","eventValue","gamee.logEvent"),!e||e.length>160||n.core.logEvent(t,e))},requestBattleData:function(t){(0,n.validateDataType)(t,"function","cb","gamee.requestBattleData"),n.core.requestBattleData(t)},requestPlayerReplay:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerReplay"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerReplay"),n.core.requestPlayerReplay(t,e)},requestPlayerSaveState:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerSaveState"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerSaveState"),n.core.requestPlayerSaveState(t,e)},playerEnterToGameRoom:function(){n.core.playerEnterToGameRoom()},playerExitGameRoom:function(){n.core.playerExitGameRoom()},purchaseItem:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItem"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItem"),n.core.purchaseItemWithCoins(t,e,!0)},purchaseItemWithCoins:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithCoins"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithCoins"),n.core.purchaseItemWithCoins(t,e)},purchaseItemWithGems:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithGems"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithGems"),n.core.purchaseItemWithGems(t,e)},share:function(t,e){(0,n.validateDataType)(t,"object","shareDetails","gamee.share"),(0,n.validateDataType)(e,"function","cb","gamee.share"),n.core.share(t,e)},loadRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.loadRewardedVideo"),n.core.loadRewardedVideo(t)},showRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showRewardedVideo"),n.core.showRewardedVideo(t)},showSubscribeDialog:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showSubscribeDialog"),n.core.showSubscribeDialog(t)},requestPlayerData:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestPlayerData"),void 0!==e&&(0,n.validateDataType)(e,"number","userId","gamee.requestPlayerData"),n.core.requestPlayerData(t,e)}}}()},function(t,e,o){"use strict";function PlatformBridge(){this.requests={},this.platform="",this._init()}function PostMessageBridge(t){this._gameeWin=t,PlatformBridge.call(this),this.platform="web"}function MobileBridge(t){this.device=t,PostMessageBridge.call(this),this.platform="mobile"}Object.defineProperty(e,"__esModule",{value:!0}),e.PlatformAPI=void 0;var n="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};e.PlatformBridge=PlatformBridge,e.PostMessageBridge=PostMessageBridge,e.MobileBridge=MobileBridge;var r=o(1),a=e.PlatformAPI={emitter:null,pause:function(t){var e=new CustomEvent("pause",{detail:{callback:t}});this.emitter.dispatchEvent(e)},resume:function(t){var e=new CustomEvent("resume",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostShow:function(t){var e=new CustomEvent("ghostShow",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostHide:function(t){var e=new CustomEvent("ghostHide",{detail:{callback:t}});this.emitter.dispatchEvent(e)},mute:function(t){var e=new CustomEvent("mute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},unmute:function(t){var e=new CustomEvent("unmute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},start:function(t,e){var o=new CustomEvent("start",{detail:{callback:e}}),n=r.core.startSignal(t);if(n)return void e(n);t.replay&&(o.detail.opt_replay=!0),t.ghostMode&&(o.detail.opt_ghostMode=!0),t.resetState&&(o.detail.opt_resetState=!0),t.replayData&&(o.detail.replayData=t.replayData),this.emitter.dispatchEvent(o)}};PlatformBridge.prototype={instCount:0,_init:function(){},createRequest:function(t,e,o){if(this.validateMethod(t)){"function"==typeof e&&(o=e,e=void 0);var n=this.instCount++;void 0!==o&&(this.requests[n]=o);var r={request:{method:t,messageId:n,data:null}};this.doCall(r,e)}},validateMethod:function(t){return"gameLoadingProgress"!==t},doCall:function(t,e){throw"Not implemented"},_callback:function(t,e){var o=this.requests[t];delete this.requests[t],o&&o(e)},doResponse:function(t,e){throw"Not implemented"}},PostMessageBridge.prototype=Object.create(PlatformBridge.prototype),PostMessageBridge.prototype.constructor=PostMessageBridge,PostMessageBridge.prototype._init=function(){window.addEventListener("message",function(t){var e;if("object"===n(t.detail)&&null!==typeof t.detail)e=t.detail;else{if("object"!==n(t.data))return;e=t.data}if(r.core.isSilentModeEnabled(),e.request&&e.request.method&&void 0!==e.request.messageId)this._resolveAPICall(e.request.method,e.request.messageId,e.request.data);else if(e.response&&void 0!==e.response.messageId){if(e.error)throw e.error;this._callback(e.response.messageId,e.response.data)}}.bind(this),!1)},PostMessageBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),this._gameeWin.postMessage(t,"*")},PostMessageBridge.prototype.doResponse=function(t,e){var o={version:this.version,response:{messageId:t}};e&&(o.data=e),this._gameeWin.postMessage(o,"*")},PostMessageBridge.prototype._resolveAPICall=function(t,e,o){var n=this.doResponse.bind(this,e);switch(t){case"pause":a.pause(n);break;case"resume":a.resume(n);break;case"mute":a.mute(n);break;case"unmute":a.unmute(n);break;case"ghostShow":a.ghostShow(n);break;case"ghostHide":a.ghostHide(n);break;case"start":if(!o)throw"Method _start missing params";a.start(o,n);break;default:r.core.isSilentModeEnabled()}},MobileBridge.prototype=Object.create(PostMessageBridge.prototype),MobileBridge.prototype.constructor=MobileBridge,MobileBridge.prototype._init=function(){if(PostMessageBridge.prototype._init.call(this),"ios"===this.device)this._gameeWin=webkit.messageHandlers.callbackHandler;else{if("android"!==this.device)throw"Unknown device used in webkit bridge";this._gameeWin=_toDevice}window._triggerMessage=function(t){try{t=JSON.parse(t)}catch(e){throw"Couldn't parse message from native app: \n"+t+"\n"+e}r.core.isSilentModeEnabled(),this.dispatchEvent(new CustomEvent("message",{detail:t}))}.bind(window)},MobileBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),"android"===this.device&&(t=JSON.stringify(t)),this._gameeWin.postMessage(t,"*")}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){var t=this,e={};t.on=function(t,o,n){if(!(arguments.length<2||"string"!=typeof t||"function"!=typeof o)){var r=o.toString();void 0!==e[t]?void 0===e[t].callbacks[r]?e[t].callbacks[r]={cb:o,once:!!n}:"boolean"==typeof n&&(e[t].callbacks[r].once=n):(e[t]={callbacks:{}},e[t].callbacks[r]={cb:o,once:!!n})}},t.once=function(e,o){t.on(e,o,!0)},t.off=function(t,o){if("string"==typeof t&&void 0!==e[t])if("function"==typeof o){var n=o.toString(),r=e[t].callbacks[n];void 0!==r&&delete e[t].callbacks[n]}else delete e[t]},t.trigger=function(o,n){if("string"==typeof o&&void 0!==e[o])for(var r in e[o].callbacks){var a=e[o].callbacks[r];"function"==typeof a.cb&&a.cb(n),"boolean"==typeof a.once&&!0===a.once&&t.off(o,a.cb)}}};e.Bullet=new n},function(t,e,o){"use strict";function Button(t,e){var o=this;r.call(this),this._pressed=!0,this.key=t,this.keyCode=e,this.on("keydown",function(){o._pressed=!0}),this.on("keyup",function(){o._pressed=!1})}function Controller(){var t=this;r.call(this),this.buttons={},this.buttonAlias={},this.on("$keydown",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keydown",e)}),this.on("$keyup",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keyup",e)}),this.on("keydown",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keydown")}),this.on("keyup",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keyup")})}function OneButtonController(){Controller.call(this),this.addButton(new Button("button",32))}function TwoButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39))}function TwoActionButtonsController(){Controller.call(this),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function FiveButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32))}function SixButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function TwoArrowsOneButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function TwoArrowsTwoButtonsController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourArrowController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40))}function TouchController(){var t=this;Controller.call(this),this.on("$touchstart",function(e){t.trigger("touchstart",e)}),this.on("$touchend",function(e){t.trigger("touchend",e)}),this.on("$touchmove",function(e){t.trigger("touchmove",e)}),this.on("$touchleave",function(e){t.trigger("touchleave",e)}),this.on("$touchcancel",function(e){t.trigger("touchcancel",e)})}function JoystickController(){var t=this;Controller.call(this),this.x=0,this.y=0,this.on("$change",function(e){t.x=e.position.x,t.y=e.position.y,t.trigger("change",e)})}function JoystickButtonController(){JoystickController.call(this),this.addButton(new Button("button",32))}Object.defineProperty(e,"__esModule",{value:!0}),e.BulletClass=void 0,e.Button=Button,e.Controller=Controller,e.OneButtonController=OneButtonController,e.TwoButtonController=TwoButtonController,e.TwoActionButtonsController=TwoActionButtonsController,e.FourButtonController=FourButtonController,e.FiveButtonController=FiveButtonController,e.SixButtonController=SixButtonController,e.TwoArrowsOneButtonController=TwoArrowsOneButtonController,e.TwoArrowsTwoButtonsController=TwoArrowsTwoButtonsController,e.FourArrowController=FourArrowController,e.TouchController=TouchController,e.JoystickController=JoystickController,e.JoystickButtonController=JoystickButtonController;var n=o(4),r=e.BulletClass=n.Bullet.constructor;Button.prototype=Object.create(r.constructor.prototype),Button.constructor=Button,Button.prototype.isDown=function(){return this._pressed},Controller.prototype=Object.create(r.constructor.prototype),Controller.constructor=Controller,Controller.prototype.addButton=function(t){this.buttons[t.key]=t},Controller.prototype.enableKeyboard=function(t){var e,o,n={},r=this;for(e in this.buttons)o=this.buttons[e],o.keyCode&&(n[o.keyCode]=o);t._keydown(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keydown",{button:e.key}))}),t._keyup(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keyup",{button:e.key}))})},Controller.prototype.remapButton=function(t,e){if(e.name&&(e=e.name),!this.buttons[t])throw Error("Button "+t+" was not found in controller");this.buttonAlias[t]=e.name,this.buttons[e.name]=this.buttons[t],delete this.buttons[t]},OneButtonController.prototype=Object.create(Controller.prototype),OneButtonController.prototype.constructor=OneButtonController,TwoButtonController.prototype=Object.create(Controller.prototype),TwoButtonController.prototype.constructor=TwoButtonController,TwoActionButtonsController.prototype=Object.create(Controller.prototype),TwoActionButtonsController.prototype.constructor=TwoActionButtonsController,FourButtonController.prototype=Object.create(Controller.prototype),FourButtonController.prototype.constructor=FourButtonController,FiveButtonController.prototype=Object.create(Controller.prototype),FiveButtonController.prototype.constructor=FiveButtonController,SixButtonController.prototype=Object.create(Controller.prototype),SixButtonController.prototype.constructor=SixButtonController,TwoArrowsOneButtonController.prototype=Object.create(Controller.prototype),TwoArrowsOneButtonController.prototype.constructor=TwoArrowsOneButtonController,TwoArrowsTwoButtonsController.prototype=Object.create(Controller.prototype),TwoArrowsTwoButtonsController.prototype.constructor=TwoArrowsTwoButtonsController,FourArrowController.prototype=Object.create(Controller.prototype),FourArrowController.prototype.constructor=FourArrowController,TouchController.prototype=Object.create(TouchController.prototype),TouchController.prototype.constructor=TouchController,JoystickController.prototype=Object.create(Controller.prototype),JoystickController.prototype.constructor=JoystickController,JoystickButtonController.prototype=Object.create(JoystickController.prototype),JoystickButtonController.prototype.constructor=JoystickButtonController},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.gamee=void 0,o(0);var n=o(2),r=o(1),a=o(3),i=e.gamee=void 0,u=function(){var t,o="web",r=navigator.userAgent.toLowerCase();switch(/iphone|ipod|ipad/.test(r)?o=window.self!==window.top?"web":"ios":/gamee\/[0-9\.]+$/.test(r)?o="android":window.parent?o="web":window.parent&&window.parent.gameeSimulator&&(o="web"),e.gamee=i=new n.Gamee(o),window.gamee=i,o){case"web":window.parent,window,t=new a.PostMessageBridge(window.parent);break;case"ios":t=new a.MobileBridge("ios");break;case"android":t=new a.MobileBridge("android");break;default:throw"Can't identify the platform"}return t}();r.core.PlatformAPI=a.PlatformAPI,r.core.native=u,a.PlatformAPI.emitter=i.emitter},function(t,e){var o;o=function(){return this}();try{o=o||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(o=window)}t.exports=o}])}); //# sourceMappingURL=gamee-js.min.js.map \ No newline at end of file diff --git a/gamee/dist/gamee-js.min.js.map b/gamee/dist/gamee-js.min.js.map index 2a09dc3..c381e14 100644 --- a/gamee/dist/gamee-js.min.js.map +++ b/gamee/dist/gamee-js.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6","webpack:///gamee-js.min.js","webpack:///webpack/bootstrap 16f37751307f6bb82f86?c4a5","webpack:///./gamee/libs/shims.js?26b9","webpack:///./gamee/src/core.js?6b70","webpack:///./gamee/src/gameeAPI.js?7205","webpack:///./gamee/src/platform_bridge.js?848f","webpack:///./gamee/libs/bullet.js?d693","webpack:///./gamee/src/game_controllers.js?1af2","webpack:///./gamee/src/index.js?b323","webpack:///(webpack)/buildin/global.js?3698"],"names":["root","factory","exports","module","define","amd","a","i","this","modules","__webpack_require__","moduleId","installedModules","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","CustomEmitter","delegate","method","eventTarget","bind","document","createDocumentFragment","forEach","wrapKeyEvent","fn","ev","keyCode","window","event","which","ce","CustomEvent","preventDefault","defaultPrevented","Error","e","params","evt","origPrevent","bubbles","cancelable","detail","undefined","createEvent","initCustomEvent","Event","win","doc","docHijack","old","v","addListen","addEvent","on","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","length","addEventListener","Element","all","global","validateDataType","DataTypeException","core","_typeof","Symbol","iterator","constructor","_game_controllers","controllers","newObj","key","default","_shims","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","createController","opts","btn","controller","controllerTypes","enableKeyboard","buttons","remapButton","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","allOk","arguments","cap","Array","isArray","indexOf","native","createRequest","version","responseData","error","platform","requestController","_bindKeyboardTriggers","err","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","purchaseItemWithCoins","options","oldMethod","coins","isSilentModeEnabled","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","requestPlayerData","playerData","startSignal","ghostMode","mainController","additionalController","gameeNative","apply","_keydown","_keyup","OneButton","OneButtonController","TwoButtons","TwoButtonController","FourButtons","FourButtonController","FiveButtons","FiveButtonController","SixButtons","SixButtonController","FourArrows","FourArrowController","Touch","TouchController","Joystick","JoystickController","JoystickWithButton","JoystickButtonController","TwoArrowsTwoButtons","TwoArrowsTwoButtonsController","TwoArrowsOneButton","TwoArrowsOneButtonController","TwoActionButtons","TwoActionButtonsController","registerPlatform","platformAPI","silentMode","expected","present","argument","message","testedInput","expectedType","originMethod","Gamee","GameeEmitter","_core","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","requests","_init","PostMessageBridge","endpoint","_gameeWin","MobileBridge","device","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","create","_resolveAPICall","response","postMessage","opt_data","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","JSON","parse","stringify","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","_pressed","Controller","buttonAlias","addButton","x","y","position","_bullet","isDown","gamee","keyCodes","oldName","newName","_gameeAPI","_platform_bridge","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","g","Function","eval"],"mappings":";CAAA,SAAAA,EAAAC,GACA,mBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,QACA,sBAAAG,gBAAAC,IACAD,UAAAH,OACA,CACA,GAAAK,GAAAL,GACA,QAAAM,KAA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AK,MACGhS,OAAOmS,OAAWnS,OAGtB+R,EAAiB,GAAAD,GAAAnE,kBAAsB3N,OAAOmS,OAC9C,MACJ,KAAK,MACDJ,EAAiB,GAAAD,GAAAhE,aAAiB,MAClC,MACJ,KAAK,UACDiE,EAAiB,GAAAD,GAAAhE,aAAiB,UAClC,MACJ,SACI,KAAM,8BAEd,MAAOiE,KAGXvF,GAAAhK,KAAKwL,YAAL8D,EAAA9D,YACAxB,EAAAhK,KAAK6D,OAAS0L,EAEdD,EAAA9D,YAAYvB,QAAUgF,EAAMhF,SRi4EtB,SAAUrP,EAAQD,GSx8ExB,GAAAkV,EAGAA,GAAA,WACA,MAAA5U,QAGA,KAEA4U,KAAAC,SAAA,qBAAAC,MAAA,QACC,MAAA/R,GAED,gBAAAR,UACAqS,EAAArS,QAOA5C,EAAAD,QAAAkV","file":"gamee-js.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","/*! @preserve build time 2019-08-27 08:54:59 */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 6);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.CustomEmitter = CustomEmitter;\nexports.wrapKeyEvent = wrapKeyEvent;\n/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function CustomEvent(event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function get() {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return; //No need to polyfill\n\n\tfunction docHijack(p) {\n\t\tvar old = doc[p];doc[p] = function (v) {\n\t\t\treturn addListen(old(v));\n\t\t};\n\t}\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () {\n\t\t\t\te.returnValue = false;\n\t\t\t};\n\t\t\te.stopPropagation = e.stopPropagation || function () {\n\t\t\t\te.cancelBubble = true;\n\t\t\t};\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--) {\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t\t}\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent; //IE8\n\telse {\n\t\t\t//IE < 8\n\t\t\tdoc.attachEvent('onreadystatechange', function () {\n\t\t\t\taddListen(doc.all);\n\t\t\t}); //Make sure we also init at domReady\n\t\t\tdocHijack('getElementsByTagName');\n\t\t\tdocHijack('getElementById');\n\t\t\tdocHijack('createElement');\n\t\t\taddListen(doc.all);\n\t\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nfunction CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\"addEventListener\", \"dispatchEvent\", \"removeEventListener\"].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nfunction wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.validateDataType = exports.DataTypeException = exports.core = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _game_controllers = __webpack_require__(5);\n\nvar controllers = _interopRequireWildcard(_game_controllers);\n\nvar _shims = __webpack_require__(0);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function overloadedAudioContext(type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function resume() {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx;\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) {\n // throw error in async part\n setTimeout(function () {\n throw e;\n }, 0);\n }\n})();\n\n/**\n * @class core\n */\nvar core = exports.core = function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function noop() {};\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.0\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\", \"rewardedAds\", \"coins\", \"logEvents\", \"playerData\", \"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true,\n cap = {};\n if (capabilities !== undefined && Array.isArray(capabilities)) {\n for (var i = 0; i < capabilities.length; i++) {\n if (typeof capabilities[i] !== \"string\" || internals.CAPABILITIES.indexOf(capabilities[i]) === -1) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk) throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if (typeof percentage !== \"number\" || percentage < 0 || percentage > 100) throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n }();\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\") throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if (!cache.capabilities.saveState) throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb, numberOfPlayers) {\n\n if (!cache.capabilities.socialData) throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if (!cache.capabilities.logEvents) throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", { eventName: eventName, eventValue: eventValue }, function (error) {\n if (error) {\n throw error;\n }\n });\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if (!cache.capabilities.replay) throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if (!cache.capabilities.coins) throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if (!cache.capabilities.gems) throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if (!cache.capabilities.share) throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Share Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if (!cache.capabilities.playerData) throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n var options = undefined;\n if (userID) {\n options = { userID: userID };\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay) error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode) error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function requestController(type, opts) {\n if (type === \"FullScreen\") return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function additionalController(type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function trigger() {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n}();\n\nvar DataTypeException = exports.DataTypeException = function DataTypeException(expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = \"Invalid data type in method \" + this.method + \", argument \" + this.argument + \" is expected to be \" + this.expected + \", but found \" + this.present;\n};\n\nvar validateDataType = exports.validateDataType = function validateDataType(testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput)) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n break;\n\n default:\n if ((typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput)) !== expectedType) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Gamee = exports.GameeEmitter = undefined;\n\nvar _core = __webpack_require__(1);\n\nvar _shims = __webpack_require__(0);\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nvar GameeEmitter = exports.GameeEmitter = function GameeEmitter() {\n _shims.CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nvar Gamee = exports.Gamee = function Gamee(platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = function () {\n\n var cbError = function cbError(err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: _core.core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function gameInit(controllType, controllOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n (0, _core.validateDataType)(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n (0, _core.validateDataType)(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n (0, _core.validateDataType)(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.gameInit\");\n (0, _core.validateDataType)(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = _core.core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function gameLoadingProgress(percentage, opt_cb) {\n (0, _core.validateDataType)(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n _core.core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function gameReady(opt_cb) {\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n _core.core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function gameSave(data, opt_share, opt_cb) {\n var share = false,\n cb;\n (0, _core.validateDataType)(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function') opt_cb = opt_share;else if (typeof opt_share !== \"undefined\") (0, _core.validateDataType)(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n _core.core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function getPlatform() {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function updateScore(score, opt_ghostSign, opt_cb) {\n (0, _core.validateDataType)(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\") opt_cb = opt_ghostSign;else if (typeof opt_ghostSign !== \"undefined\") (0, _core.validateDataType)(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n _core.core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function gameOver(opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\") opt_cb = opt_replayData;else if (typeof opt_replayData !== \"undefined\") (0, _core.validateDataType)(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n (0, _core.validateDataType)(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n _core.core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function requestSocial(cb, numberOfPlayers) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = _core.core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function logEvent(eventName, eventValue) {\n\n (0, _core.validateDataType)(eventName, \"string\", \"eventName\", \"gamee.logEvent\");\n\n if (!eventName || eventName.length > 24) {\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return;\n }\n\n (0, _core.validateDataType)(eventValue, \"string\", \"eventValue\", \"gamee.logEvent\");\n\n if (!eventValue || eventValue.length > 160) {\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return;\n }\n\n _core.core.logEvent(eventName, eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function requestBattleData(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n _core.core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function requestPlayerReplay(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n _core.core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function requestPlayerSaveState(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n _core.core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function purchaseItem(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItem\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItem\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb, true);\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function purchaseItemWithCoins(purchaseDetails, cb) {\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithCoins\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithCoins\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb);\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function purchaseItemWithGems(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithGems\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithGems\");\n\n _core.core.purchaseItemWithGems(purchaseDetails, cb);\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function share(shareDetails, cb) {\n (0, _core.validateDataType)(shareDetails, \"object\", \"shareDetails\", \"gamee.share\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.share\");\n\n _core.core.share(shareDetails, cb);\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function loadRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.loadRewardedVideo\");\n _core.core.loadRewardedVideo(cb);\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function showRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showRewardedVideo\");\n _core.core.showRewardedVideo(cb);\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function requestPlayerData(cb, userID) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerData\");\n if (userID !== undefined) {\n (0, _core.validateDataType)(userID, \"number\", \"userId\", \"gamee.requestPlayerData\");\n }\n _core.core.requestPlayerData(cb, userID);\n }\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n}();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.PlatformAPI = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.PlatformBridge = PlatformBridge;\nexports.PostMessageBridge = PostMessageBridge;\nexports.MobileBridge = MobileBridge;\n\nvar _core = __webpack_require__(1);\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nvar PlatformAPI = exports.PlatformAPI = {\n\temitter: null,\n\tpause: function pause(cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function resume(cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function ghostShow(cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function ghostHide(cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function mute(cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function unmute(cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function start(data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = _core.core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay) event.detail.opt_replay = true;\n\t\tif (data.ghostMode) event.detail.opt_ghostMode = true;\n\t\tif (data.resetState) event.detail.opt_resetState = true;\n\t\tif (data.replayData) {\n\t\t\tevent.detail.replayData = data.replayData;\n\t\t}\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n/**\n * @class PlatformBridge\n *\n */\nfunction PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function _init() {},\n\tcreateRequest: function createRequest(method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method)) return;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function validateMethod(method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n * @abstract\n */\n\tdoCall: function doCall(preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function _callback(id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb) cb(responseData);\n\t},\n\t/**\n * @abstract\n */\n\tdoResponse: function doResponse(preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t}\n};\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nfunction PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (_typeof(ev.detail) === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (_typeof(ev.data) === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4) + ' data');\n\t\t}\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\t\tif (data.error) throw data.error;\n\t\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData) preparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\t\tconsole.error(\"Unknown method call\");\n\t\t\t}\n\t}\n};\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nfunction MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4));\n\t\t}\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar BulletClass = function BulletClass() {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 || typeof event !== \"string\" || typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n } else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n } else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n } else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n};\n\nvar Bullet = exports.Bullet = new BulletClass();\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.BulletClass = undefined;\nexports.Button = Button;\nexports.Controller = Controller;\nexports.OneButtonController = OneButtonController;\nexports.TwoButtonController = TwoButtonController;\nexports.TwoActionButtonsController = TwoActionButtonsController;\nexports.FourButtonController = FourButtonController;\nexports.FiveButtonController = FiveButtonController;\nexports.SixButtonController = SixButtonController;\nexports.TwoArrowsOneButtonController = TwoArrowsOneButtonController;\nexports.TwoArrowsTwoButtonsController = TwoArrowsTwoButtonsController;\nexports.FourArrowController = FourArrowController;\nexports.TouchController = TouchController;\nexports.JoystickController = JoystickController;\nexports.JoystickButtonController = JoystickButtonController;\n\nvar _bullet = __webpack_require__(4);\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nvar BulletClass = exports.BulletClass = _bullet.Bullet.constructor;\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nfunction Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nfunction Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key,\n\t button,\n\t keyCodes = {},\n\t self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nfunction OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nfunction TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nfunction TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nfunction FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nfunction FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nfunction SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nfunction TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nfunction TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nfunction FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nfunction TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nfunction JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nfunction JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.gamee = undefined;\n\n__webpack_require__(0);\n\nvar _gameeAPI = __webpack_require__(2);\n\nvar _core = __webpack_require__(1);\n\nvar _platform_bridge = __webpack_require__(3);\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nvar gamee = exports.gamee = undefined;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = function () {\n\n var platformBridge,\n platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) {\n // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) {\n // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) {\n // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) {\n // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n exports.gamee = gamee = new _gameeAPI.Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new _platform_bridge.PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new _platform_bridge.MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new _platform_bridge.MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n}();\n\n_core.core.PlatformAPI = _platform_bridge.PlatformAPI;\n_core.core.native = platformBridge;\n\n_platform_bridge.PlatformAPI.emitter = gamee.emitter;\n\nfunction loadScript(url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\nvar g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// gamee-js.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 16f37751307f6bb82f86","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.0\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6","webpack:///gamee-js.min.js","webpack:///webpack/bootstrap 2b97e13ed7e1fd3e15e5?ee2a","webpack:///./gamee/libs/shims.js?26b9","webpack:///./gamee/src/core.js?6b70","webpack:///./gamee/src/gameeAPI.js?7205","webpack:///./gamee/src/platform_bridge.js?848f","webpack:///./gamee/libs/bullet.js?d693","webpack:///./gamee/src/game_controllers.js?1af2","webpack:///./gamee/src/index.js?b323","webpack:///(webpack)/buildin/global.js?3698"],"names":["root","factory","exports","module","define","amd","a","i","this","modules","__webpack_require__","moduleId","installedModules","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","CustomEmitter","delegate","method","eventTarget","bind","document","createDocumentFragment","forEach","wrapKeyEvent","fn","ev","keyCode","window","event","which","ce","CustomEvent","preventDefault","defaultPrevented","Error","e","params","evt","origPrevent","bubbles","cancelable","detail","undefined","createEvent","initCustomEvent","Event","win","doc","docHijack","old","v","addListen","addEvent","on","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","length","addEventListener","Element","all","global","validateDataType","DataTypeException","core","_typeof","Symbol","iterator","constructor","_game_controllers","controllers","newObj","key","default","_shims","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","createController","opts","btn","controller","controllerTypes","enableKeyboard","buttons","remapButton","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","allOk","arguments","cap","Array","isArray","indexOf","native","createRequest","version","responseData","error","platform","requestController","_bindKeyboardTriggers","err","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","playerEnterToGameRoom","playerExitGameRoom","purchaseItemWithCoins","options","oldMethod","coins","isSilentModeEnabled","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","showSubscribeDialog","requestPlayerData","playerData","startSignal","ghostMode","mainController","additionalController","gameeNative","apply","_keydown","_keyup","OneButton","OneButtonController","TwoButtons","TwoButtonController","FourButtons","FourButtonController","FiveButtons","FiveButtonController","SixButtons","SixButtonController","FourArrows","FourArrowController","Touch","TouchController","Joystick","JoystickController","JoystickWithButton","JoystickButtonController","TwoArrowsTwoButtons","TwoArrowsTwoButtonsController","TwoArrowsOneButton","TwoArrowsOneButtonController","TwoActionButtons","TwoActionButtonsController","registerPlatform","platformAPI","silentMode","expected","present","argument","message","testedInput","expectedType","originMethod","Gamee","GameeEmitter","_core","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","requests","_init","PostMessageBridge","endpoint","_gameeWin","MobileBridge","device","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","create","_resolveAPICall","response","postMessage","opt_data","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","JSON","parse","stringify","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","_pressed","Controller","buttonAlias","addButton","x","y","position","_bullet","isDown","gamee","keyCodes","oldName","newName","_gameeAPI","_platform_bridge","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","g","Function","eval"],"mappings":";CAAA,SAAAA,EAAAC,GACA,mBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,QACA,sBAAAG,gBAAAC,IACAD,UAAAH,OACA,CAC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EAAA,GACAsU,EAAAtU,EAAA,GASWiU,iBAOPM,EAAkB,WAElB,GAAIA,GAAgBC,EAAe,MAI/BzO,EAAYD,UAAUC,UAAU0O,aAwBpC,QAtBI,mBAAmB5O,KAAKE,GAKpByO,EADAnS,OAAO2B,OAAS3B,OAAOqS,IACR,MAEA,MAEZ,mBAAmB7O,KAAKE,GAE/ByO,EAAe,UACRnS,OAAOsS,OACdH,EAAe,MACRnS,OAAOsS,QAAUtS,OAAOsS,OAAOC,iBACtCJ,EAAe,OAGnBhV,EAjCOyU,MAiCPA,EAAQ,GAAAI,GAAAvF,MAAU0F,GAElBnS,OAAO4R,MAAQA,EAEPO,GACJ,IAAK,MACGnS,OAAOsS,OAAWtS,OAGtBkS,EAAiB,GAAAD,GAAAnE,kBAAsB9N,OAAOsS,OAC9C,MACJ,KAAK,MACDJ,EAAiB,GAAAD,GAAAhE,aAAiB,MAClC,MACJ,KAAK,UACDiE,EAAiB,GAAAD,GAAAhE,aAAiB,UAClC,MACJ,SACI,KAAM,8BAEd,MAAOiE,KAGXvF,GAAAnK,KAAK2L,YAAL8D,EAAA9D,YACAxB,EAAAnK,KAAK6D,OAAS6L,EAEdD,EAAA9D,YAAYvB,QAAUgF,EAAMhF,SRy6EtB,SAAUxP,EAAQD,GSh/ExB,GAAAqV,EAGAA,GAAA,WACA,MAAA/U,QAGA,KAEA+U,KAAAC,SAAA,qBAAAC,MAAA,QACC,MAAAlS,GAED,gBAAAR,UACAwS,EAAAxS,QAOA5C,EAAAD,QAAAqV","file":"gamee-js.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","/*! @preserve build time 2019-10-15 09:07:55 */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 6);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.CustomEmitter = CustomEmitter;\nexports.wrapKeyEvent = wrapKeyEvent;\n/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function CustomEvent(event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function get() {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return; //No need to polyfill\n\n\tfunction docHijack(p) {\n\t\tvar old = doc[p];doc[p] = function (v) {\n\t\t\treturn addListen(old(v));\n\t\t};\n\t}\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () {\n\t\t\t\te.returnValue = false;\n\t\t\t};\n\t\t\te.stopPropagation = e.stopPropagation || function () {\n\t\t\t\te.cancelBubble = true;\n\t\t\t};\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--) {\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t\t}\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent; //IE8\n\telse {\n\t\t\t//IE < 8\n\t\t\tdoc.attachEvent('onreadystatechange', function () {\n\t\t\t\taddListen(doc.all);\n\t\t\t}); //Make sure we also init at domReady\n\t\t\tdocHijack('getElementsByTagName');\n\t\t\tdocHijack('getElementById');\n\t\t\tdocHijack('createElement');\n\t\t\taddListen(doc.all);\n\t\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nfunction CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\"addEventListener\", \"dispatchEvent\", \"removeEventListener\"].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nfunction wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.validateDataType = exports.DataTypeException = exports.core = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _game_controllers = __webpack_require__(5);\n\nvar controllers = _interopRequireWildcard(_game_controllers);\n\nvar _shims = __webpack_require__(0);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function overloadedAudioContext(type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function resume() {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx;\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) {\n // throw error in async part\n setTimeout(function () {\n throw e;\n }, 0);\n }\n})();\n\n/**\n * @class core\n */\nvar core = exports.core = function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function noop() {};\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\", \"rewardedAds\", \"coins\", \"logEvents\", \"playerData\", \"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true,\n cap = {};\n if (capabilities !== undefined && Array.isArray(capabilities)) {\n for (var i = 0; i < capabilities.length; i++) {\n if (typeof capabilities[i] !== \"string\" || internals.CAPABILITIES.indexOf(capabilities[i]) === -1) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk) throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if (typeof percentage !== \"number\" || percentage < 0 || percentage > 100) throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n }();\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\") throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if (!cache.capabilities.saveState) throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb, numberOfPlayers) {\n\n if (!cache.capabilities.socialData) throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if (!cache.capabilities.logEvents) throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", { eventName: eventName, eventValue: eventValue }, function (error) {\n if (error) {\n throw error;\n }\n });\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if (!cache.capabilities.replay) throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnterToGameRoom = function () {\n this.native.createRequest('playerEnterToGameRoom');\n };\n\n core.playerExitGameRoom = function () {\n this.native.createRequest('playerExitGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if (!cache.capabilities.coins) throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if (!cache.capabilities.gems) throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if (!cache.capabilities.share) throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Share Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if (!cache.capabilities.playerData) throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n var options = undefined;\n if (userID) {\n options = { userID: userID };\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay) error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode) error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function requestController(type, opts) {\n if (type === \"FullScreen\") return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function additionalController(type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function trigger() {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n}();\n\nvar DataTypeException = exports.DataTypeException = function DataTypeException(expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = \"Invalid data type in method \" + this.method + \", argument \" + this.argument + \" is expected to be \" + this.expected + \", but found \" + this.present;\n};\n\nvar validateDataType = exports.validateDataType = function validateDataType(testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput)) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n break;\n\n default:\n if ((typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput)) !== expectedType) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Gamee = exports.GameeEmitter = undefined;\n\nvar _core = __webpack_require__(1);\n\nvar _shims = __webpack_require__(0);\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nvar GameeEmitter = exports.GameeEmitter = function GameeEmitter() {\n _shims.CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nvar Gamee = exports.Gamee = function Gamee(platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = function () {\n\n var cbError = function cbError(err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: _core.core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function gameInit(controllType, controllOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n (0, _core.validateDataType)(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n (0, _core.validateDataType)(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n (0, _core.validateDataType)(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.gameInit\");\n (0, _core.validateDataType)(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = _core.core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function gameLoadingProgress(percentage, opt_cb) {\n (0, _core.validateDataType)(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n _core.core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function gameReady(opt_cb) {\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n _core.core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function gameSave(data, opt_share, opt_cb) {\n var share = false,\n cb;\n (0, _core.validateDataType)(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function') opt_cb = opt_share;else if (typeof opt_share !== \"undefined\") (0, _core.validateDataType)(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n _core.core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function getPlatform() {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function updateScore(score, opt_ghostSign, opt_cb) {\n (0, _core.validateDataType)(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\") opt_cb = opt_ghostSign;else if (typeof opt_ghostSign !== \"undefined\") (0, _core.validateDataType)(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n _core.core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function gameOver(opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\") opt_cb = opt_replayData;else if (typeof opt_replayData !== \"undefined\") (0, _core.validateDataType)(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n (0, _core.validateDataType)(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n _core.core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function requestSocial(cb, numberOfPlayers) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = _core.core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function logEvent(eventName, eventValue) {\n\n (0, _core.validateDataType)(eventName, \"string\", \"eventName\", \"gamee.logEvent\");\n\n if (!eventName || eventName.length > 24) {\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return;\n }\n\n (0, _core.validateDataType)(eventValue, \"string\", \"eventValue\", \"gamee.logEvent\");\n\n if (!eventValue || eventValue.length > 160) {\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return;\n }\n\n _core.core.logEvent(eventName, eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function requestBattleData(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n _core.core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function requestPlayerReplay(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n _core.core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function requestPlayerSaveState(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n _core.core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnterToGameRoom\n * @member of Gamee\n */\n playerEnterToGameRoom: function playerEnterToGameRoom() {\n _core.core.playerEnterToGameRoom();\n },\n\n /*\n * playerExitGameRoom\n * @member of Gamee\n */\n playerExitGameRoom: function playerExitGameRoom() {\n _core.core.playerExitGameRoom();\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function purchaseItem(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItem\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItem\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb, true);\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function purchaseItemWithCoins(purchaseDetails, cb) {\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithCoins\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithCoins\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb);\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function purchaseItemWithGems(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithGems\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithGems\");\n\n _core.core.purchaseItemWithGems(purchaseDetails, cb);\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function share(shareDetails, cb) {\n (0, _core.validateDataType)(shareDetails, \"object\", \"shareDetails\", \"gamee.share\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.share\");\n\n _core.core.share(shareDetails, cb);\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function loadRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.loadRewardedVideo\");\n _core.core.loadRewardedVideo(cb);\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function showRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showRewardedVideo\");\n _core.core.showRewardedVideo(cb);\n },\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function showSubscribeDialog(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showSubscribeDialog\");\n _core.core.showSubscribeDialog(cb);\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function requestPlayerData(cb, userID) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerData\");\n if (userID !== undefined) {\n (0, _core.validateDataType)(userID, \"number\", \"userId\", \"gamee.requestPlayerData\");\n }\n _core.core.requestPlayerData(cb, userID);\n }\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n}();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.PlatformAPI = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.PlatformBridge = PlatformBridge;\nexports.PostMessageBridge = PostMessageBridge;\nexports.MobileBridge = MobileBridge;\n\nvar _core = __webpack_require__(1);\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nvar PlatformAPI = exports.PlatformAPI = {\n\temitter: null,\n\tpause: function pause(cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function resume(cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function ghostShow(cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function ghostHide(cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function mute(cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function unmute(cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function start(data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = _core.core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay) event.detail.opt_replay = true;\n\t\tif (data.ghostMode) event.detail.opt_ghostMode = true;\n\t\tif (data.resetState) event.detail.opt_resetState = true;\n\t\tif (data.replayData) {\n\t\t\tevent.detail.replayData = data.replayData;\n\t\t}\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n/**\n * @class PlatformBridge\n *\n */\nfunction PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function _init() {},\n\tcreateRequest: function createRequest(method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method)) return;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function validateMethod(method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n * @abstract\n */\n\tdoCall: function doCall(preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function _callback(id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb) cb(responseData);\n\t},\n\t/**\n * @abstract\n */\n\tdoResponse: function doResponse(preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t}\n};\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nfunction PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (_typeof(ev.detail) === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (_typeof(ev.data) === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4) + ' data');\n\t\t}\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\t\tif (data.error) throw data.error;\n\t\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData) preparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\t\tconsole.error(\"Unknown method call\");\n\t\t\t}\n\t}\n};\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nfunction MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4));\n\t\t}\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar BulletClass = function BulletClass() {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 || typeof event !== \"string\" || typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n } else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n } else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n } else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n};\n\nvar Bullet = exports.Bullet = new BulletClass();\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.BulletClass = undefined;\nexports.Button = Button;\nexports.Controller = Controller;\nexports.OneButtonController = OneButtonController;\nexports.TwoButtonController = TwoButtonController;\nexports.TwoActionButtonsController = TwoActionButtonsController;\nexports.FourButtonController = FourButtonController;\nexports.FiveButtonController = FiveButtonController;\nexports.SixButtonController = SixButtonController;\nexports.TwoArrowsOneButtonController = TwoArrowsOneButtonController;\nexports.TwoArrowsTwoButtonsController = TwoArrowsTwoButtonsController;\nexports.FourArrowController = FourArrowController;\nexports.TouchController = TouchController;\nexports.JoystickController = JoystickController;\nexports.JoystickButtonController = JoystickButtonController;\n\nvar _bullet = __webpack_require__(4);\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nvar BulletClass = exports.BulletClass = _bullet.Bullet.constructor;\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nfunction Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nfunction Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key,\n\t button,\n\t keyCodes = {},\n\t self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nfunction OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nfunction TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nfunction TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nfunction FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nfunction FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nfunction SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nfunction TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nfunction TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nfunction FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nfunction TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nfunction JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nfunction JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.gamee = undefined;\n\n__webpack_require__(0);\n\nvar _gameeAPI = __webpack_require__(2);\n\nvar _core = __webpack_require__(1);\n\nvar _platform_bridge = __webpack_require__(3);\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nvar gamee = exports.gamee = undefined;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = function () {\n\n var platformBridge,\n platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) {\n // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) {\n // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) {\n // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) {\n // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n exports.gamee = gamee = new _gameeAPI.Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new _platform_bridge.PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new _platform_bridge.MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new _platform_bridge.MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n}();\n\n_core.core.PlatformAPI = _platform_bridge.PlatformAPI;\n_core.core.native = platformBridge;\n\n_platform_bridge.PlatformAPI.emitter = gamee.emitter;\n\nfunction loadScript(url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\nvar g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// gamee-js.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 2b97e13ed7e1fd3e15e5","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnterToGameRoom = function () {\n this.native.createRequest('playerEnterToGameRoom');\n };\n\n core.playerExitGameRoom = function () {\n this.native.createRequest('playerExitGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnterToGameRoom\n * @member of Gamee\n */\n playerEnterToGameRoom: function () {\n core.playerEnterToGameRoom()\n },\n\n /*\n * playerExitGameRoom\n * @member of Gamee\n */\n playerExitGameRoom: function () {\n core.playerExitGameRoom()\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function (cb){\n validateDataType(cb,\"function\",\"cb\",\"gamee.showSubscribeDialog\");\n core.showSubscribeDialog(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file diff --git a/gamee/src/core.js b/gamee/src/core.js index d0a3cd2..002b322 100644 --- a/gamee/src/core.js +++ b/gamee/src/core.js @@ -107,7 +107,7 @@ export var core = (function () { /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */ var internals = { - VERSION: "2.4.0", // version of the gamee library + VERSION: "2.4.1", // version of the gamee library CAPABILITIES: ["ghostMode", "saveState", "replay", "socialData","rewardedAds","coins","logEvents","playerData","share", "gems"], // supported capabilities variant: 0, // for automating communication with server soundUnlocked: false, @@ -392,6 +392,14 @@ export var core = (function () { }); }; + core.playerEnterToGameRoom = function () { + this.native.createRequest('playerEnterToGameRoom'); + }; + + core.playerExitGameRoom = function () { + this.native.createRequest('playerExitGameRoom'); + }; + core.purchaseItemWithCoins = function (options, cb, oldMethod) { if(!cache.capabilities.coins) @@ -482,6 +490,12 @@ export var core = (function () { }); }; + core.showSubscribeDialog = function (cb) { + this.native.createRequest("showSubscribeDialog", function (responseData) { + cb(null, responseData); + }); + }; + core.requestPlayerData = function (cb, userID) { if(!cache.capabilities.playerData) diff --git a/gamee/src/gameeAPI.js b/gamee/src/gameeAPI.js index 32439d6..14f5f27 100644 --- a/gamee/src/gameeAPI.js +++ b/gamee/src/gameeAPI.js @@ -269,6 +269,22 @@ Gamee.prototype = (function () { core.requestPlayerSaveState(userID, cb); }, + /* + * playerEnterToGameRoom + * @member of Gamee + */ + playerEnterToGameRoom: function () { + core.playerEnterToGameRoom() + }, + + /* + * playerExitGameRoom + * @member of Gamee + */ + playerExitGameRoom: function () { + core.playerExitGameRoom() + }, + /* *purchaseItem *@member of Gamee @@ -344,6 +360,17 @@ Gamee.prototype = (function () { core.showRewardedVideo(cb) }, + + /* + * showSubscribeDialog + * @member of Gamee + * @param{Gamee~showSubscribeDialog} cb + */ + showSubscribeDialog: function (cb){ + validateDataType(cb,"function","cb","gamee.showSubscribeDialog"); + core.showSubscribeDialog(cb) + }, + /** *requestPlayerData *@member of Gamee diff --git a/package.json b/package.json index c525def..259fa8b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gamee-js", - "version": "2.4.0", + "version": "2.4.1", "description": "Gamee JS SDK", "main": "gamee/src/index.js", "scripts": { From b41d59c51c490ab8236e074e2e529180b70baff0 Mon Sep 17 00:00:00 2001 From: Hadik Date: Tue, 15 Oct 2019 12:05:19 +0200 Subject: [PATCH 2/5] Rename methods --- gamee/src/core.js | 8 ++++---- gamee/src/gameeAPI.js | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gamee/src/core.js b/gamee/src/core.js index 002b322..ccf35cf 100644 --- a/gamee/src/core.js +++ b/gamee/src/core.js @@ -392,12 +392,12 @@ export var core = (function () { }); }; - core.playerEnterToGameRoom = function () { - this.native.createRequest('playerEnterToGameRoom'); + core.playerEnteredToGameRoom = function () { + this.native.createRequest('playerEnteredToGameRoom'); }; - core.playerExitGameRoom = function () { - this.native.createRequest('playerExitGameRoom'); + core.playerLeftGameRoom = function () { + this.native.createRequest('playerLeftGameRoom'); }; core.purchaseItemWithCoins = function (options, cb, oldMethod) { diff --git a/gamee/src/gameeAPI.js b/gamee/src/gameeAPI.js index 14f5f27..81d1fcb 100644 --- a/gamee/src/gameeAPI.js +++ b/gamee/src/gameeAPI.js @@ -270,19 +270,19 @@ Gamee.prototype = (function () { }, /* - * playerEnterToGameRoom + * playerEnteredToGameRoom * @member of Gamee */ - playerEnterToGameRoom: function () { - core.playerEnterToGameRoom() + playerEnteredToGameRoom: function () { + core.playerEnteredToGameRoom() }, /* - * playerExitGameRoom + * playerLeftGameRoom * @member of Gamee */ - playerExitGameRoom: function () { - core.playerExitGameRoom() + playerLeftGameRoom: function () { + core.playerLeftGameRoom() }, /* From 91806709867eff906d2bc356e675e84bbd147097 Mon Sep 17 00:00:00 2001 From: Hadik Date: Tue, 15 Oct 2019 12:05:55 +0200 Subject: [PATCH 3/5] Build --- gamee/dist/gamee-js.js | 22 +++++++++++----------- gamee/dist/gamee-js.js.map | 2 +- gamee/dist/gamee-js.min.js | 4 ++-- gamee/dist/gamee-js.min.js.map | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gamee/dist/gamee-js.js b/gamee/dist/gamee-js.js index 3c9607b..dfff75a 100644 --- a/gamee/dist/gamee-js.js +++ b/gamee/dist/gamee-js.js @@ -1,4 +1,4 @@ -/*! @preserve build time 2019-10-15 09:07:55 */ +/*! @preserve build time 2019-10-15 10:05:46 */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -606,12 +606,12 @@ var core = exports.core = function () { }); }; - core.playerEnterToGameRoom = function () { - this.native.createRequest('playerEnterToGameRoom'); + core.playerEnteredToGameRoom = function () { + this.native.createRequest('playerEnteredToGameRoom'); }; - core.playerExitGameRoom = function () { - this.native.createRequest('playerExitGameRoom'); + core.playerLeftGameRoom = function () { + this.native.createRequest('playerLeftGameRoom'); }; core.purchaseItemWithCoins = function (options, cb, oldMethod) { @@ -1203,19 +1203,19 @@ Gamee.prototype = function () { }, /* - * playerEnterToGameRoom + * playerEnteredToGameRoom * @member of Gamee */ - playerEnterToGameRoom: function playerEnterToGameRoom() { - _core.core.playerEnterToGameRoom(); + playerEnteredToGameRoom: function playerEnteredToGameRoom() { + _core.core.playerEnteredToGameRoom(); }, /* - * playerExitGameRoom + * playerLeftGameRoom * @member of Gamee */ - playerExitGameRoom: function playerExitGameRoom() { - _core.core.playerExitGameRoom(); + playerLeftGameRoom: function playerLeftGameRoom() { + _core.core.playerLeftGameRoom(); }, /* diff --git a/gamee/dist/gamee-js.js.map b/gamee/dist/gamee-js.js.map index 85b363d..cd3a0ba 100644 --- a/gamee/dist/gamee-js.js.map +++ b/gamee/dist/gamee-js.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 2b97e13ed7e1fd3e15e5","webpack:///./gamee/libs/shims.js","webpack:///./gamee/src/core.js","webpack:///./gamee/src/gameeAPI.js","webpack:///./gamee/src/platform_bridge.js","webpack:///./gamee/libs/bullet.js","webpack:///./gamee/src/game_controllers.js","webpack:///./gamee/src/index.js","webpack:///(webpack)/buildin/global.js"],"names":["CustomEmitter","wrapKeyEvent","shimCustomEvent","ce","window","CustomEvent","preventDefault","defaultPrevented","Error","e","event","params","evt","origPrevent","bubbles","cancelable","detail","undefined","document","createEvent","initCustomEvent","call","Object","defineProperty","get","prototype","Event","win","doc","addEventListener","docHijack","p","old","v","addListen","addEvent","on","fn","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","i","length","Element","all","eventTarget","createDocumentFragment","delegate","method","bind","forEach","ev","keyCode","which","controllers","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","core","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","silentMode","allOk","cap","Array","isArray","indexOf","native","createRequest","version","controller","responseData","error","platform","requestController","enableKeyboard","_bindKeyboardTriggers","err","global","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","hasOwnProperty","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","playerEnterToGameRoom","playerExitGameRoom","purchaseItemWithCoins","options","oldMethod","coins","propertiesList","property","isSilentModeEnabled","console","log","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","showSubscribeDialog","requestPlayerData","playerData","startSignal","ghostMode","mainController","opts","createController","additionalController","gameeNative","apply","arguments","_keydown","_keyup","btn","controllerTypes","buttons","remapButton","OneButtonController","TwoButtonController","FourButtonController","FiveButtonController","SixButtonController","FourArrowController","TouchController","JoystickController","JoystickButtonController","TwoArrowsTwoButtonsController","TwoArrowsOneButtonController","TwoActionButtonsController","registerPlatform","platformAPI","DataTypeException","expected","present","argument","message","validateDataType","testedInput","expectedType","originMethod","GameeEmitter","Gamee","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","result","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","PostMessageBridge","MobileBridge","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","requests","_init","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","endpoint","_gameeWin","create","constructor","JSON","stringify","_resolveAPICall","response","postMessage","opt_data","device","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","parse","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","Controller","key","_pressed","isDown","buttonAlias","addButton","gamee","keyCodes","oldName","newName","name","x","y","position","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","loadScript","url","head","getElementsByTagName","script","createElement","src","onreadystatechange","onload","appendChild"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA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,KAAP,GAAeA,KAAf;;AAEA,YAAQS,YAAR;AACI,aAAK,KAAL;AACI,gBAAInS,OAAOsS,MAAP,KAAkBtS,MAAtB,EAA8B;AAC1ByJ,wBAAQnD,KAAR,CAAc,0CAAd;AACH;AACD4L,6BAAiB,uCAAsBlS,OAAOsS,MAA7B,CAAjB;AACA;AACJ,aAAK,KAAL;AACIJ,6BAAiB,kCAAiB,KAAjB,CAAjB;AACA;AACJ,aAAK,SAAL;AACIA,6BAAiB,kCAAiB,SAAjB,CAAjB;AACA;AACJ;AACI,kBAAM,6BAAN;AAdR;AAgBA,WAAOA,cAAP;AACH,CA/CoB,EAArB;;AAiDA,WAAKpE,WAAL;AACA,WAAK7H,MAAL,GAAciM,cAAd;;AAEA,6BAAYvF,OAAZ,GAAsB+E,MAAM/E,OAA5B;;AAGA,SAAS6F,UAAT,CAAqBC,GAArB,EAA0BzE,QAA1B,EAAoC;AAChC;AACA,QAAI0E,OAAO5R,SAAS6R,oBAAT,CAA8B,MAA9B,EAAsC,CAAtC,CAAX;AACA,QAAIC,SAAS9R,SAAS+R,aAAT,CAAuB,QAAvB,CAAb;AACAD,WAAOE,GAAP,GAAaL,GAAb;;AAEA;AACA;AACAG,WAAOG,kBAAP,GAA4B/E,QAA5B;AACA4E,WAAOI,MAAP,GAAgBhF,QAAhB;;AAEA;AACA0E,SAAKO,WAAL,CAAiBL,MAAjB;AACH,C;;;;;;ACvFD;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"gamee-js.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 2b97e13ed7e1fd3e15e5","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnterToGameRoom = function () {\n this.native.createRequest('playerEnterToGameRoom');\n };\n\n core.playerExitGameRoom = function () {\n this.native.createRequest('playerExitGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnterToGameRoom\n * @member of Gamee\n */\n playerEnterToGameRoom: function () {\n core.playerEnterToGameRoom()\n },\n\n /*\n * playerExitGameRoom\n * @member of Gamee\n */\n playerExitGameRoom: function () {\n core.playerExitGameRoom()\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function (cb){\n validateDataType(cb,\"function\",\"cb\",\"gamee.showSubscribeDialog\");\n core.showSubscribeDialog(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap e3344513ac420d153d79","webpack:///./gamee/libs/shims.js","webpack:///./gamee/src/core.js","webpack:///./gamee/src/gameeAPI.js","webpack:///./gamee/src/platform_bridge.js","webpack:///./gamee/libs/bullet.js","webpack:///./gamee/src/game_controllers.js","webpack:///./gamee/src/index.js","webpack:///(webpack)/buildin/global.js"],"names":["CustomEmitter","wrapKeyEvent","shimCustomEvent","ce","window","CustomEvent","preventDefault","defaultPrevented","Error","e","event","params","evt","origPrevent","bubbles","cancelable","detail","undefined","document","createEvent","initCustomEvent","call","Object","defineProperty","get","prototype","Event","win","doc","addEventListener","docHijack","p","old","v","addListen","addEvent","on","fn","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","i","length","Element","all","eventTarget","createDocumentFragment","delegate","method","bind","forEach","ev","keyCode","which","controllers","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","core","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","silentMode","allOk","cap","Array","isArray","indexOf","native","createRequest","version","controller","responseData","error","platform","requestController","enableKeyboard","_bindKeyboardTriggers","err","global","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","hasOwnProperty","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","playerEnteredToGameRoom","playerLeftGameRoom","purchaseItemWithCoins","options","oldMethod","coins","propertiesList","property","isSilentModeEnabled","console","log","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","showSubscribeDialog","requestPlayerData","playerData","startSignal","ghostMode","mainController","opts","createController","additionalController","gameeNative","apply","arguments","_keydown","_keyup","btn","controllerTypes","buttons","remapButton","OneButtonController","TwoButtonController","FourButtonController","FiveButtonController","SixButtonController","FourArrowController","TouchController","JoystickController","JoystickButtonController","TwoArrowsTwoButtonsController","TwoArrowsOneButtonController","TwoActionButtonsController","registerPlatform","platformAPI","DataTypeException","expected","present","argument","message","validateDataType","testedInput","expectedType","originMethod","GameeEmitter","Gamee","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","result","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","PostMessageBridge","MobileBridge","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","requests","_init","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","endpoint","_gameeWin","create","constructor","JSON","stringify","_resolveAPICall","response","postMessage","opt_data","device","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","parse","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","Controller","key","_pressed","isDown","buttonAlias","addButton","gamee","keyCodes","oldName","newName","name","x","y","position","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","loadScript","url","head","getElementsByTagName","script","createElement","src","onreadystatechange","onload","appendChild"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;QC6BgBA,a,GAAAA,a;QAoBAC,Y,GAAAA,Y;AAjHhB;;;AAGA,CAAC,SAASC,eAAT,GAA2B;AAC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aAAK,SAAL;AACIA,6BAAiB,kCAAiB,SAAjB,CAAjB;AACA;AACJ;AACI,kBAAM,6BAAN;AAdR;AAgBA,WAAOA,cAAP;AACH,CA/CoB,EAArB;;AAiDA,WAAKpE,WAAL;AACA,WAAK7H,MAAL,GAAciM,cAAd;;AAEA,6BAAYvF,OAAZ,GAAsB+E,MAAM/E,OAA5B;;AAGA,SAAS6F,UAAT,CAAqBC,GAArB,EAA0BzE,QAA1B,EAAoC;AAChC;AACA,QAAI0E,OAAO5R,SAAS6R,oBAAT,CAA8B,MAA9B,EAAsC,CAAtC,CAAX;AACA,QAAIC,SAAS9R,SAAS+R,aAAT,CAAuB,QAAvB,CAAb;AACAD,WAAOE,GAAP,GAAaL,GAAb;;AAEA;AACA;AACAG,WAAOG,kBAAP,GAA4B/E,QAA5B;AACA4E,WAAOI,MAAP,GAAgBhF,QAAhB;;AAEA;AACA0E,SAAKO,WAAL,CAAiBL,MAAjB;AACH,C;;;;;;ACvFD;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"gamee-js.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e3344513ac420d153d79","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredToGameRoom = function () {\n this.native.createRequest('playerEnteredToGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredToGameRoom\n * @member of Gamee\n */\n playerEnteredToGameRoom: function () {\n core.playerEnteredToGameRoom()\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function () {\n core.playerLeftGameRoom()\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function (cb){\n validateDataType(cb,\"function\",\"cb\",\"gamee.showSubscribeDialog\");\n core.showSubscribeDialog(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file diff --git a/gamee/dist/gamee-js.min.js b/gamee/dist/gamee-js.min.js index dfa41c4..51ddb4f 100644 --- a/gamee/dist/gamee-js.min.js +++ b/gamee/dist/gamee-js.min.js @@ -1,3 +1,3 @@ -/*! @preserve build time 2019-10-15 09:07:55 */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,function(){return function(t){function __webpack_require__(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,__webpack_require__),n.l=!0,n.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.i=function(t){return t},__webpack_require__.d=function(t,e,o){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=6)}([function(t,e,o){"use strict";function CustomEmitter(){function delegate(e){this[e]=t[e].bind(t)}var t=document.createDocumentFragment();["addEventListener","dispatchEvent","removeEventListener"].forEach(delegate,this)}function wrapKeyEvent(t){return function(e){return e&&e.keyCode||(e||(e=window.event),e.which&&(e.keyCode=e.which)),t(e)}}Object.defineProperty(e,"__esModule",{value:!0}),e.CustomEmitter=CustomEmitter,e.wrapKeyEvent=wrapKeyEvent,function(){try{var t=new window.CustomEvent("test");if(t.preventDefault(),!0!==t.defaultPrevented)throw new Error("Could not prevent default")}catch(t){var e=function(t,e){var o,n;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},o=document.createEvent("CustomEvent"),o.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n=o.preventDefault,o.preventDefault=function(){n.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},o};e.prototype=window.Event.prototype,window.CustomEvent=e}}(),function(t,e){function docHijack(t){var o=e[t];e[t]=function(t){return addListen(o(t))}}function addEvent(e,o,n){return(n=this).attachEvent("on"+e,function(e){e=e||t.event,e.preventDefault=e.preventDefault||function(){e.returnValue=!1},e.stopPropagation=e.stopPropagation||function(){e.cancelBubble=!0},o.call(n,e)})}function addListen(t,e){if(e=t.length)for(;e--;)t[e].addEventListener=addEvent;else t.addEventListener=addEvent;return t}t.addEventListener||(addListen([e,t]),"Element"in t?t.Element.prototype.addEventListener=addEvent:(e.attachEvent("onreadystatechange",function(){addListen(e.all)}),docHijack("getElementsByTagName"),docHijack("getElementById"),docHijack("createElement"),addListen(e.all)))}(window,document)},function(t,e,o){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.validateDataType=e.DataTypeException=e.core=void 0;var n="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},r=o(5),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e.default=t,e}(r),i=o(0);!function(){var t=function(t){var e=new t;if("suspended"===e.state){var o=function resume(){if(/(iPhone|iPad)/i.test(navigator.userAgent)){var t=e.createBuffer(1,1,44100),o=e.createBufferSource();o.buffer=t,o.connect(e.destination),o.start(0),o.disconnect()}e.resume(),setTimeout(function(){"running"===e.state&&document.body.removeEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),resume,!1)},0)};document.body.addEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),o,!1)}return e};try{void 0!==window.AudioContext?window.AudioContext=t.bind(null,window.AudioContext):"undefined"!=typeof webkitAudioContext&&(window.webkitAudioContext=t.bind(null,window.webkitAudioContext))}catch(t){setTimeout(function(){throw t},0)}}();var u=(e.core=function(){function createController(t,e){var o,n;if(!u[t])throw new Error("Unsupported controller type, "+t);if(e=e||{},n=new u[t],e.enableKeyboard&&n.enableKeyboard(r),e.buttons)for(o in e.buttons)n.remapButton(o,e.buttons[o]);return n}var e=function(){},o={},n={VERSION:"2.4.1",CAPABILITIES:["ghostMode","saveState","replay","socialData","rewardedAds","coins","logEvents","playerData","share","gems"],variant:0,soundUnlocked:!1,onReady:e,onGameStart:e},r={};r.gameeInit=function(t,e,a,i){var u=(arguments.length>4&&void 0!==arguments[4]&&arguments[4],!0),s={};if(void 0!==a&&Array.isArray(a))for(var l=0;l100)throw"Percentage passed to gameLoadingProgress out of bounds or not a number.";e>t&&(t=e,this.native.createRequest("gameLoadingProgress",{percentage:e}))}}(),r.gameReady=function(){this.native.createRequest("gameReady")},r.updateScore=function(t,e){if("number"!=typeof t)throw"Score passed to updateScore is not a number.";var o={score:parseInt(t,10)};e&&(o.ghostSign=!0),this.native.createRequest("updateScore",o)},r.gameOver=function(t,e,o){o=void 0!==o&&o;var n={};if(t){if(t.hasOwnProperty("variant")||(t.variant=""),!t.hasOwnProperty("data"))throw"Replay data must have `data` property";n.replayData=t}n.hideOverlay=o,e&&(n.state=e),r.native.createRequest("gameOver",n)},r.gameSave=function(t,e){if(!o.capabilities.saveState)throw"Save State not supported, you must add the capability on gamee.Init";r.native.createRequest("saveState",{state:t,share:e})},r.requestSocial=function(t,e){if(!o.capabilities.socialData)throw"Social Data not supported, you must add the capability on gamee.Init";this.native.createRequest("requestSocial",e,function(e){t(null,e)})},r.logEvent=function(t,e){if(!o.capabilities.logEvents)throw"Log Events not supported, you must add the capability on gamee.Init";this.native.createRequest("logEvent",{eventName:t,eventValue:e},function(t){if(t)throw t})},r.requestBattleData=function(t){this.native.createRequest("requestBattleData",void 0,function(e){t(null,e)})},r.requestPlayerReplay=function(t,e){if(!o.capabilities.replay)throw"Replays not supported, you must add the capability on gamee.Init";this.native.createRequest("requestPlayerReplay",{userID:t},function(t){e(null,t)})},r.requestPlayerSaveState=function(t,e){this.native.createRequest("requestPlayerSaveState",{userID:t},function(t){e(null,t)})},r.playerEnterToGameRoom=function(){this.native.createRequest("playerEnterToGameRoom")},r.playerExitGameRoom=function(){this.native.createRequest("playerExitGameRoom")},r.purchaseItemWithCoins=function(t,e,n){if(!o.capabilities.coins)throw"Coins purchases not supported, you must add the capability on gamee.Init";if(t){["coinsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase Options must have `"+e+"` property"})}this.isSilentModeEnabled();var r="purchaseItemWithCoins";void 0!==n&&!0===n&&(r="purchaseItem"),this.native.createRequest(r,t,function(t){e(null,t)})},r.purchaseItemWithGems=function(t,e){if(!o.capabilities.gems)throw"Gems purchases not supported, you must add the capability on gamee.Init";if(t){["gemsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("purchaseItemWithGems",t,function(t){e(null,t)})},r.share=function(t,e){if(!o.capabilities.share)throw"Share option not supported, you must add the capability on gamee.Init";if(t){["destination"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Share Options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("share",t,function(t){e(null,t)})},r.loadRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("loadRewardedVideo",function(e){t(null,e)})},r.showRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("showRewardedVideo",function(e){t(null,e)})},r.showSubscribeDialog=function(t){this.native.createRequest("showSubscribeDialog",function(e){t(null,e)})},r.requestPlayerData=function(t,e){if(!o.capabilities.playerData)throw"Player Data not supported, you must add the capability on gamee.Init";var n=void 0;e&&(n={userID:e}),this.native.createRequest("requestPlayerData",n,function(e){t(null,e)})},r.startSignal=function(t){var e;return t.replay&&!o.capabilities.replay&&(e="Game doesn't support replay. "),t.ghostMode&&!o.capabilities.ghostMode&&(e="Game doesn't support ghost Mode. "),e},r.controller={mainController:null,requestController:function(t,e){if("FullScreen"===t)return null;var o=createController(t,e);return this.mainController=o,o},additionalController:function(t,e){var o=createController(t,e);return gameeNative.additionalController(t),o},trigger:function(){if(!this.mainController)throw new Error("No controller present");this.mainController.trigger.apply(this.mainController,arguments)}},r._keydown=function(e){t.addEventListener("keydown",(0,i.wrapKeyEvent)(e))},r._keyup=function(e){t.addEventListener("keyup",(0,i.wrapKeyEvent)(e))};var u={OneButton:a.OneButtonController,TwoButtons:a.TwoButtonController,FourButtons:a.FourButtonController,FiveButtons:a.FiveButtonController,SixButtons:a.SixButtonController,FourArrows:a.FourArrowController,Touch:a.TouchController,Joystick:a.JoystickController,JoystickWithButton:a.JoystickButtonController,TwoArrowsTwoButtons:a.TwoArrowsTwoButtonsController,TwoArrowsOneButton:a.TwoArrowsOneButtonController,TwoActionButtons:a.TwoActionButtonsController};return r.registerPlatform=function(t){},r.isSilentModeEnabled=function(){return o.silentMode},r}(),e.DataTypeException=function(t,e,o,n){this.expected=t,this.present=e,this.method=n,this.argument=o,this.message="Invalid data type in method "+this.method+", argument "+this.argument+" is expected to be "+this.expected+", but found "+this.present});e.validateDataType=function(t,e,o,r){switch(e){case"array":if(!Array.isArray(t))throw new u(e,void 0===t?"undefined":n(t),o,r);break;default:if((void 0===t?"undefined":n(t))!==e)throw new u(e,void 0===t?"undefined":n(t),o,r)}}}).call(e,o(7))},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Gamee=e.GameeEmitter=void 0;var n=o(1),r=o(0),a=e.GameeEmitter=function(){r.CustomEmitter.call(this)};(e.Gamee=function(t){this.emitter=new a,this._platform=t}).prototype=function(){var t=function(t){if(t)throw"Error "+t.toString()};return{_controller:n.core.controller,gameInit:function(t,e,o,r){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];(0,n.validateDataType)(t,"string","controllType","gamee.updateScore"),(0,n.validateDataType)(e,"object","controllOpts","gamee.gameInit"),(0,n.validateDataType)(o,"array","capabilities","gamee.gameInit"),(0,n.validateDataType)(r,"function","cb","gamee.gameInit"),(0,n.validateDataType)(a,"boolean","silentMode","gamee.gameInit"),n.core.gameeInit(t,e,o,r,a)},gameLoadingProgress:function(e,o){(0,n.validateDataType)(e,"number","percentage","gamee.gameLoadingProgress"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameLoadingProgress"),n.core.gameLoadingProgress(e),o(null)},gameReady:function(e){e=e||t,(0,n.validateDataType)(e,"function","opt_cb","gamee.gameReady"),n.core.gameReady(),e(null)},gameSave:function(e,o,r){(0,n.validateDataType)(e,"string","data","gamee.gameSave"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_share","gamee.gameSave"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.gameSave"),n.core.gameSave(e,!1),r(null)},getPlatform:function(){return this._platform},updateScore:function(e,o,r){(0,n.validateDataType)(e,"number","score","gamee.updateScore"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_ghostSign","gamee.updateScore"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.updateScore"),n.core.updateScore(e,o),r(null)},gameOver:function(e,o,r,a){"function"==typeof e?o=e:void 0!==e&&(0,n.validateDataType)(e,"object","opt_replayData","gamee.gameOver"),void 0!==a&&(0,n.validateDataType)(a,"boolean","opt_hideOverlay","gamee.gameOver"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameOver"),n.core.gameOver(e,r,a),o(null)},requestSocial:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestSocial"),n.core.requestSocial(function(e,o){var n=o.hasOwnProperty("socialData")?o:{socialData:o};t(null,n)},e)},logEvent:function(t,e){(0,n.validateDataType)(t,"string","eventName","gamee.logEvent"),!t||t.length>24||((0,n.validateDataType)(e,"string","eventValue","gamee.logEvent"),!e||e.length>160||n.core.logEvent(t,e))},requestBattleData:function(t){(0,n.validateDataType)(t,"function","cb","gamee.requestBattleData"),n.core.requestBattleData(t)},requestPlayerReplay:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerReplay"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerReplay"),n.core.requestPlayerReplay(t,e)},requestPlayerSaveState:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerSaveState"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerSaveState"),n.core.requestPlayerSaveState(t,e)},playerEnterToGameRoom:function(){n.core.playerEnterToGameRoom()},playerExitGameRoom:function(){n.core.playerExitGameRoom()},purchaseItem:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItem"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItem"),n.core.purchaseItemWithCoins(t,e,!0)},purchaseItemWithCoins:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithCoins"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithCoins"),n.core.purchaseItemWithCoins(t,e)},purchaseItemWithGems:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithGems"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithGems"),n.core.purchaseItemWithGems(t,e)},share:function(t,e){(0,n.validateDataType)(t,"object","shareDetails","gamee.share"),(0,n.validateDataType)(e,"function","cb","gamee.share"),n.core.share(t,e)},loadRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.loadRewardedVideo"),n.core.loadRewardedVideo(t)},showRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showRewardedVideo"),n.core.showRewardedVideo(t)},showSubscribeDialog:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showSubscribeDialog"),n.core.showSubscribeDialog(t)},requestPlayerData:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestPlayerData"),void 0!==e&&(0,n.validateDataType)(e,"number","userId","gamee.requestPlayerData"),n.core.requestPlayerData(t,e)}}}()},function(t,e,o){"use strict";function PlatformBridge(){this.requests={},this.platform="",this._init()}function PostMessageBridge(t){this._gameeWin=t,PlatformBridge.call(this),this.platform="web"}function MobileBridge(t){this.device=t,PostMessageBridge.call(this),this.platform="mobile"}Object.defineProperty(e,"__esModule",{value:!0}),e.PlatformAPI=void 0;var n="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};e.PlatformBridge=PlatformBridge,e.PostMessageBridge=PostMessageBridge,e.MobileBridge=MobileBridge;var r=o(1),a=e.PlatformAPI={emitter:null,pause:function(t){var e=new CustomEvent("pause",{detail:{callback:t}});this.emitter.dispatchEvent(e)},resume:function(t){var e=new CustomEvent("resume",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostShow:function(t){var e=new CustomEvent("ghostShow",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostHide:function(t){var e=new CustomEvent("ghostHide",{detail:{callback:t}});this.emitter.dispatchEvent(e)},mute:function(t){var e=new CustomEvent("mute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},unmute:function(t){var e=new CustomEvent("unmute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},start:function(t,e){var o=new CustomEvent("start",{detail:{callback:e}}),n=r.core.startSignal(t);if(n)return void e(n);t.replay&&(o.detail.opt_replay=!0),t.ghostMode&&(o.detail.opt_ghostMode=!0),t.resetState&&(o.detail.opt_resetState=!0),t.replayData&&(o.detail.replayData=t.replayData),this.emitter.dispatchEvent(o)}};PlatformBridge.prototype={instCount:0,_init:function(){},createRequest:function(t,e,o){if(this.validateMethod(t)){"function"==typeof e&&(o=e,e=void 0);var n=this.instCount++;void 0!==o&&(this.requests[n]=o);var r={request:{method:t,messageId:n,data:null}};this.doCall(r,e)}},validateMethod:function(t){return"gameLoadingProgress"!==t},doCall:function(t,e){throw"Not implemented"},_callback:function(t,e){var o=this.requests[t];delete this.requests[t],o&&o(e)},doResponse:function(t,e){throw"Not implemented"}},PostMessageBridge.prototype=Object.create(PlatformBridge.prototype),PostMessageBridge.prototype.constructor=PostMessageBridge,PostMessageBridge.prototype._init=function(){window.addEventListener("message",function(t){var e;if("object"===n(t.detail)&&null!==typeof t.detail)e=t.detail;else{if("object"!==n(t.data))return;e=t.data}if(r.core.isSilentModeEnabled(),e.request&&e.request.method&&void 0!==e.request.messageId)this._resolveAPICall(e.request.method,e.request.messageId,e.request.data);else if(e.response&&void 0!==e.response.messageId){if(e.error)throw e.error;this._callback(e.response.messageId,e.response.data)}}.bind(this),!1)},PostMessageBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),this._gameeWin.postMessage(t,"*")},PostMessageBridge.prototype.doResponse=function(t,e){var o={version:this.version,response:{messageId:t}};e&&(o.data=e),this._gameeWin.postMessage(o,"*")},PostMessageBridge.prototype._resolveAPICall=function(t,e,o){var n=this.doResponse.bind(this,e);switch(t){case"pause":a.pause(n);break;case"resume":a.resume(n);break;case"mute":a.mute(n);break;case"unmute":a.unmute(n);break;case"ghostShow":a.ghostShow(n);break;case"ghostHide":a.ghostHide(n);break;case"start":if(!o)throw"Method _start missing params";a.start(o,n);break;default:r.core.isSilentModeEnabled()}},MobileBridge.prototype=Object.create(PostMessageBridge.prototype),MobileBridge.prototype.constructor=MobileBridge,MobileBridge.prototype._init=function(){if(PostMessageBridge.prototype._init.call(this),"ios"===this.device)this._gameeWin=webkit.messageHandlers.callbackHandler;else{if("android"!==this.device)throw"Unknown device used in webkit bridge";this._gameeWin=_toDevice}window._triggerMessage=function(t){try{t=JSON.parse(t)}catch(e){throw"Couldn't parse message from native app: \n"+t+"\n"+e}r.core.isSilentModeEnabled(),this.dispatchEvent(new CustomEvent("message",{detail:t}))}.bind(window)},MobileBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),"android"===this.device&&(t=JSON.stringify(t)),this._gameeWin.postMessage(t,"*")}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){var t=this,e={};t.on=function(t,o,n){if(!(arguments.length<2||"string"!=typeof t||"function"!=typeof o)){var r=o.toString();void 0!==e[t]?void 0===e[t].callbacks[r]?e[t].callbacks[r]={cb:o,once:!!n}:"boolean"==typeof n&&(e[t].callbacks[r].once=n):(e[t]={callbacks:{}},e[t].callbacks[r]={cb:o,once:!!n})}},t.once=function(e,o){t.on(e,o,!0)},t.off=function(t,o){if("string"==typeof t&&void 0!==e[t])if("function"==typeof o){var n=o.toString(),r=e[t].callbacks[n];void 0!==r&&delete e[t].callbacks[n]}else delete e[t]},t.trigger=function(o,n){if("string"==typeof o&&void 0!==e[o])for(var r in e[o].callbacks){var a=e[o].callbacks[r];"function"==typeof a.cb&&a.cb(n),"boolean"==typeof a.once&&!0===a.once&&t.off(o,a.cb)}}};e.Bullet=new n},function(t,e,o){"use strict";function Button(t,e){var o=this;r.call(this),this._pressed=!0,this.key=t,this.keyCode=e,this.on("keydown",function(){o._pressed=!0}),this.on("keyup",function(){o._pressed=!1})}function Controller(){var t=this;r.call(this),this.buttons={},this.buttonAlias={},this.on("$keydown",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keydown",e)}),this.on("$keyup",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keyup",e)}),this.on("keydown",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keydown")}),this.on("keyup",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keyup")})}function OneButtonController(){Controller.call(this),this.addButton(new Button("button",32))}function TwoButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39))}function TwoActionButtonsController(){Controller.call(this),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function FiveButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32))}function SixButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function TwoArrowsOneButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function TwoArrowsTwoButtonsController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourArrowController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40))}function TouchController(){var t=this;Controller.call(this),this.on("$touchstart",function(e){t.trigger("touchstart",e)}),this.on("$touchend",function(e){t.trigger("touchend",e)}),this.on("$touchmove",function(e){t.trigger("touchmove",e)}),this.on("$touchleave",function(e){t.trigger("touchleave",e)}),this.on("$touchcancel",function(e){t.trigger("touchcancel",e)})}function JoystickController(){var t=this;Controller.call(this),this.x=0,this.y=0,this.on("$change",function(e){t.x=e.position.x,t.y=e.position.y,t.trigger("change",e)})}function JoystickButtonController(){JoystickController.call(this),this.addButton(new Button("button",32))}Object.defineProperty(e,"__esModule",{value:!0}),e.BulletClass=void 0,e.Button=Button,e.Controller=Controller,e.OneButtonController=OneButtonController,e.TwoButtonController=TwoButtonController,e.TwoActionButtonsController=TwoActionButtonsController,e.FourButtonController=FourButtonController,e.FiveButtonController=FiveButtonController,e.SixButtonController=SixButtonController,e.TwoArrowsOneButtonController=TwoArrowsOneButtonController,e.TwoArrowsTwoButtonsController=TwoArrowsTwoButtonsController,e.FourArrowController=FourArrowController,e.TouchController=TouchController,e.JoystickController=JoystickController,e.JoystickButtonController=JoystickButtonController;var n=o(4),r=e.BulletClass=n.Bullet.constructor;Button.prototype=Object.create(r.constructor.prototype),Button.constructor=Button,Button.prototype.isDown=function(){return this._pressed},Controller.prototype=Object.create(r.constructor.prototype),Controller.constructor=Controller,Controller.prototype.addButton=function(t){this.buttons[t.key]=t},Controller.prototype.enableKeyboard=function(t){var e,o,n={},r=this;for(e in this.buttons)o=this.buttons[e],o.keyCode&&(n[o.keyCode]=o);t._keydown(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keydown",{button:e.key}))}),t._keyup(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keyup",{button:e.key}))})},Controller.prototype.remapButton=function(t,e){if(e.name&&(e=e.name),!this.buttons[t])throw Error("Button "+t+" was not found in controller");this.buttonAlias[t]=e.name,this.buttons[e.name]=this.buttons[t],delete this.buttons[t]},OneButtonController.prototype=Object.create(Controller.prototype),OneButtonController.prototype.constructor=OneButtonController,TwoButtonController.prototype=Object.create(Controller.prototype),TwoButtonController.prototype.constructor=TwoButtonController,TwoActionButtonsController.prototype=Object.create(Controller.prototype),TwoActionButtonsController.prototype.constructor=TwoActionButtonsController,FourButtonController.prototype=Object.create(Controller.prototype),FourButtonController.prototype.constructor=FourButtonController,FiveButtonController.prototype=Object.create(Controller.prototype),FiveButtonController.prototype.constructor=FiveButtonController,SixButtonController.prototype=Object.create(Controller.prototype),SixButtonController.prototype.constructor=SixButtonController,TwoArrowsOneButtonController.prototype=Object.create(Controller.prototype),TwoArrowsOneButtonController.prototype.constructor=TwoArrowsOneButtonController,TwoArrowsTwoButtonsController.prototype=Object.create(Controller.prototype),TwoArrowsTwoButtonsController.prototype.constructor=TwoArrowsTwoButtonsController,FourArrowController.prototype=Object.create(Controller.prototype),FourArrowController.prototype.constructor=FourArrowController,TouchController.prototype=Object.create(TouchController.prototype),TouchController.prototype.constructor=TouchController,JoystickController.prototype=Object.create(Controller.prototype),JoystickController.prototype.constructor=JoystickController,JoystickButtonController.prototype=Object.create(JoystickController.prototype),JoystickButtonController.prototype.constructor=JoystickButtonController},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.gamee=void 0,o(0);var n=o(2),r=o(1),a=o(3),i=e.gamee=void 0,u=function(){var t,o="web",r=navigator.userAgent.toLowerCase();switch(/iphone|ipod|ipad/.test(r)?o=window.self!==window.top?"web":"ios":/gamee\/[0-9\.]+$/.test(r)?o="android":window.parent?o="web":window.parent&&window.parent.gameeSimulator&&(o="web"),e.gamee=i=new n.Gamee(o),window.gamee=i,o){case"web":window.parent,window,t=new a.PostMessageBridge(window.parent);break;case"ios":t=new a.MobileBridge("ios");break;case"android":t=new a.MobileBridge("android");break;default:throw"Can't identify the platform"}return t}();r.core.PlatformAPI=a.PlatformAPI,r.core.native=u,a.PlatformAPI.emitter=i.emitter},function(t,e){var o;o=function(){return this}();try{o=o||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(o=window)}t.exports=o}])}); +/*! @preserve build time 2019-10-15 10:05:46 */ +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,function(){return function(t){function __webpack_require__(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,__webpack_require__),n.l=!0,n.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.i=function(t){return t},__webpack_require__.d=function(t,e,o){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=6)}([function(t,e,o){"use strict";function CustomEmitter(){function delegate(e){this[e]=t[e].bind(t)}var t=document.createDocumentFragment();["addEventListener","dispatchEvent","removeEventListener"].forEach(delegate,this)}function wrapKeyEvent(t){return function(e){return e&&e.keyCode||(e||(e=window.event),e.which&&(e.keyCode=e.which)),t(e)}}Object.defineProperty(e,"__esModule",{value:!0}),e.CustomEmitter=CustomEmitter,e.wrapKeyEvent=wrapKeyEvent,function(){try{var t=new window.CustomEvent("test");if(t.preventDefault(),!0!==t.defaultPrevented)throw new Error("Could not prevent default")}catch(t){var e=function(t,e){var o,n;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},o=document.createEvent("CustomEvent"),o.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n=o.preventDefault,o.preventDefault=function(){n.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},o};e.prototype=window.Event.prototype,window.CustomEvent=e}}(),function(t,e){function docHijack(t){var o=e[t];e[t]=function(t){return addListen(o(t))}}function addEvent(e,o,n){return(n=this).attachEvent("on"+e,function(e){e=e||t.event,e.preventDefault=e.preventDefault||function(){e.returnValue=!1},e.stopPropagation=e.stopPropagation||function(){e.cancelBubble=!0},o.call(n,e)})}function addListen(t,e){if(e=t.length)for(;e--;)t[e].addEventListener=addEvent;else t.addEventListener=addEvent;return t}t.addEventListener||(addListen([e,t]),"Element"in t?t.Element.prototype.addEventListener=addEvent:(e.attachEvent("onreadystatechange",function(){addListen(e.all)}),docHijack("getElementsByTagName"),docHijack("getElementById"),docHijack("createElement"),addListen(e.all)))}(window,document)},function(t,e,o){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.validateDataType=e.DataTypeException=e.core=void 0;var n="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},r=o(5),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e.default=t,e}(r),i=o(0);!function(){var t=function(t){var e=new t;if("suspended"===e.state){var o=function resume(){if(/(iPhone|iPad)/i.test(navigator.userAgent)){var t=e.createBuffer(1,1,44100),o=e.createBufferSource();o.buffer=t,o.connect(e.destination),o.start(0),o.disconnect()}e.resume(),setTimeout(function(){"running"===e.state&&document.body.removeEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),resume,!1)},0)};document.body.addEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),o,!1)}return e};try{void 0!==window.AudioContext?window.AudioContext=t.bind(null,window.AudioContext):"undefined"!=typeof webkitAudioContext&&(window.webkitAudioContext=t.bind(null,window.webkitAudioContext))}catch(t){setTimeout(function(){throw t},0)}}();var u=(e.core=function(){function createController(t,e){var o,n;if(!u[t])throw new Error("Unsupported controller type, "+t);if(e=e||{},n=new u[t],e.enableKeyboard&&n.enableKeyboard(r),e.buttons)for(o in e.buttons)n.remapButton(o,e.buttons[o]);return n}var e=function(){},o={},n={VERSION:"2.4.1",CAPABILITIES:["ghostMode","saveState","replay","socialData","rewardedAds","coins","logEvents","playerData","share","gems"],variant:0,soundUnlocked:!1,onReady:e,onGameStart:e},r={};r.gameeInit=function(t,e,a,i){var u=(arguments.length>4&&void 0!==arguments[4]&&arguments[4],!0),s={};if(void 0!==a&&Array.isArray(a))for(var l=0;l100)throw"Percentage passed to gameLoadingProgress out of bounds or not a number.";e>t&&(t=e,this.native.createRequest("gameLoadingProgress",{percentage:e}))}}(),r.gameReady=function(){this.native.createRequest("gameReady")},r.updateScore=function(t,e){if("number"!=typeof t)throw"Score passed to updateScore is not a number.";var o={score:parseInt(t,10)};e&&(o.ghostSign=!0),this.native.createRequest("updateScore",o)},r.gameOver=function(t,e,o){o=void 0!==o&&o;var n={};if(t){if(t.hasOwnProperty("variant")||(t.variant=""),!t.hasOwnProperty("data"))throw"Replay data must have `data` property";n.replayData=t}n.hideOverlay=o,e&&(n.state=e),r.native.createRequest("gameOver",n)},r.gameSave=function(t,e){if(!o.capabilities.saveState)throw"Save State not supported, you must add the capability on gamee.Init";r.native.createRequest("saveState",{state:t,share:e})},r.requestSocial=function(t,e){if(!o.capabilities.socialData)throw"Social Data not supported, you must add the capability on gamee.Init";this.native.createRequest("requestSocial",e,function(e){t(null,e)})},r.logEvent=function(t,e){if(!o.capabilities.logEvents)throw"Log Events not supported, you must add the capability on gamee.Init";this.native.createRequest("logEvent",{eventName:t,eventValue:e},function(t){if(t)throw t})},r.requestBattleData=function(t){this.native.createRequest("requestBattleData",void 0,function(e){t(null,e)})},r.requestPlayerReplay=function(t,e){if(!o.capabilities.replay)throw"Replays not supported, you must add the capability on gamee.Init";this.native.createRequest("requestPlayerReplay",{userID:t},function(t){e(null,t)})},r.requestPlayerSaveState=function(t,e){this.native.createRequest("requestPlayerSaveState",{userID:t},function(t){e(null,t)})},r.playerEnteredToGameRoom=function(){this.native.createRequest("playerEnteredToGameRoom")},r.playerLeftGameRoom=function(){this.native.createRequest("playerLeftGameRoom")},r.purchaseItemWithCoins=function(t,e,n){if(!o.capabilities.coins)throw"Coins purchases not supported, you must add the capability on gamee.Init";if(t){["coinsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase Options must have `"+e+"` property"})}this.isSilentModeEnabled();var r="purchaseItemWithCoins";void 0!==n&&!0===n&&(r="purchaseItem"),this.native.createRequest(r,t,function(t){e(null,t)})},r.purchaseItemWithGems=function(t,e){if(!o.capabilities.gems)throw"Gems purchases not supported, you must add the capability on gamee.Init";if(t){["gemsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("purchaseItemWithGems",t,function(t){e(null,t)})},r.share=function(t,e){if(!o.capabilities.share)throw"Share option not supported, you must add the capability on gamee.Init";if(t){["destination"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Share Options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("share",t,function(t){e(null,t)})},r.loadRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("loadRewardedVideo",function(e){t(null,e)})},r.showRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("showRewardedVideo",function(e){t(null,e)})},r.showSubscribeDialog=function(t){this.native.createRequest("showSubscribeDialog",function(e){t(null,e)})},r.requestPlayerData=function(t,e){if(!o.capabilities.playerData)throw"Player Data not supported, you must add the capability on gamee.Init";var n=void 0;e&&(n={userID:e}),this.native.createRequest("requestPlayerData",n,function(e){t(null,e)})},r.startSignal=function(t){var e;return t.replay&&!o.capabilities.replay&&(e="Game doesn't support replay. "),t.ghostMode&&!o.capabilities.ghostMode&&(e="Game doesn't support ghost Mode. "),e},r.controller={mainController:null,requestController:function(t,e){if("FullScreen"===t)return null;var o=createController(t,e);return this.mainController=o,o},additionalController:function(t,e){var o=createController(t,e);return gameeNative.additionalController(t),o},trigger:function(){if(!this.mainController)throw new Error("No controller present");this.mainController.trigger.apply(this.mainController,arguments)}},r._keydown=function(e){t.addEventListener("keydown",(0,i.wrapKeyEvent)(e))},r._keyup=function(e){t.addEventListener("keyup",(0,i.wrapKeyEvent)(e))};var u={OneButton:a.OneButtonController,TwoButtons:a.TwoButtonController,FourButtons:a.FourButtonController,FiveButtons:a.FiveButtonController,SixButtons:a.SixButtonController,FourArrows:a.FourArrowController,Touch:a.TouchController,Joystick:a.JoystickController,JoystickWithButton:a.JoystickButtonController,TwoArrowsTwoButtons:a.TwoArrowsTwoButtonsController,TwoArrowsOneButton:a.TwoArrowsOneButtonController,TwoActionButtons:a.TwoActionButtonsController};return r.registerPlatform=function(t){},r.isSilentModeEnabled=function(){return o.silentMode},r}(),e.DataTypeException=function(t,e,o,n){this.expected=t,this.present=e,this.method=n,this.argument=o,this.message="Invalid data type in method "+this.method+", argument "+this.argument+" is expected to be "+this.expected+", but found "+this.present});e.validateDataType=function(t,e,o,r){switch(e){case"array":if(!Array.isArray(t))throw new u(e,void 0===t?"undefined":n(t),o,r);break;default:if((void 0===t?"undefined":n(t))!==e)throw new u(e,void 0===t?"undefined":n(t),o,r)}}}).call(e,o(7))},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Gamee=e.GameeEmitter=void 0;var n=o(1),r=o(0),a=e.GameeEmitter=function(){r.CustomEmitter.call(this)};(e.Gamee=function(t){this.emitter=new a,this._platform=t}).prototype=function(){var t=function(t){if(t)throw"Error "+t.toString()};return{_controller:n.core.controller,gameInit:function(t,e,o,r){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];(0,n.validateDataType)(t,"string","controllType","gamee.updateScore"),(0,n.validateDataType)(e,"object","controllOpts","gamee.gameInit"),(0,n.validateDataType)(o,"array","capabilities","gamee.gameInit"),(0,n.validateDataType)(r,"function","cb","gamee.gameInit"),(0,n.validateDataType)(a,"boolean","silentMode","gamee.gameInit"),n.core.gameeInit(t,e,o,r,a)},gameLoadingProgress:function(e,o){(0,n.validateDataType)(e,"number","percentage","gamee.gameLoadingProgress"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameLoadingProgress"),n.core.gameLoadingProgress(e),o(null)},gameReady:function(e){e=e||t,(0,n.validateDataType)(e,"function","opt_cb","gamee.gameReady"),n.core.gameReady(),e(null)},gameSave:function(e,o,r){(0,n.validateDataType)(e,"string","data","gamee.gameSave"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_share","gamee.gameSave"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.gameSave"),n.core.gameSave(e,!1),r(null)},getPlatform:function(){return this._platform},updateScore:function(e,o,r){(0,n.validateDataType)(e,"number","score","gamee.updateScore"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_ghostSign","gamee.updateScore"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.updateScore"),n.core.updateScore(e,o),r(null)},gameOver:function(e,o,r,a){"function"==typeof e?o=e:void 0!==e&&(0,n.validateDataType)(e,"object","opt_replayData","gamee.gameOver"),void 0!==a&&(0,n.validateDataType)(a,"boolean","opt_hideOverlay","gamee.gameOver"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameOver"),n.core.gameOver(e,r,a),o(null)},requestSocial:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestSocial"),n.core.requestSocial(function(e,o){var n=o.hasOwnProperty("socialData")?o:{socialData:o};t(null,n)},e)},logEvent:function(t,e){(0,n.validateDataType)(t,"string","eventName","gamee.logEvent"),!t||t.length>24||((0,n.validateDataType)(e,"string","eventValue","gamee.logEvent"),!e||e.length>160||n.core.logEvent(t,e))},requestBattleData:function(t){(0,n.validateDataType)(t,"function","cb","gamee.requestBattleData"),n.core.requestBattleData(t)},requestPlayerReplay:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerReplay"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerReplay"),n.core.requestPlayerReplay(t,e)},requestPlayerSaveState:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerSaveState"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerSaveState"),n.core.requestPlayerSaveState(t,e)},playerEnteredToGameRoom:function(){n.core.playerEnteredToGameRoom()},playerLeftGameRoom:function(){n.core.playerLeftGameRoom()},purchaseItem:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItem"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItem"),n.core.purchaseItemWithCoins(t,e,!0)},purchaseItemWithCoins:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithCoins"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithCoins"),n.core.purchaseItemWithCoins(t,e)},purchaseItemWithGems:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithGems"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithGems"),n.core.purchaseItemWithGems(t,e)},share:function(t,e){(0,n.validateDataType)(t,"object","shareDetails","gamee.share"),(0,n.validateDataType)(e,"function","cb","gamee.share"),n.core.share(t,e)},loadRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.loadRewardedVideo"),n.core.loadRewardedVideo(t)},showRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showRewardedVideo"),n.core.showRewardedVideo(t)},showSubscribeDialog:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showSubscribeDialog"),n.core.showSubscribeDialog(t)},requestPlayerData:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestPlayerData"),void 0!==e&&(0,n.validateDataType)(e,"number","userId","gamee.requestPlayerData"),n.core.requestPlayerData(t,e)}}}()},function(t,e,o){"use strict";function PlatformBridge(){this.requests={},this.platform="",this._init()}function PostMessageBridge(t){this._gameeWin=t,PlatformBridge.call(this),this.platform="web"}function MobileBridge(t){this.device=t,PostMessageBridge.call(this),this.platform="mobile"}Object.defineProperty(e,"__esModule",{value:!0}),e.PlatformAPI=void 0;var n="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};e.PlatformBridge=PlatformBridge,e.PostMessageBridge=PostMessageBridge,e.MobileBridge=MobileBridge;var r=o(1),a=e.PlatformAPI={emitter:null,pause:function(t){var e=new CustomEvent("pause",{detail:{callback:t}});this.emitter.dispatchEvent(e)},resume:function(t){var e=new CustomEvent("resume",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostShow:function(t){var e=new CustomEvent("ghostShow",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostHide:function(t){var e=new CustomEvent("ghostHide",{detail:{callback:t}});this.emitter.dispatchEvent(e)},mute:function(t){var e=new CustomEvent("mute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},unmute:function(t){var e=new CustomEvent("unmute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},start:function(t,e){var o=new CustomEvent("start",{detail:{callback:e}}),n=r.core.startSignal(t);if(n)return void e(n);t.replay&&(o.detail.opt_replay=!0),t.ghostMode&&(o.detail.opt_ghostMode=!0),t.resetState&&(o.detail.opt_resetState=!0),t.replayData&&(o.detail.replayData=t.replayData),this.emitter.dispatchEvent(o)}};PlatformBridge.prototype={instCount:0,_init:function(){},createRequest:function(t,e,o){if(this.validateMethod(t)){"function"==typeof e&&(o=e,e=void 0);var n=this.instCount++;void 0!==o&&(this.requests[n]=o);var r={request:{method:t,messageId:n,data:null}};this.doCall(r,e)}},validateMethod:function(t){return"gameLoadingProgress"!==t},doCall:function(t,e){throw"Not implemented"},_callback:function(t,e){var o=this.requests[t];delete this.requests[t],o&&o(e)},doResponse:function(t,e){throw"Not implemented"}},PostMessageBridge.prototype=Object.create(PlatformBridge.prototype),PostMessageBridge.prototype.constructor=PostMessageBridge,PostMessageBridge.prototype._init=function(){window.addEventListener("message",function(t){var e;if("object"===n(t.detail)&&null!==typeof t.detail)e=t.detail;else{if("object"!==n(t.data))return;e=t.data}if(r.core.isSilentModeEnabled(),e.request&&e.request.method&&void 0!==e.request.messageId)this._resolveAPICall(e.request.method,e.request.messageId,e.request.data);else if(e.response&&void 0!==e.response.messageId){if(e.error)throw e.error;this._callback(e.response.messageId,e.response.data)}}.bind(this),!1)},PostMessageBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),this._gameeWin.postMessage(t,"*")},PostMessageBridge.prototype.doResponse=function(t,e){var o={version:this.version,response:{messageId:t}};e&&(o.data=e),this._gameeWin.postMessage(o,"*")},PostMessageBridge.prototype._resolveAPICall=function(t,e,o){var n=this.doResponse.bind(this,e);switch(t){case"pause":a.pause(n);break;case"resume":a.resume(n);break;case"mute":a.mute(n);break;case"unmute":a.unmute(n);break;case"ghostShow":a.ghostShow(n);break;case"ghostHide":a.ghostHide(n);break;case"start":if(!o)throw"Method _start missing params";a.start(o,n);break;default:r.core.isSilentModeEnabled()}},MobileBridge.prototype=Object.create(PostMessageBridge.prototype),MobileBridge.prototype.constructor=MobileBridge,MobileBridge.prototype._init=function(){if(PostMessageBridge.prototype._init.call(this),"ios"===this.device)this._gameeWin=webkit.messageHandlers.callbackHandler;else{if("android"!==this.device)throw"Unknown device used in webkit bridge";this._gameeWin=_toDevice}window._triggerMessage=function(t){try{t=JSON.parse(t)}catch(e){throw"Couldn't parse message from native app: \n"+t+"\n"+e}r.core.isSilentModeEnabled(),this.dispatchEvent(new CustomEvent("message",{detail:t}))}.bind(window)},MobileBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),"android"===this.device&&(t=JSON.stringify(t)),this._gameeWin.postMessage(t,"*")}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){var t=this,e={};t.on=function(t,o,n){if(!(arguments.length<2||"string"!=typeof t||"function"!=typeof o)){var r=o.toString();void 0!==e[t]?void 0===e[t].callbacks[r]?e[t].callbacks[r]={cb:o,once:!!n}:"boolean"==typeof n&&(e[t].callbacks[r].once=n):(e[t]={callbacks:{}},e[t].callbacks[r]={cb:o,once:!!n})}},t.once=function(e,o){t.on(e,o,!0)},t.off=function(t,o){if("string"==typeof t&&void 0!==e[t])if("function"==typeof o){var n=o.toString(),r=e[t].callbacks[n];void 0!==r&&delete e[t].callbacks[n]}else delete e[t]},t.trigger=function(o,n){if("string"==typeof o&&void 0!==e[o])for(var r in e[o].callbacks){var a=e[o].callbacks[r];"function"==typeof a.cb&&a.cb(n),"boolean"==typeof a.once&&!0===a.once&&t.off(o,a.cb)}}};e.Bullet=new n},function(t,e,o){"use strict";function Button(t,e){var o=this;r.call(this),this._pressed=!0,this.key=t,this.keyCode=e,this.on("keydown",function(){o._pressed=!0}),this.on("keyup",function(){o._pressed=!1})}function Controller(){var t=this;r.call(this),this.buttons={},this.buttonAlias={},this.on("$keydown",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keydown",e)}),this.on("$keyup",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keyup",e)}),this.on("keydown",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keydown")}),this.on("keyup",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keyup")})}function OneButtonController(){Controller.call(this),this.addButton(new Button("button",32))}function TwoButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39))}function TwoActionButtonsController(){Controller.call(this),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function FiveButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32))}function SixButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function TwoArrowsOneButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function TwoArrowsTwoButtonsController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourArrowController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40))}function TouchController(){var t=this;Controller.call(this),this.on("$touchstart",function(e){t.trigger("touchstart",e)}),this.on("$touchend",function(e){t.trigger("touchend",e)}),this.on("$touchmove",function(e){t.trigger("touchmove",e)}),this.on("$touchleave",function(e){t.trigger("touchleave",e)}),this.on("$touchcancel",function(e){t.trigger("touchcancel",e)})}function JoystickController(){var t=this;Controller.call(this),this.x=0,this.y=0,this.on("$change",function(e){t.x=e.position.x,t.y=e.position.y,t.trigger("change",e)})}function JoystickButtonController(){JoystickController.call(this),this.addButton(new Button("button",32))}Object.defineProperty(e,"__esModule",{value:!0}),e.BulletClass=void 0,e.Button=Button,e.Controller=Controller,e.OneButtonController=OneButtonController,e.TwoButtonController=TwoButtonController,e.TwoActionButtonsController=TwoActionButtonsController,e.FourButtonController=FourButtonController,e.FiveButtonController=FiveButtonController,e.SixButtonController=SixButtonController,e.TwoArrowsOneButtonController=TwoArrowsOneButtonController,e.TwoArrowsTwoButtonsController=TwoArrowsTwoButtonsController,e.FourArrowController=FourArrowController,e.TouchController=TouchController,e.JoystickController=JoystickController,e.JoystickButtonController=JoystickButtonController;var n=o(4),r=e.BulletClass=n.Bullet.constructor;Button.prototype=Object.create(r.constructor.prototype),Button.constructor=Button,Button.prototype.isDown=function(){return this._pressed},Controller.prototype=Object.create(r.constructor.prototype),Controller.constructor=Controller,Controller.prototype.addButton=function(t){this.buttons[t.key]=t},Controller.prototype.enableKeyboard=function(t){var e,o,n={},r=this;for(e in this.buttons)o=this.buttons[e],o.keyCode&&(n[o.keyCode]=o);t._keydown(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keydown",{button:e.key}))}),t._keyup(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keyup",{button:e.key}))})},Controller.prototype.remapButton=function(t,e){if(e.name&&(e=e.name),!this.buttons[t])throw Error("Button "+t+" was not found in controller");this.buttonAlias[t]=e.name,this.buttons[e.name]=this.buttons[t],delete this.buttons[t]},OneButtonController.prototype=Object.create(Controller.prototype),OneButtonController.prototype.constructor=OneButtonController,TwoButtonController.prototype=Object.create(Controller.prototype),TwoButtonController.prototype.constructor=TwoButtonController,TwoActionButtonsController.prototype=Object.create(Controller.prototype),TwoActionButtonsController.prototype.constructor=TwoActionButtonsController,FourButtonController.prototype=Object.create(Controller.prototype),FourButtonController.prototype.constructor=FourButtonController,FiveButtonController.prototype=Object.create(Controller.prototype),FiveButtonController.prototype.constructor=FiveButtonController,SixButtonController.prototype=Object.create(Controller.prototype),SixButtonController.prototype.constructor=SixButtonController,TwoArrowsOneButtonController.prototype=Object.create(Controller.prototype),TwoArrowsOneButtonController.prototype.constructor=TwoArrowsOneButtonController,TwoArrowsTwoButtonsController.prototype=Object.create(Controller.prototype),TwoArrowsTwoButtonsController.prototype.constructor=TwoArrowsTwoButtonsController,FourArrowController.prototype=Object.create(Controller.prototype),FourArrowController.prototype.constructor=FourArrowController,TouchController.prototype=Object.create(TouchController.prototype),TouchController.prototype.constructor=TouchController,JoystickController.prototype=Object.create(Controller.prototype),JoystickController.prototype.constructor=JoystickController,JoystickButtonController.prototype=Object.create(JoystickController.prototype),JoystickButtonController.prototype.constructor=JoystickButtonController},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.gamee=void 0,o(0);var n=o(2),r=o(1),a=o(3),i=e.gamee=void 0,u=function(){var t,o="web",r=navigator.userAgent.toLowerCase();switch(/iphone|ipod|ipad/.test(r)?o=window.self!==window.top?"web":"ios":/gamee\/[0-9\.]+$/.test(r)?o="android":window.parent?o="web":window.parent&&window.parent.gameeSimulator&&(o="web"),e.gamee=i=new n.Gamee(o),window.gamee=i,o){case"web":window.parent,window,t=new a.PostMessageBridge(window.parent);break;case"ios":t=new a.MobileBridge("ios");break;case"android":t=new a.MobileBridge("android");break;default:throw"Can't identify the platform"}return t}();r.core.PlatformAPI=a.PlatformAPI,r.core.native=u,a.PlatformAPI.emitter=i.emitter},function(t,e){var o;o=function(){return this}();try{o=o||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(o=window)}t.exports=o}])}); //# sourceMappingURL=gamee-js.min.js.map \ No newline at end of file diff --git a/gamee/dist/gamee-js.min.js.map b/gamee/dist/gamee-js.min.js.map index c381e14..1672edd 100644 --- a/gamee/dist/gamee-js.min.js.map +++ b/gamee/dist/gamee-js.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6","webpack:///gamee-js.min.js","webpack:///webpack/bootstrap 2b97e13ed7e1fd3e15e5?ee2a","webpack:///./gamee/libs/shims.js?26b9","webpack:///./gamee/src/core.js?6b70","webpack:///./gamee/src/gameeAPI.js?7205","webpack:///./gamee/src/platform_bridge.js?848f","webpack:///./gamee/libs/bullet.js?d693","webpack:///./gamee/src/game_controllers.js?1af2","webpack:///./gamee/src/index.js?b323","webpack:///(webpack)/buildin/global.js?3698"],"names":["root","factory","exports","module","define","amd","a","i","this","modules","__webpack_require__","moduleId","installedModules","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","CustomEmitter","delegate","method","eventTarget","bind","document","createDocumentFragment","forEach","wrapKeyEvent","fn","ev","keyCode","window","event","which","ce","CustomEvent","preventDefault","defaultPrevented","Error","e","params","evt","origPrevent","bubbles","cancelable","detail","undefined","createEvent","initCustomEvent","Event","win","doc","docHijack","old","v","addListen","addEvent","on","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","length","addEventListener","Element","all","global","validateDataType","DataTypeException","core","_typeof","Symbol","iterator","constructor","_game_controllers","controllers","newObj","key","default","_shims","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","createController","opts","btn","controller","controllerTypes","enableKeyboard","buttons","remapButton","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","allOk","arguments","cap","Array","isArray","indexOf","native","createRequest","version","responseData","error","platform","requestController","_bindKeyboardTriggers","err","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","playerEnterToGameRoom","playerExitGameRoom","purchaseItemWithCoins","options","oldMethod","coins","isSilentModeEnabled","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","showSubscribeDialog","requestPlayerData","playerData","startSignal","ghostMode","mainController","additionalController","gameeNative","apply","_keydown","_keyup","OneButton","OneButtonController","TwoButtons","TwoButtonController","FourButtons","FourButtonController","FiveButtons","FiveButtonController","SixButtons","SixButtonController","FourArrows","FourArrowController","Touch","TouchController","Joystick","JoystickController","JoystickWithButton","JoystickButtonController","TwoArrowsTwoButtons","TwoArrowsTwoButtonsController","TwoArrowsOneButton","TwoArrowsOneButtonController","TwoActionButtons","TwoActionButtonsController","registerPlatform","platformAPI","silentMode","expected","present","argument","message","testedInput","expectedType","originMethod","Gamee","GameeEmitter","_core","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","requests","_init","PostMessageBridge","endpoint","_gameeWin","MobileBridge","device","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","create","_resolveAPICall","response","postMessage","opt_data","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","JSON","parse","stringify","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","_pressed","Controller","buttonAlias","addButton","x","y","position","_bullet","isDown","gamee","keyCodes","oldName","newName","_gameeAPI","_platform_bridge","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","g","Function","eval"],"mappings":";CAAA,SAAAA,EAAAC,GACA,mBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,QACA,sBAAAG,gBAAAC,IACAD,UAAAH,OACA,CACA,GAAAK,GAAAL,GACA,QAAAM,KAAAD,IAAA,gBAAAJ,iBAAAF,GAAAO,GAAAD,EAAAC,KAECC,KAAA,WACD,MCCgB,UAAUC,GCP1B,QAAAC,qBAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAT,OAGA,IAAAC,GAAAS,EAAAD,IACAJ,EAAAI,EACAE,GAAA,EACAX,WAUA,OANAO,GAAAE,GAAAG,KAAAX,EAA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QAAUtS,OAAOsS,OAAOC,iBACtCJ,EAAe,OAGnBhV,EAjCOyU,MAiCPA,EAAQ,GAAAI,GAAAvF,MAAU0F,GAElBnS,OAAO4R,MAAQA,EAEPO,GACJ,IAAK,MACGnS,OAAOsS,OAAWtS,OAGtBkS,EAAiB,GAAAD,GAAAnE,kBAAsB9N,OAAOsS,OAC9C,MACJ,KAAK,MACDJ,EAAiB,GAAAD,GAAAhE,aAAiB,MAClC,MACJ,KAAK,UACDiE,EAAiB,GAAAD,GAAAhE,aAAiB,UAClC,MACJ,SACI,KAAM,8BAEd,MAAOiE,KAGXvF,GAAAnK,KAAK2L,YAAL8D,EAAA9D,YACAxB,EAAAnK,KAAK6D,OAAS6L,EAEdD,EAAA9D,YAAYvB,QAAUgF,EAAMhF,SRy6EtB,SAAUxP,EAAQD,GSh/ExB,GAAAqV,EAGAA,GAAA,WACA,MAAA/U,QAGA,KAEA+U,KAAAC,SAAA,qBAAAC,MAAA,QACC,MAAAlS,GAED,gBAAAR,UACAwS,EAAAxS,QAOA5C,EAAAD,QAAAqV","file":"gamee-js.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","/*! @preserve build time 2019-10-15 09:07:55 */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 6);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.CustomEmitter = CustomEmitter;\nexports.wrapKeyEvent = wrapKeyEvent;\n/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function CustomEvent(event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function get() {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return; //No need to polyfill\n\n\tfunction docHijack(p) {\n\t\tvar old = doc[p];doc[p] = function (v) {\n\t\t\treturn addListen(old(v));\n\t\t};\n\t}\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () {\n\t\t\t\te.returnValue = false;\n\t\t\t};\n\t\t\te.stopPropagation = e.stopPropagation || function () {\n\t\t\t\te.cancelBubble = true;\n\t\t\t};\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--) {\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t\t}\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent; //IE8\n\telse {\n\t\t\t//IE < 8\n\t\t\tdoc.attachEvent('onreadystatechange', function () {\n\t\t\t\taddListen(doc.all);\n\t\t\t}); //Make sure we also init at domReady\n\t\t\tdocHijack('getElementsByTagName');\n\t\t\tdocHijack('getElementById');\n\t\t\tdocHijack('createElement');\n\t\t\taddListen(doc.all);\n\t\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nfunction CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\"addEventListener\", \"dispatchEvent\", \"removeEventListener\"].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nfunction wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.validateDataType = exports.DataTypeException = exports.core = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _game_controllers = __webpack_require__(5);\n\nvar controllers = _interopRequireWildcard(_game_controllers);\n\nvar _shims = __webpack_require__(0);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function overloadedAudioContext(type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function resume() {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx;\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) {\n // throw error in async part\n setTimeout(function () {\n throw e;\n }, 0);\n }\n})();\n\n/**\n * @class core\n */\nvar core = exports.core = function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function noop() {};\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\", \"rewardedAds\", \"coins\", \"logEvents\", \"playerData\", \"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true,\n cap = {};\n if (capabilities !== undefined && Array.isArray(capabilities)) {\n for (var i = 0; i < capabilities.length; i++) {\n if (typeof capabilities[i] !== \"string\" || internals.CAPABILITIES.indexOf(capabilities[i]) === -1) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk) throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if (typeof percentage !== \"number\" || percentage < 0 || percentage > 100) throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n }();\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\") throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if (!cache.capabilities.saveState) throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb, numberOfPlayers) {\n\n if (!cache.capabilities.socialData) throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if (!cache.capabilities.logEvents) throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", { eventName: eventName, eventValue: eventValue }, function (error) {\n if (error) {\n throw error;\n }\n });\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if (!cache.capabilities.replay) throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnterToGameRoom = function () {\n this.native.createRequest('playerEnterToGameRoom');\n };\n\n core.playerExitGameRoom = function () {\n this.native.createRequest('playerExitGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if (!cache.capabilities.coins) throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if (!cache.capabilities.gems) throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if (!cache.capabilities.share) throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Share Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if (!cache.capabilities.playerData) throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n var options = undefined;\n if (userID) {\n options = { userID: userID };\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay) error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode) error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function requestController(type, opts) {\n if (type === \"FullScreen\") return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function additionalController(type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function trigger() {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n}();\n\nvar DataTypeException = exports.DataTypeException = function DataTypeException(expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = \"Invalid data type in method \" + this.method + \", argument \" + this.argument + \" is expected to be \" + this.expected + \", but found \" + this.present;\n};\n\nvar validateDataType = exports.validateDataType = function validateDataType(testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput)) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n break;\n\n default:\n if ((typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput)) !== expectedType) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Gamee = exports.GameeEmitter = undefined;\n\nvar _core = __webpack_require__(1);\n\nvar _shims = __webpack_require__(0);\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nvar GameeEmitter = exports.GameeEmitter = function GameeEmitter() {\n _shims.CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nvar Gamee = exports.Gamee = function Gamee(platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = function () {\n\n var cbError = function cbError(err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: _core.core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function gameInit(controllType, controllOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n (0, _core.validateDataType)(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n (0, _core.validateDataType)(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n (0, _core.validateDataType)(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.gameInit\");\n (0, _core.validateDataType)(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = _core.core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function gameLoadingProgress(percentage, opt_cb) {\n (0, _core.validateDataType)(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n _core.core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function gameReady(opt_cb) {\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n _core.core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function gameSave(data, opt_share, opt_cb) {\n var share = false,\n cb;\n (0, _core.validateDataType)(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function') opt_cb = opt_share;else if (typeof opt_share !== \"undefined\") (0, _core.validateDataType)(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n _core.core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function getPlatform() {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function updateScore(score, opt_ghostSign, opt_cb) {\n (0, _core.validateDataType)(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\") opt_cb = opt_ghostSign;else if (typeof opt_ghostSign !== \"undefined\") (0, _core.validateDataType)(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n _core.core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function gameOver(opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\") opt_cb = opt_replayData;else if (typeof opt_replayData !== \"undefined\") (0, _core.validateDataType)(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n (0, _core.validateDataType)(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n _core.core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function requestSocial(cb, numberOfPlayers) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = _core.core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function logEvent(eventName, eventValue) {\n\n (0, _core.validateDataType)(eventName, \"string\", \"eventName\", \"gamee.logEvent\");\n\n if (!eventName || eventName.length > 24) {\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return;\n }\n\n (0, _core.validateDataType)(eventValue, \"string\", \"eventValue\", \"gamee.logEvent\");\n\n if (!eventValue || eventValue.length > 160) {\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return;\n }\n\n _core.core.logEvent(eventName, eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function requestBattleData(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n _core.core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function requestPlayerReplay(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n _core.core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function requestPlayerSaveState(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n _core.core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnterToGameRoom\n * @member of Gamee\n */\n playerEnterToGameRoom: function playerEnterToGameRoom() {\n _core.core.playerEnterToGameRoom();\n },\n\n /*\n * playerExitGameRoom\n * @member of Gamee\n */\n playerExitGameRoom: function playerExitGameRoom() {\n _core.core.playerExitGameRoom();\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function purchaseItem(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItem\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItem\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb, true);\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function purchaseItemWithCoins(purchaseDetails, cb) {\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithCoins\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithCoins\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb);\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function purchaseItemWithGems(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithGems\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithGems\");\n\n _core.core.purchaseItemWithGems(purchaseDetails, cb);\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function share(shareDetails, cb) {\n (0, _core.validateDataType)(shareDetails, \"object\", \"shareDetails\", \"gamee.share\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.share\");\n\n _core.core.share(shareDetails, cb);\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function loadRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.loadRewardedVideo\");\n _core.core.loadRewardedVideo(cb);\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function showRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showRewardedVideo\");\n _core.core.showRewardedVideo(cb);\n },\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function showSubscribeDialog(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showSubscribeDialog\");\n _core.core.showSubscribeDialog(cb);\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function requestPlayerData(cb, userID) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerData\");\n if (userID !== undefined) {\n (0, _core.validateDataType)(userID, \"number\", \"userId\", \"gamee.requestPlayerData\");\n }\n _core.core.requestPlayerData(cb, userID);\n }\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n}();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.PlatformAPI = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.PlatformBridge = PlatformBridge;\nexports.PostMessageBridge = PostMessageBridge;\nexports.MobileBridge = MobileBridge;\n\nvar _core = __webpack_require__(1);\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nvar PlatformAPI = exports.PlatformAPI = {\n\temitter: null,\n\tpause: function pause(cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function resume(cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function ghostShow(cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function ghostHide(cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function mute(cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function unmute(cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function start(data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = _core.core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay) event.detail.opt_replay = true;\n\t\tif (data.ghostMode) event.detail.opt_ghostMode = true;\n\t\tif (data.resetState) event.detail.opt_resetState = true;\n\t\tif (data.replayData) {\n\t\t\tevent.detail.replayData = data.replayData;\n\t\t}\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n/**\n * @class PlatformBridge\n *\n */\nfunction PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function _init() {},\n\tcreateRequest: function createRequest(method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method)) return;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function validateMethod(method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n * @abstract\n */\n\tdoCall: function doCall(preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function _callback(id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb) cb(responseData);\n\t},\n\t/**\n * @abstract\n */\n\tdoResponse: function doResponse(preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t}\n};\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nfunction PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (_typeof(ev.detail) === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (_typeof(ev.data) === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4) + ' data');\n\t\t}\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\t\tif (data.error) throw data.error;\n\t\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData) preparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\t\tconsole.error(\"Unknown method call\");\n\t\t\t}\n\t}\n};\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nfunction MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4));\n\t\t}\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar BulletClass = function BulletClass() {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 || typeof event !== \"string\" || typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n } else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n } else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n } else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n};\n\nvar Bullet = exports.Bullet = new BulletClass();\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.BulletClass = undefined;\nexports.Button = Button;\nexports.Controller = Controller;\nexports.OneButtonController = OneButtonController;\nexports.TwoButtonController = TwoButtonController;\nexports.TwoActionButtonsController = TwoActionButtonsController;\nexports.FourButtonController = FourButtonController;\nexports.FiveButtonController = FiveButtonController;\nexports.SixButtonController = SixButtonController;\nexports.TwoArrowsOneButtonController = TwoArrowsOneButtonController;\nexports.TwoArrowsTwoButtonsController = TwoArrowsTwoButtonsController;\nexports.FourArrowController = FourArrowController;\nexports.TouchController = TouchController;\nexports.JoystickController = JoystickController;\nexports.JoystickButtonController = JoystickButtonController;\n\nvar _bullet = __webpack_require__(4);\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nvar BulletClass = exports.BulletClass = _bullet.Bullet.constructor;\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nfunction Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nfunction Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key,\n\t button,\n\t keyCodes = {},\n\t self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nfunction OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nfunction TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nfunction TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nfunction FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nfunction FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nfunction SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nfunction TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nfunction TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nfunction FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nfunction TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nfunction JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nfunction JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.gamee = undefined;\n\n__webpack_require__(0);\n\nvar _gameeAPI = __webpack_require__(2);\n\nvar _core = __webpack_require__(1);\n\nvar _platform_bridge = __webpack_require__(3);\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nvar gamee = exports.gamee = undefined;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = function () {\n\n var platformBridge,\n platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) {\n // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) {\n // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) {\n // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) {\n // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n exports.gamee = gamee = new _gameeAPI.Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new _platform_bridge.PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new _platform_bridge.MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new _platform_bridge.MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n}();\n\n_core.core.PlatformAPI = _platform_bridge.PlatformAPI;\n_core.core.native = platformBridge;\n\n_platform_bridge.PlatformAPI.emitter = gamee.emitter;\n\nfunction loadScript(url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\nvar g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// gamee-js.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 2b97e13ed7e1fd3e15e5","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnterToGameRoom = function () {\n this.native.createRequest('playerEnterToGameRoom');\n };\n\n core.playerExitGameRoom = function () {\n this.native.createRequest('playerExitGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnterToGameRoom\n * @member of Gamee\n */\n playerEnterToGameRoom: function () {\n core.playerEnterToGameRoom()\n },\n\n /*\n * playerExitGameRoom\n * @member of Gamee\n */\n playerExitGameRoom: function () {\n core.playerExitGameRoom()\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function (cb){\n validateDataType(cb,\"function\",\"cb\",\"gamee.showSubscribeDialog\");\n core.showSubscribeDialog(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6","webpack:///gamee-js.min.js","webpack:///webpack/bootstrap e3344513ac420d153d79?1c4f","webpack:///./gamee/libs/shims.js?26b9","webpack:///./gamee/src/core.js?6b70","webpack:///./gamee/src/gameeAPI.js?7205","webpack:///./gamee/src/platform_bridge.js?848f","webpack:///./gamee/libs/bullet.js?d693","webpack:///./gamee/src/game_controllers.js?1af2","webpack:///./gamee/src/index.js?b323","webpack:///(webpack)/buildin/global.js?3698"],"names":["root","factory","exports","module","define","amd","a","i","this","modules","__webpack_require__","moduleId","installedModules","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","CustomEmitter","delegate","method","eventTarget","bind","document","createDocumentFragment","forEach","wrapKeyEvent","fn","ev","keyCode","window","event","which","ce","CustomEvent","preventDefault","defaultPrevented","Error","e","params","evt","origPrevent","bubbles","cancelable","detail","undefined","createEvent","initCustomEvent","Event","win","doc","docHijack","old","v","addListen","addEvent","on","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","length","addEventListener","Element","all","global","validateDataType","DataTypeException","core","_typeof","Symbol","iterator","constructor","_game_controllers","controllers","newObj","key","default","_shims","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","createController","opts","btn","controller","controllerTypes","enableKeyboard","buttons","remapButton","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","allOk","arguments","cap","Array","isArray","indexOf","native","createRequest","version","responseData","error","platform","requestController","_bindKeyboardTriggers","err","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","playerEnteredToGameRoom","playerLeftGameRoom","purchaseItemWithCoins","options","oldMethod","coins","isSilentModeEnabled","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","showSubscribeDialog","requestPlayerData","playerData","startSignal","ghostMode","mainController","additionalController","gameeNative","apply","_keydown","_keyup","OneButton","OneButtonController","TwoButtons","TwoButtonController","FourButtons","FourButtonController","FiveButtons","FiveButtonController","SixButtons","SixButtonController","FourArrows","FourArrowController","Touch","TouchController","Joystick","JoystickController","JoystickWithButton","JoystickButtonController","TwoArrowsTwoButtons","TwoArrowsTwoButtonsController","TwoArrowsOneButton","TwoArrowsOneButtonController","TwoActionButtons","TwoActionButtonsController","registerPlatform","platformAPI","silentMode","expected","present","argument","message","testedInput","expectedType","originMethod","Gamee","GameeEmitter","_core","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","requests","_init","PostMessageBridge","endpoint","_gameeWin","MobileBridge","device","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","create","_resolveAPICall","response","postMessage","opt_data","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","JSON","parse","stringify","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","_pressed","Controller","buttonAlias","addButton","x","y","position","_bullet","isDown","gamee","keyCodes","oldName","newName","_gameeAPI","_platform_bridge","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","g","Function","eval"],"mappings":";CAAA,SAAAA,EAAAC,GACA,mBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,QACA,sBAAAG,gBAAAC,IACAD,UAAAH,OACA,CACA,GAAAK,GAAAL,GAC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tU,EAAA,GASWiU,iBAOPM,EAAkB,WAElB,GAAIA,GAAgBC,EAAe,MAI/BzO,EAAYD,UAAUC,UAAU0O,aAwBpC,QAtBI,mBAAmB5O,KAAKE,GAKpByO,EADAnS,OAAO2B,OAAS3B,OAAOqS,IACR,MAEA,MAEZ,mBAAmB7O,KAAKE,GAE/ByO,EAAe,UACRnS,OAAOsS,OACdH,EAAe,MACRnS,OAAOsS,QAAUtS,OAAOsS,OAAOC,iBACtCJ,EAAe,OAGnBhV,EAjCOyU,MAiCPA,EAAQ,GAAAI,GAAAvF,MAAU0F,GAElBnS,OAAO4R,MAAQA,EAEPO,GACJ,IAAK,MACGnS,OAAOsS,OAAWtS,OAGtBkS,EAAiB,GAAAD,GAAAnE,kBAAsB9N,OAAOsS,OAC9C,MACJ,KAAK,MACDJ,EAAiB,GAAAD,GAAAhE,aAAiB,MAClC,MACJ,KAAK,UACDiE,EAAiB,GAAAD,GAAAhE,aAAiB,UAClC,MACJ,SACI,KAAM,8BAEd,MAAOiE,KAGXvF,GAAAnK,KAAK2L,YAAL8D,EAAA9D,YACAxB,EAAAnK,KAAK6D,OAAS6L,EAEdD,EAAA9D,YAAYvB,QAAUgF,EAAMhF,SRy6EtB,SAAUxP,EAAQD,GSh/ExB,GAAAqV,EAGAA,GAAA,WACA,MAAA/U,QAGA,KAEA+U,KAAAC,SAAA,qBAAAC,MAAA,QACC,MAAAlS,GAED,gBAAAR,UACAwS,EAAAxS,QAOA5C,EAAAD,QAAAqV","file":"gamee-js.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","/*! @preserve build time 2019-10-15 10:05:46 */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 6);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.CustomEmitter = CustomEmitter;\nexports.wrapKeyEvent = wrapKeyEvent;\n/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function CustomEvent(event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function get() {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return; //No need to polyfill\n\n\tfunction docHijack(p) {\n\t\tvar old = doc[p];doc[p] = function (v) {\n\t\t\treturn addListen(old(v));\n\t\t};\n\t}\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () {\n\t\t\t\te.returnValue = false;\n\t\t\t};\n\t\t\te.stopPropagation = e.stopPropagation || function () {\n\t\t\t\te.cancelBubble = true;\n\t\t\t};\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--) {\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t\t}\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent; //IE8\n\telse {\n\t\t\t//IE < 8\n\t\t\tdoc.attachEvent('onreadystatechange', function () {\n\t\t\t\taddListen(doc.all);\n\t\t\t}); //Make sure we also init at domReady\n\t\t\tdocHijack('getElementsByTagName');\n\t\t\tdocHijack('getElementById');\n\t\t\tdocHijack('createElement');\n\t\t\taddListen(doc.all);\n\t\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nfunction CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\"addEventListener\", \"dispatchEvent\", \"removeEventListener\"].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nfunction wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.validateDataType = exports.DataTypeException = exports.core = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _game_controllers = __webpack_require__(5);\n\nvar controllers = _interopRequireWildcard(_game_controllers);\n\nvar _shims = __webpack_require__(0);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function overloadedAudioContext(type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function resume() {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx;\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) {\n // throw error in async part\n setTimeout(function () {\n throw e;\n }, 0);\n }\n})();\n\n/**\n * @class core\n */\nvar core = exports.core = function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function noop() {};\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\", \"rewardedAds\", \"coins\", \"logEvents\", \"playerData\", \"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true,\n cap = {};\n if (capabilities !== undefined && Array.isArray(capabilities)) {\n for (var i = 0; i < capabilities.length; i++) {\n if (typeof capabilities[i] !== \"string\" || internals.CAPABILITIES.indexOf(capabilities[i]) === -1) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk) throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if (typeof percentage !== \"number\" || percentage < 0 || percentage > 100) throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n }();\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\") throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if (!cache.capabilities.saveState) throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb, numberOfPlayers) {\n\n if (!cache.capabilities.socialData) throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if (!cache.capabilities.logEvents) throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", { eventName: eventName, eventValue: eventValue }, function (error) {\n if (error) {\n throw error;\n }\n });\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if (!cache.capabilities.replay) throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredToGameRoom = function () {\n this.native.createRequest('playerEnteredToGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if (!cache.capabilities.coins) throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if (!cache.capabilities.gems) throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if (!cache.capabilities.share) throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Share Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if (!cache.capabilities.playerData) throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n var options = undefined;\n if (userID) {\n options = { userID: userID };\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay) error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode) error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function requestController(type, opts) {\n if (type === \"FullScreen\") return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function additionalController(type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function trigger() {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n}();\n\nvar DataTypeException = exports.DataTypeException = function DataTypeException(expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = \"Invalid data type in method \" + this.method + \", argument \" + this.argument + \" is expected to be \" + this.expected + \", but found \" + this.present;\n};\n\nvar validateDataType = exports.validateDataType = function validateDataType(testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput)) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n break;\n\n default:\n if ((typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput)) !== expectedType) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Gamee = exports.GameeEmitter = undefined;\n\nvar _core = __webpack_require__(1);\n\nvar _shims = __webpack_require__(0);\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nvar GameeEmitter = exports.GameeEmitter = function GameeEmitter() {\n _shims.CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nvar Gamee = exports.Gamee = function Gamee(platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = function () {\n\n var cbError = function cbError(err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: _core.core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function gameInit(controllType, controllOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n (0, _core.validateDataType)(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n (0, _core.validateDataType)(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n (0, _core.validateDataType)(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.gameInit\");\n (0, _core.validateDataType)(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = _core.core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function gameLoadingProgress(percentage, opt_cb) {\n (0, _core.validateDataType)(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n _core.core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function gameReady(opt_cb) {\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n _core.core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function gameSave(data, opt_share, opt_cb) {\n var share = false,\n cb;\n (0, _core.validateDataType)(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function') opt_cb = opt_share;else if (typeof opt_share !== \"undefined\") (0, _core.validateDataType)(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n _core.core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function getPlatform() {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function updateScore(score, opt_ghostSign, opt_cb) {\n (0, _core.validateDataType)(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\") opt_cb = opt_ghostSign;else if (typeof opt_ghostSign !== \"undefined\") (0, _core.validateDataType)(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n _core.core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function gameOver(opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\") opt_cb = opt_replayData;else if (typeof opt_replayData !== \"undefined\") (0, _core.validateDataType)(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n (0, _core.validateDataType)(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n _core.core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function requestSocial(cb, numberOfPlayers) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = _core.core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function logEvent(eventName, eventValue) {\n\n (0, _core.validateDataType)(eventName, \"string\", \"eventName\", \"gamee.logEvent\");\n\n if (!eventName || eventName.length > 24) {\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return;\n }\n\n (0, _core.validateDataType)(eventValue, \"string\", \"eventValue\", \"gamee.logEvent\");\n\n if (!eventValue || eventValue.length > 160) {\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return;\n }\n\n _core.core.logEvent(eventName, eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function requestBattleData(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n _core.core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function requestPlayerReplay(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n _core.core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function requestPlayerSaveState(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n _core.core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredToGameRoom\n * @member of Gamee\n */\n playerEnteredToGameRoom: function playerEnteredToGameRoom() {\n _core.core.playerEnteredToGameRoom();\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function playerLeftGameRoom() {\n _core.core.playerLeftGameRoom();\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function purchaseItem(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItem\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItem\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb, true);\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function purchaseItemWithCoins(purchaseDetails, cb) {\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithCoins\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithCoins\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb);\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function purchaseItemWithGems(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithGems\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithGems\");\n\n _core.core.purchaseItemWithGems(purchaseDetails, cb);\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function share(shareDetails, cb) {\n (0, _core.validateDataType)(shareDetails, \"object\", \"shareDetails\", \"gamee.share\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.share\");\n\n _core.core.share(shareDetails, cb);\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function loadRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.loadRewardedVideo\");\n _core.core.loadRewardedVideo(cb);\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function showRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showRewardedVideo\");\n _core.core.showRewardedVideo(cb);\n },\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function showSubscribeDialog(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showSubscribeDialog\");\n _core.core.showSubscribeDialog(cb);\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function requestPlayerData(cb, userID) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerData\");\n if (userID !== undefined) {\n (0, _core.validateDataType)(userID, \"number\", \"userId\", \"gamee.requestPlayerData\");\n }\n _core.core.requestPlayerData(cb, userID);\n }\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n}();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.PlatformAPI = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.PlatformBridge = PlatformBridge;\nexports.PostMessageBridge = PostMessageBridge;\nexports.MobileBridge = MobileBridge;\n\nvar _core = __webpack_require__(1);\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nvar PlatformAPI = exports.PlatformAPI = {\n\temitter: null,\n\tpause: function pause(cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function resume(cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function ghostShow(cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function ghostHide(cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function mute(cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function unmute(cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function start(data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = _core.core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay) event.detail.opt_replay = true;\n\t\tif (data.ghostMode) event.detail.opt_ghostMode = true;\n\t\tif (data.resetState) event.detail.opt_resetState = true;\n\t\tif (data.replayData) {\n\t\t\tevent.detail.replayData = data.replayData;\n\t\t}\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n/**\n * @class PlatformBridge\n *\n */\nfunction PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function _init() {},\n\tcreateRequest: function createRequest(method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method)) return;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function validateMethod(method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n * @abstract\n */\n\tdoCall: function doCall(preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function _callback(id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb) cb(responseData);\n\t},\n\t/**\n * @abstract\n */\n\tdoResponse: function doResponse(preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t}\n};\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nfunction PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (_typeof(ev.detail) === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (_typeof(ev.data) === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4) + ' data');\n\t\t}\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\t\tif (data.error) throw data.error;\n\t\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData) preparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\t\tconsole.error(\"Unknown method call\");\n\t\t\t}\n\t}\n};\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nfunction MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4));\n\t\t}\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar BulletClass = function BulletClass() {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 || typeof event !== \"string\" || typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n } else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n } else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n } else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n};\n\nvar Bullet = exports.Bullet = new BulletClass();\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.BulletClass = undefined;\nexports.Button = Button;\nexports.Controller = Controller;\nexports.OneButtonController = OneButtonController;\nexports.TwoButtonController = TwoButtonController;\nexports.TwoActionButtonsController = TwoActionButtonsController;\nexports.FourButtonController = FourButtonController;\nexports.FiveButtonController = FiveButtonController;\nexports.SixButtonController = SixButtonController;\nexports.TwoArrowsOneButtonController = TwoArrowsOneButtonController;\nexports.TwoArrowsTwoButtonsController = TwoArrowsTwoButtonsController;\nexports.FourArrowController = FourArrowController;\nexports.TouchController = TouchController;\nexports.JoystickController = JoystickController;\nexports.JoystickButtonController = JoystickButtonController;\n\nvar _bullet = __webpack_require__(4);\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nvar BulletClass = exports.BulletClass = _bullet.Bullet.constructor;\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nfunction Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nfunction Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key,\n\t button,\n\t keyCodes = {},\n\t self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nfunction OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nfunction TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nfunction TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nfunction FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nfunction FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nfunction SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nfunction TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nfunction TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nfunction FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nfunction TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nfunction JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nfunction JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.gamee = undefined;\n\n__webpack_require__(0);\n\nvar _gameeAPI = __webpack_require__(2);\n\nvar _core = __webpack_require__(1);\n\nvar _platform_bridge = __webpack_require__(3);\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nvar gamee = exports.gamee = undefined;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = function () {\n\n var platformBridge,\n platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) {\n // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) {\n // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) {\n // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) {\n // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n exports.gamee = gamee = new _gameeAPI.Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new _platform_bridge.PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new _platform_bridge.MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new _platform_bridge.MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n}();\n\n_core.core.PlatformAPI = _platform_bridge.PlatformAPI;\n_core.core.native = platformBridge;\n\n_platform_bridge.PlatformAPI.emitter = gamee.emitter;\n\nfunction loadScript(url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\nvar g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// gamee-js.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e3344513ac420d153d79","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredToGameRoom = function () {\n this.native.createRequest('playerEnteredToGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredToGameRoom\n * @member of Gamee\n */\n playerEnteredToGameRoom: function () {\n core.playerEnteredToGameRoom()\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function () {\n core.playerLeftGameRoom()\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function (cb){\n validateDataType(cb,\"function\",\"cb\",\"gamee.showSubscribeDialog\");\n core.showSubscribeDialog(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file From b8631e01276aeb22797a8e80c37d5e9fb1dc887a Mon Sep 17 00:00:00 2001 From: Hadik Date: Tue, 15 Oct 2019 12:59:39 +0200 Subject: [PATCH 4/5] Rename methods 3# --- gamee/dist/gamee-js.js | 12 ++++++------ gamee/dist/gamee-js.js.map | 2 +- gamee/dist/gamee-js.min.js | 4 ++-- gamee/dist/gamee-js.min.js.map | 2 +- gamee/src/core.js | 4 ++-- gamee/src/gameeAPI.js | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gamee/dist/gamee-js.js b/gamee/dist/gamee-js.js index dfff75a..0ea4024 100644 --- a/gamee/dist/gamee-js.js +++ b/gamee/dist/gamee-js.js @@ -1,4 +1,4 @@ -/*! @preserve build time 2019-10-15 10:05:46 */ +/*! @preserve build time 2019-10-15 10:59:21 */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -606,8 +606,8 @@ var core = exports.core = function () { }); }; - core.playerEnteredToGameRoom = function () { - this.native.createRequest('playerEnteredToGameRoom'); + core.playerEnteredGameRoom = function () { + this.native.createRequest('playerEnteredGameRoom'); }; core.playerLeftGameRoom = function () { @@ -1203,11 +1203,11 @@ Gamee.prototype = function () { }, /* - * playerEnteredToGameRoom + * playerEnteredGameRoom * @member of Gamee */ - playerEnteredToGameRoom: function playerEnteredToGameRoom() { - _core.core.playerEnteredToGameRoom(); + playerEnteredGameRoom: function playerEnteredGameRoom() { + _core.core.playerEnteredGameRoom(); }, /* diff --git a/gamee/dist/gamee-js.js.map b/gamee/dist/gamee-js.js.map index cd3a0ba..f239379 100644 --- a/gamee/dist/gamee-js.js.map +++ b/gamee/dist/gamee-js.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap e3344513ac420d153d79","webpack:///./gamee/libs/shims.js","webpack:///./gamee/src/core.js","webpack:///./gamee/src/gameeAPI.js","webpack:///./gamee/src/platform_bridge.js","webpack:///./gamee/libs/bullet.js","webpack:///./gamee/src/game_controllers.js","webpack:///./gamee/src/index.js","webpack:///(webpack)/buildin/global.js"],"names":["CustomEmitter","wrapKeyEvent","shimCustomEvent","ce","window","CustomEvent","preventDefault","defaultPrevented","Error","e","event","params","evt","origPrevent","bubbles","cancelable","detail","undefined","document","createEvent","initCustomEvent","call","Object","defineProperty","get","prototype","Event","win","doc","addEventListener","docHijack","p","old","v","addListen","addEvent","on","fn","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","i","length","Element","all","eventTarget","createDocumentFragment","delegate","method","bind","forEach","ev","keyCode","which","controllers","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","core","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","silentMode","allOk","cap","Array","isArray","indexOf","native","createRequest","version","controller","responseData","error","platform","requestController","enableKeyboard","_bindKeyboardTriggers","err","global","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","hasOwnProperty","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","playerEnteredToGameRoom","playerLeftGameRoom","purchaseItemWithCoins","options","oldMethod","coins","propertiesList","property","isSilentModeEnabled","console","log","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","showSubscribeDialog","requestPlayerData","playerData","startSignal","ghostMode","mainController","opts","createController","additionalController","gameeNative","apply","arguments","_keydown","_keyup","btn","controllerTypes","buttons","remapButton","OneButtonController","TwoButtonController","FourButtonController","FiveButtonController","SixButtonController","FourArrowController","TouchController","JoystickController","JoystickButtonController","TwoArrowsTwoButtonsController","TwoArrowsOneButtonController","TwoActionButtonsController","registerPlatform","platformAPI","DataTypeException","expected","present","argument","message","validateDataType","testedInput","expectedType","originMethod","GameeEmitter","Gamee","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","result","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","PostMessageBridge","MobileBridge","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","requests","_init","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","endpoint","_gameeWin","create","constructor","JSON","stringify","_resolveAPICall","response","postMessage","opt_data","device","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","parse","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","Controller","key","_pressed","isDown","buttonAlias","addButton","gamee","keyCodes","oldName","newName","name","x","y","position","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","loadScript","url","head","getElementsByTagName","script","createElement","src","onreadystatechange","onload","appendChild"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;A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AAQS,YAAR;AACI,aAAK,KAAL;AACI,gBAAInS,OAAOsS,MAAP,KAAkBtS,MAAtB,EAA8B;AAC1ByJ,wBAAQnD,KAAR,CAAc,0CAAd;AACH;AACD4L,6BAAiB,uCAAsBlS,OAAOsS,MAA7B,CAAjB;AACA;AACJ,aAAK,KAAL;AACIJ,6BAAiB,kCAAiB,KAAjB,CAAjB;AACA;AACJ,aAAK,SAAL;AACIA,6BAAiB,kCAAiB,SAAjB,CAAjB;AACA;AACJ;AACI,kBAAM,6BAAN;AAdR;AAgBA,WAAOA,cAAP;AACH,CA/CoB,EAArB;;AAiDA,WAAKpE,WAAL;AACA,WAAK7H,MAAL,GAAciM,cAAd;;AAEA,6BAAYvF,OAAZ,GAAsB+E,MAAM/E,OAA5B;;AAGA,SAAS6F,UAAT,CAAqBC,GAArB,EAA0BzE,QAA1B,EAAoC;AAChC;AACA,QAAI0E,OAAO5R,SAAS6R,oBAAT,CAA8B,MAA9B,EAAsC,CAAtC,CAAX;AACA,QAAIC,SAAS9R,SAAS+R,aAAT,CAAuB,QAAvB,CAAb;AACAD,WAAOE,GAAP,GAAaL,GAAb;;AAEA;AACA;AACAG,WAAOG,kBAAP,GAA4B/E,QAA5B;AACA4E,WAAOI,MAAP,GAAgBhF,QAAhB;;AAEA;AACA0E,SAAKO,WAAL,CAAiBL,MAAjB;AACH,C;;;;;;ACvFD;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"gamee-js.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e3344513ac420d153d79","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredToGameRoom = function () {\n this.native.createRequest('playerEnteredToGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredToGameRoom\n * @member of Gamee\n */\n playerEnteredToGameRoom: function () {\n core.playerEnteredToGameRoom()\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function () {\n core.playerLeftGameRoom()\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function (cb){\n validateDataType(cb,\"function\",\"cb\",\"gamee.showSubscribeDialog\");\n core.showSubscribeDialog(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 617022220ca38c913700","webpack:///./gamee/libs/shims.js","webpack:///./gamee/src/core.js","webpack:///./gamee/src/gameeAPI.js","webpack:///./gamee/src/platform_bridge.js","webpack:///./gamee/libs/bullet.js","webpack:///./gamee/src/game_controllers.js","webpack:///./gamee/src/index.js","webpack:///(webpack)/buildin/global.js"],"names":["CustomEmitter","wrapKeyEvent","shimCustomEvent","ce","window","CustomEvent","preventDefault","defaultPrevented","Error","e","event","params","evt","origPrevent","bubbles","cancelable","detail","undefined","document","createEvent","initCustomEvent","call","Object","defineProperty","get","prototype","Event","win","doc","addEventListener","docHijack","p","old","v","addListen","addEvent","on","fn","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","i","length","Element","all","eventTarget","createDocumentFragment","delegate","method","bind","forEach","ev","keyCode","which","controllers","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","core","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","silentMode","allOk","cap","Array","isArray","indexOf","native","createRequest","version","controller","responseData","error","platform","requestController","enableKeyboard","_bindKeyboardTriggers","err","global","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","hasOwnProperty","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","playerEnteredGameRoom","playerLeftGameRoom","purchaseItemWithCoins","options","oldMethod","coins","propertiesList","property","isSilentModeEnabled","console","log","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","showSubscribeDialog","requestPlayerData","playerData","startSignal","ghostMode","mainController","opts","createController","additionalController","gameeNative","apply","arguments","_keydown","_keyup","btn","controllerTypes","buttons","remapButton","OneButtonController","TwoButtonController","FourButtonController","FiveButtonController","SixButtonController","FourArrowController","TouchController","JoystickController","JoystickButtonController","TwoArrowsTwoButtonsController","TwoArrowsOneButtonController","TwoActionButtonsController","registerPlatform","platformAPI","DataTypeException","expected","present","argument","message","validateDataType","testedInput","expectedType","originMethod","GameeEmitter","Gamee","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","result","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","PostMessageBridge","MobileBridge","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","requests","_init","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","endpoint","_gameeWin","create","constructor","JSON","stringify","_resolveAPICall","response","postMessage","opt_data","device","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","parse","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","Controller","key","_pressed","isDown","buttonAlias","addButton","gamee","keyCodes","oldName","newName","name","x","y","position","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","loadScript","url","head","getElementsByTagName","script","createElement","src","onreadystatechange","onload","appendChild"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;QC6BgBA,a,GAAAA,a;QAoBAC,Y,GAAAA,Y;AAjHhB;;;AAGA,CAAC,SAASC,eAAT,GAA2B;AAC3B,KAAI;AACH,MAAIC,KAAK,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kCAAiB,SAAjB,CAAjB;AACA;AACJ;AACI,kBAAM,6BAAN;AAdR;AAgBA,WAAOA,cAAP;AACH,CA/CoB,EAArB;;AAiDA,WAAKpE,WAAL;AACA,WAAK7H,MAAL,GAAciM,cAAd;;AAEA,6BAAYvF,OAAZ,GAAsB+E,MAAM/E,OAA5B;;AAGA,SAAS6F,UAAT,CAAqBC,GAArB,EAA0BzE,QAA1B,EAAoC;AAChC;AACA,QAAI0E,OAAO5R,SAAS6R,oBAAT,CAA8B,MAA9B,EAAsC,CAAtC,CAAX;AACA,QAAIC,SAAS9R,SAAS+R,aAAT,CAAuB,QAAvB,CAAb;AACAD,WAAOE,GAAP,GAAaL,GAAb;;AAEA;AACA;AACAG,WAAOG,kBAAP,GAA4B/E,QAA5B;AACA4E,WAAOI,MAAP,GAAgBhF,QAAhB;;AAEA;AACA0E,SAAKO,WAAL,CAAiBL,MAAjB;AACH,C;;;;;;ACvFD;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"gamee-js.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 617022220ca38c913700","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredGameRoom = function () {\n this.native.createRequest('playerEnteredGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredGameRoom\n * @member of Gamee\n */\n playerEnteredGameRoom: function () {\n core.playerEnteredGameRoom()\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function () {\n core.playerLeftGameRoom()\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function (cb){\n validateDataType(cb,\"function\",\"cb\",\"gamee.showSubscribeDialog\");\n core.showSubscribeDialog(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file diff --git a/gamee/dist/gamee-js.min.js b/gamee/dist/gamee-js.min.js index 51ddb4f..8bdacb9 100644 --- a/gamee/dist/gamee-js.min.js +++ b/gamee/dist/gamee-js.min.js @@ -1,3 +1,3 @@ -/*! @preserve build time 2019-10-15 10:05:46 */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,function(){return function(t){function __webpack_require__(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,__webpack_require__),n.l=!0,n.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.i=function(t){return t},__webpack_require__.d=function(t,e,o){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=6)}([function(t,e,o){"use strict";function CustomEmitter(){function delegate(e){this[e]=t[e].bind(t)}var t=document.createDocumentFragment();["addEventListener","dispatchEvent","removeEventListener"].forEach(delegate,this)}function wrapKeyEvent(t){return function(e){return e&&e.keyCode||(e||(e=window.event),e.which&&(e.keyCode=e.which)),t(e)}}Object.defineProperty(e,"__esModule",{value:!0}),e.CustomEmitter=CustomEmitter,e.wrapKeyEvent=wrapKeyEvent,function(){try{var t=new window.CustomEvent("test");if(t.preventDefault(),!0!==t.defaultPrevented)throw new Error("Could not prevent default")}catch(t){var e=function(t,e){var o,n;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},o=document.createEvent("CustomEvent"),o.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n=o.preventDefault,o.preventDefault=function(){n.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},o};e.prototype=window.Event.prototype,window.CustomEvent=e}}(),function(t,e){function docHijack(t){var o=e[t];e[t]=function(t){return addListen(o(t))}}function addEvent(e,o,n){return(n=this).attachEvent("on"+e,function(e){e=e||t.event,e.preventDefault=e.preventDefault||function(){e.returnValue=!1},e.stopPropagation=e.stopPropagation||function(){e.cancelBubble=!0},o.call(n,e)})}function addListen(t,e){if(e=t.length)for(;e--;)t[e].addEventListener=addEvent;else t.addEventListener=addEvent;return t}t.addEventListener||(addListen([e,t]),"Element"in t?t.Element.prototype.addEventListener=addEvent:(e.attachEvent("onreadystatechange",function(){addListen(e.all)}),docHijack("getElementsByTagName"),docHijack("getElementById"),docHijack("createElement"),addListen(e.all)))}(window,document)},function(t,e,o){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.validateDataType=e.DataTypeException=e.core=void 0;var n="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},r=o(5),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e.default=t,e}(r),i=o(0);!function(){var t=function(t){var e=new t;if("suspended"===e.state){var o=function resume(){if(/(iPhone|iPad)/i.test(navigator.userAgent)){var t=e.createBuffer(1,1,44100),o=e.createBufferSource();o.buffer=t,o.connect(e.destination),o.start(0),o.disconnect()}e.resume(),setTimeout(function(){"running"===e.state&&document.body.removeEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),resume,!1)},0)};document.body.addEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),o,!1)}return e};try{void 0!==window.AudioContext?window.AudioContext=t.bind(null,window.AudioContext):"undefined"!=typeof webkitAudioContext&&(window.webkitAudioContext=t.bind(null,window.webkitAudioContext))}catch(t){setTimeout(function(){throw t},0)}}();var u=(e.core=function(){function createController(t,e){var o,n;if(!u[t])throw new Error("Unsupported controller type, "+t);if(e=e||{},n=new u[t],e.enableKeyboard&&n.enableKeyboard(r),e.buttons)for(o in e.buttons)n.remapButton(o,e.buttons[o]);return n}var e=function(){},o={},n={VERSION:"2.4.1",CAPABILITIES:["ghostMode","saveState","replay","socialData","rewardedAds","coins","logEvents","playerData","share","gems"],variant:0,soundUnlocked:!1,onReady:e,onGameStart:e},r={};r.gameeInit=function(t,e,a,i){var u=(arguments.length>4&&void 0!==arguments[4]&&arguments[4],!0),s={};if(void 0!==a&&Array.isArray(a))for(var l=0;l100)throw"Percentage passed to gameLoadingProgress out of bounds or not a number.";e>t&&(t=e,this.native.createRequest("gameLoadingProgress",{percentage:e}))}}(),r.gameReady=function(){this.native.createRequest("gameReady")},r.updateScore=function(t,e){if("number"!=typeof t)throw"Score passed to updateScore is not a number.";var o={score:parseInt(t,10)};e&&(o.ghostSign=!0),this.native.createRequest("updateScore",o)},r.gameOver=function(t,e,o){o=void 0!==o&&o;var n={};if(t){if(t.hasOwnProperty("variant")||(t.variant=""),!t.hasOwnProperty("data"))throw"Replay data must have `data` property";n.replayData=t}n.hideOverlay=o,e&&(n.state=e),r.native.createRequest("gameOver",n)},r.gameSave=function(t,e){if(!o.capabilities.saveState)throw"Save State not supported, you must add the capability on gamee.Init";r.native.createRequest("saveState",{state:t,share:e})},r.requestSocial=function(t,e){if(!o.capabilities.socialData)throw"Social Data not supported, you must add the capability on gamee.Init";this.native.createRequest("requestSocial",e,function(e){t(null,e)})},r.logEvent=function(t,e){if(!o.capabilities.logEvents)throw"Log Events not supported, you must add the capability on gamee.Init";this.native.createRequest("logEvent",{eventName:t,eventValue:e},function(t){if(t)throw t})},r.requestBattleData=function(t){this.native.createRequest("requestBattleData",void 0,function(e){t(null,e)})},r.requestPlayerReplay=function(t,e){if(!o.capabilities.replay)throw"Replays not supported, you must add the capability on gamee.Init";this.native.createRequest("requestPlayerReplay",{userID:t},function(t){e(null,t)})},r.requestPlayerSaveState=function(t,e){this.native.createRequest("requestPlayerSaveState",{userID:t},function(t){e(null,t)})},r.playerEnteredToGameRoom=function(){this.native.createRequest("playerEnteredToGameRoom")},r.playerLeftGameRoom=function(){this.native.createRequest("playerLeftGameRoom")},r.purchaseItemWithCoins=function(t,e,n){if(!o.capabilities.coins)throw"Coins purchases not supported, you must add the capability on gamee.Init";if(t){["coinsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase Options must have `"+e+"` property"})}this.isSilentModeEnabled();var r="purchaseItemWithCoins";void 0!==n&&!0===n&&(r="purchaseItem"),this.native.createRequest(r,t,function(t){e(null,t)})},r.purchaseItemWithGems=function(t,e){if(!o.capabilities.gems)throw"Gems purchases not supported, you must add the capability on gamee.Init";if(t){["gemsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("purchaseItemWithGems",t,function(t){e(null,t)})},r.share=function(t,e){if(!o.capabilities.share)throw"Share option not supported, you must add the capability on gamee.Init";if(t){["destination"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Share Options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("share",t,function(t){e(null,t)})},r.loadRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("loadRewardedVideo",function(e){t(null,e)})},r.showRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("showRewardedVideo",function(e){t(null,e)})},r.showSubscribeDialog=function(t){this.native.createRequest("showSubscribeDialog",function(e){t(null,e)})},r.requestPlayerData=function(t,e){if(!o.capabilities.playerData)throw"Player Data not supported, you must add the capability on gamee.Init";var n=void 0;e&&(n={userID:e}),this.native.createRequest("requestPlayerData",n,function(e){t(null,e)})},r.startSignal=function(t){var e;return t.replay&&!o.capabilities.replay&&(e="Game doesn't support replay. "),t.ghostMode&&!o.capabilities.ghostMode&&(e="Game doesn't support ghost Mode. "),e},r.controller={mainController:null,requestController:function(t,e){if("FullScreen"===t)return null;var o=createController(t,e);return this.mainController=o,o},additionalController:function(t,e){var o=createController(t,e);return gameeNative.additionalController(t),o},trigger:function(){if(!this.mainController)throw new Error("No controller present");this.mainController.trigger.apply(this.mainController,arguments)}},r._keydown=function(e){t.addEventListener("keydown",(0,i.wrapKeyEvent)(e))},r._keyup=function(e){t.addEventListener("keyup",(0,i.wrapKeyEvent)(e))};var u={OneButton:a.OneButtonController,TwoButtons:a.TwoButtonController,FourButtons:a.FourButtonController,FiveButtons:a.FiveButtonController,SixButtons:a.SixButtonController,FourArrows:a.FourArrowController,Touch:a.TouchController,Joystick:a.JoystickController,JoystickWithButton:a.JoystickButtonController,TwoArrowsTwoButtons:a.TwoArrowsTwoButtonsController,TwoArrowsOneButton:a.TwoArrowsOneButtonController,TwoActionButtons:a.TwoActionButtonsController};return r.registerPlatform=function(t){},r.isSilentModeEnabled=function(){return o.silentMode},r}(),e.DataTypeException=function(t,e,o,n){this.expected=t,this.present=e,this.method=n,this.argument=o,this.message="Invalid data type in method "+this.method+", argument "+this.argument+" is expected to be "+this.expected+", but found "+this.present});e.validateDataType=function(t,e,o,r){switch(e){case"array":if(!Array.isArray(t))throw new u(e,void 0===t?"undefined":n(t),o,r);break;default:if((void 0===t?"undefined":n(t))!==e)throw new u(e,void 0===t?"undefined":n(t),o,r)}}}).call(e,o(7))},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Gamee=e.GameeEmitter=void 0;var n=o(1),r=o(0),a=e.GameeEmitter=function(){r.CustomEmitter.call(this)};(e.Gamee=function(t){this.emitter=new a,this._platform=t}).prototype=function(){var t=function(t){if(t)throw"Error "+t.toString()};return{_controller:n.core.controller,gameInit:function(t,e,o,r){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];(0,n.validateDataType)(t,"string","controllType","gamee.updateScore"),(0,n.validateDataType)(e,"object","controllOpts","gamee.gameInit"),(0,n.validateDataType)(o,"array","capabilities","gamee.gameInit"),(0,n.validateDataType)(r,"function","cb","gamee.gameInit"),(0,n.validateDataType)(a,"boolean","silentMode","gamee.gameInit"),n.core.gameeInit(t,e,o,r,a)},gameLoadingProgress:function(e,o){(0,n.validateDataType)(e,"number","percentage","gamee.gameLoadingProgress"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameLoadingProgress"),n.core.gameLoadingProgress(e),o(null)},gameReady:function(e){e=e||t,(0,n.validateDataType)(e,"function","opt_cb","gamee.gameReady"),n.core.gameReady(),e(null)},gameSave:function(e,o,r){(0,n.validateDataType)(e,"string","data","gamee.gameSave"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_share","gamee.gameSave"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.gameSave"),n.core.gameSave(e,!1),r(null)},getPlatform:function(){return this._platform},updateScore:function(e,o,r){(0,n.validateDataType)(e,"number","score","gamee.updateScore"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_ghostSign","gamee.updateScore"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.updateScore"),n.core.updateScore(e,o),r(null)},gameOver:function(e,o,r,a){"function"==typeof e?o=e:void 0!==e&&(0,n.validateDataType)(e,"object","opt_replayData","gamee.gameOver"),void 0!==a&&(0,n.validateDataType)(a,"boolean","opt_hideOverlay","gamee.gameOver"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameOver"),n.core.gameOver(e,r,a),o(null)},requestSocial:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestSocial"),n.core.requestSocial(function(e,o){var n=o.hasOwnProperty("socialData")?o:{socialData:o};t(null,n)},e)},logEvent:function(t,e){(0,n.validateDataType)(t,"string","eventName","gamee.logEvent"),!t||t.length>24||((0,n.validateDataType)(e,"string","eventValue","gamee.logEvent"),!e||e.length>160||n.core.logEvent(t,e))},requestBattleData:function(t){(0,n.validateDataType)(t,"function","cb","gamee.requestBattleData"),n.core.requestBattleData(t)},requestPlayerReplay:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerReplay"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerReplay"),n.core.requestPlayerReplay(t,e)},requestPlayerSaveState:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerSaveState"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerSaveState"),n.core.requestPlayerSaveState(t,e)},playerEnteredToGameRoom:function(){n.core.playerEnteredToGameRoom()},playerLeftGameRoom:function(){n.core.playerLeftGameRoom()},purchaseItem:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItem"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItem"),n.core.purchaseItemWithCoins(t,e,!0)},purchaseItemWithCoins:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithCoins"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithCoins"),n.core.purchaseItemWithCoins(t,e)},purchaseItemWithGems:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithGems"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithGems"),n.core.purchaseItemWithGems(t,e)},share:function(t,e){(0,n.validateDataType)(t,"object","shareDetails","gamee.share"),(0,n.validateDataType)(e,"function","cb","gamee.share"),n.core.share(t,e)},loadRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.loadRewardedVideo"),n.core.loadRewardedVideo(t)},showRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showRewardedVideo"),n.core.showRewardedVideo(t)},showSubscribeDialog:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showSubscribeDialog"),n.core.showSubscribeDialog(t)},requestPlayerData:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestPlayerData"),void 0!==e&&(0,n.validateDataType)(e,"number","userId","gamee.requestPlayerData"),n.core.requestPlayerData(t,e)}}}()},function(t,e,o){"use strict";function PlatformBridge(){this.requests={},this.platform="",this._init()}function PostMessageBridge(t){this._gameeWin=t,PlatformBridge.call(this),this.platform="web"}function MobileBridge(t){this.device=t,PostMessageBridge.call(this),this.platform="mobile"}Object.defineProperty(e,"__esModule",{value:!0}),e.PlatformAPI=void 0;var n="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};e.PlatformBridge=PlatformBridge,e.PostMessageBridge=PostMessageBridge,e.MobileBridge=MobileBridge;var r=o(1),a=e.PlatformAPI={emitter:null,pause:function(t){var e=new CustomEvent("pause",{detail:{callback:t}});this.emitter.dispatchEvent(e)},resume:function(t){var e=new CustomEvent("resume",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostShow:function(t){var e=new CustomEvent("ghostShow",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostHide:function(t){var e=new CustomEvent("ghostHide",{detail:{callback:t}});this.emitter.dispatchEvent(e)},mute:function(t){var e=new CustomEvent("mute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},unmute:function(t){var e=new CustomEvent("unmute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},start:function(t,e){var o=new CustomEvent("start",{detail:{callback:e}}),n=r.core.startSignal(t);if(n)return void e(n);t.replay&&(o.detail.opt_replay=!0),t.ghostMode&&(o.detail.opt_ghostMode=!0),t.resetState&&(o.detail.opt_resetState=!0),t.replayData&&(o.detail.replayData=t.replayData),this.emitter.dispatchEvent(o)}};PlatformBridge.prototype={instCount:0,_init:function(){},createRequest:function(t,e,o){if(this.validateMethod(t)){"function"==typeof e&&(o=e,e=void 0);var n=this.instCount++;void 0!==o&&(this.requests[n]=o);var r={request:{method:t,messageId:n,data:null}};this.doCall(r,e)}},validateMethod:function(t){return"gameLoadingProgress"!==t},doCall:function(t,e){throw"Not implemented"},_callback:function(t,e){var o=this.requests[t];delete this.requests[t],o&&o(e)},doResponse:function(t,e){throw"Not implemented"}},PostMessageBridge.prototype=Object.create(PlatformBridge.prototype),PostMessageBridge.prototype.constructor=PostMessageBridge,PostMessageBridge.prototype._init=function(){window.addEventListener("message",function(t){var e;if("object"===n(t.detail)&&null!==typeof t.detail)e=t.detail;else{if("object"!==n(t.data))return;e=t.data}if(r.core.isSilentModeEnabled(),e.request&&e.request.method&&void 0!==e.request.messageId)this._resolveAPICall(e.request.method,e.request.messageId,e.request.data);else if(e.response&&void 0!==e.response.messageId){if(e.error)throw e.error;this._callback(e.response.messageId,e.response.data)}}.bind(this),!1)},PostMessageBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),this._gameeWin.postMessage(t,"*")},PostMessageBridge.prototype.doResponse=function(t,e){var o={version:this.version,response:{messageId:t}};e&&(o.data=e),this._gameeWin.postMessage(o,"*")},PostMessageBridge.prototype._resolveAPICall=function(t,e,o){var n=this.doResponse.bind(this,e);switch(t){case"pause":a.pause(n);break;case"resume":a.resume(n);break;case"mute":a.mute(n);break;case"unmute":a.unmute(n);break;case"ghostShow":a.ghostShow(n);break;case"ghostHide":a.ghostHide(n);break;case"start":if(!o)throw"Method _start missing params";a.start(o,n);break;default:r.core.isSilentModeEnabled()}},MobileBridge.prototype=Object.create(PostMessageBridge.prototype),MobileBridge.prototype.constructor=MobileBridge,MobileBridge.prototype._init=function(){if(PostMessageBridge.prototype._init.call(this),"ios"===this.device)this._gameeWin=webkit.messageHandlers.callbackHandler;else{if("android"!==this.device)throw"Unknown device used in webkit bridge";this._gameeWin=_toDevice}window._triggerMessage=function(t){try{t=JSON.parse(t)}catch(e){throw"Couldn't parse message from native app: \n"+t+"\n"+e}r.core.isSilentModeEnabled(),this.dispatchEvent(new CustomEvent("message",{detail:t}))}.bind(window)},MobileBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),"android"===this.device&&(t=JSON.stringify(t)),this._gameeWin.postMessage(t,"*")}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){var t=this,e={};t.on=function(t,o,n){if(!(arguments.length<2||"string"!=typeof t||"function"!=typeof o)){var r=o.toString();void 0!==e[t]?void 0===e[t].callbacks[r]?e[t].callbacks[r]={cb:o,once:!!n}:"boolean"==typeof n&&(e[t].callbacks[r].once=n):(e[t]={callbacks:{}},e[t].callbacks[r]={cb:o,once:!!n})}},t.once=function(e,o){t.on(e,o,!0)},t.off=function(t,o){if("string"==typeof t&&void 0!==e[t])if("function"==typeof o){var n=o.toString(),r=e[t].callbacks[n];void 0!==r&&delete e[t].callbacks[n]}else delete e[t]},t.trigger=function(o,n){if("string"==typeof o&&void 0!==e[o])for(var r in e[o].callbacks){var a=e[o].callbacks[r];"function"==typeof a.cb&&a.cb(n),"boolean"==typeof a.once&&!0===a.once&&t.off(o,a.cb)}}};e.Bullet=new n},function(t,e,o){"use strict";function Button(t,e){var o=this;r.call(this),this._pressed=!0,this.key=t,this.keyCode=e,this.on("keydown",function(){o._pressed=!0}),this.on("keyup",function(){o._pressed=!1})}function Controller(){var t=this;r.call(this),this.buttons={},this.buttonAlias={},this.on("$keydown",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keydown",e)}),this.on("$keyup",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keyup",e)}),this.on("keydown",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keydown")}),this.on("keyup",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keyup")})}function OneButtonController(){Controller.call(this),this.addButton(new Button("button",32))}function TwoButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39))}function TwoActionButtonsController(){Controller.call(this),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function FiveButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32))}function SixButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function TwoArrowsOneButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function TwoArrowsTwoButtonsController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourArrowController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40))}function TouchController(){var t=this;Controller.call(this),this.on("$touchstart",function(e){t.trigger("touchstart",e)}),this.on("$touchend",function(e){t.trigger("touchend",e)}),this.on("$touchmove",function(e){t.trigger("touchmove",e)}),this.on("$touchleave",function(e){t.trigger("touchleave",e)}),this.on("$touchcancel",function(e){t.trigger("touchcancel",e)})}function JoystickController(){var t=this;Controller.call(this),this.x=0,this.y=0,this.on("$change",function(e){t.x=e.position.x,t.y=e.position.y,t.trigger("change",e)})}function JoystickButtonController(){JoystickController.call(this),this.addButton(new Button("button",32))}Object.defineProperty(e,"__esModule",{value:!0}),e.BulletClass=void 0,e.Button=Button,e.Controller=Controller,e.OneButtonController=OneButtonController,e.TwoButtonController=TwoButtonController,e.TwoActionButtonsController=TwoActionButtonsController,e.FourButtonController=FourButtonController,e.FiveButtonController=FiveButtonController,e.SixButtonController=SixButtonController,e.TwoArrowsOneButtonController=TwoArrowsOneButtonController,e.TwoArrowsTwoButtonsController=TwoArrowsTwoButtonsController,e.FourArrowController=FourArrowController,e.TouchController=TouchController,e.JoystickController=JoystickController,e.JoystickButtonController=JoystickButtonController;var n=o(4),r=e.BulletClass=n.Bullet.constructor;Button.prototype=Object.create(r.constructor.prototype),Button.constructor=Button,Button.prototype.isDown=function(){return this._pressed},Controller.prototype=Object.create(r.constructor.prototype),Controller.constructor=Controller,Controller.prototype.addButton=function(t){this.buttons[t.key]=t},Controller.prototype.enableKeyboard=function(t){var e,o,n={},r=this;for(e in this.buttons)o=this.buttons[e],o.keyCode&&(n[o.keyCode]=o);t._keydown(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keydown",{button:e.key}))}),t._keyup(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keyup",{button:e.key}))})},Controller.prototype.remapButton=function(t,e){if(e.name&&(e=e.name),!this.buttons[t])throw Error("Button "+t+" was not found in controller");this.buttonAlias[t]=e.name,this.buttons[e.name]=this.buttons[t],delete this.buttons[t]},OneButtonController.prototype=Object.create(Controller.prototype),OneButtonController.prototype.constructor=OneButtonController,TwoButtonController.prototype=Object.create(Controller.prototype),TwoButtonController.prototype.constructor=TwoButtonController,TwoActionButtonsController.prototype=Object.create(Controller.prototype),TwoActionButtonsController.prototype.constructor=TwoActionButtonsController,FourButtonController.prototype=Object.create(Controller.prototype),FourButtonController.prototype.constructor=FourButtonController,FiveButtonController.prototype=Object.create(Controller.prototype),FiveButtonController.prototype.constructor=FiveButtonController,SixButtonController.prototype=Object.create(Controller.prototype),SixButtonController.prototype.constructor=SixButtonController,TwoArrowsOneButtonController.prototype=Object.create(Controller.prototype),TwoArrowsOneButtonController.prototype.constructor=TwoArrowsOneButtonController,TwoArrowsTwoButtonsController.prototype=Object.create(Controller.prototype),TwoArrowsTwoButtonsController.prototype.constructor=TwoArrowsTwoButtonsController,FourArrowController.prototype=Object.create(Controller.prototype),FourArrowController.prototype.constructor=FourArrowController,TouchController.prototype=Object.create(TouchController.prototype),TouchController.prototype.constructor=TouchController,JoystickController.prototype=Object.create(Controller.prototype),JoystickController.prototype.constructor=JoystickController,JoystickButtonController.prototype=Object.create(JoystickController.prototype),JoystickButtonController.prototype.constructor=JoystickButtonController},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.gamee=void 0,o(0);var n=o(2),r=o(1),a=o(3),i=e.gamee=void 0,u=function(){var t,o="web",r=navigator.userAgent.toLowerCase();switch(/iphone|ipod|ipad/.test(r)?o=window.self!==window.top?"web":"ios":/gamee\/[0-9\.]+$/.test(r)?o="android":window.parent?o="web":window.parent&&window.parent.gameeSimulator&&(o="web"),e.gamee=i=new n.Gamee(o),window.gamee=i,o){case"web":window.parent,window,t=new a.PostMessageBridge(window.parent);break;case"ios":t=new a.MobileBridge("ios");break;case"android":t=new a.MobileBridge("android");break;default:throw"Can't identify the platform"}return t}();r.core.PlatformAPI=a.PlatformAPI,r.core.native=u,a.PlatformAPI.emitter=i.emitter},function(t,e){var o;o=function(){return this}();try{o=o||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(o=window)}t.exports=o}])}); +/*! @preserve build time 2019-10-15 10:59:21 */ +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,function(){return function(t){function __webpack_require__(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,__webpack_require__),n.l=!0,n.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.i=function(t){return t},__webpack_require__.d=function(t,e,o){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=6)}([function(t,e,o){"use strict";function CustomEmitter(){function delegate(e){this[e]=t[e].bind(t)}var t=document.createDocumentFragment();["addEventListener","dispatchEvent","removeEventListener"].forEach(delegate,this)}function wrapKeyEvent(t){return function(e){return e&&e.keyCode||(e||(e=window.event),e.which&&(e.keyCode=e.which)),t(e)}}Object.defineProperty(e,"__esModule",{value:!0}),e.CustomEmitter=CustomEmitter,e.wrapKeyEvent=wrapKeyEvent,function(){try{var t=new window.CustomEvent("test");if(t.preventDefault(),!0!==t.defaultPrevented)throw new Error("Could not prevent default")}catch(t){var e=function(t,e){var o,n;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},o=document.createEvent("CustomEvent"),o.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n=o.preventDefault,o.preventDefault=function(){n.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},o};e.prototype=window.Event.prototype,window.CustomEvent=e}}(),function(t,e){function docHijack(t){var o=e[t];e[t]=function(t){return addListen(o(t))}}function addEvent(e,o,n){return(n=this).attachEvent("on"+e,function(e){e=e||t.event,e.preventDefault=e.preventDefault||function(){e.returnValue=!1},e.stopPropagation=e.stopPropagation||function(){e.cancelBubble=!0},o.call(n,e)})}function addListen(t,e){if(e=t.length)for(;e--;)t[e].addEventListener=addEvent;else t.addEventListener=addEvent;return t}t.addEventListener||(addListen([e,t]),"Element"in t?t.Element.prototype.addEventListener=addEvent:(e.attachEvent("onreadystatechange",function(){addListen(e.all)}),docHijack("getElementsByTagName"),docHijack("getElementById"),docHijack("createElement"),addListen(e.all)))}(window,document)},function(t,e,o){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.validateDataType=e.DataTypeException=e.core=void 0;var n="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},r=o(5),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e.default=t,e}(r),i=o(0);!function(){var t=function(t){var e=new t;if("suspended"===e.state){var o=function resume(){if(/(iPhone|iPad)/i.test(navigator.userAgent)){var t=e.createBuffer(1,1,44100),o=e.createBufferSource();o.buffer=t,o.connect(e.destination),o.start(0),o.disconnect()}e.resume(),setTimeout(function(){"running"===e.state&&document.body.removeEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),resume,!1)},0)};document.body.addEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),o,!1)}return e};try{void 0!==window.AudioContext?window.AudioContext=t.bind(null,window.AudioContext):"undefined"!=typeof webkitAudioContext&&(window.webkitAudioContext=t.bind(null,window.webkitAudioContext))}catch(t){setTimeout(function(){throw t},0)}}();var u=(e.core=function(){function createController(t,e){var o,n;if(!u[t])throw new Error("Unsupported controller type, "+t);if(e=e||{},n=new u[t],e.enableKeyboard&&n.enableKeyboard(r),e.buttons)for(o in e.buttons)n.remapButton(o,e.buttons[o]);return n}var e=function(){},o={},n={VERSION:"2.4.1",CAPABILITIES:["ghostMode","saveState","replay","socialData","rewardedAds","coins","logEvents","playerData","share","gems"],variant:0,soundUnlocked:!1,onReady:e,onGameStart:e},r={};r.gameeInit=function(t,e,a,i){var u=(arguments.length>4&&void 0!==arguments[4]&&arguments[4],!0),s={};if(void 0!==a&&Array.isArray(a))for(var l=0;l100)throw"Percentage passed to gameLoadingProgress out of bounds or not a number.";e>t&&(t=e,this.native.createRequest("gameLoadingProgress",{percentage:e}))}}(),r.gameReady=function(){this.native.createRequest("gameReady")},r.updateScore=function(t,e){if("number"!=typeof t)throw"Score passed to updateScore is not a number.";var o={score:parseInt(t,10)};e&&(o.ghostSign=!0),this.native.createRequest("updateScore",o)},r.gameOver=function(t,e,o){o=void 0!==o&&o;var n={};if(t){if(t.hasOwnProperty("variant")||(t.variant=""),!t.hasOwnProperty("data"))throw"Replay data must have `data` property";n.replayData=t}n.hideOverlay=o,e&&(n.state=e),r.native.createRequest("gameOver",n)},r.gameSave=function(t,e){if(!o.capabilities.saveState)throw"Save State not supported, you must add the capability on gamee.Init";r.native.createRequest("saveState",{state:t,share:e})},r.requestSocial=function(t,e){if(!o.capabilities.socialData)throw"Social Data not supported, you must add the capability on gamee.Init";this.native.createRequest("requestSocial",e,function(e){t(null,e)})},r.logEvent=function(t,e){if(!o.capabilities.logEvents)throw"Log Events not supported, you must add the capability on gamee.Init";this.native.createRequest("logEvent",{eventName:t,eventValue:e},function(t){if(t)throw t})},r.requestBattleData=function(t){this.native.createRequest("requestBattleData",void 0,function(e){t(null,e)})},r.requestPlayerReplay=function(t,e){if(!o.capabilities.replay)throw"Replays not supported, you must add the capability on gamee.Init";this.native.createRequest("requestPlayerReplay",{userID:t},function(t){e(null,t)})},r.requestPlayerSaveState=function(t,e){this.native.createRequest("requestPlayerSaveState",{userID:t},function(t){e(null,t)})},r.playerEnteredGameRoom=function(){this.native.createRequest("playerEnteredGameRoom")},r.playerLeftGameRoom=function(){this.native.createRequest("playerLeftGameRoom")},r.purchaseItemWithCoins=function(t,e,n){if(!o.capabilities.coins)throw"Coins purchases not supported, you must add the capability on gamee.Init";if(t){["coinsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase Options must have `"+e+"` property"})}this.isSilentModeEnabled();var r="purchaseItemWithCoins";void 0!==n&&!0===n&&(r="purchaseItem"),this.native.createRequest(r,t,function(t){e(null,t)})},r.purchaseItemWithGems=function(t,e){if(!o.capabilities.gems)throw"Gems purchases not supported, you must add the capability on gamee.Init";if(t){["gemsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("purchaseItemWithGems",t,function(t){e(null,t)})},r.share=function(t,e){if(!o.capabilities.share)throw"Share option not supported, you must add the capability on gamee.Init";if(t){["destination"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Share Options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("share",t,function(t){e(null,t)})},r.loadRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("loadRewardedVideo",function(e){t(null,e)})},r.showRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("showRewardedVideo",function(e){t(null,e)})},r.showSubscribeDialog=function(t){this.native.createRequest("showSubscribeDialog",function(e){t(null,e)})},r.requestPlayerData=function(t,e){if(!o.capabilities.playerData)throw"Player Data not supported, you must add the capability on gamee.Init";var n=void 0;e&&(n={userID:e}),this.native.createRequest("requestPlayerData",n,function(e){t(null,e)})},r.startSignal=function(t){var e;return t.replay&&!o.capabilities.replay&&(e="Game doesn't support replay. "),t.ghostMode&&!o.capabilities.ghostMode&&(e="Game doesn't support ghost Mode. "),e},r.controller={mainController:null,requestController:function(t,e){if("FullScreen"===t)return null;var o=createController(t,e);return this.mainController=o,o},additionalController:function(t,e){var o=createController(t,e);return gameeNative.additionalController(t),o},trigger:function(){if(!this.mainController)throw new Error("No controller present");this.mainController.trigger.apply(this.mainController,arguments)}},r._keydown=function(e){t.addEventListener("keydown",(0,i.wrapKeyEvent)(e))},r._keyup=function(e){t.addEventListener("keyup",(0,i.wrapKeyEvent)(e))};var u={OneButton:a.OneButtonController,TwoButtons:a.TwoButtonController,FourButtons:a.FourButtonController,FiveButtons:a.FiveButtonController,SixButtons:a.SixButtonController,FourArrows:a.FourArrowController,Touch:a.TouchController,Joystick:a.JoystickController,JoystickWithButton:a.JoystickButtonController,TwoArrowsTwoButtons:a.TwoArrowsTwoButtonsController,TwoArrowsOneButton:a.TwoArrowsOneButtonController,TwoActionButtons:a.TwoActionButtonsController};return r.registerPlatform=function(t){},r.isSilentModeEnabled=function(){return o.silentMode},r}(),e.DataTypeException=function(t,e,o,n){this.expected=t,this.present=e,this.method=n,this.argument=o,this.message="Invalid data type in method "+this.method+", argument "+this.argument+" is expected to be "+this.expected+", but found "+this.present});e.validateDataType=function(t,e,o,r){switch(e){case"array":if(!Array.isArray(t))throw new u(e,void 0===t?"undefined":n(t),o,r);break;default:if((void 0===t?"undefined":n(t))!==e)throw new u(e,void 0===t?"undefined":n(t),o,r)}}}).call(e,o(7))},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Gamee=e.GameeEmitter=void 0;var n=o(1),r=o(0),a=e.GameeEmitter=function(){r.CustomEmitter.call(this)};(e.Gamee=function(t){this.emitter=new a,this._platform=t}).prototype=function(){var t=function(t){if(t)throw"Error "+t.toString()};return{_controller:n.core.controller,gameInit:function(t,e,o,r){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];(0,n.validateDataType)(t,"string","controllType","gamee.updateScore"),(0,n.validateDataType)(e,"object","controllOpts","gamee.gameInit"),(0,n.validateDataType)(o,"array","capabilities","gamee.gameInit"),(0,n.validateDataType)(r,"function","cb","gamee.gameInit"),(0,n.validateDataType)(a,"boolean","silentMode","gamee.gameInit"),n.core.gameeInit(t,e,o,r,a)},gameLoadingProgress:function(e,o){(0,n.validateDataType)(e,"number","percentage","gamee.gameLoadingProgress"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameLoadingProgress"),n.core.gameLoadingProgress(e),o(null)},gameReady:function(e){e=e||t,(0,n.validateDataType)(e,"function","opt_cb","gamee.gameReady"),n.core.gameReady(),e(null)},gameSave:function(e,o,r){(0,n.validateDataType)(e,"string","data","gamee.gameSave"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_share","gamee.gameSave"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.gameSave"),n.core.gameSave(e,!1),r(null)},getPlatform:function(){return this._platform},updateScore:function(e,o,r){(0,n.validateDataType)(e,"number","score","gamee.updateScore"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_ghostSign","gamee.updateScore"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.updateScore"),n.core.updateScore(e,o),r(null)},gameOver:function(e,o,r,a){"function"==typeof e?o=e:void 0!==e&&(0,n.validateDataType)(e,"object","opt_replayData","gamee.gameOver"),void 0!==a&&(0,n.validateDataType)(a,"boolean","opt_hideOverlay","gamee.gameOver"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameOver"),n.core.gameOver(e,r,a),o(null)},requestSocial:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestSocial"),n.core.requestSocial(function(e,o){var n=o.hasOwnProperty("socialData")?o:{socialData:o};t(null,n)},e)},logEvent:function(t,e){(0,n.validateDataType)(t,"string","eventName","gamee.logEvent"),!t||t.length>24||((0,n.validateDataType)(e,"string","eventValue","gamee.logEvent"),!e||e.length>160||n.core.logEvent(t,e))},requestBattleData:function(t){(0,n.validateDataType)(t,"function","cb","gamee.requestBattleData"),n.core.requestBattleData(t)},requestPlayerReplay:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerReplay"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerReplay"),n.core.requestPlayerReplay(t,e)},requestPlayerSaveState:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerSaveState"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerSaveState"),n.core.requestPlayerSaveState(t,e)},playerEnteredGameRoom:function(){n.core.playerEnteredGameRoom()},playerLeftGameRoom:function(){n.core.playerLeftGameRoom()},purchaseItem:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItem"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItem"),n.core.purchaseItemWithCoins(t,e,!0)},purchaseItemWithCoins:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithCoins"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithCoins"),n.core.purchaseItemWithCoins(t,e)},purchaseItemWithGems:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithGems"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithGems"),n.core.purchaseItemWithGems(t,e)},share:function(t,e){(0,n.validateDataType)(t,"object","shareDetails","gamee.share"),(0,n.validateDataType)(e,"function","cb","gamee.share"),n.core.share(t,e)},loadRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.loadRewardedVideo"),n.core.loadRewardedVideo(t)},showRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showRewardedVideo"),n.core.showRewardedVideo(t)},showSubscribeDialog:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showSubscribeDialog"),n.core.showSubscribeDialog(t)},requestPlayerData:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestPlayerData"),void 0!==e&&(0,n.validateDataType)(e,"number","userId","gamee.requestPlayerData"),n.core.requestPlayerData(t,e)}}}()},function(t,e,o){"use strict";function PlatformBridge(){this.requests={},this.platform="",this._init()}function PostMessageBridge(t){this._gameeWin=t,PlatformBridge.call(this),this.platform="web"}function MobileBridge(t){this.device=t,PostMessageBridge.call(this),this.platform="mobile"}Object.defineProperty(e,"__esModule",{value:!0}),e.PlatformAPI=void 0;var n="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};e.PlatformBridge=PlatformBridge,e.PostMessageBridge=PostMessageBridge,e.MobileBridge=MobileBridge;var r=o(1),a=e.PlatformAPI={emitter:null,pause:function(t){var e=new CustomEvent("pause",{detail:{callback:t}});this.emitter.dispatchEvent(e)},resume:function(t){var e=new CustomEvent("resume",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostShow:function(t){var e=new CustomEvent("ghostShow",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostHide:function(t){var e=new CustomEvent("ghostHide",{detail:{callback:t}});this.emitter.dispatchEvent(e)},mute:function(t){var e=new CustomEvent("mute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},unmute:function(t){var e=new CustomEvent("unmute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},start:function(t,e){var o=new CustomEvent("start",{detail:{callback:e}}),n=r.core.startSignal(t);if(n)return void e(n);t.replay&&(o.detail.opt_replay=!0),t.ghostMode&&(o.detail.opt_ghostMode=!0),t.resetState&&(o.detail.opt_resetState=!0),t.replayData&&(o.detail.replayData=t.replayData),this.emitter.dispatchEvent(o)}};PlatformBridge.prototype={instCount:0,_init:function(){},createRequest:function(t,e,o){if(this.validateMethod(t)){"function"==typeof e&&(o=e,e=void 0);var n=this.instCount++;void 0!==o&&(this.requests[n]=o);var r={request:{method:t,messageId:n,data:null}};this.doCall(r,e)}},validateMethod:function(t){return"gameLoadingProgress"!==t},doCall:function(t,e){throw"Not implemented"},_callback:function(t,e){var o=this.requests[t];delete this.requests[t],o&&o(e)},doResponse:function(t,e){throw"Not implemented"}},PostMessageBridge.prototype=Object.create(PlatformBridge.prototype),PostMessageBridge.prototype.constructor=PostMessageBridge,PostMessageBridge.prototype._init=function(){window.addEventListener("message",function(t){var e;if("object"===n(t.detail)&&null!==typeof t.detail)e=t.detail;else{if("object"!==n(t.data))return;e=t.data}if(r.core.isSilentModeEnabled(),e.request&&e.request.method&&void 0!==e.request.messageId)this._resolveAPICall(e.request.method,e.request.messageId,e.request.data);else if(e.response&&void 0!==e.response.messageId){if(e.error)throw e.error;this._callback(e.response.messageId,e.response.data)}}.bind(this),!1)},PostMessageBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),this._gameeWin.postMessage(t,"*")},PostMessageBridge.prototype.doResponse=function(t,e){var o={version:this.version,response:{messageId:t}};e&&(o.data=e),this._gameeWin.postMessage(o,"*")},PostMessageBridge.prototype._resolveAPICall=function(t,e,o){var n=this.doResponse.bind(this,e);switch(t){case"pause":a.pause(n);break;case"resume":a.resume(n);break;case"mute":a.mute(n);break;case"unmute":a.unmute(n);break;case"ghostShow":a.ghostShow(n);break;case"ghostHide":a.ghostHide(n);break;case"start":if(!o)throw"Method _start missing params";a.start(o,n);break;default:r.core.isSilentModeEnabled()}},MobileBridge.prototype=Object.create(PostMessageBridge.prototype),MobileBridge.prototype.constructor=MobileBridge,MobileBridge.prototype._init=function(){if(PostMessageBridge.prototype._init.call(this),"ios"===this.device)this._gameeWin=webkit.messageHandlers.callbackHandler;else{if("android"!==this.device)throw"Unknown device used in webkit bridge";this._gameeWin=_toDevice}window._triggerMessage=function(t){try{t=JSON.parse(t)}catch(e){throw"Couldn't parse message from native app: \n"+t+"\n"+e}r.core.isSilentModeEnabled(),this.dispatchEvent(new CustomEvent("message",{detail:t}))}.bind(window)},MobileBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),"android"===this.device&&(t=JSON.stringify(t)),this._gameeWin.postMessage(t,"*")}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){var t=this,e={};t.on=function(t,o,n){if(!(arguments.length<2||"string"!=typeof t||"function"!=typeof o)){var r=o.toString();void 0!==e[t]?void 0===e[t].callbacks[r]?e[t].callbacks[r]={cb:o,once:!!n}:"boolean"==typeof n&&(e[t].callbacks[r].once=n):(e[t]={callbacks:{}},e[t].callbacks[r]={cb:o,once:!!n})}},t.once=function(e,o){t.on(e,o,!0)},t.off=function(t,o){if("string"==typeof t&&void 0!==e[t])if("function"==typeof o){var n=o.toString(),r=e[t].callbacks[n];void 0!==r&&delete e[t].callbacks[n]}else delete e[t]},t.trigger=function(o,n){if("string"==typeof o&&void 0!==e[o])for(var r in e[o].callbacks){var a=e[o].callbacks[r];"function"==typeof a.cb&&a.cb(n),"boolean"==typeof a.once&&!0===a.once&&t.off(o,a.cb)}}};e.Bullet=new n},function(t,e,o){"use strict";function Button(t,e){var o=this;r.call(this),this._pressed=!0,this.key=t,this.keyCode=e,this.on("keydown",function(){o._pressed=!0}),this.on("keyup",function(){o._pressed=!1})}function Controller(){var t=this;r.call(this),this.buttons={},this.buttonAlias={},this.on("$keydown",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keydown",e)}),this.on("$keyup",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keyup",e)}),this.on("keydown",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keydown")}),this.on("keyup",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keyup")})}function OneButtonController(){Controller.call(this),this.addButton(new Button("button",32))}function TwoButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39))}function TwoActionButtonsController(){Controller.call(this),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function FiveButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32))}function SixButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function TwoArrowsOneButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function TwoArrowsTwoButtonsController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourArrowController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40))}function TouchController(){var t=this;Controller.call(this),this.on("$touchstart",function(e){t.trigger("touchstart",e)}),this.on("$touchend",function(e){t.trigger("touchend",e)}),this.on("$touchmove",function(e){t.trigger("touchmove",e)}),this.on("$touchleave",function(e){t.trigger("touchleave",e)}),this.on("$touchcancel",function(e){t.trigger("touchcancel",e)})}function JoystickController(){var t=this;Controller.call(this),this.x=0,this.y=0,this.on("$change",function(e){t.x=e.position.x,t.y=e.position.y,t.trigger("change",e)})}function JoystickButtonController(){JoystickController.call(this),this.addButton(new Button("button",32))}Object.defineProperty(e,"__esModule",{value:!0}),e.BulletClass=void 0,e.Button=Button,e.Controller=Controller,e.OneButtonController=OneButtonController,e.TwoButtonController=TwoButtonController,e.TwoActionButtonsController=TwoActionButtonsController,e.FourButtonController=FourButtonController,e.FiveButtonController=FiveButtonController,e.SixButtonController=SixButtonController,e.TwoArrowsOneButtonController=TwoArrowsOneButtonController,e.TwoArrowsTwoButtonsController=TwoArrowsTwoButtonsController,e.FourArrowController=FourArrowController,e.TouchController=TouchController,e.JoystickController=JoystickController,e.JoystickButtonController=JoystickButtonController;var n=o(4),r=e.BulletClass=n.Bullet.constructor;Button.prototype=Object.create(r.constructor.prototype),Button.constructor=Button,Button.prototype.isDown=function(){return this._pressed},Controller.prototype=Object.create(r.constructor.prototype),Controller.constructor=Controller,Controller.prototype.addButton=function(t){this.buttons[t.key]=t},Controller.prototype.enableKeyboard=function(t){var e,o,n={},r=this;for(e in this.buttons)o=this.buttons[e],o.keyCode&&(n[o.keyCode]=o);t._keydown(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keydown",{button:e.key}))}),t._keyup(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keyup",{button:e.key}))})},Controller.prototype.remapButton=function(t,e){if(e.name&&(e=e.name),!this.buttons[t])throw Error("Button "+t+" was not found in controller");this.buttonAlias[t]=e.name,this.buttons[e.name]=this.buttons[t],delete this.buttons[t]},OneButtonController.prototype=Object.create(Controller.prototype),OneButtonController.prototype.constructor=OneButtonController,TwoButtonController.prototype=Object.create(Controller.prototype),TwoButtonController.prototype.constructor=TwoButtonController,TwoActionButtonsController.prototype=Object.create(Controller.prototype),TwoActionButtonsController.prototype.constructor=TwoActionButtonsController,FourButtonController.prototype=Object.create(Controller.prototype),FourButtonController.prototype.constructor=FourButtonController,FiveButtonController.prototype=Object.create(Controller.prototype),FiveButtonController.prototype.constructor=FiveButtonController,SixButtonController.prototype=Object.create(Controller.prototype),SixButtonController.prototype.constructor=SixButtonController,TwoArrowsOneButtonController.prototype=Object.create(Controller.prototype),TwoArrowsOneButtonController.prototype.constructor=TwoArrowsOneButtonController,TwoArrowsTwoButtonsController.prototype=Object.create(Controller.prototype),TwoArrowsTwoButtonsController.prototype.constructor=TwoArrowsTwoButtonsController,FourArrowController.prototype=Object.create(Controller.prototype),FourArrowController.prototype.constructor=FourArrowController,TouchController.prototype=Object.create(TouchController.prototype),TouchController.prototype.constructor=TouchController,JoystickController.prototype=Object.create(Controller.prototype),JoystickController.prototype.constructor=JoystickController,JoystickButtonController.prototype=Object.create(JoystickController.prototype),JoystickButtonController.prototype.constructor=JoystickButtonController},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.gamee=void 0,o(0);var n=o(2),r=o(1),a=o(3),i=e.gamee=void 0,u=function(){var t,o="web",r=navigator.userAgent.toLowerCase();switch(/iphone|ipod|ipad/.test(r)?o=window.self!==window.top?"web":"ios":/gamee\/[0-9\.]+$/.test(r)?o="android":window.parent?o="web":window.parent&&window.parent.gameeSimulator&&(o="web"),e.gamee=i=new n.Gamee(o),window.gamee=i,o){case"web":window.parent,window,t=new a.PostMessageBridge(window.parent);break;case"ios":t=new a.MobileBridge("ios");break;case"android":t=new a.MobileBridge("android");break;default:throw"Can't identify the platform"}return t}();r.core.PlatformAPI=a.PlatformAPI,r.core.native=u,a.PlatformAPI.emitter=i.emitter},function(t,e){var o;o=function(){return this}();try{o=o||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(o=window)}t.exports=o}])}); //# sourceMappingURL=gamee-js.min.js.map \ No newline at end of file diff --git a/gamee/dist/gamee-js.min.js.map b/gamee/dist/gamee-js.min.js.map index 1672edd..ba3a039 100644 --- a/gamee/dist/gamee-js.min.js.map +++ b/gamee/dist/gamee-js.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6","webpack:///gamee-js.min.js","webpack:///webpack/bootstrap e3344513ac420d153d79?1c4f","webpack:///./gamee/libs/shims.js?26b9","webpack:///./gamee/src/core.js?6b70","webpack:///./gamee/src/gameeAPI.js?7205","webpack:///./gamee/src/platform_bridge.js?848f","webpack:///./gamee/libs/bullet.js?d693","webpack:///./gamee/src/game_controllers.js?1af2","webpack:///./gamee/src/index.js?b323","webpack:///(webpack)/buildin/global.js?3698"],"names":["root","factory","exports","module","define","amd","a","i","this","modules","__webpack_require__","moduleId","installedModules","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","CustomEmitter","delegate","method","eventTarget","bind","document","createDocumentFragment","forEach","wrapKeyEvent","fn","ev","keyCode","window","event","which","ce","CustomEvent","preventDefault","defaultPrevented","Error","e","params","evt","origPrevent","bubbles","cancelable","detail","undefined","createEvent","initCustomEvent","Event","win","doc","docHijack","old","v","addListen","addEvent","on","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","length","addEventListener","Element","all","global","validateDataType","DataTypeException","core","_typeof","Symbol","iterator","constructor","_game_controllers","controllers","newObj","key","default","_shims","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","createController","opts","btn","controller","controllerTypes","enableKeyboard","buttons","remapButton","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","allOk","arguments","cap","Array","isArray","indexOf","native","createRequest","version","responseData","error","platform","requestController","_bindKeyboardTriggers","err","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","playerEnteredToGameRoom","playerLeftGameRoom","purchaseItemWithCoins","options","oldMethod","coins","isSilentModeEnabled","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","showSubscribeDialog","requestPlayerData","playerData","startSignal","ghostMode","mainController","additionalController","gameeNative","apply","_keydown","_keyup","OneButton","OneButtonController","TwoButtons","TwoButtonController","FourButtons","FourButtonController","FiveButtons","FiveButtonController","SixButtons","SixButtonController","FourArrows","FourArrowController","Touch","TouchController","Joystick","JoystickController","JoystickWithButton","JoystickButtonController","TwoArrowsTwoButtons","TwoArrowsTwoButtonsController","TwoArrowsOneButton","TwoArrowsOneButtonController","TwoActionButtons","TwoActionButtonsController","registerPlatform","platformAPI","silentMode","expected","present","argument","message","testedInput","expectedType","originMethod","Gamee","GameeEmitter","_core","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","requests","_init","PostMessageBridge","endpoint","_gameeWin","MobileBridge","device","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","create","_resolveAPICall","response","postMessage","opt_data","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","JSON","parse","stringify","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","_pressed","Controller","buttonAlias","addButton","x","y","position","_bullet","isDown","gamee","keyCodes","oldName","newName","_gameeAPI","_platform_bridge","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","g","Function","eval"],"mappings":";CAAA,SAAAA,EAAAC,GACA,mBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,QACA,sBAAAG,gBAAAC,IACAD,UAAAH,OACA,CACA,GAAAK,GAAAL,GACA,QAAAM,KAAAD,IAAA,gBAAAJ,iBAAAF,GAAAO,GAAAD,EAAAC,KAECC,KAAA,WACD,MCCgB,UAAUC,GCP1B,QAAAC,qBAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAT,OAGA,IAAAC,GAAAS,EAAAD,IACAJ,EAAAI,EACAE,GAAA,EACAX,WAUA,OANAO,GAAAE,GAAAG,KAAAX,EAAAD,QAAAC,IAAAD,QAAAQ,qBAG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J,EAAe,OAGnBhV,EAjCOyU,MAiCPA,EAAQ,GAAAI,GAAAvF,MAAU0F,GAElBnS,OAAO4R,MAAQA,EAEPO,GACJ,IAAK,MACGnS,OAAOsS,OAAWtS,OAGtBkS,EAAiB,GAAAD,GAAAnE,kBAAsB9N,OAAOsS,OAC9C,MACJ,KAAK,MACDJ,EAAiB,GAAAD,GAAAhE,aAAiB,MAClC,MACJ,KAAK,UACDiE,EAAiB,GAAAD,GAAAhE,aAAiB,UAClC,MACJ,SACI,KAAM,8BAEd,MAAOiE,KAGXvF,GAAAnK,KAAK2L,YAAL8D,EAAA9D,YACAxB,EAAAnK,KAAK6D,OAAS6L,EAEdD,EAAA9D,YAAYvB,QAAUgF,EAAMhF,SRy6EtB,SAAUxP,EAAQD,GSh/ExB,GAAAqV,EAGAA,GAAA,WACA,MAAA/U,QAGA,KAEA+U,KAAAC,SAAA,qBAAAC,MAAA,QACC,MAAAlS,GAED,gBAAAR,UACAwS,EAAAxS,QAOA5C,EAAAD,QAAAqV","file":"gamee-js.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","/*! @preserve build time 2019-10-15 10:05:46 */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 6);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.CustomEmitter = CustomEmitter;\nexports.wrapKeyEvent = wrapKeyEvent;\n/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function CustomEvent(event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function get() {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return; //No need to polyfill\n\n\tfunction docHijack(p) {\n\t\tvar old = doc[p];doc[p] = function (v) {\n\t\t\treturn addListen(old(v));\n\t\t};\n\t}\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () {\n\t\t\t\te.returnValue = false;\n\t\t\t};\n\t\t\te.stopPropagation = e.stopPropagation || function () {\n\t\t\t\te.cancelBubble = true;\n\t\t\t};\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--) {\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t\t}\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent; //IE8\n\telse {\n\t\t\t//IE < 8\n\t\t\tdoc.attachEvent('onreadystatechange', function () {\n\t\t\t\taddListen(doc.all);\n\t\t\t}); //Make sure we also init at domReady\n\t\t\tdocHijack('getElementsByTagName');\n\t\t\tdocHijack('getElementById');\n\t\t\tdocHijack('createElement');\n\t\t\taddListen(doc.all);\n\t\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nfunction CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\"addEventListener\", \"dispatchEvent\", \"removeEventListener\"].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nfunction wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.validateDataType = exports.DataTypeException = exports.core = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _game_controllers = __webpack_require__(5);\n\nvar controllers = _interopRequireWildcard(_game_controllers);\n\nvar _shims = __webpack_require__(0);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function overloadedAudioContext(type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function resume() {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx;\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) {\n // throw error in async part\n setTimeout(function () {\n throw e;\n }, 0);\n }\n})();\n\n/**\n * @class core\n */\nvar core = exports.core = function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function noop() {};\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\", \"rewardedAds\", \"coins\", \"logEvents\", \"playerData\", \"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true,\n cap = {};\n if (capabilities !== undefined && Array.isArray(capabilities)) {\n for (var i = 0; i < capabilities.length; i++) {\n if (typeof capabilities[i] !== \"string\" || internals.CAPABILITIES.indexOf(capabilities[i]) === -1) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk) throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if (typeof percentage !== \"number\" || percentage < 0 || percentage > 100) throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n }();\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\") throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if (!cache.capabilities.saveState) throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb, numberOfPlayers) {\n\n if (!cache.capabilities.socialData) throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if (!cache.capabilities.logEvents) throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", { eventName: eventName, eventValue: eventValue }, function (error) {\n if (error) {\n throw error;\n }\n });\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if (!cache.capabilities.replay) throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredToGameRoom = function () {\n this.native.createRequest('playerEnteredToGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if (!cache.capabilities.coins) throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if (!cache.capabilities.gems) throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if (!cache.capabilities.share) throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Share Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if (!cache.capabilities.playerData) throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n var options = undefined;\n if (userID) {\n options = { userID: userID };\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay) error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode) error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function requestController(type, opts) {\n if (type === \"FullScreen\") return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function additionalController(type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function trigger() {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n}();\n\nvar DataTypeException = exports.DataTypeException = function DataTypeException(expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = \"Invalid data type in method \" + this.method + \", argument \" + this.argument + \" is expected to be \" + this.expected + \", but found \" + this.present;\n};\n\nvar validateDataType = exports.validateDataType = function validateDataType(testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput)) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n break;\n\n default:\n if ((typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput)) !== expectedType) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Gamee = exports.GameeEmitter = undefined;\n\nvar _core = __webpack_require__(1);\n\nvar _shims = __webpack_require__(0);\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nvar GameeEmitter = exports.GameeEmitter = function GameeEmitter() {\n _shims.CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nvar Gamee = exports.Gamee = function Gamee(platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = function () {\n\n var cbError = function cbError(err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: _core.core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function gameInit(controllType, controllOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n (0, _core.validateDataType)(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n (0, _core.validateDataType)(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n (0, _core.validateDataType)(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.gameInit\");\n (0, _core.validateDataType)(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = _core.core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function gameLoadingProgress(percentage, opt_cb) {\n (0, _core.validateDataType)(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n _core.core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function gameReady(opt_cb) {\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n _core.core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function gameSave(data, opt_share, opt_cb) {\n var share = false,\n cb;\n (0, _core.validateDataType)(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function') opt_cb = opt_share;else if (typeof opt_share !== \"undefined\") (0, _core.validateDataType)(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n _core.core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function getPlatform() {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function updateScore(score, opt_ghostSign, opt_cb) {\n (0, _core.validateDataType)(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\") opt_cb = opt_ghostSign;else if (typeof opt_ghostSign !== \"undefined\") (0, _core.validateDataType)(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n _core.core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function gameOver(opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\") opt_cb = opt_replayData;else if (typeof opt_replayData !== \"undefined\") (0, _core.validateDataType)(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n (0, _core.validateDataType)(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n _core.core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function requestSocial(cb, numberOfPlayers) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = _core.core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function logEvent(eventName, eventValue) {\n\n (0, _core.validateDataType)(eventName, \"string\", \"eventName\", \"gamee.logEvent\");\n\n if (!eventName || eventName.length > 24) {\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return;\n }\n\n (0, _core.validateDataType)(eventValue, \"string\", \"eventValue\", \"gamee.logEvent\");\n\n if (!eventValue || eventValue.length > 160) {\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return;\n }\n\n _core.core.logEvent(eventName, eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function requestBattleData(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n _core.core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function requestPlayerReplay(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n _core.core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function requestPlayerSaveState(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n _core.core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredToGameRoom\n * @member of Gamee\n */\n playerEnteredToGameRoom: function playerEnteredToGameRoom() {\n _core.core.playerEnteredToGameRoom();\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function playerLeftGameRoom() {\n _core.core.playerLeftGameRoom();\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function purchaseItem(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItem\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItem\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb, true);\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function purchaseItemWithCoins(purchaseDetails, cb) {\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithCoins\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithCoins\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb);\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function purchaseItemWithGems(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithGems\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithGems\");\n\n _core.core.purchaseItemWithGems(purchaseDetails, cb);\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function share(shareDetails, cb) {\n (0, _core.validateDataType)(shareDetails, \"object\", \"shareDetails\", \"gamee.share\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.share\");\n\n _core.core.share(shareDetails, cb);\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function loadRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.loadRewardedVideo\");\n _core.core.loadRewardedVideo(cb);\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function showRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showRewardedVideo\");\n _core.core.showRewardedVideo(cb);\n },\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function showSubscribeDialog(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showSubscribeDialog\");\n _core.core.showSubscribeDialog(cb);\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function requestPlayerData(cb, userID) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerData\");\n if (userID !== undefined) {\n (0, _core.validateDataType)(userID, \"number\", \"userId\", \"gamee.requestPlayerData\");\n }\n _core.core.requestPlayerData(cb, userID);\n }\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n}();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.PlatformAPI = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.PlatformBridge = PlatformBridge;\nexports.PostMessageBridge = PostMessageBridge;\nexports.MobileBridge = MobileBridge;\n\nvar _core = __webpack_require__(1);\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nvar PlatformAPI = exports.PlatformAPI = {\n\temitter: null,\n\tpause: function pause(cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function resume(cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function ghostShow(cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function ghostHide(cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function mute(cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function unmute(cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function start(data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = _core.core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay) event.detail.opt_replay = true;\n\t\tif (data.ghostMode) event.detail.opt_ghostMode = true;\n\t\tif (data.resetState) event.detail.opt_resetState = true;\n\t\tif (data.replayData) {\n\t\t\tevent.detail.replayData = data.replayData;\n\t\t}\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n/**\n * @class PlatformBridge\n *\n */\nfunction PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function _init() {},\n\tcreateRequest: function createRequest(method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method)) return;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function validateMethod(method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n * @abstract\n */\n\tdoCall: function doCall(preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function _callback(id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb) cb(responseData);\n\t},\n\t/**\n * @abstract\n */\n\tdoResponse: function doResponse(preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t}\n};\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nfunction PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (_typeof(ev.detail) === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (_typeof(ev.data) === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4) + ' data');\n\t\t}\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\t\tif (data.error) throw data.error;\n\t\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData) preparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\t\tconsole.error(\"Unknown method call\");\n\t\t\t}\n\t}\n};\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nfunction MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4));\n\t\t}\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar BulletClass = function BulletClass() {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 || typeof event !== \"string\" || typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n } else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n } else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n } else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n};\n\nvar Bullet = exports.Bullet = new BulletClass();\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.BulletClass = undefined;\nexports.Button = Button;\nexports.Controller = Controller;\nexports.OneButtonController = OneButtonController;\nexports.TwoButtonController = TwoButtonController;\nexports.TwoActionButtonsController = TwoActionButtonsController;\nexports.FourButtonController = FourButtonController;\nexports.FiveButtonController = FiveButtonController;\nexports.SixButtonController = SixButtonController;\nexports.TwoArrowsOneButtonController = TwoArrowsOneButtonController;\nexports.TwoArrowsTwoButtonsController = TwoArrowsTwoButtonsController;\nexports.FourArrowController = FourArrowController;\nexports.TouchController = TouchController;\nexports.JoystickController = JoystickController;\nexports.JoystickButtonController = JoystickButtonController;\n\nvar _bullet = __webpack_require__(4);\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nvar BulletClass = exports.BulletClass = _bullet.Bullet.constructor;\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nfunction Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nfunction Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key,\n\t button,\n\t keyCodes = {},\n\t self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nfunction OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nfunction TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nfunction TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nfunction FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nfunction FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nfunction SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nfunction TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nfunction TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nfunction FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nfunction TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nfunction JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nfunction JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.gamee = undefined;\n\n__webpack_require__(0);\n\nvar _gameeAPI = __webpack_require__(2);\n\nvar _core = __webpack_require__(1);\n\nvar _platform_bridge = __webpack_require__(3);\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nvar gamee = exports.gamee = undefined;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = function () {\n\n var platformBridge,\n platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) {\n // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) {\n // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) {\n // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) {\n // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n exports.gamee = gamee = new _gameeAPI.Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new _platform_bridge.PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new _platform_bridge.MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new _platform_bridge.MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n}();\n\n_core.core.PlatformAPI = _platform_bridge.PlatformAPI;\n_core.core.native = platformBridge;\n\n_platform_bridge.PlatformAPI.emitter = gamee.emitter;\n\nfunction loadScript(url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\nvar g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// gamee-js.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e3344513ac420d153d79","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredToGameRoom = function () {\n this.native.createRequest('playerEnteredToGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredToGameRoom\n * @member of Gamee\n */\n playerEnteredToGameRoom: function () {\n core.playerEnteredToGameRoom()\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function () {\n core.playerLeftGameRoom()\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function (cb){\n validateDataType(cb,\"function\",\"cb\",\"gamee.showSubscribeDialog\");\n core.showSubscribeDialog(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6","webpack:///gamee-js.min.js","webpack:///webpack/bootstrap 617022220ca38c913700?c093","webpack:///./gamee/libs/shims.js?26b9","webpack:///./gamee/src/core.js?6b70","webpack:///./gamee/src/gameeAPI.js?7205","webpack:///./gamee/src/platform_bridge.js?848f","webpack:///./gamee/libs/bullet.js?d693","webpack:///./gamee/src/game_controllers.js?1af2","webpack:///./gamee/src/index.js?b323","webpack:///(webpack)/buildin/global.js?3698"],"names":["root","factory","exports","module","define","amd","a","i","this","modules","__webpack_require__","moduleId","installedModules","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","CustomEmitter","delegate","method","eventTarget","bind","document","createDocumentFragment","forEach","wrapKeyEvent","fn","ev","keyCode","window","event","which","ce","CustomEvent","preventDefault","defaultPrevented","Error","e","params","evt","origPrevent","bubbles","cancelable","detail","undefined","createEvent","initCustomEvent","Event","win","doc","docHijack","old","v","addListen","addEvent","on","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","length","addEventListener","Element","all","global","validateDataType","DataTypeException","core","_typeof","Symbol","iterator","constructor","_game_controllers","controllers","newObj","key","default","_shims","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","createController","opts","btn","controller","controllerTypes","enableKeyboard","buttons","remapButton","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","allOk","arguments","cap","Array","isArray","indexOf","native","createRequest","version","responseData","error","platform","requestController","_bindKeyboardTriggers","err","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","playerEnteredGameRoom","playerLeftGameRoom","purchaseItemWithCoins","options","oldMethod","coins","isSilentModeEnabled","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","showSubscribeDialog","requestPlayerData","playerData","startSignal","ghostMode","mainController","additionalController","gameeNative","apply","_keydown","_keyup","OneButton","OneButtonController","TwoButtons","TwoButtonController","FourButtons","FourButtonController","FiveButtons","FiveButtonController","SixButtons","SixButtonController","FourArrows","FourArrowController","Touch","TouchController","Joystick","JoystickController","JoystickWithButton","JoystickButtonController","TwoArrowsTwoButtons","TwoArrowsTwoButtonsController","TwoArrowsOneButton","TwoArrowsOneButtonController","TwoActionButtons","TwoActionButtonsController","registerPlatform","platformAPI","silentMode","expected","present","argument","message","testedInput","expectedType","originMethod","Gamee","GameeEmitter","_core","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","requests","_init","PostMessageBridge","endpoint","_gameeWin","MobileBridge","device","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","create","_resolveAPICall","response","postMessage","opt_data","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","JSON","parse","stringify","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","_pressed","Controller","buttonAlias","addButton","x","y","position","_bullet","isDown","gamee","keyCodes","oldName","newName","_gameeAPI","_platform_bridge","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","g","Function","eval"],"mappings":";CAAA,SAAAA,EAAAC,GACA,mBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,QACA,sBAAAG,gBAAAC,IACAD,UAAAH,OACA,CACA,GAAAK,GAAAL,GACA,QAAAM,KAAAD,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BAOPM,EAAkB,WAElB,GAAIA,GAAgBC,EAAe,MAI/BzO,EAAYD,UAAUC,UAAU0O,aAwBpC,QAtBI,mBAAmB5O,KAAKE,GAKpByO,EADAnS,OAAO2B,OAAS3B,OAAOqS,IACR,MAEA,MAEZ,mBAAmB7O,KAAKE,GAE/ByO,EAAe,UACRnS,OAAOsS,OACdH,EAAe,MACRnS,OAAOsS,QAAUtS,OAAOsS,OAAOC,iBACtCJ,EAAe,OAGnBhV,EAjCOyU,MAiCPA,EAAQ,GAAAI,GAAAvF,MAAU0F,GAElBnS,OAAO4R,MAAQA,EAEPO,GACJ,IAAK,MACGnS,OAAOsS,OAAWtS,OAGtBkS,EAAiB,GAAAD,GAAAnE,kBAAsB9N,OAAOsS,OAC9C,MACJ,KAAK,MACDJ,EAAiB,GAAAD,GAAAhE,aAAiB,MAClC,MACJ,KAAK,UACDiE,EAAiB,GAAAD,GAAAhE,aAAiB,UAClC,MACJ,SACI,KAAM,8BAEd,MAAOiE,KAGXvF,GAAAnK,KAAK2L,YAAL8D,EAAA9D,YACAxB,EAAAnK,KAAK6D,OAAS6L,EAEdD,EAAA9D,YAAYvB,QAAUgF,EAAMhF,SRy6EtB,SAAUxP,EAAQD,GSh/ExB,GAAAqV,EAGAA,GAAA,WACA,MAAA/U,QAGA,KAEA+U,KAAAC,SAAA,qBAAAC,MAAA,QACC,MAAAlS,GAED,gBAAAR,UACAwS,EAAAxS,QAOA5C,EAAAD,QAAAqV","file":"gamee-js.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","/*! @preserve build time 2019-10-15 10:59:21 */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 6);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.CustomEmitter = CustomEmitter;\nexports.wrapKeyEvent = wrapKeyEvent;\n/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function CustomEvent(event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function get() {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return; //No need to polyfill\n\n\tfunction docHijack(p) {\n\t\tvar old = doc[p];doc[p] = function (v) {\n\t\t\treturn addListen(old(v));\n\t\t};\n\t}\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () {\n\t\t\t\te.returnValue = false;\n\t\t\t};\n\t\t\te.stopPropagation = e.stopPropagation || function () {\n\t\t\t\te.cancelBubble = true;\n\t\t\t};\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--) {\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t\t}\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent; //IE8\n\telse {\n\t\t\t//IE < 8\n\t\t\tdoc.attachEvent('onreadystatechange', function () {\n\t\t\t\taddListen(doc.all);\n\t\t\t}); //Make sure we also init at domReady\n\t\t\tdocHijack('getElementsByTagName');\n\t\t\tdocHijack('getElementById');\n\t\t\tdocHijack('createElement');\n\t\t\taddListen(doc.all);\n\t\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nfunction CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\"addEventListener\", \"dispatchEvent\", \"removeEventListener\"].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nfunction wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.validateDataType = exports.DataTypeException = exports.core = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _game_controllers = __webpack_require__(5);\n\nvar controllers = _interopRequireWildcard(_game_controllers);\n\nvar _shims = __webpack_require__(0);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function overloadedAudioContext(type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function resume() {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx;\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) {\n // throw error in async part\n setTimeout(function () {\n throw e;\n }, 0);\n }\n})();\n\n/**\n * @class core\n */\nvar core = exports.core = function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function noop() {};\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\", \"rewardedAds\", \"coins\", \"logEvents\", \"playerData\", \"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true,\n cap = {};\n if (capabilities !== undefined && Array.isArray(capabilities)) {\n for (var i = 0; i < capabilities.length; i++) {\n if (typeof capabilities[i] !== \"string\" || internals.CAPABILITIES.indexOf(capabilities[i]) === -1) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk) throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if (typeof percentage !== \"number\" || percentage < 0 || percentage > 100) throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n }();\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\") throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if (!cache.capabilities.saveState) throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb, numberOfPlayers) {\n\n if (!cache.capabilities.socialData) throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if (!cache.capabilities.logEvents) throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", { eventName: eventName, eventValue: eventValue }, function (error) {\n if (error) {\n throw error;\n }\n });\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if (!cache.capabilities.replay) throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredGameRoom = function () {\n this.native.createRequest('playerEnteredGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if (!cache.capabilities.coins) throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if (!cache.capabilities.gems) throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if (!cache.capabilities.share) throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Share Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if (!cache.capabilities.playerData) throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n var options = undefined;\n if (userID) {\n options = { userID: userID };\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay) error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode) error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function requestController(type, opts) {\n if (type === \"FullScreen\") return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function additionalController(type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function trigger() {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n}();\n\nvar DataTypeException = exports.DataTypeException = function DataTypeException(expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = \"Invalid data type in method \" + this.method + \", argument \" + this.argument + \" is expected to be \" + this.expected + \", but found \" + this.present;\n};\n\nvar validateDataType = exports.validateDataType = function validateDataType(testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput)) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n break;\n\n default:\n if ((typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput)) !== expectedType) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Gamee = exports.GameeEmitter = undefined;\n\nvar _core = __webpack_require__(1);\n\nvar _shims = __webpack_require__(0);\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nvar GameeEmitter = exports.GameeEmitter = function GameeEmitter() {\n _shims.CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nvar Gamee = exports.Gamee = function Gamee(platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = function () {\n\n var cbError = function cbError(err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: _core.core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function gameInit(controllType, controllOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n (0, _core.validateDataType)(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n (0, _core.validateDataType)(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n (0, _core.validateDataType)(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.gameInit\");\n (0, _core.validateDataType)(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = _core.core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function gameLoadingProgress(percentage, opt_cb) {\n (0, _core.validateDataType)(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n _core.core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function gameReady(opt_cb) {\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n _core.core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function gameSave(data, opt_share, opt_cb) {\n var share = false,\n cb;\n (0, _core.validateDataType)(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function') opt_cb = opt_share;else if (typeof opt_share !== \"undefined\") (0, _core.validateDataType)(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n _core.core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function getPlatform() {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function updateScore(score, opt_ghostSign, opt_cb) {\n (0, _core.validateDataType)(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\") opt_cb = opt_ghostSign;else if (typeof opt_ghostSign !== \"undefined\") (0, _core.validateDataType)(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n _core.core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function gameOver(opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\") opt_cb = opt_replayData;else if (typeof opt_replayData !== \"undefined\") (0, _core.validateDataType)(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n (0, _core.validateDataType)(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n _core.core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function requestSocial(cb, numberOfPlayers) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = _core.core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function logEvent(eventName, eventValue) {\n\n (0, _core.validateDataType)(eventName, \"string\", \"eventName\", \"gamee.logEvent\");\n\n if (!eventName || eventName.length > 24) {\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return;\n }\n\n (0, _core.validateDataType)(eventValue, \"string\", \"eventValue\", \"gamee.logEvent\");\n\n if (!eventValue || eventValue.length > 160) {\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return;\n }\n\n _core.core.logEvent(eventName, eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function requestBattleData(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n _core.core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function requestPlayerReplay(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n _core.core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function requestPlayerSaveState(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n _core.core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredGameRoom\n * @member of Gamee\n */\n playerEnteredGameRoom: function playerEnteredGameRoom() {\n _core.core.playerEnteredGameRoom();\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function playerLeftGameRoom() {\n _core.core.playerLeftGameRoom();\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function purchaseItem(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItem\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItem\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb, true);\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function purchaseItemWithCoins(purchaseDetails, cb) {\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithCoins\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithCoins\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb);\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function purchaseItemWithGems(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithGems\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithGems\");\n\n _core.core.purchaseItemWithGems(purchaseDetails, cb);\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function share(shareDetails, cb) {\n (0, _core.validateDataType)(shareDetails, \"object\", \"shareDetails\", \"gamee.share\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.share\");\n\n _core.core.share(shareDetails, cb);\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function loadRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.loadRewardedVideo\");\n _core.core.loadRewardedVideo(cb);\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function showRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showRewardedVideo\");\n _core.core.showRewardedVideo(cb);\n },\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function showSubscribeDialog(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showSubscribeDialog\");\n _core.core.showSubscribeDialog(cb);\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function requestPlayerData(cb, userID) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerData\");\n if (userID !== undefined) {\n (0, _core.validateDataType)(userID, \"number\", \"userId\", \"gamee.requestPlayerData\");\n }\n _core.core.requestPlayerData(cb, userID);\n }\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n}();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.PlatformAPI = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.PlatformBridge = PlatformBridge;\nexports.PostMessageBridge = PostMessageBridge;\nexports.MobileBridge = MobileBridge;\n\nvar _core = __webpack_require__(1);\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nvar PlatformAPI = exports.PlatformAPI = {\n\temitter: null,\n\tpause: function pause(cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function resume(cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function ghostShow(cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function ghostHide(cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function mute(cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function unmute(cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function start(data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = _core.core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay) event.detail.opt_replay = true;\n\t\tif (data.ghostMode) event.detail.opt_ghostMode = true;\n\t\tif (data.resetState) event.detail.opt_resetState = true;\n\t\tif (data.replayData) {\n\t\t\tevent.detail.replayData = data.replayData;\n\t\t}\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n/**\n * @class PlatformBridge\n *\n */\nfunction PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function _init() {},\n\tcreateRequest: function createRequest(method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method)) return;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function validateMethod(method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n * @abstract\n */\n\tdoCall: function doCall(preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function _callback(id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb) cb(responseData);\n\t},\n\t/**\n * @abstract\n */\n\tdoResponse: function doResponse(preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t}\n};\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nfunction PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (_typeof(ev.detail) === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (_typeof(ev.data) === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4) + ' data');\n\t\t}\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\t\tif (data.error) throw data.error;\n\t\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData) preparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\t\tconsole.error(\"Unknown method call\");\n\t\t\t}\n\t}\n};\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nfunction MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4));\n\t\t}\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar BulletClass = function BulletClass() {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 || typeof event !== \"string\" || typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n } else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n } else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n } else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n};\n\nvar Bullet = exports.Bullet = new BulletClass();\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.BulletClass = undefined;\nexports.Button = Button;\nexports.Controller = Controller;\nexports.OneButtonController = OneButtonController;\nexports.TwoButtonController = TwoButtonController;\nexports.TwoActionButtonsController = TwoActionButtonsController;\nexports.FourButtonController = FourButtonController;\nexports.FiveButtonController = FiveButtonController;\nexports.SixButtonController = SixButtonController;\nexports.TwoArrowsOneButtonController = TwoArrowsOneButtonController;\nexports.TwoArrowsTwoButtonsController = TwoArrowsTwoButtonsController;\nexports.FourArrowController = FourArrowController;\nexports.TouchController = TouchController;\nexports.JoystickController = JoystickController;\nexports.JoystickButtonController = JoystickButtonController;\n\nvar _bullet = __webpack_require__(4);\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nvar BulletClass = exports.BulletClass = _bullet.Bullet.constructor;\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nfunction Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nfunction Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key,\n\t button,\n\t keyCodes = {},\n\t self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nfunction OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nfunction TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nfunction TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nfunction FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nfunction FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nfunction SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nfunction TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nfunction TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nfunction FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nfunction TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nfunction JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nfunction JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.gamee = undefined;\n\n__webpack_require__(0);\n\nvar _gameeAPI = __webpack_require__(2);\n\nvar _core = __webpack_require__(1);\n\nvar _platform_bridge = __webpack_require__(3);\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nvar gamee = exports.gamee = undefined;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = function () {\n\n var platformBridge,\n platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) {\n // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) {\n // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) {\n // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) {\n // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n exports.gamee = gamee = new _gameeAPI.Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new _platform_bridge.PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new _platform_bridge.MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new _platform_bridge.MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n}();\n\n_core.core.PlatformAPI = _platform_bridge.PlatformAPI;\n_core.core.native = platformBridge;\n\n_platform_bridge.PlatformAPI.emitter = gamee.emitter;\n\nfunction loadScript(url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\nvar g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// gamee-js.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 617022220ca38c913700","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredGameRoom = function () {\n this.native.createRequest('playerEnteredGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredGameRoom\n * @member of Gamee\n */\n playerEnteredGameRoom: function () {\n core.playerEnteredGameRoom()\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function () {\n core.playerLeftGameRoom()\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function (cb){\n validateDataType(cb,\"function\",\"cb\",\"gamee.showSubscribeDialog\");\n core.showSubscribeDialog(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file diff --git a/gamee/src/core.js b/gamee/src/core.js index ccf35cf..a0dd67b 100644 --- a/gamee/src/core.js +++ b/gamee/src/core.js @@ -392,8 +392,8 @@ export var core = (function () { }); }; - core.playerEnteredToGameRoom = function () { - this.native.createRequest('playerEnteredToGameRoom'); + core.playerEnteredGameRoom = function () { + this.native.createRequest('playerEnteredGameRoom'); }; core.playerLeftGameRoom = function () { diff --git a/gamee/src/gameeAPI.js b/gamee/src/gameeAPI.js index 81d1fcb..97eae9e 100644 --- a/gamee/src/gameeAPI.js +++ b/gamee/src/gameeAPI.js @@ -270,11 +270,11 @@ Gamee.prototype = (function () { }, /* - * playerEnteredToGameRoom + * playerEnteredGameRoom * @member of Gamee */ - playerEnteredToGameRoom: function () { - core.playerEnteredToGameRoom() + playerEnteredGameRoom: function () { + core.playerEnteredGameRoom() }, /* From c221c5764ab9c886427122c830f9b4e52ea08873 Mon Sep 17 00:00:00 2001 From: Hadik Date: Thu, 17 Oct 2019 16:04:57 +0200 Subject: [PATCH 5/5] Tempomary fix version --- gamee/dist/gamee-js.js | 4 ++-- gamee/dist/gamee-js.js.map | 2 +- gamee/dist/gamee-js.min.js | 4 ++-- gamee/dist/gamee-js.min.js.map | 2 +- gamee/src/core.js | 2 +- package.json | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gamee/dist/gamee-js.js b/gamee/dist/gamee-js.js index 0ea4024..0a8afd1 100644 --- a/gamee/dist/gamee-js.js +++ b/gamee/dist/gamee-js.js @@ -1,4 +1,4 @@ -/*! @preserve build time 2019-10-15 10:59:21 */ +/*! @preserve build time 2019-10-17 14:04:37 */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -329,7 +329,7 @@ var core = exports.core = function () { /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */ var internals = { - VERSION: "2.4.1", // version of the gamee library + VERSION: "2.4.0", // version of the gamee library CAPABILITIES: ["ghostMode", "saveState", "replay", "socialData", "rewardedAds", "coins", "logEvents", "playerData", "share", "gems"], // supported capabilities variant: 0, // for automating communication with server soundUnlocked: false, diff --git a/gamee/dist/gamee-js.js.map b/gamee/dist/gamee-js.js.map index f239379..6b89bd9 100644 --- a/gamee/dist/gamee-js.js.map +++ b/gamee/dist/gamee-js.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 617022220ca38c913700","webpack:///./gamee/libs/shims.js","webpack:///./gamee/src/core.js","webpack:///./gamee/src/gameeAPI.js","webpack:///./gamee/src/platform_bridge.js","webpack:///./gamee/libs/bullet.js","webpack:///./gamee/src/game_controllers.js","webpack:///./gamee/src/index.js","webpack:///(webpack)/buildin/global.js"],"names":["CustomEmitter","wrapKeyEvent","shimCustomEvent","ce","window","CustomEvent","preventDefault","defaultPrevented","Error","e","event","params","evt","origPrevent","bubbles","cancelable","detail","undefined","document","createEvent","initCustomEvent","call","Object","defineProperty","get","prototype","Event","win","doc","addEventListener","docHijack","p","old","v","addListen","addEvent","on","fn","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","i","length","Element","all","eventTarget","createDocumentFragment","delegate","method","bind","forEach","ev","keyCode","which","controllers","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","core","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","silentMode","allOk","cap","Array","isArray","indexOf","native","createRequest","version","controller","responseData","error","platform","requestController","enableKeyboard","_bindKeyboardTriggers","err","global","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","hasOwnProperty","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","playerEnteredGameRoom","playerLeftGameRoom","purchaseItemWithCoins","options","oldMethod","coins","propertiesList","property","isSilentModeEnabled","console","log","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","showSubscribeDialog","requestPlayerData","playerData","startSignal","ghostMode","mainController","opts","createController","additionalController","gameeNative","apply","arguments","_keydown","_keyup","btn","controllerTypes","buttons","remapButton","OneButtonController","TwoButtonController","FourButtonController","FiveButtonController","SixButtonController","FourArrowController","TouchController","JoystickController","JoystickButtonController","TwoArrowsTwoButtonsController","TwoArrowsOneButtonController","TwoActionButtonsController","registerPlatform","platformAPI","DataTypeException","expected","present","argument","message","validateDataType","testedInput","expectedType","originMethod","GameeEmitter","Gamee","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","result","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","PostMessageBridge","MobileBridge","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","requests","_init","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","endpoint","_gameeWin","create","constructor","JSON","stringify","_resolveAPICall","response","postMessage","opt_data","device","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","parse","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","Controller","key","_pressed","isDown","buttonAlias","addButton","gamee","keyCodes","oldName","newName","name","x","y","position","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","loadScript","url","head","getElementsByTagName","script","createElement","src","onreadystatechange","onload","appendChild"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;QC6BgBA,a,GAAAA,a;QAoBAC,Y,GAAAA,Y;AAjHhB;;;AAGA,CAAC,SAASC,eAAT,GAA2B;AAC3B,KAAI;AACH,MAAIC,KAAK,IAAIC,OAAOC,WAAX,CAAuB,MAAvB,CAAT;AACAF,KAAGG,cAAH;AACA,MAAIH,GAAGI,gBAAH,KAAwB,IAA5B,EAAkC;AACjC;AACA;AACA,SAAM,IAAIC,KAAJ,CAAU,2BAAV,CAAN;AACA;AACD,EARD,CAQE,OAAOC,CAAP,EAAU;AACX,MAAIJ,cAAc,SAAdA,WAAc,CAAUK,KAAV,EAAiBC,MAAjB,EAAyB;AAC1C,OAAIC,GAAJ,EAASC,WAAT;AACAF,YAASA,UAAU;AAClBG,aAAS,KADS;AAElBC,gBAAY,KAFM;AAGlBC,YAAQC;AAHU,IAAnB;;AAMAL,SAAMM,SAASC,WAAT,CAAqB,aAArB,CAAN;AACAP,OAAIQ,eAAJ,CAAoBV,KAApB,EAA2BC,OAAOG,OAAlC,EAA2CH,OAAOI,UAAlD,EAA8DJ,OAAOK,MAArE;AACAH,iBAAcD,IAAIN,cAAlB;AACAM,OAAIN,cAAJ,GAAqB,YAAY;AAChCO,gBAAYQ,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;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"gamee-js.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 617022220ca38c913700","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredGameRoom = function () {\n this.native.createRequest('playerEnteredGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredGameRoom\n * @member of Gamee\n */\n playerEnteredGameRoom: function () {\n core.playerEnteredGameRoom()\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function () {\n core.playerLeftGameRoom()\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function (cb){\n validateDataType(cb,\"function\",\"cb\",\"gamee.showSubscribeDialog\");\n core.showSubscribeDialog(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap ccb5c86008c7f7644613","webpack:///./gamee/libs/shims.js","webpack:///./gamee/src/core.js","webpack:///./gamee/src/gameeAPI.js","webpack:///./gamee/src/platform_bridge.js","webpack:///./gamee/libs/bullet.js","webpack:///./gamee/src/game_controllers.js","webpack:///./gamee/src/index.js","webpack:///(webpack)/buildin/global.js"],"names":["CustomEmitter","wrapKeyEvent","shimCustomEvent","ce","window","CustomEvent","preventDefault","defaultPrevented","Error","e","event","params","evt","origPrevent","bubbles","cancelable","detail","undefined","document","createEvent","initCustomEvent","call","Object","defineProperty","get","prototype","Event","win","doc","addEventListener","docHijack","p","old","v","addListen","addEvent","on","fn","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","i","length","Element","all","eventTarget","createDocumentFragment","delegate","method","bind","forEach","ev","keyCode","which","controllers","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","core","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","silentMode","allOk","cap","Array","isArray","indexOf","native","createRequest","version","controller","responseData","error","platform","requestController","enableKeyboard","_bindKeyboardTriggers","err","global","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","hasOwnProperty","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","playerEnteredGameRoom","playerLeftGameRoom","purchaseItemWithCoins","options","oldMethod","coins","propertiesList","property","isSilentModeEnabled","console","log","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","showSubscribeDialog","requestPlayerData","playerData","startSignal","ghostMode","mainController","opts","createController","additionalController","gameeNative","apply","arguments","_keydown","_keyup","btn","controllerTypes","buttons","remapButton","OneButtonController","TwoButtonController","FourButtonController","FiveButtonController","SixButtonController","FourArrowController","TouchController","JoystickController","JoystickButtonController","TwoArrowsTwoButtonsController","TwoArrowsOneButtonController","TwoActionButtonsController","registerPlatform","platformAPI","DataTypeException","expected","present","argument","message","validateDataType","testedInput","expectedType","originMethod","GameeEmitter","Gamee","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","result","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","PostMessageBridge","MobileBridge","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","requests","_init","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","endpoint","_gameeWin","create","constructor","JSON","stringify","_resolveAPICall","response","postMessage","opt_data","device","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","parse","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","Controller","key","_pressed","isDown","buttonAlias","addButton","gamee","keyCodes","oldName","newName","name","x","y","position","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","loadScript","url","head","getElementsByTagName","script","createElement","src","onreadystatechange","onload","appendChild"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA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S,YAAV,CAAR;;AAEAnS,WAAO0R,KAAP,GAAeA,KAAf;;AAEA,YAAQS,YAAR;AACI,aAAK,KAAL;AACI,gBAAInS,OAAOsS,MAAP,KAAkBtS,MAAtB,EAA8B;AAC1ByJ,wBAAQnD,KAAR,CAAc,0CAAd;AACH;AACD4L,6BAAiB,uCAAsBlS,OAAOsS,MAA7B,CAAjB;AACA;AACJ,aAAK,KAAL;AACIJ,6BAAiB,kCAAiB,KAAjB,CAAjB;AACA;AACJ,aAAK,SAAL;AACIA,6BAAiB,kCAAiB,SAAjB,CAAjB;AACA;AACJ;AACI,kBAAM,6BAAN;AAdR;AAgBA,WAAOA,cAAP;AACH,CA/CoB,EAArB;;AAiDA,WAAKpE,WAAL;AACA,WAAK7H,MAAL,GAAciM,cAAd;;AAEA,6BAAYvF,OAAZ,GAAsB+E,MAAM/E,OAA5B;;AAGA,SAAS6F,UAAT,CAAqBC,GAArB,EAA0BzE,QAA1B,EAAoC;AAChC;AACA,QAAI0E,OAAO5R,SAAS6R,oBAAT,CAA8B,MAA9B,EAAsC,CAAtC,CAAX;AACA,QAAIC,SAAS9R,SAAS+R,aAAT,CAAuB,QAAvB,CAAb;AACAD,WAAOE,GAAP,GAAaL,GAAb;;AAEA;AACA;AACAG,WAAOG,kBAAP,GAA4B/E,QAA5B;AACA4E,WAAOI,MAAP,GAAgBhF,QAAhB;;AAEA;AACA0E,SAAKO,WAAL,CAAiBL,MAAjB;AACH,C;;;;;;ACvFD;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C","file":"gamee-js.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ccb5c86008c7f7644613","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.0\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredGameRoom = function () {\n this.native.createRequest('playerEnteredGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredGameRoom\n * @member of Gamee\n */\n playerEnteredGameRoom: function () {\n core.playerEnteredGameRoom()\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function () {\n core.playerLeftGameRoom()\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function (cb){\n validateDataType(cb,\"function\",\"cb\",\"gamee.showSubscribeDialog\");\n core.showSubscribeDialog(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file diff --git a/gamee/dist/gamee-js.min.js b/gamee/dist/gamee-js.min.js index 8bdacb9..faec33c 100644 --- a/gamee/dist/gamee-js.min.js +++ b/gamee/dist/gamee-js.min.js @@ -1,3 +1,3 @@ -/*! @preserve build time 2019-10-15 10:59:21 */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,function(){return function(t){function __webpack_require__(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,__webpack_require__),n.l=!0,n.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.i=function(t){return t},__webpack_require__.d=function(t,e,o){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=6)}([function(t,e,o){"use strict";function CustomEmitter(){function delegate(e){this[e]=t[e].bind(t)}var t=document.createDocumentFragment();["addEventListener","dispatchEvent","removeEventListener"].forEach(delegate,this)}function wrapKeyEvent(t){return function(e){return e&&e.keyCode||(e||(e=window.event),e.which&&(e.keyCode=e.which)),t(e)}}Object.defineProperty(e,"__esModule",{value:!0}),e.CustomEmitter=CustomEmitter,e.wrapKeyEvent=wrapKeyEvent,function(){try{var t=new window.CustomEvent("test");if(t.preventDefault(),!0!==t.defaultPrevented)throw new Error("Could not prevent default")}catch(t){var e=function(t,e){var o,n;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},o=document.createEvent("CustomEvent"),o.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n=o.preventDefault,o.preventDefault=function(){n.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},o};e.prototype=window.Event.prototype,window.CustomEvent=e}}(),function(t,e){function docHijack(t){var o=e[t];e[t]=function(t){return addListen(o(t))}}function addEvent(e,o,n){return(n=this).attachEvent("on"+e,function(e){e=e||t.event,e.preventDefault=e.preventDefault||function(){e.returnValue=!1},e.stopPropagation=e.stopPropagation||function(){e.cancelBubble=!0},o.call(n,e)})}function addListen(t,e){if(e=t.length)for(;e--;)t[e].addEventListener=addEvent;else t.addEventListener=addEvent;return t}t.addEventListener||(addListen([e,t]),"Element"in t?t.Element.prototype.addEventListener=addEvent:(e.attachEvent("onreadystatechange",function(){addListen(e.all)}),docHijack("getElementsByTagName"),docHijack("getElementById"),docHijack("createElement"),addListen(e.all)))}(window,document)},function(t,e,o){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.validateDataType=e.DataTypeException=e.core=void 0;var n="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},r=o(5),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e.default=t,e}(r),i=o(0);!function(){var t=function(t){var e=new t;if("suspended"===e.state){var o=function resume(){if(/(iPhone|iPad)/i.test(navigator.userAgent)){var t=e.createBuffer(1,1,44100),o=e.createBufferSource();o.buffer=t,o.connect(e.destination),o.start(0),o.disconnect()}e.resume(),setTimeout(function(){"running"===e.state&&document.body.removeEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),resume,!1)},0)};document.body.addEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),o,!1)}return e};try{void 0!==window.AudioContext?window.AudioContext=t.bind(null,window.AudioContext):"undefined"!=typeof webkitAudioContext&&(window.webkitAudioContext=t.bind(null,window.webkitAudioContext))}catch(t){setTimeout(function(){throw t},0)}}();var u=(e.core=function(){function createController(t,e){var o,n;if(!u[t])throw new Error("Unsupported controller type, "+t);if(e=e||{},n=new u[t],e.enableKeyboard&&n.enableKeyboard(r),e.buttons)for(o in e.buttons)n.remapButton(o,e.buttons[o]);return n}var e=function(){},o={},n={VERSION:"2.4.1",CAPABILITIES:["ghostMode","saveState","replay","socialData","rewardedAds","coins","logEvents","playerData","share","gems"],variant:0,soundUnlocked:!1,onReady:e,onGameStart:e},r={};r.gameeInit=function(t,e,a,i){var u=(arguments.length>4&&void 0!==arguments[4]&&arguments[4],!0),s={};if(void 0!==a&&Array.isArray(a))for(var l=0;l100)throw"Percentage passed to gameLoadingProgress out of bounds or not a number.";e>t&&(t=e,this.native.createRequest("gameLoadingProgress",{percentage:e}))}}(),r.gameReady=function(){this.native.createRequest("gameReady")},r.updateScore=function(t,e){if("number"!=typeof t)throw"Score passed to updateScore is not a number.";var o={score:parseInt(t,10)};e&&(o.ghostSign=!0),this.native.createRequest("updateScore",o)},r.gameOver=function(t,e,o){o=void 0!==o&&o;var n={};if(t){if(t.hasOwnProperty("variant")||(t.variant=""),!t.hasOwnProperty("data"))throw"Replay data must have `data` property";n.replayData=t}n.hideOverlay=o,e&&(n.state=e),r.native.createRequest("gameOver",n)},r.gameSave=function(t,e){if(!o.capabilities.saveState)throw"Save State not supported, you must add the capability on gamee.Init";r.native.createRequest("saveState",{state:t,share:e})},r.requestSocial=function(t,e){if(!o.capabilities.socialData)throw"Social Data not supported, you must add the capability on gamee.Init";this.native.createRequest("requestSocial",e,function(e){t(null,e)})},r.logEvent=function(t,e){if(!o.capabilities.logEvents)throw"Log Events not supported, you must add the capability on gamee.Init";this.native.createRequest("logEvent",{eventName:t,eventValue:e},function(t){if(t)throw t})},r.requestBattleData=function(t){this.native.createRequest("requestBattleData",void 0,function(e){t(null,e)})},r.requestPlayerReplay=function(t,e){if(!o.capabilities.replay)throw"Replays not supported, you must add the capability on gamee.Init";this.native.createRequest("requestPlayerReplay",{userID:t},function(t){e(null,t)})},r.requestPlayerSaveState=function(t,e){this.native.createRequest("requestPlayerSaveState",{userID:t},function(t){e(null,t)})},r.playerEnteredGameRoom=function(){this.native.createRequest("playerEnteredGameRoom")},r.playerLeftGameRoom=function(){this.native.createRequest("playerLeftGameRoom")},r.purchaseItemWithCoins=function(t,e,n){if(!o.capabilities.coins)throw"Coins purchases not supported, you must add the capability on gamee.Init";if(t){["coinsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase Options must have `"+e+"` property"})}this.isSilentModeEnabled();var r="purchaseItemWithCoins";void 0!==n&&!0===n&&(r="purchaseItem"),this.native.createRequest(r,t,function(t){e(null,t)})},r.purchaseItemWithGems=function(t,e){if(!o.capabilities.gems)throw"Gems purchases not supported, you must add the capability on gamee.Init";if(t){["gemsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("purchaseItemWithGems",t,function(t){e(null,t)})},r.share=function(t,e){if(!o.capabilities.share)throw"Share option not supported, you must add the capability on gamee.Init";if(t){["destination"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Share Options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("share",t,function(t){e(null,t)})},r.loadRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("loadRewardedVideo",function(e){t(null,e)})},r.showRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("showRewardedVideo",function(e){t(null,e)})},r.showSubscribeDialog=function(t){this.native.createRequest("showSubscribeDialog",function(e){t(null,e)})},r.requestPlayerData=function(t,e){if(!o.capabilities.playerData)throw"Player Data not supported, you must add the capability on gamee.Init";var n=void 0;e&&(n={userID:e}),this.native.createRequest("requestPlayerData",n,function(e){t(null,e)})},r.startSignal=function(t){var e;return t.replay&&!o.capabilities.replay&&(e="Game doesn't support replay. "),t.ghostMode&&!o.capabilities.ghostMode&&(e="Game doesn't support ghost Mode. "),e},r.controller={mainController:null,requestController:function(t,e){if("FullScreen"===t)return null;var o=createController(t,e);return this.mainController=o,o},additionalController:function(t,e){var o=createController(t,e);return gameeNative.additionalController(t),o},trigger:function(){if(!this.mainController)throw new Error("No controller present");this.mainController.trigger.apply(this.mainController,arguments)}},r._keydown=function(e){t.addEventListener("keydown",(0,i.wrapKeyEvent)(e))},r._keyup=function(e){t.addEventListener("keyup",(0,i.wrapKeyEvent)(e))};var u={OneButton:a.OneButtonController,TwoButtons:a.TwoButtonController,FourButtons:a.FourButtonController,FiveButtons:a.FiveButtonController,SixButtons:a.SixButtonController,FourArrows:a.FourArrowController,Touch:a.TouchController,Joystick:a.JoystickController,JoystickWithButton:a.JoystickButtonController,TwoArrowsTwoButtons:a.TwoArrowsTwoButtonsController,TwoArrowsOneButton:a.TwoArrowsOneButtonController,TwoActionButtons:a.TwoActionButtonsController};return r.registerPlatform=function(t){},r.isSilentModeEnabled=function(){return o.silentMode},r}(),e.DataTypeException=function(t,e,o,n){this.expected=t,this.present=e,this.method=n,this.argument=o,this.message="Invalid data type in method "+this.method+", argument "+this.argument+" is expected to be "+this.expected+", but found "+this.present});e.validateDataType=function(t,e,o,r){switch(e){case"array":if(!Array.isArray(t))throw new u(e,void 0===t?"undefined":n(t),o,r);break;default:if((void 0===t?"undefined":n(t))!==e)throw new u(e,void 0===t?"undefined":n(t),o,r)}}}).call(e,o(7))},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Gamee=e.GameeEmitter=void 0;var n=o(1),r=o(0),a=e.GameeEmitter=function(){r.CustomEmitter.call(this)};(e.Gamee=function(t){this.emitter=new a,this._platform=t}).prototype=function(){var t=function(t){if(t)throw"Error "+t.toString()};return{_controller:n.core.controller,gameInit:function(t,e,o,r){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];(0,n.validateDataType)(t,"string","controllType","gamee.updateScore"),(0,n.validateDataType)(e,"object","controllOpts","gamee.gameInit"),(0,n.validateDataType)(o,"array","capabilities","gamee.gameInit"),(0,n.validateDataType)(r,"function","cb","gamee.gameInit"),(0,n.validateDataType)(a,"boolean","silentMode","gamee.gameInit"),n.core.gameeInit(t,e,o,r,a)},gameLoadingProgress:function(e,o){(0,n.validateDataType)(e,"number","percentage","gamee.gameLoadingProgress"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameLoadingProgress"),n.core.gameLoadingProgress(e),o(null)},gameReady:function(e){e=e||t,(0,n.validateDataType)(e,"function","opt_cb","gamee.gameReady"),n.core.gameReady(),e(null)},gameSave:function(e,o,r){(0,n.validateDataType)(e,"string","data","gamee.gameSave"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_share","gamee.gameSave"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.gameSave"),n.core.gameSave(e,!1),r(null)},getPlatform:function(){return this._platform},updateScore:function(e,o,r){(0,n.validateDataType)(e,"number","score","gamee.updateScore"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_ghostSign","gamee.updateScore"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.updateScore"),n.core.updateScore(e,o),r(null)},gameOver:function(e,o,r,a){"function"==typeof e?o=e:void 0!==e&&(0,n.validateDataType)(e,"object","opt_replayData","gamee.gameOver"),void 0!==a&&(0,n.validateDataType)(a,"boolean","opt_hideOverlay","gamee.gameOver"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameOver"),n.core.gameOver(e,r,a),o(null)},requestSocial:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestSocial"),n.core.requestSocial(function(e,o){var n=o.hasOwnProperty("socialData")?o:{socialData:o};t(null,n)},e)},logEvent:function(t,e){(0,n.validateDataType)(t,"string","eventName","gamee.logEvent"),!t||t.length>24||((0,n.validateDataType)(e,"string","eventValue","gamee.logEvent"),!e||e.length>160||n.core.logEvent(t,e))},requestBattleData:function(t){(0,n.validateDataType)(t,"function","cb","gamee.requestBattleData"),n.core.requestBattleData(t)},requestPlayerReplay:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerReplay"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerReplay"),n.core.requestPlayerReplay(t,e)},requestPlayerSaveState:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerSaveState"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerSaveState"),n.core.requestPlayerSaveState(t,e)},playerEnteredGameRoom:function(){n.core.playerEnteredGameRoom()},playerLeftGameRoom:function(){n.core.playerLeftGameRoom()},purchaseItem:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItem"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItem"),n.core.purchaseItemWithCoins(t,e,!0)},purchaseItemWithCoins:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithCoins"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithCoins"),n.core.purchaseItemWithCoins(t,e)},purchaseItemWithGems:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithGems"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithGems"),n.core.purchaseItemWithGems(t,e)},share:function(t,e){(0,n.validateDataType)(t,"object","shareDetails","gamee.share"),(0,n.validateDataType)(e,"function","cb","gamee.share"),n.core.share(t,e)},loadRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.loadRewardedVideo"),n.core.loadRewardedVideo(t)},showRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showRewardedVideo"),n.core.showRewardedVideo(t)},showSubscribeDialog:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showSubscribeDialog"),n.core.showSubscribeDialog(t)},requestPlayerData:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestPlayerData"),void 0!==e&&(0,n.validateDataType)(e,"number","userId","gamee.requestPlayerData"),n.core.requestPlayerData(t,e)}}}()},function(t,e,o){"use strict";function PlatformBridge(){this.requests={},this.platform="",this._init()}function PostMessageBridge(t){this._gameeWin=t,PlatformBridge.call(this),this.platform="web"}function MobileBridge(t){this.device=t,PostMessageBridge.call(this),this.platform="mobile"}Object.defineProperty(e,"__esModule",{value:!0}),e.PlatformAPI=void 0;var n="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};e.PlatformBridge=PlatformBridge,e.PostMessageBridge=PostMessageBridge,e.MobileBridge=MobileBridge;var r=o(1),a=e.PlatformAPI={emitter:null,pause:function(t){var e=new CustomEvent("pause",{detail:{callback:t}});this.emitter.dispatchEvent(e)},resume:function(t){var e=new CustomEvent("resume",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostShow:function(t){var e=new CustomEvent("ghostShow",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostHide:function(t){var e=new CustomEvent("ghostHide",{detail:{callback:t}});this.emitter.dispatchEvent(e)},mute:function(t){var e=new CustomEvent("mute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},unmute:function(t){var e=new CustomEvent("unmute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},start:function(t,e){var o=new CustomEvent("start",{detail:{callback:e}}),n=r.core.startSignal(t);if(n)return void e(n);t.replay&&(o.detail.opt_replay=!0),t.ghostMode&&(o.detail.opt_ghostMode=!0),t.resetState&&(o.detail.opt_resetState=!0),t.replayData&&(o.detail.replayData=t.replayData),this.emitter.dispatchEvent(o)}};PlatformBridge.prototype={instCount:0,_init:function(){},createRequest:function(t,e,o){if(this.validateMethod(t)){"function"==typeof e&&(o=e,e=void 0);var n=this.instCount++;void 0!==o&&(this.requests[n]=o);var r={request:{method:t,messageId:n,data:null}};this.doCall(r,e)}},validateMethod:function(t){return"gameLoadingProgress"!==t},doCall:function(t,e){throw"Not implemented"},_callback:function(t,e){var o=this.requests[t];delete this.requests[t],o&&o(e)},doResponse:function(t,e){throw"Not implemented"}},PostMessageBridge.prototype=Object.create(PlatformBridge.prototype),PostMessageBridge.prototype.constructor=PostMessageBridge,PostMessageBridge.prototype._init=function(){window.addEventListener("message",function(t){var e;if("object"===n(t.detail)&&null!==typeof t.detail)e=t.detail;else{if("object"!==n(t.data))return;e=t.data}if(r.core.isSilentModeEnabled(),e.request&&e.request.method&&void 0!==e.request.messageId)this._resolveAPICall(e.request.method,e.request.messageId,e.request.data);else if(e.response&&void 0!==e.response.messageId){if(e.error)throw e.error;this._callback(e.response.messageId,e.response.data)}}.bind(this),!1)},PostMessageBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),this._gameeWin.postMessage(t,"*")},PostMessageBridge.prototype.doResponse=function(t,e){var o={version:this.version,response:{messageId:t}};e&&(o.data=e),this._gameeWin.postMessage(o,"*")},PostMessageBridge.prototype._resolveAPICall=function(t,e,o){var n=this.doResponse.bind(this,e);switch(t){case"pause":a.pause(n);break;case"resume":a.resume(n);break;case"mute":a.mute(n);break;case"unmute":a.unmute(n);break;case"ghostShow":a.ghostShow(n);break;case"ghostHide":a.ghostHide(n);break;case"start":if(!o)throw"Method _start missing params";a.start(o,n);break;default:r.core.isSilentModeEnabled()}},MobileBridge.prototype=Object.create(PostMessageBridge.prototype),MobileBridge.prototype.constructor=MobileBridge,MobileBridge.prototype._init=function(){if(PostMessageBridge.prototype._init.call(this),"ios"===this.device)this._gameeWin=webkit.messageHandlers.callbackHandler;else{if("android"!==this.device)throw"Unknown device used in webkit bridge";this._gameeWin=_toDevice}window._triggerMessage=function(t){try{t=JSON.parse(t)}catch(e){throw"Couldn't parse message from native app: \n"+t+"\n"+e}r.core.isSilentModeEnabled(),this.dispatchEvent(new CustomEvent("message",{detail:t}))}.bind(window)},MobileBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),"android"===this.device&&(t=JSON.stringify(t)),this._gameeWin.postMessage(t,"*")}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){var t=this,e={};t.on=function(t,o,n){if(!(arguments.length<2||"string"!=typeof t||"function"!=typeof o)){var r=o.toString();void 0!==e[t]?void 0===e[t].callbacks[r]?e[t].callbacks[r]={cb:o,once:!!n}:"boolean"==typeof n&&(e[t].callbacks[r].once=n):(e[t]={callbacks:{}},e[t].callbacks[r]={cb:o,once:!!n})}},t.once=function(e,o){t.on(e,o,!0)},t.off=function(t,o){if("string"==typeof t&&void 0!==e[t])if("function"==typeof o){var n=o.toString(),r=e[t].callbacks[n];void 0!==r&&delete e[t].callbacks[n]}else delete e[t]},t.trigger=function(o,n){if("string"==typeof o&&void 0!==e[o])for(var r in e[o].callbacks){var a=e[o].callbacks[r];"function"==typeof a.cb&&a.cb(n),"boolean"==typeof a.once&&!0===a.once&&t.off(o,a.cb)}}};e.Bullet=new n},function(t,e,o){"use strict";function Button(t,e){var o=this;r.call(this),this._pressed=!0,this.key=t,this.keyCode=e,this.on("keydown",function(){o._pressed=!0}),this.on("keyup",function(){o._pressed=!1})}function Controller(){var t=this;r.call(this),this.buttons={},this.buttonAlias={},this.on("$keydown",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keydown",e)}),this.on("$keyup",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keyup",e)}),this.on("keydown",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keydown")}),this.on("keyup",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keyup")})}function OneButtonController(){Controller.call(this),this.addButton(new Button("button",32))}function TwoButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39))}function TwoActionButtonsController(){Controller.call(this),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function FiveButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32))}function SixButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function TwoArrowsOneButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function TwoArrowsTwoButtonsController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourArrowController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40))}function TouchController(){var t=this;Controller.call(this),this.on("$touchstart",function(e){t.trigger("touchstart",e)}),this.on("$touchend",function(e){t.trigger("touchend",e)}),this.on("$touchmove",function(e){t.trigger("touchmove",e)}),this.on("$touchleave",function(e){t.trigger("touchleave",e)}),this.on("$touchcancel",function(e){t.trigger("touchcancel",e)})}function JoystickController(){var t=this;Controller.call(this),this.x=0,this.y=0,this.on("$change",function(e){t.x=e.position.x,t.y=e.position.y,t.trigger("change",e)})}function JoystickButtonController(){JoystickController.call(this),this.addButton(new Button("button",32))}Object.defineProperty(e,"__esModule",{value:!0}),e.BulletClass=void 0,e.Button=Button,e.Controller=Controller,e.OneButtonController=OneButtonController,e.TwoButtonController=TwoButtonController,e.TwoActionButtonsController=TwoActionButtonsController,e.FourButtonController=FourButtonController,e.FiveButtonController=FiveButtonController,e.SixButtonController=SixButtonController,e.TwoArrowsOneButtonController=TwoArrowsOneButtonController,e.TwoArrowsTwoButtonsController=TwoArrowsTwoButtonsController,e.FourArrowController=FourArrowController,e.TouchController=TouchController,e.JoystickController=JoystickController,e.JoystickButtonController=JoystickButtonController;var n=o(4),r=e.BulletClass=n.Bullet.constructor;Button.prototype=Object.create(r.constructor.prototype),Button.constructor=Button,Button.prototype.isDown=function(){return this._pressed},Controller.prototype=Object.create(r.constructor.prototype),Controller.constructor=Controller,Controller.prototype.addButton=function(t){this.buttons[t.key]=t},Controller.prototype.enableKeyboard=function(t){var e,o,n={},r=this;for(e in this.buttons)o=this.buttons[e],o.keyCode&&(n[o.keyCode]=o);t._keydown(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keydown",{button:e.key}))}),t._keyup(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keyup",{button:e.key}))})},Controller.prototype.remapButton=function(t,e){if(e.name&&(e=e.name),!this.buttons[t])throw Error("Button "+t+" was not found in controller");this.buttonAlias[t]=e.name,this.buttons[e.name]=this.buttons[t],delete this.buttons[t]},OneButtonController.prototype=Object.create(Controller.prototype),OneButtonController.prototype.constructor=OneButtonController,TwoButtonController.prototype=Object.create(Controller.prototype),TwoButtonController.prototype.constructor=TwoButtonController,TwoActionButtonsController.prototype=Object.create(Controller.prototype),TwoActionButtonsController.prototype.constructor=TwoActionButtonsController,FourButtonController.prototype=Object.create(Controller.prototype),FourButtonController.prototype.constructor=FourButtonController,FiveButtonController.prototype=Object.create(Controller.prototype),FiveButtonController.prototype.constructor=FiveButtonController,SixButtonController.prototype=Object.create(Controller.prototype),SixButtonController.prototype.constructor=SixButtonController,TwoArrowsOneButtonController.prototype=Object.create(Controller.prototype),TwoArrowsOneButtonController.prototype.constructor=TwoArrowsOneButtonController,TwoArrowsTwoButtonsController.prototype=Object.create(Controller.prototype),TwoArrowsTwoButtonsController.prototype.constructor=TwoArrowsTwoButtonsController,FourArrowController.prototype=Object.create(Controller.prototype),FourArrowController.prototype.constructor=FourArrowController,TouchController.prototype=Object.create(TouchController.prototype),TouchController.prototype.constructor=TouchController,JoystickController.prototype=Object.create(Controller.prototype),JoystickController.prototype.constructor=JoystickController,JoystickButtonController.prototype=Object.create(JoystickController.prototype),JoystickButtonController.prototype.constructor=JoystickButtonController},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.gamee=void 0,o(0);var n=o(2),r=o(1),a=o(3),i=e.gamee=void 0,u=function(){var t,o="web",r=navigator.userAgent.toLowerCase();switch(/iphone|ipod|ipad/.test(r)?o=window.self!==window.top?"web":"ios":/gamee\/[0-9\.]+$/.test(r)?o="android":window.parent?o="web":window.parent&&window.parent.gameeSimulator&&(o="web"),e.gamee=i=new n.Gamee(o),window.gamee=i,o){case"web":window.parent,window,t=new a.PostMessageBridge(window.parent);break;case"ios":t=new a.MobileBridge("ios");break;case"android":t=new a.MobileBridge("android");break;default:throw"Can't identify the platform"}return t}();r.core.PlatformAPI=a.PlatformAPI,r.core.native=u,a.PlatformAPI.emitter=i.emitter},function(t,e){var o;o=function(){return this}();try{o=o||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(o=window)}t.exports=o}])}); +/*! @preserve build time 2019-10-17 14:04:37 */ +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,function(){return function(t){function __webpack_require__(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,__webpack_require__),n.l=!0,n.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.i=function(t){return t},__webpack_require__.d=function(t,e,o){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=6)}([function(t,e,o){"use strict";function CustomEmitter(){function delegate(e){this[e]=t[e].bind(t)}var t=document.createDocumentFragment();["addEventListener","dispatchEvent","removeEventListener"].forEach(delegate,this)}function wrapKeyEvent(t){return function(e){return e&&e.keyCode||(e||(e=window.event),e.which&&(e.keyCode=e.which)),t(e)}}Object.defineProperty(e,"__esModule",{value:!0}),e.CustomEmitter=CustomEmitter,e.wrapKeyEvent=wrapKeyEvent,function(){try{var t=new window.CustomEvent("test");if(t.preventDefault(),!0!==t.defaultPrevented)throw new Error("Could not prevent default")}catch(t){var e=function(t,e){var o,n;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},o=document.createEvent("CustomEvent"),o.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n=o.preventDefault,o.preventDefault=function(){n.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},o};e.prototype=window.Event.prototype,window.CustomEvent=e}}(),function(t,e){function docHijack(t){var o=e[t];e[t]=function(t){return addListen(o(t))}}function addEvent(e,o,n){return(n=this).attachEvent("on"+e,function(e){e=e||t.event,e.preventDefault=e.preventDefault||function(){e.returnValue=!1},e.stopPropagation=e.stopPropagation||function(){e.cancelBubble=!0},o.call(n,e)})}function addListen(t,e){if(e=t.length)for(;e--;)t[e].addEventListener=addEvent;else t.addEventListener=addEvent;return t}t.addEventListener||(addListen([e,t]),"Element"in t?t.Element.prototype.addEventListener=addEvent:(e.attachEvent("onreadystatechange",function(){addListen(e.all)}),docHijack("getElementsByTagName"),docHijack("getElementById"),docHijack("createElement"),addListen(e.all)))}(window,document)},function(t,e,o){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.validateDataType=e.DataTypeException=e.core=void 0;var n="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},r=o(5),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e.default=t,e}(r),i=o(0);!function(){var t=function(t){var e=new t;if("suspended"===e.state){var o=function resume(){if(/(iPhone|iPad)/i.test(navigator.userAgent)){var t=e.createBuffer(1,1,44100),o=e.createBufferSource();o.buffer=t,o.connect(e.destination),o.start(0),o.disconnect()}e.resume(),setTimeout(function(){"running"===e.state&&document.body.removeEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),resume,!1)},0)};document.body.addEventListener(["touchcancel","touchend","touchenter","touchleave","touchmove","touchstart","mouseenter","mouseover","mousemove","mousedown","mouseup"].join(" "),o,!1)}return e};try{void 0!==window.AudioContext?window.AudioContext=t.bind(null,window.AudioContext):"undefined"!=typeof webkitAudioContext&&(window.webkitAudioContext=t.bind(null,window.webkitAudioContext))}catch(t){setTimeout(function(){throw t},0)}}();var u=(e.core=function(){function createController(t,e){var o,n;if(!u[t])throw new Error("Unsupported controller type, "+t);if(e=e||{},n=new u[t],e.enableKeyboard&&n.enableKeyboard(r),e.buttons)for(o in e.buttons)n.remapButton(o,e.buttons[o]);return n}var e=function(){},o={},n={VERSION:"2.4.0",CAPABILITIES:["ghostMode","saveState","replay","socialData","rewardedAds","coins","logEvents","playerData","share","gems"],variant:0,soundUnlocked:!1,onReady:e,onGameStart:e},r={};r.gameeInit=function(t,e,a,i){var u=(arguments.length>4&&void 0!==arguments[4]&&arguments[4],!0),s={};if(void 0!==a&&Array.isArray(a))for(var l=0;l100)throw"Percentage passed to gameLoadingProgress out of bounds or not a number.";e>t&&(t=e,this.native.createRequest("gameLoadingProgress",{percentage:e}))}}(),r.gameReady=function(){this.native.createRequest("gameReady")},r.updateScore=function(t,e){if("number"!=typeof t)throw"Score passed to updateScore is not a number.";var o={score:parseInt(t,10)};e&&(o.ghostSign=!0),this.native.createRequest("updateScore",o)},r.gameOver=function(t,e,o){o=void 0!==o&&o;var n={};if(t){if(t.hasOwnProperty("variant")||(t.variant=""),!t.hasOwnProperty("data"))throw"Replay data must have `data` property";n.replayData=t}n.hideOverlay=o,e&&(n.state=e),r.native.createRequest("gameOver",n)},r.gameSave=function(t,e){if(!o.capabilities.saveState)throw"Save State not supported, you must add the capability on gamee.Init";r.native.createRequest("saveState",{state:t,share:e})},r.requestSocial=function(t,e){if(!o.capabilities.socialData)throw"Social Data not supported, you must add the capability on gamee.Init";this.native.createRequest("requestSocial",e,function(e){t(null,e)})},r.logEvent=function(t,e){if(!o.capabilities.logEvents)throw"Log Events not supported, you must add the capability on gamee.Init";this.native.createRequest("logEvent",{eventName:t,eventValue:e},function(t){if(t)throw t})},r.requestBattleData=function(t){this.native.createRequest("requestBattleData",void 0,function(e){t(null,e)})},r.requestPlayerReplay=function(t,e){if(!o.capabilities.replay)throw"Replays not supported, you must add the capability on gamee.Init";this.native.createRequest("requestPlayerReplay",{userID:t},function(t){e(null,t)})},r.requestPlayerSaveState=function(t,e){this.native.createRequest("requestPlayerSaveState",{userID:t},function(t){e(null,t)})},r.playerEnteredGameRoom=function(){this.native.createRequest("playerEnteredGameRoom")},r.playerLeftGameRoom=function(){this.native.createRequest("playerLeftGameRoom")},r.purchaseItemWithCoins=function(t,e,n){if(!o.capabilities.coins)throw"Coins purchases not supported, you must add the capability on gamee.Init";if(t){["coinsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase Options must have `"+e+"` property"})}this.isSilentModeEnabled();var r="purchaseItemWithCoins";void 0!==n&&!0===n&&(r="purchaseItem"),this.native.createRequest(r,t,function(t){e(null,t)})},r.purchaseItemWithGems=function(t,e){if(!o.capabilities.gems)throw"Gems purchases not supported, you must add the capability on gamee.Init";if(t){["gemsCost","itemName"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Purchase options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("purchaseItemWithGems",t,function(t){e(null,t)})},r.share=function(t,e){if(!o.capabilities.share)throw"Share option not supported, you must add the capability on gamee.Init";if(t){["destination"].forEach(function(e){if(!t.hasOwnProperty(e))throw"Share Options must have `"+e+"` property"})}this.isSilentModeEnabled(),this.native.createRequest("share",t,function(t){e(null,t)})},r.loadRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("loadRewardedVideo",function(e){t(null,e)})},r.showRewardedVideo=function(t){if(!o.capabilities.rewardedAds)throw"Rewarded Ads not supported, you must add the capability on gamee.Init";this.native.createRequest("showRewardedVideo",function(e){t(null,e)})},r.showSubscribeDialog=function(t){this.native.createRequest("showSubscribeDialog",function(e){t(null,e)})},r.requestPlayerData=function(t,e){if(!o.capabilities.playerData)throw"Player Data not supported, you must add the capability on gamee.Init";var n=void 0;e&&(n={userID:e}),this.native.createRequest("requestPlayerData",n,function(e){t(null,e)})},r.startSignal=function(t){var e;return t.replay&&!o.capabilities.replay&&(e="Game doesn't support replay. "),t.ghostMode&&!o.capabilities.ghostMode&&(e="Game doesn't support ghost Mode. "),e},r.controller={mainController:null,requestController:function(t,e){if("FullScreen"===t)return null;var o=createController(t,e);return this.mainController=o,o},additionalController:function(t,e){var o=createController(t,e);return gameeNative.additionalController(t),o},trigger:function(){if(!this.mainController)throw new Error("No controller present");this.mainController.trigger.apply(this.mainController,arguments)}},r._keydown=function(e){t.addEventListener("keydown",(0,i.wrapKeyEvent)(e))},r._keyup=function(e){t.addEventListener("keyup",(0,i.wrapKeyEvent)(e))};var u={OneButton:a.OneButtonController,TwoButtons:a.TwoButtonController,FourButtons:a.FourButtonController,FiveButtons:a.FiveButtonController,SixButtons:a.SixButtonController,FourArrows:a.FourArrowController,Touch:a.TouchController,Joystick:a.JoystickController,JoystickWithButton:a.JoystickButtonController,TwoArrowsTwoButtons:a.TwoArrowsTwoButtonsController,TwoArrowsOneButton:a.TwoArrowsOneButtonController,TwoActionButtons:a.TwoActionButtonsController};return r.registerPlatform=function(t){},r.isSilentModeEnabled=function(){return o.silentMode},r}(),e.DataTypeException=function(t,e,o,n){this.expected=t,this.present=e,this.method=n,this.argument=o,this.message="Invalid data type in method "+this.method+", argument "+this.argument+" is expected to be "+this.expected+", but found "+this.present});e.validateDataType=function(t,e,o,r){switch(e){case"array":if(!Array.isArray(t))throw new u(e,void 0===t?"undefined":n(t),o,r);break;default:if((void 0===t?"undefined":n(t))!==e)throw new u(e,void 0===t?"undefined":n(t),o,r)}}}).call(e,o(7))},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Gamee=e.GameeEmitter=void 0;var n=o(1),r=o(0),a=e.GameeEmitter=function(){r.CustomEmitter.call(this)};(e.Gamee=function(t){this.emitter=new a,this._platform=t}).prototype=function(){var t=function(t){if(t)throw"Error "+t.toString()};return{_controller:n.core.controller,gameInit:function(t,e,o,r){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];(0,n.validateDataType)(t,"string","controllType","gamee.updateScore"),(0,n.validateDataType)(e,"object","controllOpts","gamee.gameInit"),(0,n.validateDataType)(o,"array","capabilities","gamee.gameInit"),(0,n.validateDataType)(r,"function","cb","gamee.gameInit"),(0,n.validateDataType)(a,"boolean","silentMode","gamee.gameInit"),n.core.gameeInit(t,e,o,r,a)},gameLoadingProgress:function(e,o){(0,n.validateDataType)(e,"number","percentage","gamee.gameLoadingProgress"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameLoadingProgress"),n.core.gameLoadingProgress(e),o(null)},gameReady:function(e){e=e||t,(0,n.validateDataType)(e,"function","opt_cb","gamee.gameReady"),n.core.gameReady(),e(null)},gameSave:function(e,o,r){(0,n.validateDataType)(e,"string","data","gamee.gameSave"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_share","gamee.gameSave"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.gameSave"),n.core.gameSave(e,!1),r(null)},getPlatform:function(){return this._platform},updateScore:function(e,o,r){(0,n.validateDataType)(e,"number","score","gamee.updateScore"),"function"==typeof o?r=o:void 0!==o&&(0,n.validateDataType)(o,"boolean","opt_ghostSign","gamee.updateScore"),r=r||t,(0,n.validateDataType)(r,"function","opt_cb","gamee.updateScore"),n.core.updateScore(e,o),r(null)},gameOver:function(e,o,r,a){"function"==typeof e?o=e:void 0!==e&&(0,n.validateDataType)(e,"object","opt_replayData","gamee.gameOver"),void 0!==a&&(0,n.validateDataType)(a,"boolean","opt_hideOverlay","gamee.gameOver"),o=o||t,(0,n.validateDataType)(o,"function","opt_cb","gamee.gameOver"),n.core.gameOver(e,r,a),o(null)},requestSocial:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestSocial"),n.core.requestSocial(function(e,o){var n=o.hasOwnProperty("socialData")?o:{socialData:o};t(null,n)},e)},logEvent:function(t,e){(0,n.validateDataType)(t,"string","eventName","gamee.logEvent"),!t||t.length>24||((0,n.validateDataType)(e,"string","eventValue","gamee.logEvent"),!e||e.length>160||n.core.logEvent(t,e))},requestBattleData:function(t){(0,n.validateDataType)(t,"function","cb","gamee.requestBattleData"),n.core.requestBattleData(t)},requestPlayerReplay:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerReplay"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerReplay"),n.core.requestPlayerReplay(t,e)},requestPlayerSaveState:function(t,e){(0,n.validateDataType)(t,"number","userID","gamee.requestPlayerSaveState"),(0,n.validateDataType)(e,"function","cb","gamee.requestPlayerSaveState"),n.core.requestPlayerSaveState(t,e)},playerEnteredGameRoom:function(){n.core.playerEnteredGameRoom()},playerLeftGameRoom:function(){n.core.playerLeftGameRoom()},purchaseItem:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItem"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItem"),n.core.purchaseItemWithCoins(t,e,!0)},purchaseItemWithCoins:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithCoins"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithCoins"),n.core.purchaseItemWithCoins(t,e)},purchaseItemWithGems:function(t,e){(0,n.validateDataType)(t,"object","purchaseDetails","gamee.purchaseItemWithGems"),(0,n.validateDataType)(e,"function","cb","gamee.purchaseItemWithGems"),n.core.purchaseItemWithGems(t,e)},share:function(t,e){(0,n.validateDataType)(t,"object","shareDetails","gamee.share"),(0,n.validateDataType)(e,"function","cb","gamee.share"),n.core.share(t,e)},loadRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.loadRewardedVideo"),n.core.loadRewardedVideo(t)},showRewardedVideo:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showRewardedVideo"),n.core.showRewardedVideo(t)},showSubscribeDialog:function(t){(0,n.validateDataType)(t,"function","cb","gamee.showSubscribeDialog"),n.core.showSubscribeDialog(t)},requestPlayerData:function(t,e){(0,n.validateDataType)(t,"function","cb","gamee.requestPlayerData"),void 0!==e&&(0,n.validateDataType)(e,"number","userId","gamee.requestPlayerData"),n.core.requestPlayerData(t,e)}}}()},function(t,e,o){"use strict";function PlatformBridge(){this.requests={},this.platform="",this._init()}function PostMessageBridge(t){this._gameeWin=t,PlatformBridge.call(this),this.platform="web"}function MobileBridge(t){this.device=t,PostMessageBridge.call(this),this.platform="mobile"}Object.defineProperty(e,"__esModule",{value:!0}),e.PlatformAPI=void 0;var n="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};e.PlatformBridge=PlatformBridge,e.PostMessageBridge=PostMessageBridge,e.MobileBridge=MobileBridge;var r=o(1),a=e.PlatformAPI={emitter:null,pause:function(t){var e=new CustomEvent("pause",{detail:{callback:t}});this.emitter.dispatchEvent(e)},resume:function(t){var e=new CustomEvent("resume",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostShow:function(t){var e=new CustomEvent("ghostShow",{detail:{callback:t}});this.emitter.dispatchEvent(e)},ghostHide:function(t){var e=new CustomEvent("ghostHide",{detail:{callback:t}});this.emitter.dispatchEvent(e)},mute:function(t){var e=new CustomEvent("mute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},unmute:function(t){var e=new CustomEvent("unmute",{detail:{callback:t}});this.emitter.dispatchEvent(e)},start:function(t,e){var o=new CustomEvent("start",{detail:{callback:e}}),n=r.core.startSignal(t);if(n)return void e(n);t.replay&&(o.detail.opt_replay=!0),t.ghostMode&&(o.detail.opt_ghostMode=!0),t.resetState&&(o.detail.opt_resetState=!0),t.replayData&&(o.detail.replayData=t.replayData),this.emitter.dispatchEvent(o)}};PlatformBridge.prototype={instCount:0,_init:function(){},createRequest:function(t,e,o){if(this.validateMethod(t)){"function"==typeof e&&(o=e,e=void 0);var n=this.instCount++;void 0!==o&&(this.requests[n]=o);var r={request:{method:t,messageId:n,data:null}};this.doCall(r,e)}},validateMethod:function(t){return"gameLoadingProgress"!==t},doCall:function(t,e){throw"Not implemented"},_callback:function(t,e){var o=this.requests[t];delete this.requests[t],o&&o(e)},doResponse:function(t,e){throw"Not implemented"}},PostMessageBridge.prototype=Object.create(PlatformBridge.prototype),PostMessageBridge.prototype.constructor=PostMessageBridge,PostMessageBridge.prototype._init=function(){window.addEventListener("message",function(t){var e;if("object"===n(t.detail)&&null!==typeof t.detail)e=t.detail;else{if("object"!==n(t.data))return;e=t.data}if(r.core.isSilentModeEnabled(),e.request&&e.request.method&&void 0!==e.request.messageId)this._resolveAPICall(e.request.method,e.request.messageId,e.request.data);else if(e.response&&void 0!==e.response.messageId){if(e.error)throw e.error;this._callback(e.response.messageId,e.response.data)}}.bind(this),!1)},PostMessageBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),this._gameeWin.postMessage(t,"*")},PostMessageBridge.prototype.doResponse=function(t,e){var o={version:this.version,response:{messageId:t}};e&&(o.data=e),this._gameeWin.postMessage(o,"*")},PostMessageBridge.prototype._resolveAPICall=function(t,e,o){var n=this.doResponse.bind(this,e);switch(t){case"pause":a.pause(n);break;case"resume":a.resume(n);break;case"mute":a.mute(n);break;case"unmute":a.unmute(n);break;case"ghostShow":a.ghostShow(n);break;case"ghostHide":a.ghostHide(n);break;case"start":if(!o)throw"Method _start missing params";a.start(o,n);break;default:r.core.isSilentModeEnabled()}},MobileBridge.prototype=Object.create(PostMessageBridge.prototype),MobileBridge.prototype.constructor=MobileBridge,MobileBridge.prototype._init=function(){if(PostMessageBridge.prototype._init.call(this),"ios"===this.device)this._gameeWin=webkit.messageHandlers.callbackHandler;else{if("android"!==this.device)throw"Unknown device used in webkit bridge";this._gameeWin=_toDevice}window._triggerMessage=function(t){try{t=JSON.parse(t)}catch(e){throw"Couldn't parse message from native app: \n"+t+"\n"+e}r.core.isSilentModeEnabled(),this.dispatchEvent(new CustomEvent("message",{detail:t}))}.bind(window)},MobileBridge.prototype.doCall=function(t,e){"object"===(void 0===e?"undefined":n(e))&&(t.request.data=e||{}),"android"===this.device&&(t=JSON.stringify(t)),this._gameeWin.postMessage(t,"*")}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){var t=this,e={};t.on=function(t,o,n){if(!(arguments.length<2||"string"!=typeof t||"function"!=typeof o)){var r=o.toString();void 0!==e[t]?void 0===e[t].callbacks[r]?e[t].callbacks[r]={cb:o,once:!!n}:"boolean"==typeof n&&(e[t].callbacks[r].once=n):(e[t]={callbacks:{}},e[t].callbacks[r]={cb:o,once:!!n})}},t.once=function(e,o){t.on(e,o,!0)},t.off=function(t,o){if("string"==typeof t&&void 0!==e[t])if("function"==typeof o){var n=o.toString(),r=e[t].callbacks[n];void 0!==r&&delete e[t].callbacks[n]}else delete e[t]},t.trigger=function(o,n){if("string"==typeof o&&void 0!==e[o])for(var r in e[o].callbacks){var a=e[o].callbacks[r];"function"==typeof a.cb&&a.cb(n),"boolean"==typeof a.once&&!0===a.once&&t.off(o,a.cb)}}};e.Bullet=new n},function(t,e,o){"use strict";function Button(t,e){var o=this;r.call(this),this._pressed=!0,this.key=t,this.keyCode=e,this.on("keydown",function(){o._pressed=!0}),this.on("keyup",function(){o._pressed=!1})}function Controller(){var t=this;r.call(this),this.buttons={},this.buttonAlias={},this.on("$keydown",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keydown",e)}),this.on("$keyup",function(e){e.button&&t.buttonAlias[e.button]&&(e.button=t.buttonAlias[e.button]),t.trigger("keyup",e)}),this.on("keydown",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keydown")}),this.on("keyup",function(e){e.button&&t.buttons[e.button]&&t.buttons[e.button].trigger("keyup")})}function OneButtonController(){Controller.call(this),this.addButton(new Button("button",32))}function TwoButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39))}function TwoActionButtonsController(){Controller.call(this),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function FiveButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32))}function SixButtonController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function TwoArrowsOneButtonController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32))}function TwoArrowsTwoButtonsController(){Controller.call(this),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("A",32)),this.addButton(new Button("B",17))}function FourArrowController(){Controller.call(this),this.addButton(new Button("up",38)),this.addButton(new Button("left",37)),this.addButton(new Button("right",39)),this.addButton(new Button("down",40))}function TouchController(){var t=this;Controller.call(this),this.on("$touchstart",function(e){t.trigger("touchstart",e)}),this.on("$touchend",function(e){t.trigger("touchend",e)}),this.on("$touchmove",function(e){t.trigger("touchmove",e)}),this.on("$touchleave",function(e){t.trigger("touchleave",e)}),this.on("$touchcancel",function(e){t.trigger("touchcancel",e)})}function JoystickController(){var t=this;Controller.call(this),this.x=0,this.y=0,this.on("$change",function(e){t.x=e.position.x,t.y=e.position.y,t.trigger("change",e)})}function JoystickButtonController(){JoystickController.call(this),this.addButton(new Button("button",32))}Object.defineProperty(e,"__esModule",{value:!0}),e.BulletClass=void 0,e.Button=Button,e.Controller=Controller,e.OneButtonController=OneButtonController,e.TwoButtonController=TwoButtonController,e.TwoActionButtonsController=TwoActionButtonsController,e.FourButtonController=FourButtonController,e.FiveButtonController=FiveButtonController,e.SixButtonController=SixButtonController,e.TwoArrowsOneButtonController=TwoArrowsOneButtonController,e.TwoArrowsTwoButtonsController=TwoArrowsTwoButtonsController,e.FourArrowController=FourArrowController,e.TouchController=TouchController,e.JoystickController=JoystickController,e.JoystickButtonController=JoystickButtonController;var n=o(4),r=e.BulletClass=n.Bullet.constructor;Button.prototype=Object.create(r.constructor.prototype),Button.constructor=Button,Button.prototype.isDown=function(){return this._pressed},Controller.prototype=Object.create(r.constructor.prototype),Controller.constructor=Controller,Controller.prototype.addButton=function(t){this.buttons[t.key]=t},Controller.prototype.enableKeyboard=function(t){var e,o,n={},r=this;for(e in this.buttons)o=this.buttons[e],o.keyCode&&(n[o.keyCode]=o);t._keydown(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keydown",{button:e.key}))}),t._keyup(function(t){var e=n[t.keyCode];e&&(t.preventDefault(),r.trigger("keyup",{button:e.key}))})},Controller.prototype.remapButton=function(t,e){if(e.name&&(e=e.name),!this.buttons[t])throw Error("Button "+t+" was not found in controller");this.buttonAlias[t]=e.name,this.buttons[e.name]=this.buttons[t],delete this.buttons[t]},OneButtonController.prototype=Object.create(Controller.prototype),OneButtonController.prototype.constructor=OneButtonController,TwoButtonController.prototype=Object.create(Controller.prototype),TwoButtonController.prototype.constructor=TwoButtonController,TwoActionButtonsController.prototype=Object.create(Controller.prototype),TwoActionButtonsController.prototype.constructor=TwoActionButtonsController,FourButtonController.prototype=Object.create(Controller.prototype),FourButtonController.prototype.constructor=FourButtonController,FiveButtonController.prototype=Object.create(Controller.prototype),FiveButtonController.prototype.constructor=FiveButtonController,SixButtonController.prototype=Object.create(Controller.prototype),SixButtonController.prototype.constructor=SixButtonController,TwoArrowsOneButtonController.prototype=Object.create(Controller.prototype),TwoArrowsOneButtonController.prototype.constructor=TwoArrowsOneButtonController,TwoArrowsTwoButtonsController.prototype=Object.create(Controller.prototype),TwoArrowsTwoButtonsController.prototype.constructor=TwoArrowsTwoButtonsController,FourArrowController.prototype=Object.create(Controller.prototype),FourArrowController.prototype.constructor=FourArrowController,TouchController.prototype=Object.create(TouchController.prototype),TouchController.prototype.constructor=TouchController,JoystickController.prototype=Object.create(Controller.prototype),JoystickController.prototype.constructor=JoystickController,JoystickButtonController.prototype=Object.create(JoystickController.prototype),JoystickButtonController.prototype.constructor=JoystickButtonController},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.gamee=void 0,o(0);var n=o(2),r=o(1),a=o(3),i=e.gamee=void 0,u=function(){var t,o="web",r=navigator.userAgent.toLowerCase();switch(/iphone|ipod|ipad/.test(r)?o=window.self!==window.top?"web":"ios":/gamee\/[0-9\.]+$/.test(r)?o="android":window.parent?o="web":window.parent&&window.parent.gameeSimulator&&(o="web"),e.gamee=i=new n.Gamee(o),window.gamee=i,o){case"web":window.parent,window,t=new a.PostMessageBridge(window.parent);break;case"ios":t=new a.MobileBridge("ios");break;case"android":t=new a.MobileBridge("android");break;default:throw"Can't identify the platform"}return t}();r.core.PlatformAPI=a.PlatformAPI,r.core.native=u,a.PlatformAPI.emitter=i.emitter},function(t,e){var o;o=function(){return this}();try{o=o||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(o=window)}t.exports=o}])}); //# sourceMappingURL=gamee-js.min.js.map \ No newline at end of file diff --git a/gamee/dist/gamee-js.min.js.map b/gamee/dist/gamee-js.min.js.map index ba3a039..00dc836 100644 --- a/gamee/dist/gamee-js.min.js.map +++ b/gamee/dist/gamee-js.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6","webpack:///gamee-js.min.js","webpack:///webpack/bootstrap 617022220ca38c913700?c093","webpack:///./gamee/libs/shims.js?26b9","webpack:///./gamee/src/core.js?6b70","webpack:///./gamee/src/gameeAPI.js?7205","webpack:///./gamee/src/platform_bridge.js?848f","webpack:///./gamee/libs/bullet.js?d693","webpack:///./gamee/src/game_controllers.js?1af2","webpack:///./gamee/src/index.js?b323","webpack:///(webpack)/buildin/global.js?3698"],"names":["root","factory","exports","module","define","amd","a","i","this","modules","__webpack_require__","moduleId","installedModules","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","CustomEmitter","delegate","method","eventTarget","bind","document","createDocumentFragment","forEach","wrapKeyEvent","fn","ev","keyCode","window","event","which","ce","CustomEvent","preventDefault","defaultPrevented","Error","e","params","evt","origPrevent","bubbles","cancelable","detail","undefined","createEvent","initCustomEvent","Event","win","doc","docHijack","old","v","addListen","addEvent","on","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","length","addEventListener","Element","all","global","validateDataType","DataTypeException","core","_typeof","Symbol","iterator","constructor","_game_controllers","controllers","newObj","key","default","_shims","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","createController","opts","btn","controller","controllerTypes","enableKeyboard","buttons","remapButton","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","allOk","arguments","cap","Array","isArray","indexOf","native","createRequest","version","responseData","error","platform","requestController","_bindKeyboardTriggers","err","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","playerEnteredGameRoom","playerLeftGameRoom","purchaseItemWithCoins","options","oldMethod","coins","isSilentModeEnabled","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","showSubscribeDialog","requestPlayerData","playerData","startSignal","ghostMode","mainController","additionalController","gameeNative","apply","_keydown","_keyup","OneButton","OneButtonController","TwoButtons","TwoButtonController","FourButtons","FourButtonController","FiveButtons","FiveButtonController","SixButtons","SixButtonController","FourArrows","FourArrowController","Touch","TouchController","Joystick","JoystickController","JoystickWithButton","JoystickButtonController","TwoArrowsTwoButtons","TwoArrowsTwoButtonsController","TwoArrowsOneButton","TwoArrowsOneButtonController","TwoActionButtons","TwoActionButtonsController","registerPlatform","platformAPI","silentMode","expected","present","argument","message","testedInput","expectedType","originMethod","Gamee","GameeEmitter","_core","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","requests","_init","PostMessageBridge","endpoint","_gameeWin","MobileBridge","device","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","create","_resolveAPICall","response","postMessage","opt_data","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","JSON","parse","stringify","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","_pressed","Controller","buttonAlias","addButton","x","y","position","_bullet","isDown","gamee","keyCodes","oldName","newName","_gameeAPI","_platform_bridge","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","g","Function","eval"],"mappings":";CAAA,SAAAA,EAAAC,GACA,mBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,QACA,sBAAAG,gBAAAC,IACAD,UA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gP,EAAAhP,EAAA,GACAsU,EAAAtU,EAAA,GASWiU,iBAOPM,EAAkB,WAElB,GAAIA,GAAgBC,EAAe,MAI/BzO,EAAYD,UAAUC,UAAU0O,aAwBpC,QAtBI,mBAAmB5O,KAAKE,GAKpByO,EADAnS,OAAO2B,OAAS3B,OAAOqS,IACR,MAEA,MAEZ,mBAAmB7O,KAAKE,GAE/ByO,EAAe,UACRnS,OAAOsS,OACdH,EAAe,MACRnS,OAAOsS,QAAUtS,OAAOsS,OAAOC,iBACtCJ,EAAe,OAGnBhV,EAjCOyU,MAiCPA,EAAQ,GAAAI,GAAAvF,MAAU0F,GAElBnS,OAAO4R,MAAQA,EAEPO,GACJ,IAAK,MACGnS,OAAOsS,OAAWtS,OAGtBkS,EAAiB,GAAAD,GAAAnE,kBAAsB9N,OAAOsS,OAC9C,MACJ,KAAK,MACDJ,EAAiB,GAAAD,GAAAhE,aAAiB,MAClC,MACJ,KAAK,UACDiE,EAAiB,GAAAD,GAAAhE,aAAiB,UAClC,MACJ,SACI,KAAM,8BAEd,MAAOiE,KAGXvF,GAAAnK,KAAK2L,YAAL8D,EAAA9D,YACAxB,EAAAnK,KAAK6D,OAAS6L,EAEdD,EAAA9D,YAAYvB,QAAUgF,EAAMhF,SRy6EtB,SAAUxP,EAAQD,GSh/ExB,GAAAqV,EAGAA,GAAA,WACA,MAAA/U,QAGA,KAEA+U,KAAAC,SAAA,qBAAAC,MAAA,QACC,MAAAlS,GAED,gBAAAR,UACAwS,EAAAxS,QAOA5C,EAAAD,QAAAqV","file":"gamee-js.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","/*! @preserve build time 2019-10-15 10:59:21 */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 6);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.CustomEmitter = CustomEmitter;\nexports.wrapKeyEvent = wrapKeyEvent;\n/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function CustomEvent(event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function get() {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return; //No need to polyfill\n\n\tfunction docHijack(p) {\n\t\tvar old = doc[p];doc[p] = function (v) {\n\t\t\treturn addListen(old(v));\n\t\t};\n\t}\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () {\n\t\t\t\te.returnValue = false;\n\t\t\t};\n\t\t\te.stopPropagation = e.stopPropagation || function () {\n\t\t\t\te.cancelBubble = true;\n\t\t\t};\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--) {\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t\t}\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent; //IE8\n\telse {\n\t\t\t//IE < 8\n\t\t\tdoc.attachEvent('onreadystatechange', function () {\n\t\t\t\taddListen(doc.all);\n\t\t\t}); //Make sure we also init at domReady\n\t\t\tdocHijack('getElementsByTagName');\n\t\t\tdocHijack('getElementById');\n\t\t\tdocHijack('createElement');\n\t\t\taddListen(doc.all);\n\t\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nfunction CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\"addEventListener\", \"dispatchEvent\", \"removeEventListener\"].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nfunction wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.validateDataType = exports.DataTypeException = exports.core = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _game_controllers = __webpack_require__(5);\n\nvar controllers = _interopRequireWildcard(_game_controllers);\n\nvar _shims = __webpack_require__(0);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function overloadedAudioContext(type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function resume() {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx;\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) {\n // throw error in async part\n setTimeout(function () {\n throw e;\n }, 0);\n }\n})();\n\n/**\n * @class core\n */\nvar core = exports.core = function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function noop() {};\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\", \"rewardedAds\", \"coins\", \"logEvents\", \"playerData\", \"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true,\n cap = {};\n if (capabilities !== undefined && Array.isArray(capabilities)) {\n for (var i = 0; i < capabilities.length; i++) {\n if (typeof capabilities[i] !== \"string\" || internals.CAPABILITIES.indexOf(capabilities[i]) === -1) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk) throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if (typeof percentage !== \"number\" || percentage < 0 || percentage > 100) throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n }();\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\") throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if (!cache.capabilities.saveState) throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb, numberOfPlayers) {\n\n if (!cache.capabilities.socialData) throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if (!cache.capabilities.logEvents) throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", { eventName: eventName, eventValue: eventValue }, function (error) {\n if (error) {\n throw error;\n }\n });\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if (!cache.capabilities.replay) throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredGameRoom = function () {\n this.native.createRequest('playerEnteredGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if (!cache.capabilities.coins) throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if (!cache.capabilities.gems) throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if (!cache.capabilities.share) throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Share Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if (!cache.capabilities.playerData) throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n var options = undefined;\n if (userID) {\n options = { userID: userID };\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay) error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode) error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function requestController(type, opts) {\n if (type === \"FullScreen\") return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function additionalController(type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function trigger() {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n}();\n\nvar DataTypeException = exports.DataTypeException = function DataTypeException(expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = \"Invalid data type in method \" + this.method + \", argument \" + this.argument + \" is expected to be \" + this.expected + \", but found \" + this.present;\n};\n\nvar validateDataType = exports.validateDataType = function validateDataType(testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput)) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n break;\n\n default:\n if ((typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput)) !== expectedType) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Gamee = exports.GameeEmitter = undefined;\n\nvar _core = __webpack_require__(1);\n\nvar _shims = __webpack_require__(0);\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nvar GameeEmitter = exports.GameeEmitter = function GameeEmitter() {\n _shims.CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nvar Gamee = exports.Gamee = function Gamee(platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = function () {\n\n var cbError = function cbError(err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: _core.core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function gameInit(controllType, controllOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n (0, _core.validateDataType)(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n (0, _core.validateDataType)(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n (0, _core.validateDataType)(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.gameInit\");\n (0, _core.validateDataType)(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = _core.core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function gameLoadingProgress(percentage, opt_cb) {\n (0, _core.validateDataType)(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n _core.core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function gameReady(opt_cb) {\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n _core.core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function gameSave(data, opt_share, opt_cb) {\n var share = false,\n cb;\n (0, _core.validateDataType)(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function') opt_cb = opt_share;else if (typeof opt_share !== \"undefined\") (0, _core.validateDataType)(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n _core.core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function getPlatform() {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function updateScore(score, opt_ghostSign, opt_cb) {\n (0, _core.validateDataType)(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\") opt_cb = opt_ghostSign;else if (typeof opt_ghostSign !== \"undefined\") (0, _core.validateDataType)(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n _core.core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function gameOver(opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\") opt_cb = opt_replayData;else if (typeof opt_replayData !== \"undefined\") (0, _core.validateDataType)(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n (0, _core.validateDataType)(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n _core.core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function requestSocial(cb, numberOfPlayers) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = _core.core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function logEvent(eventName, eventValue) {\n\n (0, _core.validateDataType)(eventName, \"string\", \"eventName\", \"gamee.logEvent\");\n\n if (!eventName || eventName.length > 24) {\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return;\n }\n\n (0, _core.validateDataType)(eventValue, \"string\", \"eventValue\", \"gamee.logEvent\");\n\n if (!eventValue || eventValue.length > 160) {\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return;\n }\n\n _core.core.logEvent(eventName, eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function requestBattleData(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n _core.core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function requestPlayerReplay(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n _core.core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function requestPlayerSaveState(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n _core.core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredGameRoom\n * @member of Gamee\n */\n playerEnteredGameRoom: function playerEnteredGameRoom() {\n _core.core.playerEnteredGameRoom();\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function playerLeftGameRoom() {\n _core.core.playerLeftGameRoom();\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function purchaseItem(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItem\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItem\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb, true);\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function purchaseItemWithCoins(purchaseDetails, cb) {\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithCoins\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithCoins\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb);\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function purchaseItemWithGems(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithGems\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithGems\");\n\n _core.core.purchaseItemWithGems(purchaseDetails, cb);\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function share(shareDetails, cb) {\n (0, _core.validateDataType)(shareDetails, \"object\", \"shareDetails\", \"gamee.share\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.share\");\n\n _core.core.share(shareDetails, cb);\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function loadRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.loadRewardedVideo\");\n _core.core.loadRewardedVideo(cb);\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function showRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showRewardedVideo\");\n _core.core.showRewardedVideo(cb);\n },\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function showSubscribeDialog(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showSubscribeDialog\");\n _core.core.showSubscribeDialog(cb);\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function requestPlayerData(cb, userID) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerData\");\n if (userID !== undefined) {\n (0, _core.validateDataType)(userID, \"number\", \"userId\", \"gamee.requestPlayerData\");\n }\n _core.core.requestPlayerData(cb, userID);\n }\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n}();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.PlatformAPI = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.PlatformBridge = PlatformBridge;\nexports.PostMessageBridge = PostMessageBridge;\nexports.MobileBridge = MobileBridge;\n\nvar _core = __webpack_require__(1);\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nvar PlatformAPI = exports.PlatformAPI = {\n\temitter: null,\n\tpause: function pause(cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function resume(cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function ghostShow(cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function ghostHide(cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function mute(cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function unmute(cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function start(data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = _core.core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay) event.detail.opt_replay = true;\n\t\tif (data.ghostMode) event.detail.opt_ghostMode = true;\n\t\tif (data.resetState) event.detail.opt_resetState = true;\n\t\tif (data.replayData) {\n\t\t\tevent.detail.replayData = data.replayData;\n\t\t}\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n/**\n * @class PlatformBridge\n *\n */\nfunction PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function _init() {},\n\tcreateRequest: function createRequest(method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method)) return;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function validateMethod(method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n * @abstract\n */\n\tdoCall: function doCall(preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function _callback(id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb) cb(responseData);\n\t},\n\t/**\n * @abstract\n */\n\tdoResponse: function doResponse(preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t}\n};\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nfunction PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (_typeof(ev.detail) === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (_typeof(ev.data) === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4) + ' data');\n\t\t}\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\t\tif (data.error) throw data.error;\n\t\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData) preparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\t\tconsole.error(\"Unknown method call\");\n\t\t\t}\n\t}\n};\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nfunction MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4));\n\t\t}\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar BulletClass = function BulletClass() {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 || typeof event !== \"string\" || typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n } else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n } else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n } else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n};\n\nvar Bullet = exports.Bullet = new BulletClass();\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.BulletClass = undefined;\nexports.Button = Button;\nexports.Controller = Controller;\nexports.OneButtonController = OneButtonController;\nexports.TwoButtonController = TwoButtonController;\nexports.TwoActionButtonsController = TwoActionButtonsController;\nexports.FourButtonController = FourButtonController;\nexports.FiveButtonController = FiveButtonController;\nexports.SixButtonController = SixButtonController;\nexports.TwoArrowsOneButtonController = TwoArrowsOneButtonController;\nexports.TwoArrowsTwoButtonsController = TwoArrowsTwoButtonsController;\nexports.FourArrowController = FourArrowController;\nexports.TouchController = TouchController;\nexports.JoystickController = JoystickController;\nexports.JoystickButtonController = JoystickButtonController;\n\nvar _bullet = __webpack_require__(4);\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nvar BulletClass = exports.BulletClass = _bullet.Bullet.constructor;\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nfunction Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nfunction Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key,\n\t button,\n\t keyCodes = {},\n\t self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nfunction OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nfunction TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nfunction TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nfunction FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nfunction FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nfunction SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nfunction TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nfunction TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nfunction FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nfunction TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nfunction JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nfunction JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.gamee = undefined;\n\n__webpack_require__(0);\n\nvar _gameeAPI = __webpack_require__(2);\n\nvar _core = __webpack_require__(1);\n\nvar _platform_bridge = __webpack_require__(3);\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nvar gamee = exports.gamee = undefined;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = function () {\n\n var platformBridge,\n platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) {\n // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) {\n // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) {\n // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) {\n // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n exports.gamee = gamee = new _gameeAPI.Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new _platform_bridge.PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new _platform_bridge.MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new _platform_bridge.MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n}();\n\n_core.core.PlatformAPI = _platform_bridge.PlatformAPI;\n_core.core.native = platformBridge;\n\n_platform_bridge.PlatformAPI.emitter = gamee.emitter;\n\nfunction loadScript(url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\nvar g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// gamee-js.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 617022220ca38c913700","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.1\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredGameRoom = function () {\n this.native.createRequest('playerEnteredGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredGameRoom\n * @member of Gamee\n */\n playerEnteredGameRoom: function () {\n core.playerEnteredGameRoom()\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function () {\n core.playerLeftGameRoom()\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function (cb){\n validateDataType(cb,\"function\",\"cb\",\"gamee.showSubscribeDialog\");\n core.showSubscribeDialog(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6","webpack:///gamee-js.min.js","webpack:///webpack/bootstrap ccb5c86008c7f7644613?2a71","webpack:///./gamee/libs/shims.js?26b9","webpack:///./gamee/src/core.js?6b70","webpack:///./gamee/src/gameeAPI.js?7205","webpack:///./gamee/src/platform_bridge.js?848f","webpack:///./gamee/libs/bullet.js?d693","webpack:///./gamee/src/game_controllers.js?1af2","webpack:///./gamee/src/index.js?b323","webpack:///(webpack)/buildin/global.js?3698"],"names":["root","factory","exports","module","define","amd","a","i","this","modules","__webpack_require__","moduleId","installedModules","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","CustomEmitter","delegate","method","eventTarget","bind","document","createDocumentFragment","forEach","wrapKeyEvent","fn","ev","keyCode","window","event","which","ce","CustomEvent","preventDefault","defaultPrevented","Error","e","params","evt","origPrevent","bubbles","cancelable","detail","undefined","createEvent","initCustomEvent","Event","win","doc","docHijack","old","v","addListen","addEvent","on","self","attachEvent","returnValue","stopPropagation","cancelBubble","obj","length","addEventListener","Element","all","global","validateDataType","DataTypeException","core","_typeof","Symbol","iterator","constructor","_game_controllers","controllers","newObj","key","default","_shims","overloadedAudioContext","type","ctx","state","resume","test","navigator","userAgent","buffer","createBuffer","dummy","createBufferSource","connect","destination","start","disconnect","setTimeout","body","removeEventListener","join","AudioContext","webkitAudioContext","createController","opts","btn","controller","controllerTypes","enableKeyboard","buttons","remapButton","noop","cache","internals","VERSION","CAPABILITIES","variant","soundUnlocked","onReady","onGameStart","gameeInit","ctrlType","ctrlOpts","capabilities","cb","allOk","arguments","cap","Array","isArray","indexOf","native","createRequest","version","responseData","error","platform","requestController","_bindKeyboardTriggers","err","data","trigger","button","gameLoadingProgress","percentageSoFar","percentage","gameReady","updateScore","score","opt_ghostSign","parseInt","ghostSign","gameOver","opt_replayData","opt_saveState","opt_hideOverlay","requestData","replayData","hideOverlay","gameSave","share","saveState","requestSocial","numberOfPlayers","socialData","logEvent","eventName","eventValue","logEvents","requestBattleData","requestPlayerReplay","userID","replay","requestPlayerSaveState","playerEnteredGameRoom","playerLeftGameRoom","purchaseItemWithCoins","options","oldMethod","coins","isSilentModeEnabled","purchaseItemWithGems","gems","loadRewardedVideo","rewardedAds","showRewardedVideo","showSubscribeDialog","requestPlayerData","playerData","startSignal","ghostMode","mainController","additionalController","gameeNative","apply","_keydown","_keyup","OneButton","OneButtonController","TwoButtons","TwoButtonController","FourButtons","FourButtonController","FiveButtons","FiveButtonController","SixButtons","SixButtonController","FourArrows","FourArrowController","Touch","TouchController","Joystick","JoystickController","JoystickWithButton","JoystickButtonController","TwoArrowsTwoButtons","TwoArrowsTwoButtonsController","TwoArrowsOneButton","TwoArrowsOneButtonController","TwoActionButtons","TwoActionButtonsController","registerPlatform","platformAPI","silentMode","expected","present","argument","message","testedInput","expectedType","originMethod","Gamee","GameeEmitter","_core","emitter","_platform","cbError","toString","_controller","gameInit","controllType","controllOpts","opt_cb","opt_share","getPlatform","modifiedResponse","purchaseItem","purchaseDetails","shareDetails","PlatformBridge","requests","_init","PostMessageBridge","endpoint","_gameeWin","MobileBridge","device","PlatformAPI","pause","callback","dispatchEvent","ghostShow","ghostHide","mute","unmute","opt_replay","opt_ghostMode","resetState","opt_resetState","instCount","opt_requestData","opt_callback","validateMethod","messId","preparedObject","request","messageId","doCall","_callback","id","doResponse","create","_resolveAPICall","response","postMessage","opt_data","webkit","messageHandlers","callbackHandler","_toDevice","_triggerMessage","JSON","parse","stringify","BulletClass","_self","_events","once","fnString","callbacks","off","fnToRemove","callbackObject","Bullet","Button","_pressed","Controller","buttonAlias","addButton","x","y","position","_bullet","isDown","gamee","keyCodes","oldName","newName","_gameeAPI","_platform_bridge","platformBridge","platformType","toLowerCase","top","parent","gameeSimulator","g","Function","eval"],"mappings":";CAAA,SAAAA,EAAAC,GACA,mBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,QACA,sBAAAG,gBAAAC,IACAD,UAAAH,OACA,CACA,GAAAK,GAAAL,GACA,QAAAM,KAAAD,IAAA,gBAAAJ,iBAAAF,GAAAO,GAAAD,EAAAC,KAECC,KAAA,WACD,MCCgB,UAAUC,GCP1B,QAAAC,qBAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAT,OAGA,IAAAC,GAAAS,EAAAD,IACAJ,EAAAI,EACAE,GAAA,EACAX,WAUA,OANAO,GAAAE,GAAAG,KAAAX,EAAAD,QAAAC,IAAAD,QAAAQ,qBAGAP,EAAAU,GAAA,EAGAV,EAAAD,QAvBA,GAAAU,KA+DA,OAnCAF,qBAAAK,EAAAN,EAGAC,oBAAAM,EAAAJ,EAGAF,oBAAAH,EAAA,SAAAU,GAA2C,MAAAA,IAG3CP,oBAAAQ,EAAA,SAAAhB,EAAAiB,EAAAC,GACAV,oBAAAW,EAAAnB,EAAAiB,IACAG,OAAAC,eAAArB,EAAAiB,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAV,oBAAAiB,EAAA,SAAAxB,GACA,GAAAiB,GAAAjB,KAAAyB,WACA,WAA2B,MAAAzB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAO,qBAAAQ,EAAAE,EAAA,IAAAA,GACAA,GAIAV,oBAAAW,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAlB,KAAAe,EAAAC,IAGtDpB,oBAAAuB,EAAA,GAGAvB,wCAAAwB,EAAA,KDiBM,SAAU/B,EAAQD,EAASQ,GAEjC,YEUO,SAASyB,iBAGf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js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","/*! @preserve build time 2019-10-17 14:04:37 */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 6);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.CustomEmitter = CustomEmitter;\nexports.wrapKeyEvent = wrapKeyEvent;\n/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function CustomEvent(event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function get() {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return; //No need to polyfill\n\n\tfunction docHijack(p) {\n\t\tvar old = doc[p];doc[p] = function (v) {\n\t\t\treturn addListen(old(v));\n\t\t};\n\t}\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () {\n\t\t\t\te.returnValue = false;\n\t\t\t};\n\t\t\te.stopPropagation = e.stopPropagation || function () {\n\t\t\t\te.cancelBubble = true;\n\t\t\t};\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--) {\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t\t}\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent; //IE8\n\telse {\n\t\t\t//IE < 8\n\t\t\tdoc.attachEvent('onreadystatechange', function () {\n\t\t\t\taddListen(doc.all);\n\t\t\t}); //Make sure we also init at domReady\n\t\t\tdocHijack('getElementsByTagName');\n\t\t\tdocHijack('getElementById');\n\t\t\tdocHijack('createElement');\n\t\t\taddListen(doc.all);\n\t\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nfunction CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\"addEventListener\", \"dispatchEvent\", \"removeEventListener\"].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nfunction wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.validateDataType = exports.DataTypeException = exports.core = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _game_controllers = __webpack_require__(5);\n\nvar controllers = _interopRequireWildcard(_game_controllers);\n\nvar _shims = __webpack_require__(0);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function overloadedAudioContext(type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function resume() {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener(['touchcancel', 'touchend', 'touchenter', 'touchleave', 'touchmove', 'touchstart', 'mouseenter', 'mouseover', 'mousemove', 'mousedown', 'mouseup'].join(\" \"), resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx;\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) {\n // throw error in async part\n setTimeout(function () {\n throw e;\n }, 0);\n }\n})();\n\n/**\n * @class core\n */\nvar core = exports.core = function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function noop() {};\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.0\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\", \"rewardedAds\", \"coins\", \"logEvents\", \"playerData\", \"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true,\n cap = {};\n if (capabilities !== undefined && Array.isArray(capabilities)) {\n for (var i = 0; i < capabilities.length; i++) {\n if (typeof capabilities[i] !== \"string\" || internals.CAPABILITIES.indexOf(capabilities[i]) === -1) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk) throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if (typeof percentage !== \"number\" || percentage < 0 || percentage > 100) throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n }();\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\") throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if (!cache.capabilities.saveState) throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb, numberOfPlayers) {\n\n if (!cache.capabilities.socialData) throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if (!cache.capabilities.logEvents) throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", { eventName: eventName, eventValue: eventValue }, function (error) {\n if (error) {\n throw error;\n }\n });\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if (!cache.capabilities.replay) throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", { userID: userID }, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredGameRoom = function () {\n this.native.createRequest('playerEnteredGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if (!cache.capabilities.coins) throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if (!cache.capabilities.gems) throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\", \"itemName\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Purchase options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if (!cache.capabilities.share) throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property) {\n if (!options.hasOwnProperty(property)) throw \"Share Options must have `\" + property + \"` property\";\n });\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if (!cache.capabilities.rewardedAds) throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if (!cache.capabilities.playerData) throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n var options = undefined;\n if (userID) {\n options = { userID: userID };\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay) error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode) error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function requestController(type, opts) {\n if (type === \"FullScreen\") return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function additionalController(type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function trigger() {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', (0, _shims.wrapKeyEvent)(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n}();\n\nvar DataTypeException = exports.DataTypeException = function DataTypeException(expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = \"Invalid data type in method \" + this.method + \", argument \" + this.argument + \" is expected to be \" + this.expected + \", but found \" + this.present;\n};\n\nvar validateDataType = exports.validateDataType = function validateDataType(testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput)) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n break;\n\n default:\n if ((typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput)) !== expectedType) throw new DataTypeException(expectedType, typeof testedInput === \"undefined\" ? \"undefined\" : _typeof(testedInput), argument, originMethod);\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Gamee = exports.GameeEmitter = undefined;\n\nvar _core = __webpack_require__(1);\n\nvar _shims = __webpack_require__(0);\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nvar GameeEmitter = exports.GameeEmitter = function GameeEmitter() {\n _shims.CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nvar Gamee = exports.Gamee = function Gamee(platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = function () {\n\n var cbError = function cbError(err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: _core.core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function gameInit(controllType, controllOpts, capabilities, cb) {\n var silentMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n (0, _core.validateDataType)(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n (0, _core.validateDataType)(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n (0, _core.validateDataType)(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.gameInit\");\n (0, _core.validateDataType)(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = _core.core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function gameLoadingProgress(percentage, opt_cb) {\n (0, _core.validateDataType)(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n _core.core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function gameReady(opt_cb) {\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n _core.core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function gameSave(data, opt_share, opt_cb) {\n var share = false,\n cb;\n (0, _core.validateDataType)(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function') opt_cb = opt_share;else if (typeof opt_share !== \"undefined\") (0, _core.validateDataType)(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n _core.core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function getPlatform() {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function updateScore(score, opt_ghostSign, opt_cb) {\n (0, _core.validateDataType)(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\") opt_cb = opt_ghostSign;else if (typeof opt_ghostSign !== \"undefined\") (0, _core.validateDataType)(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n _core.core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function gameOver(opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\") opt_cb = opt_replayData;else if (typeof opt_replayData !== \"undefined\") (0, _core.validateDataType)(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n (0, _core.validateDataType)(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n (0, _core.validateDataType)(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n _core.core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function requestSocial(cb, numberOfPlayers) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = _core.core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function logEvent(eventName, eventValue) {\n\n (0, _core.validateDataType)(eventName, \"string\", \"eventName\", \"gamee.logEvent\");\n\n if (!eventName || eventName.length > 24) {\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return;\n }\n\n (0, _core.validateDataType)(eventValue, \"string\", \"eventValue\", \"gamee.logEvent\");\n\n if (!eventValue || eventValue.length > 160) {\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return;\n }\n\n _core.core.logEvent(eventName, eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function requestBattleData(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n _core.core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function requestPlayerReplay(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n _core.core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function requestPlayerSaveState(userID, cb) {\n\n (0, _core.validateDataType)(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n _core.core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredGameRoom\n * @member of Gamee\n */\n playerEnteredGameRoom: function playerEnteredGameRoom() {\n _core.core.playerEnteredGameRoom();\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function playerLeftGameRoom() {\n _core.core.playerLeftGameRoom();\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function purchaseItem(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItem\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItem\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb, true);\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function purchaseItemWithCoins(purchaseDetails, cb) {\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithCoins\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithCoins\");\n\n _core.core.purchaseItemWithCoins(purchaseDetails, cb);\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function purchaseItemWithGems(purchaseDetails, cb) {\n\n (0, _core.validateDataType)(purchaseDetails, \"object\", \"purchaseDetails\", \"gamee.purchaseItemWithGems\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.purchaseItemWithGems\");\n\n _core.core.purchaseItemWithGems(purchaseDetails, cb);\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function share(shareDetails, cb) {\n (0, _core.validateDataType)(shareDetails, \"object\", \"shareDetails\", \"gamee.share\");\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.share\");\n\n _core.core.share(shareDetails, cb);\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function loadRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.loadRewardedVideo\");\n _core.core.loadRewardedVideo(cb);\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function showRewardedVideo(cb) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showRewardedVideo\");\n _core.core.showRewardedVideo(cb);\n },\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function showSubscribeDialog(cb) {\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.showSubscribeDialog\");\n _core.core.showSubscribeDialog(cb);\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function requestPlayerData(cb, userID) {\n\n (0, _core.validateDataType)(cb, \"function\", \"cb\", \"gamee.requestPlayerData\");\n if (userID !== undefined) {\n (0, _core.validateDataType)(userID, \"number\", \"userId\", \"gamee.requestPlayerData\");\n }\n _core.core.requestPlayerData(cb, userID);\n }\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n}();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.PlatformAPI = undefined;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.PlatformBridge = PlatformBridge;\nexports.PostMessageBridge = PostMessageBridge;\nexports.MobileBridge = MobileBridge;\n\nvar _core = __webpack_require__(1);\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nvar PlatformAPI = exports.PlatformAPI = {\n\temitter: null,\n\tpause: function pause(cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function resume(cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function ghostShow(cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function ghostHide(cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function mute(cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function unmute(cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function start(data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = _core.core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay) event.detail.opt_replay = true;\n\t\tif (data.ghostMode) event.detail.opt_ghostMode = true;\n\t\tif (data.resetState) event.detail.opt_resetState = true;\n\t\tif (data.replayData) {\n\t\t\tevent.detail.replayData = data.replayData;\n\t\t}\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n/**\n * @class PlatformBridge\n *\n */\nfunction PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function _init() {},\n\tcreateRequest: function createRequest(method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method)) return;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function validateMethod(method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n * @abstract\n */\n\tdoCall: function doCall(preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function _callback(id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb) cb(responseData);\n\t},\n\t/**\n * @abstract\n */\n\tdoResponse: function doResponse(preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t}\n};\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nfunction PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (_typeof(ev.detail) === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (_typeof(ev.data) === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4) + ' data');\n\t\t}\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\t\tif (data.error) throw data.error;\n\t\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData) preparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\t\tconsole.error(\"Unknown method call\");\n\t\t\t}\n\t}\n};\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nfunction MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!_core.core.isSilentModeEnabled()) {\n\t\t\tconsole.log(JSON.stringify(data, null, 4));\n\t\t}\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif ((typeof requestData === 'undefined' ? 'undefined' : _typeof(requestData)) === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar BulletClass = function BulletClass() {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 || typeof event !== \"string\" || typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n } else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n } else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n } else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" || typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n};\n\nvar Bullet = exports.Bullet = new BulletClass();\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.BulletClass = undefined;\nexports.Button = Button;\nexports.Controller = Controller;\nexports.OneButtonController = OneButtonController;\nexports.TwoButtonController = TwoButtonController;\nexports.TwoActionButtonsController = TwoActionButtonsController;\nexports.FourButtonController = FourButtonController;\nexports.FiveButtonController = FiveButtonController;\nexports.SixButtonController = SixButtonController;\nexports.TwoArrowsOneButtonController = TwoArrowsOneButtonController;\nexports.TwoArrowsTwoButtonsController = TwoArrowsTwoButtonsController;\nexports.FourArrowController = FourArrowController;\nexports.TouchController = TouchController;\nexports.JoystickController = JoystickController;\nexports.JoystickButtonController = JoystickButtonController;\n\nvar _bullet = __webpack_require__(4);\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nvar BulletClass = exports.BulletClass = _bullet.Bullet.constructor;\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nfunction Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nfunction Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key,\n\t button,\n\t keyCodes = {},\n\t self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nfunction OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nfunction TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nfunction TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nfunction FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nfunction FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nfunction SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nfunction TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nfunction TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nfunction FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nfunction TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nfunction JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nfunction JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.gamee = undefined;\n\n__webpack_require__(0);\n\nvar _gameeAPI = __webpack_require__(2);\n\nvar _core = __webpack_require__(1);\n\nvar _platform_bridge = __webpack_require__(3);\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nvar gamee = exports.gamee = undefined;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = function () {\n\n var platformBridge,\n platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) {\n // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) {\n // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) {\n // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) {\n // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n exports.gamee = gamee = new _gameeAPI.Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new _platform_bridge.PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new _platform_bridge.MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new _platform_bridge.MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n}();\n\n_core.core.PlatformAPI = _platform_bridge.PlatformAPI;\n_core.core.native = platformBridge;\n\n_platform_bridge.PlatformAPI.emitter = gamee.emitter;\n\nfunction loadScript(url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\nvar g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// gamee-js.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ccb5c86008c7f7644613","/**\n * @class CustomEvent\n */\n(function shimCustomEvent() {\n\ttry {\n\t\tvar ce = new window.CustomEvent('test');\n\t\tce.preventDefault();\n\t\tif (ce.defaultPrevented !== true) {\n\t\t\t// IE has problems with .preventDefault() on custom events\n\t\t\t// http://stackoverflow.com/questions/23349191\n\t\t\tthrow new Error('Could not prevent default');\n\t\t}\n\t} catch (e) {\n\t\tvar CustomEvent = function (event, params) {\n\t\t\tvar evt, origPrevent;\n\t\t\tparams = params || {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: false,\n\t\t\t\tdetail: undefined\n\t\t\t};\n\n\t\t\tevt = document.createEvent(\"CustomEvent\");\n\t\t\tevt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n\t\t\torigPrevent = evt.preventDefault;\n\t\t\tevt.preventDefault = function () {\n\t\t\t\torigPrevent.call(this);\n\t\t\t\ttry {\n\t\t\t\t\tObject.defineProperty(this, 'defaultPrevented', {\n\t\t\t\t\t\tget: function () {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.defaultPrevented = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn evt;\n\t\t};\n\n\t\tCustomEvent.prototype = window.Event.prototype;\n\t\twindow.CustomEvent = CustomEvent; // expose definition to window\n\t}\n})();\n\n//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence\n(function (win, doc) {\n\tif (win.addEventListener) return;\t\t//No need to polyfill\n\n\tfunction docHijack(p) { var old = doc[p]; doc[p] = function (v) { return addListen(old(v)); }; }\n\tfunction addEvent(on, fn, self) {\n\t\treturn (self = this).attachEvent('on' + on, function (e) {\n\t\t\te = e || win.event;\n\t\t\te.preventDefault = e.preventDefault || function () { e.returnValue = false; };\n\t\t\te.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; };\n\t\t\tfn.call(self, e);\n\t\t});\n\t}\n\tfunction addListen(obj, i) {\n\t\ti = obj.length;\n\t\tif (i) {\n\t\t\twhile (i--)\n\t\t\t\tobj[i].addEventListener = addEvent;\n\t\t} else {\n\t\t\tobj.addEventListener = addEvent;\n\t\t}\n\t\treturn obj;\n\t}\n\n\taddListen([doc, win]);\n\tif ('Element' in win) win.Element.prototype.addEventListener = addEvent;\t\t\t//IE8\n\telse {\t\t//IE < 8\n\t\tdoc.attachEvent('onreadystatechange', function () { addListen(doc.all); });\t\t//Make sure we also init at domReady\n\t\tdocHijack('getElementsByTagName');\n\t\tdocHijack('getElementById');\n\t\tdocHijack('createElement');\n\t\taddListen(doc.all);\n\t}\n})(window, document);\n\n// naomik event emiter http://stackoverflow.com/a/24216547/1866147\n// usage:\n// function Example() {\n// \tCustomEmitter.call(this);\n// }\n\n// // run it\n// var e = new Example();\n\n// e.addEventListener(\"something\", function (event) {\n// \tconsole.log(event)\n// });\n\n// e.dispatchEvent(new Event(\"something\"));\nexport function CustomEmitter() {\n\tvar eventTarget = document.createDocumentFragment();\n\n\tfunction delegate(method) {\n\t\tthis[method] = eventTarget[method].bind(eventTarget);\n\t}\n\n\t[\n\t\t\"addEventListener\",\n\t\t\"dispatchEvent\",\n\t\t\"removeEventListener\"\n\t].forEach(delegate, this);\n}\n\n/** ### wrapKeyEvent \n * \n * Handle old IE event differences for key events\n * \n * @param {Function} fn callback\n */\nexport function wrapKeyEvent(fn) {\n\treturn function (ev) {\n\t\tif (!ev || !ev.keyCode) {\n\t\t\tif (!ev) {\n\t\t\t\tev = window.event;\n\t\t\t}\n\n\t\t\tif (ev.which) {\n\t\t\t\tev.keyCode = ev.which;\n\t\t\t}\n\t\t}\n\n\t\treturn fn(ev);\n\t};\n}\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/shims.js","import * as controllers from \"./game_controllers.js\"\nimport { wrapKeyEvent } from \"../libs/shims.js\"\n\n// unlock audio\n// overrides native AudioContext & webkitAudioContext\n(function () {\n // this works as a constructor\n var overloadedAudioContext = function (type) {\n var ctx = new type();\n\n // add audio resume to function on touchstart\n if (ctx.state === 'suspended') {\n\n var resume = function () {\n\n // Check if hack is necessary. Only occurs in iOS6+ devices\n // and only when you first boot the iPhone, or play a audio/video\n // with a different sample rate\n if (/(iPhone|iPad)/i.test(navigator.userAgent)) {\n var buffer = ctx.createBuffer(1, 1, 44100);\n var dummy = ctx.createBufferSource();\n dummy.buffer = buffer;\n dummy.connect(ctx.destination);\n dummy.start(0);\n dummy.disconnect();\n }\n\n ctx.resume();\n setTimeout(function () {\n if (ctx.state === 'running') {\n document.body.removeEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"), resume, false);\n }\n }, 0);\n };\n\n // only touchend will work, but hey, we tried...\n // https://github.com/WebAudio/web-audio-api/issues/836\n // https://www.chromestatus.com/feature/6406908126691328\n document.body.addEventListener([\n 'touchcancel',\n 'touchend',\n 'touchenter',\n 'touchleave',\n 'touchmove',\n 'touchstart',\n 'mouseenter',\n 'mouseover',\n 'mousemove',\n 'mousedown',\n 'mouseup'\n ].join(\" \"),\n resume, false);\n }\n // allowed in JS to return different type of the object in the constructor\n return ctx\n };\n\n try {\n if (typeof window.AudioContext !== 'undefined') {\n window.AudioContext = overloadedAudioContext.bind(null, window.AudioContext);\n } else if (typeof webkitAudioContext !== 'undefined') {\n window.webkitAudioContext = overloadedAudioContext.bind(null, window.webkitAudioContext);\n }\n } catch (e) { // throw error in async part\n setTimeout(() => {\n throw e;\n }, 0)\n }\n})();\n\n\n/**\n * @class core\n */\nexport var core = (function () {\n\n // # Gamee.js\n //\n // This file defines and expose a public API for games to communicate\n // with Gamee*.\n //\n // Also it handles some requirements when Gamee is run in an desktop\n // environment.\n //\n // \\* _later in the document Gamee will be referred as GameeApp to not\n // be mistaken for word game_\n //\n // ** _GameeWebApp will refer to Gamee which is running in a desktop\n // browser_\n\n /** an empty function */\n var noop = function () { };\n\n var cache = {};\n\n /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */\n var internals = {\n VERSION: \"2.4.0\", // version of the gamee library\n CAPABILITIES: [\"ghostMode\", \"saveState\", \"replay\", \"socialData\",\"rewardedAds\",\"coins\",\"logEvents\",\"playerData\",\"share\", \"gems\"], // supported capabilities\n variant: 0, // for automating communication with server\n soundUnlocked: false,\n onReady: noop, // for intercepting real onReady because of behind the scenes variant handling\n onGameStart: noop // for intercepting real onGameStart because of unlocking sound\n };\n\n /** ## gamee\n *\n * GameeApp interface for games. It is exposed as a `gamee` global\n * object and games should only use its public methods and\n * properties to communicate with the GameeApp.\n *\n * _There is also [$gameeNative](gamee_native.js.html) global object\n * which handles internal parts of the communication._\n */\n var core = {};\n\n //\n // ## Signaling game state\n //\n // The game should signal the GameeApp its status (playing/game-over)\n // and current score.\n //\n\n /** ### gamee.gameeInit\n *\n * Must be called first before any other gamee calls\n * returns controller object the same way requestController did previously\n * ctrlType/ctrlOpts - requested control type + options\n * capabilities -> array of strings representing supported features:\n * after the initialization onReady is invoked and after that game can use the api\n */\n core.gameeInit = function (ctrlType, ctrlOpts, capabilities, cb, silentMode = false) {\n // let's validate the array here, so that all backends can benefit from it\n var allOk = true, cap = {};\n if ((capabilities !== undefined) && (Array.isArray(capabilities))) {\n for (var i = 0; i < capabilities.length; i++) {\n if ((typeof capabilities[i] !== \"string\") ||\n (internals.CAPABILITIES.indexOf(capabilities[i]) === -1)) allOk = false;\n cap[capabilities[i]] = true;\n }\n } else allOk = false;\n\n if (!allOk)\n throw \"Capabilities array passed to gameeInit is void, malformed or unsupported capabilites requested.\";\n // TODO remove\n // gameeNative.gameeInit(core, internals.VERSION, ctrlType, allOk ? capabilities : []);\n\n this.native.createRequest(\"init\", {\n version: internals.VERSION,\n controller: ctrlType,\n capabilities: cap\n }, function (responseData) {\n // remember capabilities of the game\n cache.capabilities = cap;\n //\n // // Mute gamee-js console output\n // cache.silentMode = silentMode;\n\n // might fail if controller of this type doesnt exist\n var error = null;\n try {\n if (this.native.platform === \"web\") {\n responseData.controller = core.controller.requestController(ctrlType, { enableKeyboard: true });\n this._bindKeyboardTriggers(responseData.controller);\n } else {\n responseData.controller = core.controller.requestController(ctrlType, {});\n }\n } catch (err) {\n error = err;\n }\n\n cb(error, responseData);\n }.bind(this));\n // TODO remove\n // return core.controller.requestController(ctrlType, ctrlOpts);\n };\n\n core._bindKeyboardTriggers = function (controller) {\n global.addEventListener('message', function (ev) {\n switch (ev.data[0]) {\n case 'button_button_down':\n controller.trigger(\"keydown\", { button: \"button\" });\n break;\n\n case 'button_button_up':\n controller.trigger(\"keyup\", { button: \"button\" });\n break;\n\n case 'button_left_up':\n controller.trigger(\"keyup\", { button: \"left\" });\n break;\n\n case 'button_left_down':\n controller.trigger(\"keydown\", { button: \"left\" });\n break;\n\n case 'button_right_down':\n controller.trigger(\"keydown\", { button: \"right\" });\n break;\n\n case 'button_right_up':\n controller.trigger(\"keyup\", { button: \"right\" });\n break;\n\n case 'button_up_down':\n controller.trigger(\"keydown\", { button: \"up\" });\n break;\n\n case 'button_up_up':\n controller.trigger(\"keyup\", { button: \"up\" });\n break;\n\n case 'button_down_down':\n controller.trigger(\"keydown\", { button: \"down\" });\n break;\n\n case 'button_down_up':\n controller.trigger(\"keyup\", { button: \"down\" });\n break;\n\n case 'button_a_down':\n controller.trigger(\"keydown\", { button: \"A\" });\n break;\n\n case 'button_a_up':\n controller.trigger(\"keyup\", { button: \"A\" });\n break;\n\n case 'button_b_down':\n controller.trigger(\"keydown\", { button: \"B\" });\n break;\n\n case 'button_b_up':\n controller.trigger(\"keyup\", { button: \"B\" });\n break;\n }\n });\n };\n\n /** ### gamee.gameLoadingProgress\n *\n * Indicates how much content is already loaded in %.\n */\n core.gameLoadingProgress = (function () {\n var percentageSoFar = 0;\n\n return function (percentage) {\n if ((typeof percentage !== \"number\") || (percentage < 0) || (percentage > 100))\n throw \"Percentage passed to gameLoadingProgress out of bounds or not a number.\";\n else if (percentage > percentageSoFar) {\n percentageSoFar = percentage;\n this.native.createRequest(\"gameLoadingProgress\", { percentage: percentage });\n }\n };\n })();\n\n\n /** ### gamee.gameReady\n *\n * Notifies platform game can accept start command.\n */\n core.gameReady = function () {\n this.native.createRequest(\"gameReady\");\n };\n\n /** ### gamee.gameStart\n *\n * Indicates that game is ready to be started (even after restart).\n */\n // core.gameStart = function () {\n // gameeNative.gameLoadingProgress(100); // FB requires this\n // gameeNative.gameStart(gamee);\n // };\n\n /** ### gamee.updateScore\n *\n * sends score to UI\n */\n core.updateScore = function (score, opt_ghostSign) {\n if (typeof score !== \"number\")\n throw \"Score passed to updateScore is not a number.\";\n var data = {\n score: parseInt(score, 10)\n };\n if (opt_ghostSign) {\n data.ghostSign = true;\n }\n this.native.createRequest(\"updateScore\", data);\n // core.native.createRequest(method, requestData, callback);\n };\n\n /** ### gamee.gameOver\n *\n * Indicates the game has ended, the game is waiting for subsequent onGameStart.\n * Data has the same format as data received in onReady callback.\n * Data must be string = responsibility for turning data structure into string is left to the game!\n */\n core.gameOver = function (opt_replayData, opt_saveState, opt_hideOverlay) {\n opt_hideOverlay = opt_hideOverlay !== undefined ? opt_hideOverlay : false;\n // var allOk = ((data !== undefined) && (typeof data === \"string\")) || (data === undefined);\n // if (!allOk) console.error(\"Data provided to gameOver function must be string.\");\n // gameeNative.gameOver(gamee, internals.variant, allOk ? data : \"\");\n var requestData = {};\n if (opt_replayData) {\n if (!opt_replayData.hasOwnProperty(\"variant\")) {\n opt_replayData.variant = \"\";\n }\n if (!opt_replayData.hasOwnProperty(\"data\")) {\n throw \"Replay data must have `data` property\";\n }\n requestData.replayData = opt_replayData;\n }\n requestData.hideOverlay = opt_hideOverlay;\n\n if (opt_saveState) {\n requestData.state = opt_saveState;\n }\n\n core.native.createRequest(\"gameOver\", requestData);\n };\n\n /** ### gamee.gameSave\n *\n * Player has requested saving current game's state\n * data must be string = responsibility for turning data structure into string is left to game!\n * share must be expression evaluating to either true or false; it indicates, whether the game progress should be shared on feed\n */\n core.gameSave = function (data, share) {\n\n if(!cache.capabilities.saveState)\n throw \"Save State not supported, you must add the capability on gamee.Init\";\n\n core.native.createRequest(\"saveState\", { state: data, share: share });\n };\n\n core.requestSocial = function (cb,numberOfPlayers) {\n\n if(!cache.capabilities.socialData)\n throw \"Social Data not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestSocial\", numberOfPlayers, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.logEvent = function (eventName, eventValue) {\n\n if(!cache.capabilities.logEvents)\n throw \"Log Events not supported, you must add the capability on gamee.Init\";\n\n //var valuesToLogString = JSON.stringify(eventValue)\n\n this.native.createRequest(\"logEvent\", {eventName,eventValue}, function (error){\n if(error){\n throw error\n }\n });\n\n };\n\n core.requestBattleData = function (cb) {\n this.native.createRequest(\"requestBattleData\", undefined, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerReplay = function (userID, cb) {\n\n if(!cache.capabilities.replay)\n throw \"Replays not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"requestPlayerReplay\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerSaveState = function (userID, cb) {\n this.native.createRequest(\"requestPlayerSaveState\", {userID}, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.playerEnteredGameRoom = function () {\n this.native.createRequest('playerEnteredGameRoom');\n };\n\n core.playerLeftGameRoom = function () {\n this.native.createRequest('playerLeftGameRoom');\n };\n\n core.purchaseItemWithCoins = function (options, cb, oldMethod) {\n\n if(!cache.capabilities.coins)\n throw \"Coins purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"coinsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase Options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n var method = \"purchaseItemWithCoins\";\n if (oldMethod !== undefined && oldMethod === true) {\n method = \"purchaseItem\";\n }\n this.native.createRequest(method, options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.purchaseItemWithGems = function (options, cb) {\n\n if(!cache.capabilities.gems)\n throw \"Gems purchases not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"gemsCost\",\"itemName\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Purchase options must have `\"+property+\"` property\"\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"purchaseItemWithGems\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.share = function (options, cb) {\n\n if(!cache.capabilities.share)\n throw \"Share option not supported, you must add the capability on gamee.Init\";\n\n if (options) {\n var propertiesList = [\"destination\"];\n propertiesList.forEach(function (property){\n if(!options.hasOwnProperty(property))\n throw \"Share Options must have `\"+property+\"` property\";\n })\n }\n\n if (!this.isSilentModeEnabled()) {\n console.log(options);\n }\n\n this.native.createRequest(\"share\",options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.loadRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"loadRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showRewardedVideo = function (cb) {\n\n if(!cache.capabilities.rewardedAds)\n throw \"Rewarded Ads not supported, you must add the capability on gamee.Init\";\n\n this.native.createRequest(\"showRewardedVideo\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.showSubscribeDialog = function (cb) {\n this.native.createRequest(\"showSubscribeDialog\", function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.requestPlayerData = function (cb, userID) {\n\n if(!cache.capabilities.playerData)\n throw \"Player Data not supported, you must add the capability on gamee.Init\";\n\n let options = undefined;\n if (userID) {\n options = {userID};\n }\n\n this.native.createRequest(\"requestPlayerData\", options, function (responseData) {\n cb(null, responseData);\n });\n };\n\n core.startSignal = function (data) {\n var error;\n\n if (data.replay && !cache.capabilities.replay)\n error = \"Game doesn't support replay. \";\n\n if (data.ghostMode && !cache.capabilities.ghostMode)\n error = \"Game doesn't support ghost Mode. \";\n\n return error;\n };\n //\n // ## Private objects and methods\n // These are internal objects in closed scope. Good to know about them\n // when debugging.\n\n //\n // ## gamee.controller\n //\n // Namespace where the methods for controller are published.\n //\n\n /**\n * TODO transform this into instance of gamee class\n */\n core.controller = {\n /** ### mainController\n *\n * Current controller.\n */\n mainController: null,\n\n /** ### requestController\n *\n * Factory method to create a controller. It creates the controller\n * and signals to GameeApp which type the game requires\n *\n * You should called this method once before calling\n * `gamee.gameStart()`.\n *\n * @param {String} type type of controller (see [controllerTypes](#controllertypes))\n * @param {Object} [opts] optional controller options\n * {'enableKeyboard': .., 'buttons': ...}\n * @param {boolean} [opts.enableKeyboard] enable the keyboard\n * @param {Object} [opts.buttons] remap buttons {'oldKey': 'newKey',\n * 'left': 'break' ..}\n */\n requestController: function (type, opts) {\n if (type === \"FullScreen\")\n return null;\n\n var controller = createController(type, opts);\n\n this.mainController = controller;\n\n return controller;\n },\n\n /** ### additionalController\n *\n * Construct an additional controller. Sometimes games require a\n * different controller depending on platform (eg. touch on mobile,\n e but Four Buttons on desktop)\n *\n * **This is currently supported only for GameeWebApp** as a way to\n * have alternate keybinding. The game should request a type used\n * for mobile platform and then some other as *additionalController*\n * if alternate keybinding is needed;\n */\n // TODO remove this function\n additionalController: function (type, opts) {\n var controller = createController(type, opts);\n gameeNative.additionalController(type);\n\n return controller;\n },\n\n /** ### trigger\n *\n * Triggers and event for the controller\n *\n * This is called by GameeApp to trigger the *keydown*, *keyup*\n * events. For more info see [Controller](#controller)\n *\n * @param {String} eventName name of the event\n * @param {*} [data,...] data to pass for the event\n *\n */\n trigger: function () {\n var i;\n\n if (this.mainController) {\n this.mainController.trigger.apply(this.mainController, arguments);\n } else {\n throw new Error('No controller present');\n }\n }\n };\n\n /** ### core._keydown\n *\n * A helper function to listen for `keydown` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keydown = function (fn) {\n global.addEventListener('keydown', wrapKeyEvent(fn));\n };\n\n /** ### core._keyup\n *\n * A helper function to listen for `keyup` events on window object.\n *\n * @param {Function} fn callback to handle the event\n */\n core._keyup = function (fn) {\n global.addEventListener('keyup', wrapKeyEvent(fn));\n };\n\n /** ### createController\n *\n * Function to create a controller.\n *\n * *see [requestController](#requestcontroller)\n *\n * @param {String} type\n * @param {Object} [opts]\n * @returns {Controller} controller\n */\n function createController(type, opts) {\n var btn, controller;\n\n if (!controllerTypes[type]) {\n throw new Error('Unsupported controller type, ' + type);\n }\n\n opts = opts || {};\n\n controller = new controllerTypes[type]();\n\n if (opts.enableKeyboard) {\n controller.enableKeyboard(core);\n }\n\n if (opts.buttons) {\n for (btn in opts.buttons) {\n controller.remapButton(btn, opts.buttons[btn]);\n }\n }\n\n return controller;\n }\n\n\n\n /** ### controllerTypes\n *\n * List of controller types and their coresponding classes.\n *\n * *see [Controllers](#controllers) for more info*\n * @requires Controller\n */\n var controllerTypes = {\n 'OneButton': controllers.OneButtonController,\n 'TwoButtons': controllers.TwoButtonController,\n 'FourButtons': controllers.FourButtonController,\n 'FiveButtons': controllers.FiveButtonController,\n 'SixButtons': controllers.SixButtonController,\n 'FourArrows': controllers.FourArrowController,\n 'Touch': controllers.TouchController,\n 'Joystick': controllers.JoystickController,\n 'JoystickWithButton': controllers.JoystickButtonController,\n 'TwoArrowsTwoButtons': controllers.TwoArrowsTwoButtonsController,\n 'TwoArrowsOneButton': controllers.TwoArrowsOneButtonController,\n 'TwoActionButtons': controllers.TwoActionButtonsController\n };\n\n\n core.registerPlatform = function (platformAPI) {\n // platformAPI.addEventListener()\n // TODO ?\n };\n\n /**\n * Is true mute all console outputs\n * @return {boolean}\n */\n core.isSilentModeEnabled = function () {\n return cache.silentMode;\n };\n\n return core;\n})();\n\nexport var DataTypeException = function (expected, present, argument, method) {\n this.expected = expected;\n this.present = present;\n this.method = method;\n this.argument = argument;\n this.message = `Invalid data type in method ${this.method}, argument ${this.argument} is expected to be ${this.expected}, but found ${this.present}`;\n};\n\nexport var validateDataType = function (testedInput, expectedType, argument, originMethod) {\n switch (expectedType) {\n\n case \"array\":\n if (!Array.isArray(testedInput))\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n break;\n\n default:\n if (typeof testedInput !== expectedType)\n throw new DataTypeException(expectedType, typeof testedInput, argument, originMethod);\n }\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/core.js","import { core } from \"./core.js\"\nimport { CustomEmitter } from \"../libs/shims.js\"\nimport { validateDataType } from \"./core.js\"\n\n/**\n * gameeAPI module desc\n * @module gameeAPI\n */\n\n/**\n * Emit events\n * @class GameeEmitter\n * @extends CustomEmitter\n */\nexport var GameeEmitter = function () {\n CustomEmitter.call(this);\n};\n\n/**\n * @class Gamee\n * @requires core\n *\n */\nexport var Gamee = function (platform) {\n /**\n * @instance\n *\n * @fires gameeAPI:GameeEmitter~start\n * @fires gameeAPI:GameeEmitter~mute\n * @fires gameeAPI:GameeEmitter~unmute\n * @fires gameeAPI:GameeEmitter~pause\n * @fires gameeAPI:GameeEmitter~unpause\n * @fires gameeAPI:GameeEmitter~ghostHide\n * @fires gameeAPI:GameeEmitter~ghostShow\n */\n this.emitter = new GameeEmitter();\n this._platform = platform;\n};\n\nGamee.prototype = (function () {\n\n var cbError = function (err) {\n if (err) {\n throw \"Error \" + err.toString();\n }\n };\n\n return {\n _controller: core.controller,\n /**\n * gameInit\n * @memberof Gamee\n * @param {string} controllType\n * @param {object} controllOpts\n * @param {string[]} capabilities\n * @param {gameInitCallback} cb\n * @param {boolean} silentMode\n */\n gameInit: function (controllType, controllOpts, capabilities, cb, silentMode = false) {\n validateDataType(controllType, \"string\", \"controllType\", \"gamee.updateScore\");\n validateDataType(controllOpts, \"object\", \"controllOpts\", \"gamee.gameInit\");\n validateDataType(capabilities, \"array\", \"capabilities\", \"gamee.gameInit\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.gameInit\");\n validateDataType(silentMode, \"boolean\", \"silentMode\", \"gamee.gameInit\");\n var result = core.gameeInit(controllType, controllOpts, capabilities, cb, silentMode);\n // cb(null, result);\n },\n\n /**\n * gameLoadingProgress\n *\n * gamee.gameLoadingProgress()\n *\n * @memberof Gamee\n * @param {number} percentage current loading progress\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameLoadingProgress: function (percentage, opt_cb) {\n validateDataType(percentage, \"number\", \"percentage\", \"gamee.gameLoadingProgress\");\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameLoadingProgress\");\n core.gameLoadingProgress(percentage);\n opt_cb(null);\n },\n\n /**\n * gameReady\n *\n * @memberof Gamee\n * @param {Gamee~voidCallback} [opt_cb]\n */\n gameReady: function (opt_cb) {\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameReady\");\n core.gameReady();\n opt_cb(null);\n },\n\n /**\n * gameSave\n *\n * NOTE: There are 2 signatures for this function\n *\n * gamee.gameSave(data, opt_cb)\n * gamee.gameSave(data, opt_share, opt_cb)\n *\n * @memberof Gamee\n * @param {String} data current ingame progress\n * @param {Boolean} [opt_share=false]\n * @param {Gamee~voidCallback} [opt_cb]\n *\n */\n gameSave: function (data, opt_share, opt_cb) {\n var share = false, cb;\n validateDataType(data, \"string\", \"data\", \"gamee.gameSave\");\n if (typeof opt_share === 'function')\n opt_cb = opt_share;\n else if (typeof opt_share !== \"undefined\")\n validateDataType(opt_share, \"boolean\", \"opt_share\", \"gamee.gameSave\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameSave\");\n core.gameSave(data, share);\n opt_cb(null);\n },\n\n /**\n * getPlatform\n *\n * @memberof Gamee\n * @returns {string} platform type can be android | ios | web | fb\n */\n getPlatform: function () {\n return this._platform;\n },\n\n /**\n * updateScore\n *\n * @memberof Gamee\n * @param {number} score\n * @param {boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead.\n * @param {Gamee~voidCallback} [opt_cb]\n */\n updateScore: function (score, opt_ghostSign, opt_cb) {\n validateDataType(score, \"number\", \"score\", \"gamee.updateScore\");\n if (typeof opt_ghostSign === \"function\")\n opt_cb = opt_ghostSign;\n else if (typeof opt_ghostSign !== \"undefined\")\n validateDataType(opt_ghostSign, \"boolean\", \"opt_ghostSign\", \"gamee.updateScore\");\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.updateScore\");\n core.updateScore(score, opt_ghostSign);\n opt_cb(null);\n },\n\n /**\n * gameOver\n *\n * @memberof Gamee\n * @param {Gamee~ReplayData} [opt_replayData]\n * @param {Gamee~voidCallback} [opt_cb]\n * @param {Gamee~object} [opt_saveState]\n * @param {Gamee~boolean} [opt_hideOverlay]\n */\n gameOver: function (opt_replayData, opt_cb, opt_saveState, opt_hideOverlay) {\n if (typeof opt_replayData === \"function\")\n opt_cb = opt_replayData;\n else if (typeof opt_replayData !== \"undefined\")\n validateDataType(opt_replayData, \"object\", \"opt_replayData\", \"gamee.gameOver\");\n\n if (typeof opt_hideOverlay !== 'undefined') {\n validateDataType(opt_hideOverlay, \"boolean\", \"opt_hideOverlay\", \"gamee.gameOver\");\n }\n\n opt_cb = opt_cb || cbError;\n validateDataType(opt_cb, \"function\", \"opt_cb\", \"gamee.gameOver\");\n core.gameOver(opt_replayData, opt_saveState, opt_hideOverlay);\n opt_cb(null);\n },\n\n /**\n * requestSocialData\n *\n * @memberof Gamee\n * @param {Gamee~requestSocialDataCallback} cb\n * @param {number} numberOfPlayers\n */\n requestSocial: function (cb, numberOfPlayers) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestSocial\");\n\n // functionality supposed to be removed once we do update for iOS\n var data = core.requestSocial(function (error, responseData) {\n var modifiedResponse = !responseData.hasOwnProperty(\"socialData\") ? { socialData: responseData } : responseData;\n cb(null, modifiedResponse);\n }, numberOfPlayers);\n\n // var data = core.requestSocial(cb);\n //cb(null, data);\n },\n\n /**\n * logEvent\n *\n * @memberof Gamee\n * @param {string} eventName\n * @param {string} eventValue\n */\n logEvent: function (eventName, eventValue) {\n\n validateDataType(eventName,\"string\",\"eventName\",\"gamee.logEvent\");\n\n if(!eventName || eventName.length > 24){\n console.error(\"eventName parameter cant be null and can only contain up to 24 characters\");\n return\n }\n\n validateDataType(eventValue,\"string\",\"eventValue\",\"gamee.logEvent\");\n\n if(!eventValue || eventValue.length > 160){\n console.error(\"eventValue parameter cant be null and can only contain up to 160 characters\");\n return\n }\n\n core.logEvent(eventName,eventValue);\n },\n\n /**\n * requestBattleData\n *\n * @memberof Gamee\n * @param {Gamee~requestBattleDataDataCallback} cb\n */\n requestBattleData: function (cb) {\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestBattleData\");\n\n core.requestBattleData(cb);\n },\n\n /**\n * requestPlayerReplay\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerReplayDataCallback} cb\n */\n requestPlayerReplay: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerReplay\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerReplay\");\n\n core.requestPlayerReplay(userID, cb);\n },\n\n /**\n * requestPlayerSaveState\n *\n * @memberof Gamee\n * @param {number} userID\n * @param {Gamee~requestPlayerSaveStateDataCallback} cb\n */\n requestPlayerSaveState: function (userID, cb) {\n\n validateDataType(userID, \"number\", \"userID\", \"gamee.requestPlayerSaveState\");\n validateDataType(cb, \"function\", \"cb\", \"gamee.requestPlayerSaveState\");\n\n core.requestPlayerSaveState(userID, cb);\n },\n\n /*\n * playerEnteredGameRoom\n * @member of Gamee\n */\n playerEnteredGameRoom: function () {\n core.playerEnteredGameRoom()\n },\n\n /*\n * playerLeftGameRoom\n * @member of Gamee\n */\n playerLeftGameRoom: function () {\n core.playerLeftGameRoom()\n },\n\n /*\n *purchaseItem\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItem: function (purchaseDetails,cb){\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItem\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItem\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb, true)\n },\n\n /*\n *purchaseItemWithCoins\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemDataCallback} cb\n */\n purchaseItemWithCoins: function (purchaseDetails, cb) {\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithCoins\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithCoins\");\n\n core.purchaseItemWithCoins(purchaseDetails, cb)\n },\n\n /*\n *purchaseItemWithGems\n *@member of Gamee\n *@param {object} purchaseDetails\n *@param {Gamee~purchaseItemWithGemsDataCallback} cb\n */\n purchaseItemWithGems: function (purchaseDetails,cb) {\n\n validateDataType(purchaseDetails,\"object\",\"purchaseDetails\",\"gamee.purchaseItemWithGems\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.purchaseItemWithGems\");\n\n core.purchaseItemWithGems(purchaseDetails,cb)\n },\n\n /*share\n *@member of Gamee\n *@param {object} shareDetails\n *@param {Gamee~shareDataCallback} cb\n */\n share: function (shareDetails,cb){\n validateDataType(shareDetails,\"object\",\"shareDetails\",\"gamee.share\");\n validateDataType(cb,\"function\",\"cb\",\"gamee.share\");\n\n core.share(shareDetails,cb)\n },\n\n /*\n *loadRewardedVideo\n *@member of Gamee\n *@param {Gamee~loadRewardedVideo} cb\n */\n loadRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.loadRewardedVideo\");\n core.loadRewardedVideo(cb)\n },\n\n /*\n *showRewardedVideo\n *@member of Gamee\n *@param{Gamee~showRewardedVideo} cb\n */\n showRewardedVideo: function (cb){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.showRewardedVideo\");\n core.showRewardedVideo(cb)\n },\n\n\n /*\n * showSubscribeDialog\n * @member of Gamee\n * @param{Gamee~showSubscribeDialog} cb\n */\n showSubscribeDialog: function (cb){\n validateDataType(cb,\"function\",\"cb\",\"gamee.showSubscribeDialog\");\n core.showSubscribeDialog(cb)\n },\n\n /**\n *requestPlayerData\n *@member of Gamee\n *@param{Gamee~requestPlayerData} cb\n * @param {number} userID\n */\n requestPlayerData: function (cb, userID){\n\n validateDataType(cb,\"function\",\"cb\",\"gamee.requestPlayerData\");\n if (userID !== undefined) {\n validateDataType(userID,\"number\",\"userId\",\"gamee.requestPlayerData\");\n }\n core.requestPlayerData(cb, userID)\n },\n };\n\n /**\n *\n * @typedef ReplayData\n * @param {string} variant\n * @param {string} data\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~voidCallback\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~gameInitCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n /**\n * This callback is displayed as part of the Requester class.\n * @callback Gamee~requestSocialDataCallback\n * @param {object} data\n * @param {string} responseCode\n */\n\n})();\n\n/**\n * Signals that game should start as normal|replay|ghost game.\n * Signal means there is no overlay over the game.\n * This signal is also being used for game restart. If previous\n * instance of the game was running, it should be terminated without\n * any additional calls and current progress should be tossed.\n * @event gameeAPI:GameeEmitter~start\n * @type {object}\n * @property {EventDetailStart} detail - Common property of events\n */\n\n/**\n * Data carried with start event.\n * @typedef EventDetailStart\n * @property {Gamee~voidCallback} callback - called after finishing task\n * @property {boolean} [opt_resetState=false] - if true, game must delete current progress and saved progress\n * @property {boolean} [opt_replay] - if true, game must run in replay mode\n * @property {boolean} [opt_ghostMode] - if true, game must run in ghost mode\n */\n\n/**\n * After that signal, game must silent all sounds immediately.\n * Game must remain silent until unmute signal occures.\n * @event gameeAPI:GameeEmitter~mute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * After unmute signal, game can play sounds again.\n * @event gameeAPI:GameeEmitter~unmute\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Pause signal means there appeared overlay over the game. Player\n * is unable to reach the context of the game anymore. So game should\n * pause all its acctions immediately.\n * @event gameeAPI:GameeEmitter~pause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Unpause signal means there is no overlay over the game anymore.\n * Game should continue with all previous actions.\n * @event gameeAPI:GameeEmitter~unpause\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostHide can appear only if game is running in ghost mode.\n * Game should hide ghost behavior and look like exactly as game without\n * the ghost (if this is possible).\n * @event gameeAPI:GameeEmitter~ghostHide\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Signal ghostShow can appear only if game is running in ghost mode.\n * Game should show ghost again if it was hidden. If ghost died or ended\n * while it was hidden, game should point that out, so the player can understand\n * why the ghost is not visible anymore.\n * @event gameeAPI:GameeEmitter~ghostShow\n * @type {object}\n * @property {EventDetailVoid} detail - Common property of events\n */\n\n/**\n * Data carried with various events. Contains only callback method.\n * @typedef {object} EventDetailVoid\n * @property {Gamee~voidCallback} callback - call after finishing task\n */\n\n/**\n * @type {function}\n * @param {MyEvent} e - The observable event.\n * @listens gameeAPI:GameeEmitter~event:snowball\n */\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/gameeAPI.js","import { core } from \"./core.js\"\n\n/**\n *\n * @requires core\n *\n * @typedef PlatformAPI\n * @param {EventTarget} emitter\n * @param {function} _pause\n * @param {function} _resume\n * @param {function} _ghostShow\n * @param {function} _ghostHide\n * @param {function} _mute\n * @param {function} _unmute\n * @param {function} _start\n */\nexport var PlatformAPI = {\n\temitter: null,\n\tpause: function (cb) {\n\t\tvar event = new CustomEvent('pause', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tresume: function (cb) {\n\t\tvar event = new CustomEvent('resume', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostShow: function (cb) {\n\t\tvar event = new CustomEvent('ghostShow', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tghostHide: function (cb) {\n\t\tvar event = new CustomEvent('ghostHide', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tmute: function (cb) {\n\t\tvar event = new CustomEvent('mute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tunmute: function (cb) {\n\t\tvar event = new CustomEvent('unmute', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\t\tthis.emitter.dispatchEvent(event);\n\t},\n\tstart: function (data, cb) {\n\t\tvar event = new CustomEvent('start', {\n\t\t\tdetail: {\n\t\t\t\tcallback: cb\n\t\t\t}\n\t\t});\n\n\t\tvar error = core.startSignal(data);\n\t\tif (error) {\n\t\t\tcb(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (data.replay)\n\t\t\tevent.detail.opt_replay = true;\n\t\tif (data.ghostMode)\n\t\t\tevent.detail.opt_ghostMode = true;\n\t\tif (data.resetState)\n\t\t\tevent.detail.opt_resetState = true;\n if (data.replayData){\n event.detail.replayData = data.replayData\n }\n\n\t\tthis.emitter.dispatchEvent(event);\n\t}\n};\n\n\n/**\n * @class PlatformBridge\n *\n */\nexport function PlatformBridge() {\n\tthis.requests = {};\n\tthis.platform = \"\";\n\tthis._init();\n}\n\nPlatformBridge.prototype = {\n\tinstCount: 0,\n\t_init: function () {\n\t},\n\tcreateRequest: function (method, opt_requestData, opt_callback) {\n\t\tif (!this.validateMethod(method))\n\t\t\treturn;\n\t\tif (typeof opt_requestData === 'function') {\n\t\t\topt_callback = opt_requestData;\n\t\t\topt_requestData = undefined;\n\t\t}\n\n\t\tvar messId = this.instCount++;\n\n\t\tif (typeof opt_callback !== 'undefined') {\n\t\t\tthis.requests[messId] = opt_callback;\n\t\t}\n\n\t\tvar preparedObject = {\n\t\t\trequest: {\n\t\t\t\tmethod: method,\n\t\t\t\tmessageId: messId,\n\t\t\t\tdata: null\n\t\t\t}\n\t\t};\n\n\t\tthis.doCall(preparedObject, opt_requestData);\n\t},\n\tvalidateMethod: function (method) {\n\t\treturn method === \"gameLoadingProgress\" ? false : true;\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoCall: function (preparedObject, requestData) {\n\t\tthrow \"Not implemented\";\n\t},\n\t_callback: function (id, responseData) {\n\t\tvar cb = this.requests[id];\n\t\tdelete this.requests[id];\n\t\tif (cb)\n\t\t\tcb(responseData);\n\t},\n\t/**\n\t * @abstract\n\t */\n\tdoResponse: function (preparedObject, responseData) {\n\t\tthrow \"Not implemented\";\n\t},\n};\n\n\n/**\n * @class PostMessageBridge\n * @requires PlatformBridge\n */\nexport function PostMessageBridge(endpoint) {\n\tthis._gameeWin = endpoint;\n\tPlatformBridge.call(this);\n\tthis.platform = \"web\";\n}\n\nPostMessageBridge.prototype = Object.create(PlatformBridge.prototype);\nPostMessageBridge.prototype.constructor = PostMessageBridge;\n\nPostMessageBridge.prototype._init = function () {\n\n\twindow.addEventListener('message', function (ev) {\n\t\t// if(ev.origin === \"source we want\")\n\t\t// console.log(\"_triggerMessage detail: \" + ev.detail);\n\t\t// console.log(\"_triggerMessage data: \" + ev.data);\n\t\tvar data;\n\t\tif (typeof ev.detail === \"object\" && typeof ev.detail !== null) {\n\t\t\tdata = ev.detail;\n\t\t} else if (typeof ev.data === \"object\") {\n\t\t\tdata = ev.data;\n\t\t} else {\n\t\t\t// message is not from native platform\n\t\t\treturn;\n\t\t}\n\n if (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4) + ' data');\n }\n\t\t// this is request\n\t\tif (data.request && data.request.method && typeof data.request.messageId !== \"undefined\") {\n\t\t\tthis._resolveAPICall(data.request.method, data.request.messageId, data.request.data);\n\t\t}\n\t\t// this is reponse\n\t\telse if (data.response && typeof data.response.messageId !== \"undefined\") {\n\t\t\tif (data.error)\n\t\t\t\tthrow data.error;\n\t\t\tthis._callback(data.response.messageId, data.response.data);\n\t\t}\n\t\t// else this message target is not this framework\n\t}.bind(this), false);\n};\n\n\nPostMessageBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype.doResponse = function (messageId, responseData) {\n\tvar preparedObject = {\n\t\tversion: this.version,\n\t\tresponse: {\n\t\t\tmessageId: messageId\n\t\t}\n\t};\n\n\tif (responseData)\n\t\tpreparedObject.data = responseData;\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\nPostMessageBridge.prototype._resolveAPICall = function (method, messageId, opt_data) {\n\tvar cb = this.doResponse.bind(this, messageId);\n\n\tswitch (method) {\n\t\tcase \"pause\":\n\t\t\tPlatformAPI.pause(cb);\n\t\t\tbreak;\n\t\tcase \"resume\":\n\t\t\tPlatformAPI.resume(cb);\n\t\t\tbreak;\n\t\tcase \"mute\":\n\t\t\tPlatformAPI.mute(cb);\n\t\t\tbreak;\n\t\tcase \"unmute\":\n\t\t\tPlatformAPI.unmute(cb);\n\t\t\tbreak;\n\t\tcase \"ghostShow\":\n\t\t\tPlatformAPI.ghostShow(cb);\n\t\t\tbreak;\n\t\tcase \"ghostHide\":\n\t\t\tPlatformAPI.ghostHide(cb);\n\t\t\tbreak;\n\t\tcase \"start\":\n\t\t\tif (!opt_data) {\n\t\t\t\tthrow \"Method _start missing params\";\n\t\t\t}\n\t\t\tPlatformAPI.start(opt_data, cb);\n\t\t\tbreak;\n\t\tdefault:\n\t\t if (!core.isSilentModeEnabled()) {\n\t\t\t console.error(\"Unknown method call\");\n }\n\t}\n};\n\n\n/**\n * @class MobileBridge\n * @requires PlatformBridge\n *\n */\nexport function MobileBridge(device) {\n\tthis.device = device;\n\tPostMessageBridge.call(this);\n\tthis.platform = \"mobile\";\n}\n\nMobileBridge.prototype = Object.create(PostMessageBridge.prototype);\nMobileBridge.prototype.constructor = MobileBridge;\n\nMobileBridge.prototype._init = function () {\n\tPostMessageBridge.prototype._init.call(this);\n\tif (this.device === \"ios\") {\n\t\tthis._gameeWin = webkit.messageHandlers.callbackHandler;\n\t} else if (this.device === \"android\") {\n\t\tthis._gameeWin = _toDevice;\n\t} else {\n\t\tthrow \"Unknown device used in webkit bridge\";\n\t}\n\n\twindow._triggerMessage = function (data) {\n\t\ttry {\n\t\t\tdata = JSON.parse(data); // message is custom message from IOS/android platform\n\t\t} catch (err) {\n\t\t\tthrow \"Couldn't parse message from native app: \\n\" + data + \"\\n\" + err;\n\t\t}\n\t\tif (!core.isSilentModeEnabled()) {\n console.log(JSON.stringify(data, null, 4));\n }\n\t\tthis.dispatchEvent(new CustomEvent(\"message\", { detail: data }));\n\t}.bind(window);\n\n};\n\nMobileBridge.prototype.doCall = function (preparedObject, requestData) {\n\tif (typeof requestData === \"object\") {\n\t\tpreparedObject.request.data = requestData || {};\n\t}\n\n\tif (this.device === \"android\") // stringify data for android devices, but not for ios\n\t\tpreparedObject = JSON.stringify(preparedObject);\n\n\tthis._gameeWin.postMessage(preparedObject, \"*\");\n};\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/platform_bridge.js","\nvar BulletClass = function () {\n var _self = this,\n _events = {};\n\n _self.on = function (event, fn, once) {\n if (arguments.length < 2 ||\n typeof event !== \"string\" ||\n typeof fn !== \"function\") return;\n\n var fnString = fn.toString();\n\n // if the named event object already exists in the dictionary...\n if (typeof _events[event] !== \"undefined\") {\n // add a callback object to the named event object if one doesn't already exist.\n if (typeof _events[event].callbacks[fnString] === \"undefined\") {\n _events[event].callbacks[fnString] = {\n cb: fn,\n once: !!once\n };\n }\n else if (typeof once === \"boolean\") {\n // the function already exists, so update it's 'once' value.\n _events[event].callbacks[fnString].once = once;\n }\n }\n else {\n // create a new event object in the dictionary with the specified name and callback.\n _events[event] = {\n callbacks: {}\n };\n\n _events[event].callbacks[fnString] = { cb: fn, once: !!once };\n }\n };\n\n _self.once = function (event, fn) {\n _self.on(event, fn, true);\n };\n\n _self.off = function (event, fn) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n // remove just the function, if passed as a parameter and in the dictionary.\n if (typeof fn === \"function\") {\n var fnString = fn.toString(),\n fnToRemove = _events[event].callbacks[fnString];\n\n if (typeof fnToRemove !== \"undefined\") {\n // delete the callback object from the dictionary.\n delete _events[event].callbacks[fnString];\n }\n }\n else {\n // delete all functions in the dictionary that are\n // registered to this event by deleting the named event object.\n delete _events[event];\n }\n };\n\n _self.trigger = function (event, data) {\n if (typeof event !== \"string\" ||\n typeof _events[event] === \"undefined\") return;\n\n for (var fnString in _events[event].callbacks) {\n var callbackObject = _events[event].callbacks[fnString];\n\n if (typeof callbackObject.cb === \"function\") callbackObject.cb(data);\n if (typeof callbackObject.once === \"boolean\" && callbackObject.once === true) _self.off(event, callbackObject.cb);\n }\n };\n\n};\n\n\nexport var Bullet = new BulletClass();\n\n\n// WEBPACK FOOTER //\n// ./gamee/libs/bullet.js","import { Bullet } from \"../libs/bullet.js\"\n\n/**\n * @module game_controllers\n */\n\n/** ## Bullet\n *\n * [Bullet.js](https://github.com/munkychop/bullet) is used as pub/sub\n * library.\n *\n * The controller and its buttons are instance of Bullet.\n */\nexport var BulletClass = Bullet.constructor;\n\n\n/** ## Button\n *\n * Represenation of a controller button. It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * @class Button\n * @param {String} key name of the button\n * @param {Number} keyCode keycode for the key to represent the button\n * on keyboard\n */\nexport function Button(key, keyCode) {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\tthis._pressed = true;\n\n\tthis.key = key;\n\tthis.keyCode = keyCode;\n\n\tthis.on('keydown', function () {\n\t\tself._pressed = true;\n\t});\n\n\tthis.on('keyup', function () {\n\t\tself._pressed = false;\n\t});\n}\n\nButton.prototype = Object.create(BulletClass.constructor.prototype);\nButton.constructor = Button;\n\n/** ### isDown\n *\n * Ask if the button is currently pressed.\n *\n * @return {Boolean} true if the button is currently pressed\n */\nButton.prototype.isDown = function () {\n\treturn this._pressed;\n};\n\n/** ## Controller\n *\n * Controller has a collection of [buttons](#buttons).\n * It is a child of\n * [Bullet](https://github.com/munkychop/bullet), so you can\n * subscribe for events triggered on it.\n *\n * Controllers will get all the events for its buttons so you can\n * listen for them globaly from controller or individualy on every\n * button.\n *\n * ```javascript\n * controller.on('keydown', function(data) {\n * console.log('button ' + data.button + ' is pressed');\n * });\n *\n * controller.buttons.left.on('keydown', function() {\n * console.log('button left is pressed');\n * });\n * ```\n *\n * @class Controller\n */\nexport function Controller() {\n\tvar self = this;\n\n\tBulletClass.call(this);\n\n\t// ### buttons\n\t//\n\t// Map of controller's [buttons](#button) by their name.\n\t//\n\t// ```javascript\n\t// controller.buttons.left // Button('left', ..)\n\t// ```\n\tthis.buttons = {};\n\n\t// ### buttonAlias\n\t//\n\t// Map of remapped buttons.\n\t//\n\t// *see [remapButton](#remapbutton) for more info*\n\t//\n\tthis.buttonAlias = {};\n\n\t// Events prefixed with *$* are private, sent from GameeApp ment\n\t// to be handled before resended as *public (non-prefixed)*\n\t// event.\n\t//\n\t// They should be not used in games as they can change in the future.\n\tthis.on('$keydown', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keydown', data);\n\t});\n\n\tthis.on('$keyup', function (data) {\n\t\tif (data.button && self.buttonAlias[data.button]) {\n\t\t\tdata.button = self.buttonAlias[data.button];\n\t\t}\n\n\t\tself.trigger('keyup', data);\n\t});\n\n\t// By default GameeApp will trigger *keydown* and *keyup* events for\n\t// the controller for every button presses/released.\n\t//\n\t// The controller then handles the event and triggers the event for\n\t// the coresponding button.\n\t//\n\t// It expexts a `data` argument which should have a property `button`\n\t// with the name of button.\n\tthis.on('keydown', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keydown');\n\t});\n\n\tthis.on('keyup', function (data) {\n\t\tif (!data.button || !self.buttons[data.button]) {\n\t\t\treturn;\n\t\t}\n\n\t\tself.buttons[data.button].trigger('keyup');\n\t});\n}\n\nController.prototype = Object.create(BulletClass.constructor.prototype);\nController.constructor = Controller;\n\n/** ### addButton\n *\n * Add button to the controller.\n *\n * @param {Button} button a [Button](#button) instance\n */\nController.prototype.addButton = function (button) {\n\tthis.buttons[button.key] = button;\n};\n\n/** ### enableKeyboard\n *\n * Enable keyboard controlls. It will attach event listeners to the\n * *window* object for every button and trigger their *keydown* /\n * *keyup* event for the controller.\n */\nController.prototype.enableKeyboard = function (gamee) {\n\tvar key, button, keyCodes = {}, self = this;\n\n\tfor (key in this.buttons) {\n\t\tbutton = this.buttons[key];\n\n\t\tif (button.keyCode) {\n\t\t\tkeyCodes[button.keyCode] = button;\n\t\t}\n\t}\n\n\tgamee._keydown(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keydown', { button: button.key });\n\t});\n\n\tgamee._keyup(function (ev) {\n\t\tvar button = keyCodes[ev.keyCode];\n\n\t\tif (!button) {\n\t\t\treturn;\n\t\t}\n\n\t\tev.preventDefault();\n\t\tself.trigger('keyup', { button: button.key });\n\t});\n};\n\n/** ### remapButton\n *\n * Remap the names of the controller's buttons. Controllers have their\n * button names set (left, right, A, B), but sometimes in context of\n * the game a different names are desired.\n *\n * ```javascript\n * var controller = gamee.controller.requestController('TwoButtons');\n * controller.remapButton('left', 'throttle');\n * controller.remapButton('right', 'break');\n *\n * controller.buttons.throttle.on('keydown', ..);\n * ```\n *\n * @param {String} oldName button name we want to change\n * @param {String} newName new button name\n */\nController.prototype.remapButton = function (oldName, newName) {\n\n\t// handle old code\n\tif (newName.name) {\n\t\tnewName = newName.name;\n\t}\n\n\tif (this.buttons[oldName]) {\n\t\tthis.buttonAlias[oldName] = newName.name;\n\n\t\tthis.buttons[newName.name] = this.buttons[oldName];\n\n\t\tdelete this.buttons[oldName];\n\t} else {\n\t\tthrow Error('Button ' + oldName + ' was not found in controller');\n\t}\n};\n\n// ## Controllers\n\n/** ### OneButtonController\n *\n * Controller with only one button.\n * @class OneButtonController\n */\nexport function OneButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nOneButtonController.prototype = Object.create(Controller.prototype);\nOneButtonController.prototype.constructor = OneButtonController;\n\n\n/** ### TwoButtonController\n *\n * Controller with two buttons\n * @class TwoButtonController\n */\nexport function TwoButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n}\nTwoButtonController.prototype = Object.create(Controller.prototype);\nTwoButtonController.prototype.constructor = TwoButtonController;\n\n\n/** ### TwoActionButtonsController\n *\n * Controller with two action buttons (A,B)\n * @class TwoActionButtonsController\n */\nexport function TwoActionButtonsController() {\n\tController.call(this);\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('B', 17));\n}\nTwoActionButtonsController.prototype = Object.create(Controller.prototype);\nTwoActionButtonsController.prototype.constructor = TwoActionButtonsController;\n\n\n/** ### FourButtonController\n *\n * Controller with four buttons\n * @class FourButtonController\n */\nexport function FourButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFourButtonController.prototype = Object.create(Controller.prototype);\nFourButtonController.prototype.constructor = FourButtonController;\n\n/** ### FiveButtonController\n *\n * Controller with five buttons\n * @class FiveButtonController\n */\nexport function FiveButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n}\nFiveButtonController.prototype = Object.create(Controller.prototype);\nFiveButtonController.prototype.constructor = FiveButtonController;\n\n/** ### SixButtonController\n *\n * Controller with six buttons\n * @class SixButtonController\n */\nexport function SixButtonController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n}\nSixButtonController.prototype = Object.create(Controller.prototype);\nSixButtonController.prototype.constructor = SixButtonController;\n\n/** ### TwoArrowsOneButtonController\n *\n * Controller with two arrows and one action button\n * @class TwoArrowsOneButtonController\n */\nexport function TwoArrowsOneButtonController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n}\nTwoArrowsOneButtonController.prototype = Object.create(Controller.prototype);\nTwoArrowsOneButtonController.prototype.constructor = TwoArrowsOneButtonController;\n\n/** ### TwoArrowsTwoButtonsController\n *\n * Controller with two arrows and two action buttons\n * @class TwoArrowsTwoButtonsController\n */\nexport function TwoArrowsTwoButtonsController() {\n\tController.call(this);\n\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\n\t// * __name__: 'A'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('A', 32));\n\n\t// * __name__: 'B'\n\t// * __key__: ctrl\n\tthis.addButton(new Button('B', 17));\n\n}\nTwoArrowsTwoButtonsController.prototype = Object.create(Controller.prototype);\nTwoArrowsTwoButtonsController.prototype.constructor = TwoArrowsTwoButtonsController;\n\n/** ### FourArrowController\n *\n * Controller with four arrow buttons\n * @class FourArrowController\n */\nexport function FourArrowController() {\n\tController.call(this);\n\n\t// * __name__: 'up'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('up', 38));\n\n\t// * __name__: 'left'\n\t// * __key__: left arrow\n\tthis.addButton(new Button('left', 37));\n\n\n\t// * __name__: 'right'\n\t// * __key__: righ arrow\n\tthis.addButton(new Button('right', 39));\n\n\t// * __name__: 'down'\n\t// * __key__: down arrow\n\tthis.addButton(new Button('down', 40));\n}\nFourArrowController.prototype = Object.create(Controller.prototype);\nFourArrowController.prototype.constructor = FourArrowController;\n\n/** ### TouchController\n *\n * This controller has no buttons. Instead it has a touchpad which\n * triggers *touchstart*, *touchend*, *touchmove*, *touchcancel*,\n * *touchend* events (similar to\n * [Touch event types](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent#Touch_event_types))\n *\n * The position of the touch is in the `data.position` argument as a\n * *x* and *y* with the values between [0, 0] for the left top corner\n * and [1, 1] for the bottom right corner ([0.5, 0.5] is the center).\n *\n * ```javascript\n * controller = gamee.controller.requestController('Touch');\n *\n * controller.on('touchstart', function(data) {\n *\tif (data.position.x < 0.5 && data.position.y < 0.5) {\n * console.log('touch in the top left quadrant');\n * }\n * })\n * ```\n * @class TouchController\n */\nexport function TouchController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\tthis.on(\"$touchstart\", function (data) {\n\t\tself.trigger('touchstart', data);\n\t});\n\n\tthis.on(\"$touchend\", function (data) {\n\t\tself.trigger('touchend', data);\n\t});\n\n\tthis.on(\"$touchmove\", function (data) {\n\t\tself.trigger('touchmove', data);\n\t});\n\n\tthis.on(\"$touchleave\", function (data) {\n\t\tself.trigger('touchleave', data);\n\t});\n\n\tthis.on(\"$touchcancel\", function (data) {\n\t\tself.trigger('touchcancel', data);\n\t});\n}\nTouchController.prototype = Object.create(TouchController.prototype);\nTouchController.prototype.constructor = TouchController;\n\n/** ### JoystickController\n *\n * JoystickController emits `change` event, after the position of the\n * joystick is changed.\n *\n * The position of the joystick is in the property `x` and `y`. The\n * position on axis is between <-1, 1> (for x -1 is max left\n * position, 1 max right position). [0.0, 0.0] is the center.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('Joystick');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n * ```\n * @class JoystickController\n */\nexport function JoystickController() {\n\tvar self = this;\n\n\tController.call(this);\n\n\t// x axis\n\tthis.x = 0;\n\t// y axis\n\tthis.y = 0;\n\n\tthis.on(\"$change\", function (data) {\n\t\tself.x = data.position.x;\n\t\tself.y = data.position.y;\n\n\t\tself.trigger(\"change\", data);\n\t});\n}\nJoystickController.prototype = Object.create(Controller.prototype);\nJoystickController.prototype.constructor = JoystickController;\n\n/** ### JoystickButtonController\n *\n * JoystickButtonController is a `JoystickController` with one button.\n *\n * ```javascript\n * joystick = gamee.controller.requestController('JoystickWithButton');\n *\n * joystick.on('change', function() {\n * new_x = joystick.x;\n * nex_y = joystick.y;\n * })\n *\n * joystick.buttons.button.on('keydown', callback)\n * // or simply\n * joystick.on('keydown', callback)\n * ```\n * @class JoystickButtonController\n */\nexport function JoystickButtonController() {\n\tvar self = this;\n\n\tJoystickController.call(this);\n\n\t// * __name__: 'button'\n\t// * __key__: spacebar\n\tthis.addButton(new Button('button', 32));\n}\nJoystickButtonController.prototype = Object.create(JoystickController.prototype);\nJoystickButtonController.prototype.constructor = JoystickButtonController;\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/game_controllers.js","import { } from \"../libs/shims.js\"\nimport { Gamee } from \"./gameeAPI.js\"\nimport { core } from \"./core.js\"\nimport { PlatformAPI, PlatformBridge, PostMessageBridge, MobileBridge } from \"./platform_bridge.js\"\n\n\n/**\n * Instance of gamee object with API for developers.\n * Internal functions becomes private this way\n *\n * @requires Gamee\n */\nexport var gamee;\n\n/**\n * Resolves what platform is being used and make instance of platform API.\n *\n * @requires PlatformBridge\n */\nvar platformBridge = (function () {\n\n var platformBridge, platformType = \"web\";\n\n // Reslove Gamee enviroment\n /* current user agent */\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (/iphone|ipod|ipad/.test(userAgent)) { // test ios device\n // user agent is use to determine current enviroment\n\n // Test if window with game have a parent (loading in iframe)\n if (window.self !== window.top) {\n platformType = \"web\";\n } else {\n platformType = \"ios\";\n }\n } else if (/gamee\\/[0-9\\.]+$/.test(userAgent)) { // test android app\n // TODO do you really test android like that?\n platformType = \"android\";\n } else if (window.parent) { // TODO doesnt make sence, parent always exists!!\n platformType = \"web\";\n } else if (window.parent && window.parent.gameeSimulator) { // TODO doesnt make sence, parent always exist?\n platformType = \"web\";\n }\n\n gamee = new Gamee(platformType);\n\n window.gamee = gamee;\n\n switch (platformType) {\n case \"web\":\n if (window.parent === window) {\n console.error(\"Gamee must run in iframe on web platform\");\n }\n platformBridge = new PostMessageBridge(window.parent);\n break;\n case \"ios\":\n platformBridge = new MobileBridge(\"ios\");\n break;\n case \"android\":\n platformBridge = new MobileBridge(\"android\");\n break;\n default:\n throw \"Can't identify the platform\";\n }\n return platformBridge;\n})();\n\ncore.PlatformAPI = PlatformAPI;\ncore.native = platformBridge;\n\nPlatformAPI.emitter = gamee.emitter;\n\n\nfunction loadScript (url, callback) {\n // Adding the script tag to the head as suggested before\n var head = document.getElementsByTagName('head')[0];\n var script = document.createElement('script');\n script.src = url;\n\n // Then bind the event to the callback function.\n // There are several events for cross browser compatibility.\n script.onreadystatechange = callback;\n script.onload = callback;\n\n // Fire the loading\n head.appendChild(script);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./gamee/src/index.js","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 7\n// module chunks = 0 1"],"sourceRoot":""} \ No newline at end of file diff --git a/gamee/src/core.js b/gamee/src/core.js index a0dd67b..ee4d648 100644 --- a/gamee/src/core.js +++ b/gamee/src/core.js @@ -107,7 +107,7 @@ export var core = (function () { /** internal variables/constants (uppercase) coupled inside separate object for potential easy referencing */ var internals = { - VERSION: "2.4.1", // version of the gamee library + VERSION: "2.4.0", // version of the gamee library CAPABILITIES: ["ghostMode", "saveState", "replay", "socialData","rewardedAds","coins","logEvents","playerData","share", "gems"], // supported capabilities variant: 0, // for automating communication with server soundUnlocked: false, diff --git a/package.json b/package.json index 259fa8b..c525def 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gamee-js", - "version": "2.4.1", + "version": "2.4.0", "description": "Gamee JS SDK", "main": "gamee/src/index.js", "scripts": {