Commit a238bd8a authored by wildfirecode13's avatar wildfirecode13

1

parent f9af7c39
No preview for this file type
......@@ -6,12 +6,12 @@ MOCK_STATUS && (require('../mock/index'));
import MD from '../MD';
MD();
//此处为spark-cli动态生成
import Pagegamescene from "./pages/pagegamescene/pagegamescene.jsx";
import PageCanvas from "./pages/pagecanvas/pagecanvas.jsx";
class App extends Component {
render() {
return (
<Pagegamescene></Pagegamescene>
<PageCanvas></PageCanvas>
);
}
}
......
import * as FYGE from "fyge-tbmini";
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else {
var a = factory();
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(window, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./src/Main.ts");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./module/RES.ts":
/*!***********************!*\
!*** ./module/RES.ts ***!
\***********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RES = void 0;
var RES;
(function (RES) {
var resData;
var videoEntityHash = {};
var soundHash = {};
var groupsCompleteHash = {};
var groupsPromiseHash = {};
var singleResPromiseHash = {};
function loadConfig(res) {
resData = res;
RES.resPath = res.path;
}
RES.loadConfig = loadConfig;
function loadSparkAssets(resList) {
var list = [];
for (var key in resList) {
list.push(resList[key]);
}
var p = new Promise(function (resolve, reject) {
loadResList(function (s) {
if (s) {
resolve();
}
else {
reject();
}
}, list);
});
return p;
}
RES.loadSparkAssets = loadSparkAssets;
function loadGroup(name) {
if (groupsCompleteHash[name]) {
return new Promise(function (resolve) {
resolve();
});
}
if (groupsPromiseHash[name]) {
return groupsPromiseHash[name];
}
var arr = getGroupResByName(name);
if (!arr || !arr.length) {
groupsCompleteHash[name] = true;
return new Promise(function (resolve) {
resolve();
});
}
var p = new Promise(function (resolve, reject) {
loadResList(function (s) {
delete groupsPromiseHash[name];
if (s) {
groupsCompleteHash[name] = true;
resolve();
}
else {
reject();
}
}, arr);
});
groupsPromiseHash[name] = p;
return p;
}
RES.loadGroup = loadGroup;
function getResAsync(str, comFun, thisObj) {
var type = str.substring(str.lastIndexOf(".") + 1, str.length);
if (type == "png" || type == "jpg") {
if (FYGE.TextureCache[str]) {
comFun && comFun.call(thisObj, FYGE.TextureCache[str], str);
new Promise(function (r) {
r(FYGE.TextureCache[str]);
});
}
else {
return new Promise(function (resolve, reject) {
FYGE.GlobalLoader.loadImage(function (s, image) {
if (s) {
FYGE.Texture.addToCache(FYGE.Texture.from(image), str);
comFun && comFun.call(thisObj, FYGE.TextureCache[str], str);
resolve(FYGE.TextureCache[str]);
}
else {
comFun && comFun.call(thisObj, null, str);
reject();
}
}, str);
});
}
}
}
RES.getResAsync = getResAsync;
function getResByUrl() {
}
RES.getResByUrl = getResByUrl;
function getRes(str) {
var type = str.substring(str.lastIndexOf(".") + 1, str.length);
if (type == "png" || type == "jpg") {
return FYGE.TextureCache[str] || null;
}
}
RES.getRes = getRes;
function hasRes(str) {
for (var i = 0; i < resData.groups.length; i++) {
var group = resData.groups[i];
var keys = group.keys;
if (keys && keys.split(",").indexOf(str) > -1) {
return group.name;
}
if (group.atlas && group.name + ".json" == str) {
return group.name;
}
}
return null;
}
function getGroupResByName(name) {
var group = getGroupByName(name);
if (!group)
return null;
if (group.atlas) {
var arr = [name + ".json"];
if (group.keys) {
arr = arr.concat(group.keys.split(",").filter(function (k) {
return k.substr(-4) != ".png";
}));
}
return arr;
}
else if (group.keys) {
return group.keys.split(",");
}
else {
return null;
}
}
function getGroupByName(name) {
var groups = resData.groups;
var group;
for (var i = 0; i < groups.length; i++) {
if (groups[i].name === name) {
group = groups[i];
break;
}
}
return group;
}
function loadResList(callback, arr) {
var count = 0;
var countAll = arr.length;
if (!countAll)
callback(true);
var mark = true;
for (var i = 0; i < countAll; i++) {
var resName = arr[i]['url'];
getResAsync(resName, function (res, str) {
if (!res)
mark = false;
if (++count == countAll)
callback(mark);
}, this);
}
}
RES.loadResList = loadResList;
function returnSingleResPromise(str, comFun, thisObj) {
singleResPromiseHash[str].then(function (r) {
comFun && comFun.call(thisObj, r, str);
}, function () {
comFun && comFun.call(thisObj, null, str);
});
return singleResPromiseHash[str];
}
var skinData;
function loadSkinConfig(skinJson) {
skinData = skinJson;
}
RES.loadSkinConfig = loadSkinConfig;
function initSkinDisplay(con, skin, root) {
var data = typeof (skin) == 'string' ? getSkinDataByName(skin) : skin;
if (!data.children || !data.children.length)
return;
for (var i = 0; i < data.children.length; i++) {
var child = data.children[i];
if (child.type == "skin")
continue;
var dis = con.addChild(getDisplayByData(child));
if (root && child.id)
root[child.id] = dis;
if (child.type == "container")
initSkinDisplay(dis, child, root);
}
}
RES.initSkinDisplay = initSkinDisplay;
function getSkinDataByName(skinName, skinNode) {
if (skinNode === void 0) { skinNode = skinData; }
if (!skinNode || !skinNode.children || !skinNode.children.length)
return null;
for (var i = 0; i < skinNode.children.length; i++) {
var child = skinNode.children[i];
if (child.name == skinName && (child.type == "container" || child.type == "skin"))
return child;
var gson = getSkinDataByName(skinName, child);
if (gson)
return gson;
}
return null;
}
RES.getSkinDataByName = getSkinDataByName;
function getSrcByUuid(resList, uuid) {
resList = resList || [];
for (var i = 0; i < resList.length; i++) {
if (resList[i].uuid == uuid) {
return resList[i].url;
}
}
return "";
}
RES.getSrcByUuid = getSrcByUuid;
function getDisplayByData(data) {
var dis;
switch (data.type) {
case "container":
dis = new FYGE.Container();
break;
case "button":
dis = new FYGE.Button(getRes(data.props.tUp), data.props.tDown ? getRes(data.props.tDown) : null, data.props.tDisable ? getRes(data.props.tDisable) : null);
break;
case "text":
dis = new FYGE.TextField();
for (var key in data.props)
dis[key] = data.props[key];
break;
case "sprite":
dis = new FYGE.Sprite(getRes(data.props.source));
break;
case "rect":
dis = new FYGE.Shape();
dis.beginFill(FYGE.string2hex(data.props.fillColor));
dis.drawRect(0, 0, data.props.width, data.props.height);
dis.endFill();
break;
}
dis.name = data.name;
dis.alpha = data.alpha || 1;
dis.position.set(data.x, data.y);
return dis;
}
function destroyRES() {
}
})(RES = exports.RES || (exports.RES = {}));
/***/ }),
/***/ "./module/ctrls/index.ts":
/*!*******************************!*\
!*** ./module/ctrls/index.ts ***!
\*******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.destroyAllCtrls = exports.removeTweens = exports.clearWait = exports.wait = exports.showAlert = exports.getCurrentScene = exports.changeScene = exports.closeCurrentPanel = exports.closeAllPanels = exports.showConfirm = exports.showPanel = exports.showToast = void 0;
var waitingCtrl_1 = __webpack_require__(/*! ./waitingCtrl */ "./module/ctrls/waitingCtrl.ts");
var panelCtrl_1 = __webpack_require__(/*! ./panelCtrl */ "./module/ctrls/panelCtrl.ts");
var sceneCtrl_1 = __webpack_require__(/*! ./sceneCtrl */ "./module/ctrls/sceneCtrl.ts");
var toastCtrl_1 = __webpack_require__(/*! ./toastCtrl */ "./module/ctrls/toastCtrl.ts");
var toastCtrl_2 = __webpack_require__(/*! ./toastCtrl */ "./module/ctrls/toastCtrl.ts");
Object.defineProperty(exports, "showToast", { enumerable: true, get: function () { return toastCtrl_2.showToast; } });
__exportStar(__webpack_require__(/*! ./waitingCtrl */ "./module/ctrls/waitingCtrl.ts"), exports);
exports.showPanel = function (panel, data) {
return panelCtrl_1.default.instance.show(panel, data);
};
exports.showConfirm = function (panel, data) {
var confirmPanel = panelCtrl_1.default.instance.show(panel, data);
return confirmPanel.makePromise();
};
exports.closeAllPanels = function () {
panelCtrl_1.default.instance.closeAll();
};
exports.closeCurrentPanel = function () {
panelCtrl_1.default.instance.closeCurrent();
};
exports.changeScene = function (scene, data) {
sceneCtrl_1.default.instance.change(scene, data);
};
function getCurrentScene() {
return sceneCtrl_1.default.instance.currentScene;
}
exports.getCurrentScene = getCurrentScene;
exports.showAlert = function (title, content) {
if (my) {
my.alert({
title: title || "",
content: content || ""
});
}
else {
console.log(title, content);
}
};
function wait(callback, time) {
var obj = {};
FYGE.Tween.get(obj)
.wait(time)
.call(callback);
return obj;
}
exports.wait = wait;
function clearWait(obj) {
obj && FYGE.Tween.removeTweens(obj);
}
exports.clearWait = clearWait;
function removeTweens(obj, isRecursive) {
if (isRecursive === void 0) { isRecursive = true; }
if (!obj)
return;
FYGE.Tween.removeTweens(obj);
if (!isRecursive || !obj.children || !obj.children.length)
return;
obj.children.forEach(function (child) {
removeTweens(child);
});
}
exports.removeTweens = removeTweens;
function destroyAllCtrls() {
toastCtrl_1.destroyToast();
waitingCtrl_1.destroyWaiting();
panelCtrl_1.default.instance.destroy();
sceneCtrl_1.default.instance.destroy();
}
exports.destroyAllCtrls = destroyAllCtrls;
/***/ }),
/***/ "./module/ctrls/panelCtrl.ts":
/*!***********************************!*\
!*** ./module/ctrls/panelCtrl.ts ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var layers_1 = __webpack_require__(/*! ../views/layers */ "./module/views/layers.ts");
var waitingCtrl_1 = __webpack_require__(/*! ./waitingCtrl */ "./module/ctrls/waitingCtrl.ts");
var toastCtrl_1 = __webpack_require__(/*! ./toastCtrl */ "./module/ctrls/toastCtrl.ts");
var PanelCtrl = (function () {
function PanelCtrl() {
this.stacks = [];
}
Object.defineProperty(PanelCtrl, "instance", {
get: function () {
return PanelCtrl._instance || (PanelCtrl._instance = new PanelCtrl());
},
enumerable: false,
configurable: true
});
PanelCtrl.prototype.init = function (parent) {
this._parent = parent;
var bg = new FYGE.Shape();
bg.beginFill(0);
bg.drawRect(layers_1.layers.stageOffsetX - parent.x, layers_1.layers.stageOffsetY - parent.y, layers_1.layers.stageWidth, layers_1.layers.stageHeight);
bg.endFill();
bg.hitTestByPixel = false;
bg.visible = false;
this._parent.addChild(bg);
this._bg = bg;
};
PanelCtrl.prototype.closeAll = function () {
this.stacks.forEach(function (e) { return e.hidePanel(); });
};
PanelCtrl.prototype.show = function (cls, data) {
var _this = this;
waitingCtrl_1.showWaiting();
var panel = new cls(data);
this.add(panel);
this.stacks.push(panel);
panel.onLoaded = function () {
waitingCtrl_1.hideWaiting();
_this.updateView(false);
panel.start(data);
if (panel.visible)
panel.showAni();
};
panel.onLoadError = function () {
waitingCtrl_1.hideWaiting();
toastCtrl_1.showToast("资源加载失败");
panel.removeEventListener('onDestroy', _this.onPanelHide, _this);
_this.remove(panel);
};
return panel;
};
PanelCtrl.prototype.updateView = function (showPanelAni) {
var _this = this;
if (showPanelAni === void 0) { showPanelAni = true; }
if (!this.stacks.length) {
if (this._bg.visible) {
this.bgAni = "hide";
FYGE.Tween.removeTweens(this._bg);
FYGE.Tween.get(this._bg)
.to({ alpha: 0 }, 200, FYGE.Ease.cubicOut)
.call(function () {
_this._bg.visible = false;
_this._current = null;
_this._parent.visible = false;
});
}
}
else {
this._parent.visible = true;
if (this.bgAni == "hide") {
this.bgAni = "show";
FYGE.Tween.removeTweens(this._bg);
this._bg.alpha = 0.7;
}
if (this._bg.visible === false) {
this._bg.visible = true;
this._bg.alpha = 0;
FYGE.Tween.get(this._bg).to({ alpha: 0.7 }, 200, FYGE.Ease.cubicOut);
}
}
for (var i = 0; i < this.stacks.length; i++) {
if (i < this.stacks.length - 1) {
this.stacks[i].visible = false;
}
else {
this.stacks[i].visible = true;
if (showPanelAni)
this.stacks[i].showAni();
this._current = this.stacks[i];
}
}
};
PanelCtrl.prototype.add = function (panel) {
this._parent.addChild(panel);
panel.addEventListener('onDestroy', this.onPanelHide, this);
};
PanelCtrl.prototype.remove = function (panel) {
this._parent.removeChild(panel);
this.stacks = this.stacks.filter(function (e) { return e != panel; });
};
PanelCtrl.prototype.onPanelHide = function (e) {
var panel = e.target;
panel.removeEventListener('onDestroy', this.onPanelHide, this);
this.remove(panel);
this.updateView();
};
PanelCtrl.prototype.closeCurrent = function () {
if (this._current) {
this._current.hidePanel();
}
};
PanelCtrl.prototype.destroy = function () {
PanelCtrl._instance = null;
this.stacks = null;
this._current = null;
this._parent = null;
FYGE.Tween.removeTweens(this._bg);
this._bg = null;
};
return PanelCtrl;
}());
exports.default = PanelCtrl;
/***/ }),
/***/ "./module/ctrls/sceneCtrl.ts":
/*!***********************************!*\
!*** ./module/ctrls/sceneCtrl.ts ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var waitingCtrl_1 = __webpack_require__(/*! ./waitingCtrl */ "./module/ctrls/waitingCtrl.ts");
var toastCtrl_1 = __webpack_require__(/*! ./toastCtrl */ "./module/ctrls/toastCtrl.ts");
var SceneCtrl = (function () {
function SceneCtrl() {
}
Object.defineProperty(SceneCtrl, "instance", {
get: function () {
return SceneCtrl._instance || (SceneCtrl._instance = new SceneCtrl());
},
enumerable: false,
configurable: true
});
SceneCtrl.prototype.init = function (parent) {
this._parent = parent;
};
SceneCtrl.prototype.change = function (cls, data) {
var _this = this;
var scene = new cls(data);
scene.visible = false;
waitingCtrl_1.showWaiting();
var preScene = this._currentScene;
scene.onLoaded = function () {
waitingCtrl_1.hideWaiting();
scene.showAni(function () {
if (preScene)
preScene.destroy();
});
scene.visible = true;
scene.start(data);
};
scene.onLoadError = function () {
waitingCtrl_1.hideWaiting();
toastCtrl_1.showToast("资源加载失败");
_this._currentScene = preScene || null;
_this._parent.removeChild(scene);
};
this._currentScene = scene;
this._parent.addChild(scene);
};
Object.defineProperty(SceneCtrl.prototype, "currentScene", {
get: function () {
return this._currentScene;
},
enumerable: false,
configurable: true
});
SceneCtrl.prototype.destroy = function () {
SceneCtrl._instance = null;
this._currentScene = null;
this._parent = null;
};
return SceneCtrl;
}());
exports.default = SceneCtrl;
/***/ }),
/***/ "./module/ctrls/toastCtrl.ts":
/*!***********************************!*\
!*** ./module/ctrls/toastCtrl.ts ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.destroyToast = exports.showToast = void 0;
var layers_1 = __webpack_require__(/*! ../views/layers */ "./module/views/layers.ts");
var RES_1 = __webpack_require__(/*! ../RES */ "./module/RES.ts");
var inited = false;
var _toast;
var _parent;
var startY;
var endY;
var initToast = function () {
if (!inited) {
inited = true;
_toast = new Toast();
_parent = layers_1.layers.toastLayer;
_toast.alpha = 0;
_toast.x = layers_1.layers.stageOffsetX - _parent.x + (layers_1.layers.stageWidth - _toast.width) / 2;
var h = _toast.height;
var y = layers_1.layers.stageOffsetY - _parent.y;
startY = y - h;
endY = y + (layers_1.layers.stageHeight - h) / 2;
}
};
exports.showToast = function (msg) {
initToast();
_toast.show(msg);
_parent.addChild(_toast);
FYGE.Tween.removeTweens(_toast);
FYGE.Tween.get(_toast)
.set({ y: startY, alpha: 1 })
.to({ y: endY }, 500, FYGE.Ease.quartOut)
.wait(800)
.to({ alpha: 0 }, 300)
.call(function () {
_parent.removeChild(_toast);
});
};
exports.destroyToast = function () {
if (inited && _toast && !_toast.destroyed) {
_toast.destroy();
_toast = null;
_parent = null;
inited = false;
}
};
var Toast = (function (_super) {
__extends(Toast, _super);
function Toast() {
var _this = _super.call(this) || this;
_this.PADDING = 40;
_this.mouseChildren = false;
_this.mouseEnable = false;
var toastBgTexture = RES_1.RES.getRes("toastBg.png");
if (toastBgTexture) {
_this.bg = new FYGE.Sprite(toastBgTexture);
_this.addChild(_this.bg);
}
_this.msg = new FYGE.TextField();
_this.msg.size = 28;
_this.msg.fillColor = "0xffffff";
_this.msg.text = "";
_this.msg.verticalAlign = FYGE.VERTICAL_ALIGN.MIDDLE;
_this.msg.textHeight = toastBgTexture ? toastBgTexture.height : 200;
_this.msg.textAlign = FYGE.TEXT_ALIGN.CENTER;
_this.addChild(_this.msg);
return _this;
}
Toast.prototype.show = function (msg) {
this.msg.text = msg;
this.msg.x = ((this.bg ? this.bg.width : 0) - this.msg.textWidth) / 2;
};
Toast.prototype.destroy = function () {
_super.prototype.destroy.call(this);
this.msg = null;
this.bg = null;
};
return Toast;
}(FYGE.Container));
/***/ }),
/***/ "./module/ctrls/waitingCtrl.ts":
/*!*************************************!*\
!*** ./module/ctrls/waitingCtrl.ts ***!
\*************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.destroyWaiting = exports.hideWaiting = exports.showWaiting = void 0;
var RES_1 = __webpack_require__(/*! ../RES */ "./module/RES.ts");
var layers_1 = __webpack_require__(/*! ../views/layers */ "./module/views/layers.ts");
var inited = false;
var _waiting;
var _parent;
var initWaiting = function () {
if (!inited) {
inited = true;
var waiting = new Waiting();
_parent = layers_1.layers.topLayer;
_waiting = waiting;
var offX = (layers_1.layers.stageWidth - 160) / 2;
var offY = (layers_1.layers.stageHeight - _waiting.height) / 2;
_waiting.x = layers_1.layers.stageOffsetX - _parent.x + offX;
_waiting.y = layers_1.layers.stageOffsetY - _parent.y + offY;
var bg = new FYGE.Graphics()
.beginFill(0x000000)
.drawRect(-offX, -offY, layers_1.layers.stageWidth, layers_1.layers.stageHeight)
.endFill();
bg.alpha = 0;
_waiting.addChildAt(bg, 0);
}
};
exports.showWaiting = function (msg) {
initWaiting();
_waiting.show(msg);
_parent.addChild(_waiting);
};
exports.hideWaiting = function () {
_parent.removeChild(_waiting);
};
exports.destroyWaiting = function () {
if (inited && _waiting && !_waiting.destroyed) {
_waiting.destroy();
_waiting = null;
_parent = null;
inited = false;
}
};
var Waiting = (function (_super) {
__extends(Waiting, _super);
function Waiting() {
var _this = _super.call(this) || this;
var rectBgTexture = RES_1.RES.getRes("waitingBg.png");
if (rectBgTexture) {
var rectBg = new FYGE.Sprite(rectBgTexture);
_this.addChild(rectBg);
var rotTexture = RES_1.RES.getRes("waitingRot.png");
var rot_1 = new FYGE.Sprite(rotTexture);
rot_1.x = (rectBgTexture.width - rotTexture.width) / 2;
rot_1.y = 47;
rot_1.anchorX = rotTexture.width / 2;
rot_1.anchorY = rotTexture.height / 2;
_this.addChild(rot_1);
var count_1 = 0;
rot_1.addEventListener(FYGE.Event.ENTER_FRAME, function () {
count_1++;
if (count_1 % 30 == 0)
rot_1.rotation += 45;
}, _this);
}
_this.msg = new FYGE.TextField();
_this.msg.y = 125;
_this.msg.textWidth = rectBgTexture ? rectBgTexture.width : 200;
_this.msg.textAlign = FYGE.TEXT_ALIGN.CENTER;
_this.msg.size = 26;
_this.msg.fillColor = "#ffffff";
_this.addChild(_this.msg);
return _this;
}
Waiting.prototype.show = function (msg) {
if (msg === void 0) { msg = "加载中"; }
this.msg.text = msg;
};
Waiting.prototype.destroy = function () {
_super.prototype.destroy.call(this);
this.msg = null;
};
return Waiting;
}(FYGE.Container));
/***/ }),
/***/ "./module/views/Module.ts":
/*!********************************!*\
!*** ./module/views/Module.ts ***!
\********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Module = void 0;
var RES_1 = __webpack_require__(/*! ../RES */ "./module/RES.ts");
var ctrls_1 = __webpack_require__(/*! ../ctrls */ "./module/ctrls/index.ts");
var Module = (function (_super) {
__extends(Module, _super);
function Module(data) {
var _this = _super.call(this) || this;
_this.data = data;
_this.init();
return _this;
}
Module.prototype.init = function () {
var _this = this;
this.preLoadRes().then(function () {
if (_this.skinName)
RES_1.RES.initSkinDisplay(_this, _this.skinName, _this);
_this.initUi();
_this.onLoaded && _this.onLoaded();
}, function () {
_this.onLoadError && _this.onLoadError();
});
};
Module.prototype.preLoadRes = function () {
var _this = this;
return new Promise(function (resolve, reject) {
if (_this.groupNames && _this.groupNames.length) {
var arr = [];
for (var i = 0; i < _this.groupNames.length; i++) {
arr.push(RES_1.RES.loadGroup(_this.groupNames[i]));
}
Promise.all(arr).then(resolve, reject);
}
else {
resolve();
}
});
};
Module.prototype.initUi = function () {
};
Object.defineProperty(Module.prototype, "groupNames", {
get: function () { return null; },
enumerable: false,
configurable: true
});
Object.defineProperty(Module.prototype, "skinName", {
get: function () { return null; },
enumerable: false,
configurable: true
});
;
Module.prototype.start = function (data) {
this.initEvents();
};
Module.prototype.initEvents = function () {
};
Module.prototype.removeEvents = function () {
};
Module.prototype.enableMouseEvt = function (enable) {
this.mouseEnable = enable;
this.mouseChildren = enable;
};
Module.prototype.btnDelay = function (target, delay) {
if (delay === void 0) { delay = 2000; }
target.mouseEnable = false;
target.mouseChildren = false;
setTimeout(function () {
target.mouseEnable = true;
target.mouseChildren = true;
}, delay);
};
Module.prototype.destroy = function () {
ctrls_1.removeTweens(this);
this.removeEvents();
this.dispatchEvent("onDestroy");
_super.prototype.destroy.call(this);
};
return Module;
}(FYGE.Container));
exports.Module = Module;
/***/ }),
/***/ "./module/views/Scene.ts":
/*!*******************************!*\
!*** ./module/views/Scene.ts ***!
\*******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Scene = void 0;
var Module_1 = __webpack_require__(/*! ./Module */ "./module/views/Module.ts");
var Scene = (function (_super) {
__extends(Scene, _super);
function Scene() {
return _super !== null && _super.apply(this, arguments) || this;
}
Scene.prototype.showAni = function (callback) {
callback();
};
Scene.prototype.updateScene = function () {
};
return Scene;
}(Module_1.Module));
exports.Scene = Scene;
/***/ }),
/***/ "./module/views/layers.ts":
/*!********************************!*\
!*** ./module/views/layers.ts ***!
\********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.destroyLayers = exports.layers = void 0;
var panelCtrl_1 = __webpack_require__(/*! ../ctrls/panelCtrl */ "./module/ctrls/panelCtrl.ts");
var sceneCtrl_1 = __webpack_require__(/*! ../ctrls/sceneCtrl */ "./module/ctrls/sceneCtrl.ts");
var Layers = (function (_super) {
__extends(Layers, _super);
function Layers() {
return _super !== null && _super.apply(this, arguments) || this;
}
Layers.prototype.init = function (stage) {
stage.addChild(this);
var arr = [
"_bottomLayer",
"_sceneLayer",
"_popupLayer",
"_toastLayer",
"_topLayer",
"_shareLayer"
];
for (var i = 0; i < arr.length; i++) {
this[arr[i]] = new FYGE.Container();
this.addChild(this[arr[i]]);
}
this.sceneLayer.y = this.stageOffsetY;
this.shareLayer.y = -this.stageOffsetY;
sceneCtrl_1.default.instance.init(this.sceneLayer);
panelCtrl_1.default.instance.init(this.popupLayer);
};
Object.defineProperty(Layers.prototype, "bottomLayer", {
get: function () { return this._bottomLayer; },
enumerable: false,
configurable: true
});
Object.defineProperty(Layers.prototype, "sceneLayer", {
get: function () { return this._sceneLayer; },
enumerable: false,
configurable: true
});
Object.defineProperty(Layers.prototype, "popupLayer", {
get: function () { return this._popupLayer; },
enumerable: false,
configurable: true
});
Object.defineProperty(Layers.prototype, "toastLayer", {
get: function () { return this._toastLayer; },
enumerable: false,
configurable: true
});
Object.defineProperty(Layers.prototype, "topLayer", {
get: function () { return this._topLayer; },
enumerable: false,
configurable: true
});
Object.defineProperty(Layers.prototype, "shareLayer", {
get: function () { return this._shareLayer; },
enumerable: false,
configurable: true
});
Object.defineProperty(Layers.prototype, "stageHeight", {
get: function () {
if (!this.stage)
return 0;
return this.stage.viewRect.height;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Layers.prototype, "stageWidth", {
get: function () {
if (!this.stage)
return 0;
return this.stage.viewRect.width;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Layers.prototype, "stageOffsetX", {
get: function () {
if (!this.stage)
return 0;
return this.stage.viewRect.x;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Layers.prototype, "stageOffsetY", {
get: function () {
if (!this.stage)
return 0;
return this.stage.viewRect.y;
},
enumerable: false,
configurable: true
});
return Layers;
}(FYGE.Container));
exports.layers = new Layers();
function destroyLayers() {
exports.layers.removeChildren();
if (exports.layers.parent)
exports.layers.parent.removeChild(exports.layers);
}
exports.destroyLayers = destroyLayers;
/***/ }),
/***/ "./resCanvasList.js":
/*!**************************!*\
!*** ./resCanvasList.js ***!
\**************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
const resCanvasList = {
'4ee17a9c-5deb-43be-b205-16fb7593d172': {
name: 'spark',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/spark.810e94665ad6f7d7684f9b25b764e040a0cce7bf.png',
uuid: '4ee17a9c-5deb-43be-b205-16fb7593d172'
},
'cb54f3b5-0469-46d1-99ea-734153b92078': {
name: 'bg',
ext: '.png',
url: '//yun.duiba.com.cn/spark/assets/bg.c4359b9ea9e843cd8d929567b2fb52ed5518e105.png',
uuid: 'cb54f3b5-0469-46d1-99ea-734153b92078'
},
'593e9d74-4944-496a-b6c1-8316756f8bf7': {
name: '宝箱2',
ext: '.png',
uuid: '593e9d74-4944-496a-b6c1-8316756f8bf7',
url: '//yun.duiba.com.cn/spark/assets/022e25a3984ff122fbf960bd0cb87bff48f8c3bf.png'
}
};
/* harmony default export */ __webpack_exports__["default"] = (resCanvasList);
/***/ }),
/***/ "./src/Main.ts":
/*!*********************!*\
!*** ./src/Main.ts ***!
\*********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Main = exports.GDispatcher = void 0;
var RES_1 = __webpack_require__(/*! ../module/RES */ "./module/RES.ts");
var layers_1 = __webpack_require__(/*! ../module/views/layers */ "./module/views/layers.ts");
var G_EVENT_1 = __webpack_require__(/*! ./common/G_EVENT */ "./src/common/G_EVENT.ts");
var ctrls_1 = __webpack_require__(/*! ../module/ctrls */ "./module/ctrls/index.ts");
var StartScene_1 = __webpack_require__(/*! ./scenes/StartScene */ "./src/scenes/StartScene.ts");
var TaoBaoNet_1 = __webpack_require__(/*! ./TaoBaoNet */ "./src/TaoBaoNet.ts");
var resCanvasList_1 = __webpack_require__(/*! ../resCanvasList */ "./resCanvasList.js");
var stage_1 = __webpack_require__(/*! ./scenes/stage */ "./src/scenes/stage.ts");
exports.GDispatcher = new FYGE.EventDispatcher();
var Main = (function () {
function Main(canvas) {
var sysInfo;
if (my) {
FYGE.initedByCanvas(canvas);
sysInfo = my.getSystemInfoSync();
}
var stage = new FYGE.Stage(canvas, 750, 1624, sysInfo && sysInfo.windowWidth || document.body.clientWidth, sysInfo && sysInfo.windowHeight || document.body.clientHeight, FYGE.RENDERER_TYPE.CANVAS);
this.stage = stage;
stage_1.setStage(stage);
stage.addEventListener(FYGE.Event.INIT_STAGE, this.onAddToStage, this);
var self = this;
loop();
function loop() {
if (!self._pause) {
FYGE.Tween.flush();
stage.flush();
}
self.requestID = FYGE.getRequestAnimationFrame()(loop);
}
}
Main.prototype.onAddToStage = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
layers_1.layers.init(this.stage);
console.log("初始化层级完成");
return [4, RES_1.RES.loadSparkAssets(resCanvasList_1.default)];
case 1:
_a.sent();
console.log("通用资源加载完成");
ctrls_1.changeScene(StartScene_1.StartScene);
return [2];
}
});
});
};
Main.prototype.run = function () {
this._pause = false;
exports.GDispatcher.dispatchEvent(G_EVENT_1.G_EVENT.ON_SHOW);
};
Main.prototype.pause = function () {
exports.GDispatcher.dispatchEvent(G_EVENT_1.G_EVENT.ON_HIDE);
};
Main.prototype.addGlobalEvent = function (name, fun, thisObj, once) {
if (once === void 0) { once = false; }
if (once) {
exports.GDispatcher.once(name, fun, thisObj);
}
else {
exports.GDispatcher.addEventListener(name, fun, thisObj);
}
};
Main.prototype.dispatchGlobalEvent = function (name, data) {
exports.GDispatcher.dispatchEvent(name, data);
};
Main.prototype.removeGlobalEvent = function (name, fun, thisObj) {
exports.GDispatcher.removeEventListener(name, fun, thisObj);
};
Main.prototype.destroy = function () {
FYGE.Tween.removeAllTweens();
FYGE.getCancelAnimationFrame()(this.requestID);
layers_1.destroyLayers();
ctrls_1.destroyAllCtrls();
this.stage.destroy();
exports.GDispatcher.removeAllEventListener();
TaoBaoNet_1.destroyNetData();
};
return Main;
}());
exports.Main = Main;
/***/ }),
/***/ "./src/TaoBaoNet.ts":
/*!**************************!*\
!*** ./src/TaoBaoNet.ts ***!
\**************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.destroyNetData = exports.getTbData = exports.sendTbNet = exports.TbNetName = void 0;
var ctrls_1 = __webpack_require__(/*! ../module/ctrls */ "./module/ctrls/index.ts");
var Main_1 = __webpack_require__(/*! ./Main */ "./src/Main.ts");
var TbNetName;
(function (TbNetName) {
TbNetName["trackingReport"] = "squirrelsAdoptRest2c.trackingReport";
TbNetName["getIndex"] = "babycare.getIndex";
TbNetName["getActivityBaseInfoById"] = "babycare.getActivityBaseInfoById";
TbNetName["getGameInfo"] = "babycare.getGameInfo";
TbNetName["consumerTools"] = "babycare.consumerTools";
TbNetName["gameOver"] = "babycare.gameOver";
TbNetName["receiveTaskRewards"] = "babycare.receiveTaskRewards";
TbNetName["exchange"] = "babycare.exchange";
TbNetName["getPrizesByLevel"] = "babycare.getPrizesByLevel";
TbNetName["queryCredits"] = "babycare.queryCredits";
TbNetName["dojoin"] = "babycare.dojoin";
TbNetName["completeTask"] = "babycare.completeTask";
TbNetName["getTaskList"] = "babycare.getTaskList";
TbNetName["authorize"] = "mine.authorize";
TbNetName["favorShop"] = "mine.favorShop";
TbNetName["getUserAddress"] = "mine.getUserAddress";
TbNetName["getAdoptName"] = "mine.getAdoptName";
TbNetName["getAppData"] = "mine.getAppData";
TbNetName["navigateToOutside"] = "mine.navigateToOutside";
TbNetName["navigateTo"] = "mine.navigateTo";
TbNetName["navigateBack"] = "mine.navigateBack";
TbNetName["showSharePanel"] = "mine.showSharePanel";
TbNetName["openDetail"] = "mine.openDetail";
TbNetName["reportAnalytics"] = "mine.reportAnalytics";
})(TbNetName = exports.TbNetName || (exports.TbNetName = {}));
var dataRecord = {};
var fc;
function sendTbNet(netName, parameter, callback, hideMsg) {
if (hideMsg === void 0) { hideMsg = false; }
return new Promise(function (resolve, reject) {
var waitObj;
if (!my) {
var url = "../../mock/miniTb/" + netName + ".json";
fetchAsync(url)
.then(function (data) {
dataRecord[netName] = data;
if (!hideMsg && !data.success)
ctrls_1.showToast(data.message || "网络异常");
callback && callback(data.success, data);
resolve(data);
console.log("\n%c[ mock ]\n"
+ ("NAME : " + netName + " \n")
+ "STATE : %o \n"
+ "PARAM : %o \n"
+ "%cDATA : %o \n", "" + (data.success ? 'color:green' : 'color:red'), data.success, parameter, "" + (data.success ? 'color:green' : 'color:red'), data);
}, function () {
});
return;
}
var fun = function (e) {
ctrls_1.clearWait(waitObj);
Main_1.GDispatcher.removeEventListener(netName, fun);
var d = e.data;
dataRecord[netName] = d;
if (!hideMsg && !d.success)
ctrls_1.showToast(d.message || "网络超时");
callback && callback(d.success, d);
resolve(d);
console.log("\n%c[ request ]\n"
+ ("NAME : " + netName + " \n")
+ "STATE : %o \n"
+ "PARAM : %o \n"
+ "%cDATA : %o \n", "" + (d.success ? 'color:green' : 'color:red'), d.success, parameter, "" + (d.success ? 'color:green' : 'color:red'), d);
};
Main_1.GDispatcher.addEventListener(netName, fun);
waitObj = ctrls_1.wait(function () {
if (netName != TbNetName.favorShop &&
netName != TbNetName.getUserAddress &&
netName != TbNetName.authorize &&
netName != TbNetName.getAdoptName &&
netName != TbNetName.trackingReport &&
netName != TbNetName.reportAnalytics) {
fun({ type: netName, data: { success: false } });
}
}, 10000);
Main_1.GDispatcher.dispatchEvent({ type: "onMessage" }, { netName: netName, parameter: parameter });
});
}
exports.sendTbNet = sendTbNet;
function getTbData(netName) {
return dataRecord[netName] || null;
}
exports.getTbData = getTbData;
function destroyNetData() {
dataRecord = {};
}
exports.destroyNetData = destroyNetData;
function fetchAsync(url) {
return __awaiter(this, void 0, void 0, function () {
var response, data;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, fetch(url)];
case 1:
response = _a.sent();
return [4, response.json()];
case 2:
data = _a.sent();
return [2, data];
}
});
});
}
var codeMsg = {
"210001": "服务器异常",
"210002": "用户不存在",
"210003": "邀请已达上限",
"210004": "无法邀请自己",
"210006": "该活动ID无效",
"210009": "该活动暂未开始",
"210010": "该分享ID不存在",
"210012": "该用户暂未获奖",
"210013": "领取失败",
"210015": "该活动已删除",
"210016": "该活动已经结束",
"210017": "该奖品已达领取上线",
"210018": "请先分享好友",
"210019": "暂有奖品未领取",
"210020": "暂有奖品未完成",
"210021": "请先玩一局游戏",
"210022": "请先选择奖品",
"210023": "领取失败,库存不足",
"210024": "请先成为会员",
"210025": "奖品已经过期",
"210026": "不能重复助力",
"210028": "请至我的奖品页重新领取",
};
/***/ }),
/***/ "./src/common/G_EVENT.ts":
/*!*******************************!*\
!*** ./src/common/G_EVENT.ts ***!
\*******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.G_EVENT = void 0;
var G_EVENT;
(function (G_EVENT) {
G_EVENT["ON_SHOW"] = "onShow";
G_EVENT["ON_HIDE"] = "onHide";
G_EVENT["UPDATE_TASK"] = "UpdateTask";
})(G_EVENT = exports.G_EVENT || (exports.G_EVENT = {}));
/***/ }),
/***/ "./src/scenes/DropItem.ts":
/*!********************************!*\
!*** ./src/scenes/DropItem.ts ***!
\********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var RES_1 = __webpack_require__(/*! ../../module/RES */ "./module/RES.ts");
var resCanvasList_1 = __webpack_require__(/*! ../../resCanvasList */ "./resCanvasList.js");
var DropItem = (function (_super) {
__extends(DropItem, _super);
function DropItem() {
var _this = _super.call(this) || this;
_this.texture = RES_1.RES.getRes(resCanvasList_1.default["593e9d74-4944-496a-b6c1-8316756f8bf7"].url);
_this.y = 0;
return _this;
}
DropItem.prototype.updatePosition = function () {
this.y += 10;
};
return DropItem;
}(FYGE.Sprite));
exports.default = DropItem;
/***/ }),
/***/ "./src/scenes/DropsCtrl.ts":
/*!*********************************!*\
!*** ./src/scenes/DropsCtrl.ts ***!
\*********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var stage_1 = __webpack_require__(/*! ./stage */ "./src/scenes/stage.ts");
var DropItem_1 = __webpack_require__(/*! ./DropItem */ "./src/scenes/DropItem.ts");
var DropsCtrl = (function () {
function DropsCtrl(root) {
this._root = root;
}
DropsCtrl.prototype.start = function () {
var _this = this;
stage_1.getStage().addEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this);
for (var index = 0; index < 10; index++) {
setTimeout(function () {
_this.addDropItem();
}, 1000 * index);
}
};
DropsCtrl.prototype.addDropItem = function () {
this._drops = this._drops || [];
var drop = new DropItem_1.default();
this._root.addChild(drop);
drop.x = Math.random() * 400 + (750 - 400) / 2;
this._drops.push(drop);
};
DropsCtrl.prototype.onEnterFrame = function () {
if (this._drops)
this._drops.forEach(function (drop) { return drop.updatePosition(); });
};
DropsCtrl.prototype.destroy = function () {
stage_1.getStage().removeEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this);
};
return DropsCtrl;
}());
exports.default = DropsCtrl;
/***/ }),
/***/ "./src/scenes/Root.ts":
/*!****************************!*\
!*** ./src/scenes/Root.ts ***!
\****************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var RES_1 = __webpack_require__(/*! ../../module/RES */ "./module/RES.ts");
var resCanvasList_1 = __webpack_require__(/*! ../../resCanvasList */ "./resCanvasList.js");
var DropsCtrl_1 = __webpack_require__(/*! ./DropsCtrl */ "./src/scenes/DropsCtrl.ts");
var Root = (function (_super) {
__extends(Root, _super);
function Root() {
var _this = _super.call(this) || this;
_this.once(FYGE.Event.ADDED_TO_STAGE, _this.onAddToStage, _this);
var bg = new FYGE.Sprite();
bg.x = 0;
bg.y = 0;
bg.texture = RES_1.RES.getRes(resCanvasList_1.default["cb54f3b5-0469-46d1-99ea-734153b92078"].url);
_this.addChild(bg);
console.log('fuck');
var ctrl = new DropsCtrl_1.default(_this);
ctrl.start();
return _this;
}
Root.prototype.onAddToStage = function () {
this.y = this.stage.viewRect.height / 2 - 1624 / 2;
};
return Root;
}(FYGE.Container));
exports.default = Root;
/***/ }),
/***/ "./src/scenes/StartScene.ts":
/*!**********************************!*\
!*** ./src/scenes/StartScene.ts ***!
\**********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.StartScene = void 0;
var Scene_1 = __webpack_require__(/*! ../../module/views/Scene */ "./module/views/Scene.ts");
var Root_1 = __webpack_require__(/*! ./Root */ "./src/scenes/Root.ts");
var StartScene = (function (_super) {
__extends(StartScene, _super);
function StartScene() {
return _super !== null && _super.apply(this, arguments) || this;
}
StartScene.prototype.initUi = function () {
_super.prototype.initUi.call(this);
var canvas = new FYGE.Container();
canvas.position.set(0, 0);
this.addChild(canvas);
};
StartScene.prototype.start = function () {
this.addChild(new Root_1.default());
};
return StartScene;
}(Scene_1.Scene));
exports.StartScene = StartScene;
/***/ }),
/***/ "./src/scenes/stage.ts":
/*!*****************************!*\
!*** ./src/scenes/stage.ts ***!
\*****************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setStage = exports.getStage = void 0;
var _stage;
exports.getStage = function () { return _stage; };
exports.setStage = function (stage) {
_stage = stage;
};
/***/ })
/******/ });
});
//# sourceMappingURL=output.js.map
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment