Commit cd5a752c authored by wildfirecode13's avatar wildfirecode13

1

parent 530b5d2b
File added
......@@ -140,6 +140,59 @@
}
}
]
},
{
"name": "gamescene",
"properties": {
"style": {
"top": 0,
"left": 0,
"width": 750,
"height": 1624,
"display": "block",
"position": "absolute"
},
"attrs": {},
"className": "",
"name": "空视图"
},
"uuid": "7627fd9c-329f-496b-afdd-43e7934dc072",
"rect": {
"x": 0,
"y": 0,
"width": 300,
"height": 300
},
"componentName": "Div",
"viewType": "Scene",
"children": [
{
"name": "gamecanvas",
"properties": {
"style": {
"width": 300,
"height": 300,
"opacity": 1,
"display": "block",
"left": 0,
"top": 0,
"position": "absolute",
"transformOrigin": "0px 0px 0px"
},
"attrs": {},
"className": ""
},
"uuid": "69d4ec71-10a2-42c1-b392-7f25a62b6ef0",
"rect": {
"x": 0,
"y": 0,
"width": 300,
"height": 300
},
"componentName": "Canvas",
"viewType": "Element"
}
]
}
]
},
......
{
"name": "spark-project-create",
"version": "0.1.0",
"private": true,
"scripts": {
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'"
},
"dependencies": {
"axios": "^0.19.2",
"css-loader": "^3.6.0",
"fyge-tbmini": "^1.3.1",
"postcss-loader": "^3.0.0",
"prettier": "^2.0.5",
"qs": "^6.9.4",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-thunk": "^2.3.0",
"style-loader": "^1.2.1",
"spark-utils": "git+ssh://git@gitlab2.dui88.com:spark/spark-utils.git"
},
"devDependencies": {
"mockjs": "^1.1.0"
}
"name": "spark-project-create",
"version": "0.1.0",
"private": true,
"scripts": { "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'" },
"dependencies": {
"axios": "^0.19.2",
"css-loader": "^3.6.0",
"fyge-tbmini": "^1.3.1",
"postcss-loader": "^3.0.0",
"prettier": "^2.0.5",
"qs": "^6.9.4",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-thunk": "^2.3.0",
"style-loader": "^1.2.1",
"spark-utils": "git+ssh://git@gitlab2.dui88.com:spark/spark-utils.git"
},
"devDependencies": { "mockjs": "^1.1.0" }
}
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="full-screen" content="true" />
<meta name="screen-orientation" content="portrait" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<!-- <meta name="viewport" content="width=device-width,minimum-scale=1.0,user-scalable=no"> -->
<!-- <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> -->
<!-- 小程序分享得用这个 -->
<!-- <script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script> -->
<!-- 易盾js -->
<!-- <script type="text/javascript" src="//cstaticdun.126.net/load.min.js"></script> -->
<!-- <script src="libs/zepto.min.js"></script> -->
<!-- <script src="libs/p2.js"></script> -->
<script src="libs/fyge.min.js"></script>
<script src="libs/svgaParser.min.js"></script>
<!-- <script src="libs/svgaParser.min1.js"></script> -->
<style>
html,
body {
padding: 0;
margin: 0;
border: 0;
width: 100%;
height: 100%;
overflow: hidden;
position: absolute;
background-color: #f5cccd;
/* background: linear-gradient(#93dbb7,#ff0,#b5d89a); */
/* background: linear-gradient(#93dbb7,#b5d89a); */
}
</style>
</head>
<body>
<script src="output.js"></script>
<!-- <div id="__loading__" style="position:absolute;left:50%;top:50%;margin-left:-45px;color:#ffffff">拼命加载中...</div> -->
<!-- <img src="" id="img" /> -->
<div id="cusEngine" style="line-height:0;font-size:0">
<canvas id="canvas" style="width: 100%;height: 100%"></canvas>
</div>
</body>
<!-- 帧率检测 -->
<!-- <script src="libs/stats.js"></script> -->
<script>
window.addEventListener("load", function () {
//获取canvas
var canvas = document.getElementById("canvas");
canvas.width = document.body.clientWidth * (window.devicePixelRatio || 1)
canvas.height = document.body.clientHeight * (window.devicePixelRatio || 1)
var main = new Main(canvas);
console.log(main.stage)
var mouseEvent = main.stage.onMouseEvent.bind(main.stage);
canvas.addEventListener("touchstart", mouseEvent, false);
canvas.addEventListener('touchmove', mouseEvent, false);
canvas.addEventListener('touchend', mouseEvent, false);
})
</script>
</html>
import { Main } from './Main';
Page({
//暂时先不用吧,有问题
data: {
},
onLoad(query) {
// 页面加载
console.info(`Page onLoad with query: ${JSON.stringify(query)}`);
},
onReady() {
return
my.development = true;
// my._createCanvas({
// id: 'canvas',
// success: (ccc) => {
// const dpr = my.getSystemInfoSync().pixelRatio
// const windowWidth = my.getSystemInfoSync().windowWidth;
// const windowHeight = my.getSystemInfoSync().windowHeight;
// ccc.width = windowWidth * dpr;
// ccc.height = windowHeight * dpr;
// // const context = canvas.getContext("2d");
// console.log(ccc.width, ccc.height, dpr)
// //初始化
// FYGE.initedByCanvas(ccc);
// //测试
// var aa = ccc.createImage();
// aa.src = "https://yun.duiba.com.cn/db_games/activity/etc/optionImages/%E5%8D%8E%E4%B8%BAP30.jpg";
// console.log(aa)
// //帧率控制
// FYGE.Stage.addFPS("canva4stats")
// this.main = new Main(ccc)
// console.log(ccc.width, ccc.height)
// }
// })
},
onCanvasReady() {
my.development = true;
my._createCanvas({
id: 'canvas',
success: (ccc) => {
const dpr = my.getSystemInfoSync().pixelRatio
const windowWidth = my.getSystemInfoSync().windowWidth;
const windowHeight = my.getSystemInfoSync().windowHeight;
ccc.width = windowWidth * dpr;
ccc.height = windowHeight * dpr;
this.main = new Main(ccc)
}
})
},
onShow() {
// 页面显示
// FYGE.Stage.pause = false
if (this.main) this.main.run();
},
onHide() {
// 页面隐藏
// FYGE.Stage.pause = true
if (this.main) this.main.pause();
},
onUnload() {
// 页面被关闭
// Stage.stop()
this.main.destroy();
},
onTitleClick() {
// 标题被点击
},
onPullDownRefresh() {
// 页面被下拉
},
onReachBottom() {
// 页面被拉到底部
},
onShareAppMessage() {
// 返回自定义分享信息
return {
title: 'My App',
desc: 'My App description',
path: 'pages/index/index',
};
},
log(e) {
if (this.main) this.main.stage.onMouseEvent(e)
},
});
This source diff could not be displayed because it is too large. You can view the blob instead.
declare module SvgaParser {
/**
* 加载方法
* @param url 资源路径
* @param success
* @param failure
*/
export function loadSvga(url: string, success: (videoItem: VideoEntity) => void, failure?: (err: string) => void): void;
/**
* 导出只是当作类型接口用
*/
export interface VideoEntity {
/**
* SVGA 文件版本
*/
version: string;
/**
* 影片尺寸
*/
videoSize: {
width: number;
height: number;
};
/**
* 帧率,60,30等每秒
*/
FPS: number;
/**
* 总帧数
*/
frames: number;
/**
* base64图片数据记录
*/
images: {
[key: string]: string
};
/**
* 图片是否已被缓存,缓存全局,注意名字覆盖
*/
hasBeenCached: boolean;
/**
* sprite对象数据
*/
sprites: SpriteEntity[];
}
interface SpriteEntity {
/**
* 标识
*/
matteKey: string;
/**
* 图片key值
*/
imageKey: string;
/**
* 帧数据数组
*/
frames: FrameEntity[];
}
/**
* 还有很多其他数据,暂不需要,比如矢量路径和遮罩路径暂时都无
*/
interface FrameEntity {
/**
* 透明度
*/
alpha: number;
/**
* 2维矩阵数据
*/
transform: {
a: number,
b: number,
c: number,
d: number,
tx: number,
ty: number,
};
}
}
declare module "svga-parser" { export = SvgaParser; }
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
var Stats = function () {
var startTime = Date.now(), prevTime = startTime;
var ms = 0, msMin = Infinity, msMax = 0;
var fps = 0, fpsMin = Infinity, fpsMax = 0;
var frames = 0, mode = 0;
var container = document.createElement('div');
container.id = 'stats';
container.addEventListener('mousedown', function (event) { event.preventDefault(); setMode(++mode % 2) }, false);
container.style.cssText = 'width:80px;opacity:0.9;cursor:pointer';
var fpsDiv = document.createElement('div');
fpsDiv.id = 'fps';
fpsDiv.style.cssText = 'padding:0 0 3px 3px;text-align:left;background-color:#002';
container.appendChild(fpsDiv);
var fpsText = document.createElement('div');
fpsText.id = 'fpsText';
fpsText.style.cssText = 'color:#0ff;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px';
fpsText.innerHTML = 'FPS';
fpsDiv.appendChild(fpsText);
var fpsGraph = document.createElement('div');
fpsGraph.id = 'fpsGraph';
fpsGraph.style.cssText = 'position:relative;width:74px;height:30px;background-color:#0ff';
fpsDiv.appendChild(fpsGraph);
while (fpsGraph.children.length < 74) {
var bar = document.createElement('span');
bar.style.cssText = 'width:1px;height:30px;float:left;background-color:#113';
fpsGraph.appendChild(bar);
}
var msDiv = document.createElement('div');
msDiv.id = 'ms';
msDiv.style.cssText = 'padding:0 0 3px 3px;text-align:left;background-color:#020;display:none';
container.appendChild(msDiv);
var msText = document.createElement('div');
msText.id = 'msText';
msText.style.cssText = 'color:#0f0;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px';
msText.innerHTML = 'MS';
msDiv.appendChild(msText);
var msGraph = document.createElement('div');
msGraph.id = 'msGraph';
msGraph.style.cssText = 'position:relative;width:74px;height:30px;background-color:#0f0';
msDiv.appendChild(msGraph);
while (msGraph.children.length < 74) {
var bar = document.createElement('span');
bar.style.cssText = 'width:1px;height:30px;float:left;background-color:#131';
msGraph.appendChild(bar);
}
var setMode = function (value) {
mode = value;
switch (mode) {
case 0:
fpsDiv.style.display = 'block';
msDiv.style.display = 'none';
break;
case 1:
fpsDiv.style.display = 'none';
msDiv.style.display = 'block';
break;
}
}
var updateGraph = function (dom, value) {
var child = dom.appendChild(dom.firstChild);
child.style.height = value + 'px';
}
return {
REVISION: 11,
domElement: container,
setMode: setMode,
begin: function () {
startTime = Date.now();
},
end: function () {
var time = Date.now();
ms = time - startTime;
msMin = Math.min(msMin, ms);
msMax = Math.max(msMax, ms);
msText.textContent = ms + ' MS (' + msMin + '-' + msMax + ')';
updateGraph(msGraph, Math.min(30, 30 - (ms / 200) * 30));
frames++;
if (time > prevTime + 1000) {
fps = Math.round((frames * 1000) / (time - prevTime));
fpsMin = Math.min(fpsMin, fps);
fpsMax = Math.max(fpsMax, fps);
fpsText.textContent = fps + ' FPS (' + fpsMin + '-' + fpsMax + ')';
updateGraph(fpsGraph, Math.min(30, 30 - (fps / 100) * 30));
prevTime = time;
frames = 0;
}
return time;
},
update: function () {
startTime = this.end();
}
}
};
//执行
var stats = new Stats();
stats.domElement.style.position = 'absolute';
stats.domElement.style.top = '0px';
document.body.appendChild(stats.domElement);
aa();
function aa() {
stats.update();
requestAnimationFrame(aa)
}
\ No newline at end of file
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SvgaParser=t():e.SvgaParser=t()}(window,(function(){return d=[function(e,t,r){"use strict";var i,n,o=e.exports=r(1),s=r(16);o.codegen=r(45),o.fetch=r(46),o.path=r(47),o.fs=o.inquire("fs"),o.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),i=0;i<t.length;)r[i]=e[t[i++]];return r}return[]},o.toObject=function(e){for(var t={},r=0;r<e.length;){var i=e[r++],n=e[r++];void 0!==n&&(t[i]=n)}return t};var a=/\\/g,f=/"/g;o.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},o.safeProp=function(e){return!/^[$\w_]+$/.test(e)||o.isReserved(e)?'["'+e.replace(a,"\\\\").replace(f,'\\"')+'"]':"."+e},o.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var l=/_([a-z])/g;o.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(l,(function(e,t){return t.toUpperCase()}))},o.compareFieldsById=function(e,t){return e.id-t.id},o.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(o.decorateRoot.remove(e.$type),e.$type.name=t,o.decorateRoot.add(e.$type)),e.$type;var n=new(i=i||r(18))(t||e.name);return o.decorateRoot.add(n),n.ctor=e,Object.defineProperty(e,"$type",{value:n,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:n,enumerable:!1}),n};var u=0;o.decorateEnum=function(e){if(e.$type)return e.$type;var t=new(n=n||r(2))("Enum"+u++,e);return o.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},Object.defineProperty(o,"decorateRoot",{get:function(){return s.decorated||(s.decorated=new(r(26)))}})},function(e,t,r){"use strict";(function(e){var i=t;function n(e,t,r){for(var i=Object.keys(t),n=0;n<i.length;++n)void 0!==e[i[n]]&&r||(e[i[n]]=t[i[n]]);return e}function o(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&n(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}i.asPromise=r(13),i.base64=r(36),i.EventEmitter=r(37),i.float=r(38),i.inquire=r(14),i.utf8=r(39),i.pool=r(40),i.LongBits=r(41),i.global="undefined"!=typeof window&&window||void 0!==e&&e||"undefined"!=typeof self&&self||this,i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isNode=Boolean(i.global.process&&i.global.process.versions&&i.global.process.versions.node),i.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},i.isString=function(e){return"string"==typeof e||e instanceof String},i.isObject=function(e){return e&&"object"==typeof e},i.isset=i.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||0<(Array.isArray(r)?r.length:Object.keys(r).length))},i.Buffer=function(){try{var e=i.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),i._Buffer_from=null,i._Buffer_allocUnsafe=null,i.newBuffer=function(e){return"number"==typeof e?i.Buffer?i._Buffer_allocUnsafe(e):new i.Array(e):i.Buffer?i._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},i.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,i.Long=i.global.dcodeIO&&i.global.dcodeIO.Long||i.global.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(e){return e?i.LongBits.from(e).toHash():i.LongBits.zeroHash},i.longFromHash=function(e,t){var r=i.LongBits.fromHash(e);return i.Long?i.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},i.merge=n,i.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},i.newError=o,i.ProtocolError=o("ProtocolError"),i.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;-1<r;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},i.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i._configure=function(){var e=i.Buffer;e?(i._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},i._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):i._Buffer_from=i._Buffer_allocUnsafe=null}}).call(this,r(35))},function(e,t,r){"use strict";e.exports=s;var i=r(3);((s.prototype=Object.create(i.prototype)).constructor=s).className="Enum";var n=r(5),o=r(0);function s(e,t,r,n,o){if(i.call(this,e,r),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=n,this.comments=o||{},this.reserved=void 0,t)for(var s=Object.keys(t),a=0;a<s.length;++a)"number"==typeof t[s[a]]&&(this.valuesById[this.values[s[a]]=t[s[a]]]=s[a])}s.fromJSON=function(e,t){var r=new s(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},s.prototype.add=function(e,t,r){if(!o.isString(e))throw TypeError("name must be a string");if(!o.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return this.comments[e]=r||null,this},s.prototype.remove=function(e){if(!o.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this},s.prototype.isReservedId=function(e){return n.isReservedId(this.reserved,e)},s.prototype.isReservedName=function(e){return n.isReservedName(this.reserved,e)}},function(e,t,r){"use strict";(e.exports=o).className="ReflectionObject";var i,n=r(0);function o(e,t){if(!n.isString(e))throw TypeError("name must be a string");if(t&&!n.isObject(t))throw TypeError("options must be an object");this.options=t,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(o.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),o.prototype.toJSON=function(){throw Error()},o.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof i&&t._handleAdd(this)},o.prototype.onRemove=function(e){var t=e.root;t instanceof i&&t._handleRemove(this),this.parent=null,this.resolved=!1},o.prototype.resolve=function(){return this.resolved||this.root instanceof i&&(this.resolved=!0),this},o.prototype.getOption=function(e){if(this.options)return this.options[e]},o.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},o.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),i=0;i<r.length;++i)this.setOption(r[i],e[r[i]],t);return this},o.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},o._configure=function(e){i=e}},function(e,t,r){"use strict";e.exports=l;var i=r(3);((l.prototype=Object.create(i.prototype)).constructor=l).className="Field";var n,o=r(2),s=r(6),a=r(0),f=/^required|optional|repeated$/;function l(e,t,r,n,o,l,u){if(a.isObject(n)?(u=o,l=n,n=o=void 0):a.isObject(o)&&(u=l,l=o,o=void 0),i.call(this,e,l),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(r))throw TypeError("type must be a string");if(void 0!==n&&!f.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==o&&!a.isString(o))throw TypeError("extend must be a string");this.rule=n&&"optional"!==n?n:void 0,this.type=r,this.id=t,this.extend=o||void 0,this.required="required"===n,this.optional=!this.required,this.repeated="repeated"===n,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==s.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=u}l.fromJSON=function(e,t){return new l(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(l.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),l.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),i.prototype.setOption.call(this,e,t,r)},l.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},l.prototype.resolve=function(){return this.resolved?this:(void 0===(this.typeDefault=s.defaults[this.type])&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof n?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof o&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof o)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long?(this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault)):this.bytes&&"string"==typeof this.typeDefault&&(a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e),this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof n&&(this.parent.ctor.prototype[this.name]=this.defaultValue),i.prototype.resolve.call(this));var e},l.d=function(e,t,r,i){return"function"==typeof t?t=a.decorateType(t).name:t&&"object"==typeof t&&(t=a.decorateEnum(t).name),function(n,o){a.decorateType(n.constructor).add(new l(o,e,t,r,{default:i}))}},l._configure=function(e){n=e}},function(e,t,r){"use strict";e.exports=u;var i=r(3);((u.prototype=Object.create(i.prototype)).constructor=u).className="Namespace";var n,o,s,a=r(4),f=r(0);function l(e,t){if(e&&e.length){for(var r={},i=0;i<e.length;++i)r[e[i].name]=e[i].toJSON(t);return r}}function u(e,t){i.call(this,e,t),this.nested=void 0,this._nestedArray=null}function h(e){return e._nestedArray=null,e}u.fromJSON=function(e,t){return new u(e,t.options).addJSON(t.nested)},u.arrayToJSON=l,u.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!=typeof e[r]&&e[r][0]<=t&&e[r][1]>t)return!0;return!1},u.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(u.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=f.toArray(this.nested))}}),u.prototype.toJSON=function(e){return f.toObject(["options",this.options,"nested",l(this.nestedArray,e)])},u.prototype.addJSON=function(e){if(e)for(var t,r=Object.keys(e),i=0;i<r.length;++i)t=e[r[i]],this.add((void 0!==t.fields?n.fromJSON:void 0!==t.values?s.fromJSON:void 0!==t.methods?o.fromJSON:void 0!==t.id?a.fromJSON:u.fromJSON)(r[i],t));return this},u.prototype.get=function(e){return this.nested&&this.nested[e]||null},u.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof s)return this.nested[e].values;throw Error("no such enum: "+e)},u.prototype.add=function(e){if(!(e instanceof a&&void 0!==e.extend||e instanceof n||e instanceof s||e instanceof o||e instanceof u))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof u&&e instanceof u)||t instanceof n||t instanceof o)throw Error("duplicate name '"+e.name+"' in "+this);for(var r=t.nestedArray,i=0;i<r.length;++i)e.add(r[i]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return(this.nested[e.name]=e).onAdd(this),h(this)},u.prototype.remove=function(e){if(!(e instanceof i))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),h(this)},u.prototype.define=function(e,t){if(f.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var r=this;0<e.length;){var i=e.shift();if(r.nested&&r.nested[i]){if(!((r=r.nested[i])instanceof u))throw Error("path conflicts with non-namespace objects")}else r.add(r=new u(i))}return t&&r.addJSON(t),r},u.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof u?e[t++].resolveAll():e[t++].resolve();return this.resolve()},u.prototype.lookup=function(e,t,r){if("boolean"==typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),f.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var i=this.get(e[0]);if(i){if(1===e.length){if(!t||-1<t.indexOf(i.constructor))return i}else if(i instanceof u&&(i=i.lookup(e.slice(1),t,!0)))return i}else for(var n=0;n<this.nestedArray.length;++n)if(this._nestedArray[n]instanceof u&&(i=this._nestedArray[n].lookup(e,t,!0)))return i;return null===this.parent||r?null:this.parent.lookup(e,t)},u.prototype.lookupType=function(e){var t=this.lookup(e,[n]);if(!t)throw Error("no such type: "+e);return t},u.prototype.lookupEnum=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},u.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[n,s]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},u.prototype.lookupService=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},u._configure=function(e,t,r){n=e,o=t,s=r}},function(e,t,r){"use strict";var i=t,n=r(0),o=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function s(e,t){var r=0,i={};for(t|=0;r<e.length;)i[o[r+t]]=e[r++];return i}i.basic=s([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),i.defaults=s([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",n.emptyArray,null]),i.long=s([0,0,0,1,1],7),i.mapKey=s([0,0,0,5,5,0,0,0,1,1,0,2],2),i.packed=s([1,5,0,0,0,5,5,0,0,0,1,1,0])},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,n,o,s,a="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array?(i=Uint8Array,n=Uint16Array,o=Int32Array,s=function(e,t,r,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+i),n);else for(var o=0;o<i;o++)e[n+o]=t[r+o]},function(e){for(var t,r,i,n=0,o=0,s=e.length;o<s;o++)n+=e[o].length;for(i=new Uint8Array(n),o=t=0,s=e.length;o<s;o++)r=e[o],i.set(r,t),t+=r.length;return i}):(i=Array,n=Array,o=Array,s=function(e,t,r,i,n){for(var o=0;o<i;o++)e[n+o]=t[r+o]},function(e){return[].concat.apply([],e)});t.utils={assign:function(e,t){for(var r in t)i=t,n=r,Object.prototype.hasOwnProperty.call(i,n)&&(e[r]=t[r]);var i,n;return e},shrinkBuf:function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)},Buf8:i,Buf16:n,Buf32:o,arraySet:s,flattenChunks:a}},function(e,t,r){"use strict";e.exports=h;var i,n=r(1),o=n.LongBits,s=n.base64,a=n.utf8;function f(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new f(l,0,0),this.tail=this.head,this.states=null}function c(){return n.Buffer?function(){return(h.create=function(){return new i})()}:function(){return new h}}function d(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function y(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;127<e.lo;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function m(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=c(),h.alloc=function(e){return new n.Array(e)},n.Array!==Array&&(h.alloc=n.pool(h.alloc,n.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new f(e,t,r),this.len+=t,this},(p.prototype=Object.create(f.prototype)).fn=function(e,t,r){for(;127<e;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(y,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.int64=h.prototype.uint64=function(e){var t=o.from(e);return this._push(y,t.length(),t)},h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(y,t.length(),t)},h.prototype.bool=function(e){return this._push(d,1,e?1:0)},h.prototype.sfixed32=h.prototype.fixed32=function(e){return this._push(m,4,e>>>0)},h.prototype.sfixed64=h.prototype.fixed64=function(e){var t=o.from(e);return this._push(m,4,t.lo)._push(m,4,t.hi)},h.prototype.float=function(e){return this._push(n.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(n.float.writeDoubleLE,8,e)};var v=n.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var i=0;i<e.length;++i)t[r+i]=e[i]};h.prototype.bytes=function(e){var t,r=e.length>>>0;return r?(n.isString(e)&&(t=h.alloc(r=s.length(e)),s.decode(e,t,0),e=t),this.uint32(r)._push(v,r,e)):this._push(d,1,0)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(d,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new f(l,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new f(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){i=e,h.create=c(),i._configure()}},function(e,t,r){"use strict";e.exports=f;var i,n=r(1),o=n.LongBits,s=n.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function f(e){this.buf=e,this.pos=0,this.len=e.length}function l(){return n.Buffer?function(e){return(f.create=function(e){return n.Buffer.isBuffer(e)?new i(e):h(e)})(e)}:h}var u,h="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new f(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new f(e);throw Error("illegal buffer")};function c(){var e=new o(0,0),t=0;if(!(4<this.len-this.pos)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,4<this.len-this.pos){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}f.create=l(),f.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,f.prototype.uint32=(u=4294967295,function(){if(u=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return u;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return u}),f.prototype.int32=function(){return 0|this.uint32()},f.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},f.prototype.bool=function(){return 0!==this.uint32()},f.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return d(this.buf,this.pos+=4)},f.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|d(this.buf,this.pos+=4)},f.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},f.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},f.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},f.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},f.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},f.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},f._configure=function(e){i=e,f.create=l(),i._configure();var t=n.Long?"toLong":"toNumber";n.merge(f.prototype,{int64:function(){return c.call(this)[t](!1)},uint64:function(){return c.call(this)[t](!0)},sint64:function(){return c.call(this).zzDecode()[t](!1)},fixed64:function(){return p.call(this)[t](!0)},sfixed64:function(){return p.call(this)[t](!1)}})}},function(e,t,r){"use strict";e.exports=s;var i=r(3);((s.prototype=Object.create(i.prototype)).constructor=s).className="OneOf";var n=r(4),o=r(0);function s(e,t,r,n){if(Array.isArray(t)||(r=t,t=void 0),i.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=n}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}s.fromJSON=function(e,t){return new s(e,t.oneof,t.options,t.comment)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},s.prototype.add=function(e){if(!(e instanceof n))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),a(e.partOf=this),this},s.prototype.remove=function(e){if(!(e instanceof n))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),-1<(t=this.oneof.indexOf(e.name))&&this.oneof.splice(t,1),e.partOf=null,this},s.prototype.onAdd=function(e){i.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var r=e.get(this.oneof[t]);r&&!r.partOf&&(r.partOf=this).fieldsArray.push(r)}a(this)},s.prototype.onRemove=function(e){for(var t,r=0;r<this.fieldsArray.length;++r)(t=this.fieldsArray[r]).parent&&t.parent.remove(t);i.prototype.onRemove.call(this,e)},s.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,r){o.decorateType(t.constructor).add(new s(r,e)),Object.defineProperty(t,r,{get:o.oneOfGetter(e),set:o.oneOfSetter(e)})}}},function(e,t,r){"use strict";e.exports=n;var i=r(1);function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}n.create=function(e){return this.$type.create(e)},n.encode=function(e,t){return this.$type.encode(e,t)},n.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},n.decode=function(e){return this.$type.decode(e)},n.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},n.verify=function(e){return this.$type.verify(e)},n.fromObject=function(e){return this.$type.fromObject(e)},n.toObject=function(e,t){return this.$type.toObject(e,t)},n.prototype.toJSON=function(){return this.$type.toObject(this,i.toJSONOptions)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(32),n=JSON.parse('{"nested":{"com":{"nested":{"opensource":{"nested":{"svga":{"options":{"objc_class_prefix":"SVGAProto","java_package":"com.opensource.svgaplayer.proto"},"nested":{"MovieParams":{"fields":{"viewBoxWidth":{"type":"float","id":1},"viewBoxHeight":{"type":"float","id":2},"fps":{"type":"int32","id":3},"frames":{"type":"int32","id":4}}},"SpriteEntity":{"fields":{"imageKey":{"type":"string","id":1},"frames":{"rule":"repeated","type":"FrameEntity","id":2},"matteKey":{"type":"string","id":3}}},"AudioEntity":{"fields":{"audioKey":{"type":"string","id":1},"startFrame":{"type":"int32","id":2},"endFrame":{"type":"int32","id":3},"startTime":{"type":"int32","id":4},"totalTime":{"type":"int32","id":5}}},"Layout":{"fields":{"x":{"type":"float","id":1},"y":{"type":"float","id":2},"width":{"type":"float","id":3},"height":{"type":"float","id":4}}},"Transform":{"fields":{"a":{"type":"float","id":1},"b":{"type":"float","id":2},"c":{"type":"float","id":3},"d":{"type":"float","id":4},"tx":{"type":"float","id":5},"ty":{"type":"float","id":6}}},"ShapeEntity":{"oneofs":{"args":{"oneof":["shape","rect","ellipse"]}},"fields":{"type":{"type":"ShapeType","id":1},"shape":{"type":"ShapeArgs","id":2},"rect":{"type":"RectArgs","id":3},"ellipse":{"type":"EllipseArgs","id":4},"styles":{"type":"ShapeStyle","id":10},"transform":{"type":"Transform","id":11}},"nested":{"ShapeType":{"values":{"SHAPE":0,"RECT":1,"ELLIPSE":2,"KEEP":3}},"ShapeArgs":{"fields":{"d":{"type":"string","id":1}}},"RectArgs":{"fields":{"x":{"type":"float","id":1},"y":{"type":"float","id":2},"width":{"type":"float","id":3},"height":{"type":"float","id":4},"cornerRadius":{"type":"float","id":5}}},"EllipseArgs":{"fields":{"x":{"type":"float","id":1},"y":{"type":"float","id":2},"radiusX":{"type":"float","id":3},"radiusY":{"type":"float","id":4}}},"ShapeStyle":{"fields":{"fill":{"type":"RGBAColor","id":1},"stroke":{"type":"RGBAColor","id":2},"strokeWidth":{"type":"float","id":3},"lineCap":{"type":"LineCap","id":4},"lineJoin":{"type":"LineJoin","id":5},"miterLimit":{"type":"float","id":6},"lineDashI":{"type":"float","id":7},"lineDashII":{"type":"float","id":8},"lineDashIII":{"type":"float","id":9}},"nested":{"RGBAColor":{"fields":{"r":{"type":"float","id":1},"g":{"type":"float","id":2},"b":{"type":"float","id":3},"a":{"type":"float","id":4}}},"LineCap":{"values":{"LineCap_BUTT":0,"LineCap_ROUND":1,"LineCap_SQUARE":2}},"LineJoin":{"values":{"LineJoin_MITER":0,"LineJoin_ROUND":1,"LineJoin_BEVEL":2}}}}}},"FrameEntity":{"fields":{"alpha":{"type":"float","id":1},"layout":{"type":"Layout","id":2},"transform":{"type":"Transform","id":3},"clipPath":{"type":"string","id":4},"shapes":{"rule":"repeated","type":"ShapeEntity","id":5}}},"MovieEntity":{"fields":{"version":{"type":"string","id":1},"params":{"type":"MovieParams","id":2},"images":{"keyType":"string","type":"bytes","id":3},"sprites":{"rule":"repeated","type":"SpriteEntity","id":4},"audios":{"rule":"repeated","type":"AudioEntity","id":5}}}}}}}}}}}');t.proto=i.Root.fromJSON(n),t.ProtoMovieEntity=t.proto.lookupType("com.opensource.svga.MovieEntity")},function(e,t,r){"use strict";e.exports=function(e,t){for(var r=new Array(arguments.length-1),i=0,n=2,o=!0;n<arguments.length;)r[i++]=arguments[n++];return new Promise((function(n,s){r[i]=function(e){if(o)if(o=!1,e)s(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];n.apply(null,t)}};try{e.apply(t||null,r)}catch(e){o&&(o=!1,s(e))}}))}},function(module,exports,__webpack_require__){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},function(e,t,r){"use strict";t.Service=r(44)},function(e,t,r){"use strict";e.exports={}},function(e,t,r){"use strict";e.exports=function(e){for(var t,r=o.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(o.compareFieldsById),f=0;f<a.length;++f){var l=a[f].resolve(),u=e._fieldsArray.indexOf(l),h=l.resolvedType instanceof i?"int32":l.type,c=n.basic[h];t="m"+o.safeProp(l.name),l.map?(r("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,l.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(l.id<<3|2)>>>0,8|n.mapKey[l.keyType],l.keyType),void 0===c?r("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,t):r(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|c,h,t),r("}")("}")):l.repeated?(r("if(%s!=null&&%s.length){",t,t),l.packed&&void 0!==n.packed[h]?r("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",h,t)("w.ldelim()"):(r("for(var i=0;i<%s.length;++i)",t),void 0===c?s(r,l,u,t+"[i]"):r("w.uint32(%i).%s(%s[i])",(l.id<<3|c)>>>0,h,t)),r("}")):(l.optional&&r("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,l.name),void 0===c?s(r,l,u,t):r("w.uint32(%i).%s(%s)",(l.id<<3|c)>>>0,h,t))}return r("return w")};var i=r(2),n=r(6),o=r(0);function s(e,t,r,i){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,i,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,i,(t.id<<3|2)>>>0)}},function(e,t,r){"use strict";e.exports=g;var i=r(5);((g.prototype=Object.create(i.prototype)).constructor=g).className="Type";var n=r(2),o=r(10),s=r(4),a=r(19),f=r(20),l=r(11),u=r(9),h=r(8),c=r(0),d=r(17),p=r(22),y=r(23),m=r(24),v=r(25);function g(e,t){i.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(g.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],i=r.id;if(this._fieldsById[i])throw Error("duplicate id "+i+" in "+this);this._fieldsById[i]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=c.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=c.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=g.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof l||((e.prototype=new l).constructor=e,c.merge(e.prototype,t)),e.$type=e.prototype.$type=this,c.merge(e,l,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var i={};for(r=0;r<this.oneofsArray.length;++r)i[this._oneofsArray[r].resolve().name]={get:c.oneOfGetter(this._oneofsArray[r].oneof),set:c.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(e.prototype,i)}}}),g.generateConstructor=function(e){for(var t,r=c.codegen(["p"],e.name),i=0;i<e.fieldsArray.length;++i)(t=e._fieldsArray[i]).map?r("this%s={}",c.safeProp(t.name)):t.repeated&&r("this%s=[]",c.safeProp(t.name));return r("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},g.fromJSON=function(e,t){var r=new g(e,t.options);r.extensions=t.extensions,r.reserved=t.reserved;for(var l=Object.keys(t.fields),u=0;u<l.length;++u)r.add((void 0!==t.fields[l[u]].keyType?a.fromJSON:s.fromJSON)(l[u],t.fields[l[u]]));if(t.oneofs)for(l=Object.keys(t.oneofs),u=0;u<l.length;++u)r.add(o.fromJSON(l[u],t.oneofs[l[u]]));if(t.nested)for(l=Object.keys(t.nested),u=0;u<l.length;++u){var h=t.nested[l[u]];r.add((void 0!==h.id?s.fromJSON:void 0!==h.fields?g.fromJSON:void 0!==h.values?n.fromJSON:void 0!==h.methods?f.fromJSON:i.fromJSON)(l[u],h))}return t.extensions&&t.extensions.length&&(r.extensions=t.extensions),t.reserved&&t.reserved.length&&(r.reserved=t.reserved),t.group&&(r.group=!0),t.comment&&(r.comment=t.comment),r},g.prototype.toJSON=function(e){var t=i.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return c.toObject(["options",t&&t.options||void 0,"oneofs",i.arrayToJSON(this.oneofsArray,e),"fields",i.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},g.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var r=this.oneofsArray;for(t=0;t<r.length;)r[t++].resolve();return i.prototype.resolveAll.call(this)},g.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},g.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof s&&void 0===e.extend){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),(this.fields[e.name]=e).message=this,e.onAdd(this),b(this)}return e instanceof o?(this.oneofs||(this.oneofs={}),(this.oneofs[e.name]=e).onAdd(this),b(this)):i.prototype.add.call(this,e)},g.prototype.remove=function(e){if(e instanceof s&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),b(this)}if(e instanceof o){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),b(this)}return i.prototype.remove.call(this,e)},g.prototype.isReservedId=function(e){return i.isReservedId(this.reserved,e)},g.prototype.isReservedName=function(e){return i.isReservedName(this.reserved,e)},g.prototype.create=function(e){return new this.ctor(e)},g.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=d(this)({Writer:h,types:t,util:c}),this.decode=p(this)({Reader:u,types:t,util:c}),this.verify=y(this)({types:t,util:c}),this.fromObject=m.fromObject(this)({types:t,util:c}),this.toObject=m.toObject(this)({types:t,util:c});var i,n=v[e];return n&&((i=Object.create(this)).fromObject=this.fromObject,this.fromObject=n.fromObject.bind(i),i.toObject=this.toObject,this.toObject=n.toObject.bind(i)),this},g.prototype.encode=function(e,t){return this.setup().encode(e,t)},g.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},g.prototype.decode=function(e,t){return this.setup().decode(e,t)},g.prototype.decodeDelimited=function(e){return e instanceof u||(e=u.create(e)),this.decode(e,e.uint32())},g.prototype.verify=function(e){return this.setup().verify(e)},g.prototype.fromObject=function(e){return this.setup().fromObject(e)},g.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},g.d=function(e){return function(t){c.decorateType(t,e)}}},function(e,t,r){"use strict";e.exports=s;var i=r(4);((s.prototype=Object.create(i.prototype)).constructor=s).className="MapField";var n=r(6),o=r(0);function s(e,t,r,n,s,a){if(i.call(this,e,t,n,void 0,void 0,s,a),!o.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}s.fromJSON=function(e,t){return new s(e,t.id,t.keyType,t.type,t.options,t.comment)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},s.prototype.resolve=function(){if(this.resolved)return this;if(void 0===n.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},s.d=function(e,t,r){return"function"==typeof r?r=o.decorateType(r).name:r&&"object"==typeof r&&(r=o.decorateEnum(r).name),function(i,n){o.decorateType(i.constructor).add(new s(n,e,t,r))}}},function(e,t,r){"use strict";e.exports=a;var i=r(5);((a.prototype=Object.create(i.prototype)).constructor=a).className="Service";var n=r(21),o=r(0),s=r(15);function a(e,t){i.call(this,e,t),this.methods={},this._methodsArray=null}function f(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var r=new a(e,t.options);if(t.methods)for(var i=Object.keys(t.methods),o=0;o<i.length;++o)r.add(n.fromJSON(i[o],t.methods[i[o]]));return t.nested&&r.addJSON(t.nested),r.comment=t.comment,r},a.prototype.toJSON=function(e){var t=i.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return o.toObject(["options",t&&t.options||void 0,"methods",i.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=o.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||i.prototype.get.call(this,e)},a.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return i.prototype.resolve.call(this)},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof n?f((this.methods[e.name]=e).parent=this):i.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof n){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,f(this)}return i.prototype.remove.call(this,e)},a.prototype.create=function(e,t,r){for(var i,n=new s.Service(e,t,r),a=0;a<this.methodsArray.length;++a){var f=o.lcFirst((i=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");n[f]=o.codegen(["r","c"],o.isReserved(f)?f+"_":f)("return this.rpcCall(m,q,s,r,c)")({m:i,q:i.resolvedRequestType.ctor,s:i.resolvedResponseType.ctor})}return n}},function(e,t,r){"use strict";e.exports=o;var i=r(3);((o.prototype=Object.create(i.prototype)).constructor=o).className="Method";var n=r(0);function o(e,t,r,o,s,a,f,l){if(n.isObject(s)?(f=s,s=a=void 0):n.isObject(a)&&(f=a,a=void 0),void 0!==t&&!n.isString(t))throw TypeError("type must be a string");if(!n.isString(r))throw TypeError("requestType must be a string");if(!n.isString(o))throw TypeError("responseType must be a string");i.call(this,e,f),this.type=t||"rpc",this.requestType=r,this.requestStream=!!s||void 0,this.responseType=o,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=l}o.fromJSON=function(e,t){return new o(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return n.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0])},o.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),i.prototype.resolve.call(this))}},function(e,t,r){"use strict";e.exports=function(e){var t=o.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k":""))("while(r.pos<c){")("var t=r.uint32()");e.group&&t("if((t&7)===4)")("break"),t("switch(t>>>3){");for(var r=0;r<e.fieldsArray.length;++r){var s=e._fieldsArray[r].resolve(),a=s.resolvedType instanceof i?"int32":s.type,f="m"+o.safeProp(s.name);t("case %i:",s.id),s.map?(t("r.skip().pos++")("if(%s===util.emptyObject)",f)("%s={}",f)("k=r.%s()",s.keyType)("r.pos++"),void 0!==n.long[s.keyType]?void 0===n.basic[a]?t('%s[typeof k==="object"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())',f,r):t('%s[typeof k==="object"?util.longToHash(k):k]=r.%s()',f,a):void 0===n.basic[a]?t("%s[k]=types[%i].decode(r,r.uint32())",f,r):t("%s[k]=r.%s()",f,a)):s.repeated?(t("if(!(%s&&%s.length))",f,f)("%s=[]",f),void 0!==n.packed[a]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",f,a)("}else"),void 0===n.basic[a]?t(s.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",f,r):t("%s.push(r.%s())",f,a)):void 0===n.basic[a]?t(s.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",f,r):t("%s=r.%s()",f,a),t("break")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),r=0;r<e._fieldsArray.length;++r){var l=e._fieldsArray[r];l.required&&t("if(!m.hasOwnProperty(%j))",l.name)("throw util.ProtocolError(%j,{instance:m})","missing required '"+l.name+"'")}return t("return m")};var i=r(2),n=r(6),o=r(0)},function(e,t,r){"use strict";e.exports=function(e){var t=n.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),r={};e.oneofsArray.length&&t("var p={}");for(var i=0;i<e.fieldsArray.length;++i){var f,l=e._fieldsArray[i].resolve(),u="m"+n.safeProp(l.name);l.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",u,l.name),l.map?(t("if(!util.isObject(%s))",u)("return%j",o(l,"object"))("var k=Object.keys(%s)",u)("for(var i=0;i<k.length;++i){"),a(t,l,"k[i]"),s(t,l,i,u+"[k[i]]")("}")):l.repeated?(t("if(!Array.isArray(%s))",u)("return%j",o(l,"array"))("for(var i=0;i<%s.length;++i){",u),s(t,l,i,u+"[i]")("}")):(l.partOf&&(f=n.safeProp(l.partOf.name),1===r[l.partOf.name]&&t("if(p%s===1)",f)("return%j",l.partOf.name+": multiple values"),r[l.partOf.name]=1,t("p%s=1",f)),s(t,l,i,u)),l.optional&&t("}")}return t("return null")};var i=r(2),n=r(0);function o(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function s(e,t,r,n){if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(%s){",n)("default:")("return%j",o(t,"enum value"));for(var s=Object.keys(t.resolvedType.values),a=0;a<s.length;++a)e("case %i:",t.resolvedType.values[s[a]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",r,n)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",n)("return%j",o(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",n,n,n,n)("return%j",o(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',n)("return%j",o(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',n)("return%j",o(t,"boolean"));break;case"string":e("if(!util.isString(%s))",n)("return%j",o(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',n,n,n)("return%j",o(t,"buffer"))}return e}function a(e,t,r){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",r)("return%j",o(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",r)("return%j",o(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",r)("return%j",o(t,"boolean key"))}return e}},function(e,t,r){"use strict";var i=t,n=r(2),o=r(0);function s(e,t,r,i){if(t.resolvedType)if(t.resolvedType instanceof n){e("switch(d%s){",i);for(var o=t.resolvedType.values,s=Object.keys(o),a=0;a<s.length;++a)t.repeated&&o[s[a]]===t.typeDefault&&e("default:"),e("case%j:",s[a])("case %i:",o[s[a]])("m%s=%j",i,o[s[a]])("break");e("}")}else e('if(typeof d%s!=="object")',i)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",i,r,i);else{var f=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",i,i);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",i,i);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",i,i);break;case"uint64":f=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",i,i,f)('else if(typeof d%s==="string")',i)("m%s=parseInt(d%s,10)",i,i)('else if(typeof d%s==="number")',i)("m%s=d%s",i,i)('else if(typeof d%s==="object")',i)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",i,i,i,f?"true":"");break;case"bytes":e('if(typeof d%s==="string")',i)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",i,i,i)("else if(d%s.length)",i)("m%s=d%s",i,i);break;case"string":e("m%s=String(d%s)",i,i);break;case"bool":e("m%s=Boolean(d%s)",i,i)}}return e}function a(e,t,r,i){if(t.resolvedType)t.resolvedType instanceof n?e("d%s=o.enums===String?types[%i].values[m%s]:m%s",i,r,i,i):e("d%s=types[%i].toObject(m%s,o)",i,r,i);else{var o=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",i,i,i,i);break;case"uint64":o=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',i)("d%s=o.longs===String?String(m%s):m%s",i,i,i)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",i,i,i,i,o?"true":"",i);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",i,i,i,i,i);break;default:e("d%s=m%s",i,i)}}return e}i.fromObject=function(e){var t=e.fieldsArray,r=o.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var i=0;i<t.length;++i){var a=t[i].resolve(),f=o.safeProp(a.name);a.map?(r("if(d%s){",f)('if(typeof d%s!=="object")',f)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",f)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",f),s(r,a,i,f+"[ks[i]]")("}")("}")):a.repeated?(r("if(d%s){",f)("if(!Array.isArray(d%s))",f)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",f)("for(var i=0;i<d%s.length;++i){",f),s(r,a,i,f+"[i]")("}")("}")):(a.resolvedType instanceof n||r("if(d%s!=null){",f),s(r,a,i,f),a.resolvedType instanceof n||r("}"))}return r("return m")},i.toObject=function(e){var t=e.fieldsArray.slice().sort(o.compareFieldsById);if(!t.length)return o.codegen()("return {}");for(var r=o.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),i=[],s=[],f=[],l=0;l<t.length;++l)t[l].partOf||(t[l].resolve().repeated?i:t[l].map?s:f).push(t[l]);if(i.length){for(r("if(o.arrays||o.defaults){"),l=0;l<i.length;++l)r("d%s=[]",o.safeProp(i[l].name));r("}")}if(s.length){for(r("if(o.objects||o.defaults){"),l=0;l<s.length;++l)r("d%s={}",o.safeProp(s[l].name));r("}")}if(f.length){for(r("if(o.defaults){"),l=0;l<f.length;++l){var u,h=f[l],c=o.safeProp(h.name);h.resolvedType instanceof n?r("d%s=o.enums===String?%j:%j",c,h.resolvedType.valuesById[h.typeDefault],h.typeDefault):h.long?r("if(util.Long){")("var n=new util.Long(%i,%i,%j)",h.typeDefault.low,h.typeDefault.high,h.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",c)("}else")("d%s=o.longs===String?%j:%i",c,h.typeDefault.toString(),h.typeDefault.toNumber()):h.bytes?(u="["+Array.prototype.slice.call(h.typeDefault).join(",")+"]",r("if(o.bytes===String)d%s=%j",c,String.fromCharCode.apply(String,h.typeDefault))("else{")("d%s=%s",c,u)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",c,c)("}")):r("d%s=%j",c,h.typeDefault)}r("}")}var d=!1;for(l=0;l<t.length;++l){h=t[l];var p=e._fieldsArray.indexOf(h);c=o.safeProp(h.name);h.map?(d||(d=!0,r("var ks2")),r("if(m%s&&(ks2=Object.keys(m%s)).length){",c,c)("d%s={}",c)("for(var j=0;j<ks2.length;++j){"),a(r,h,p,c+"[ks2[j]]")("}")):h.repeated?(r("if(m%s&&m%s.length){",c,c)("d%s=[]",c)("for(var j=0;j<m%s.length;++j){",c),a(r,h,p,c+"[j]")("}")):(r("if(m%s!=null&&m.hasOwnProperty(%j)){",c,h.name),a(r,h,p,c),h.partOf&&r("if(o.oneofs)")("d%s=%j",o.safeProp(h.partOf.name),h.name)),r("}")}return r("return d")}},function(e,t,r){"use strict";var i=t,n=r(11);i[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=this.lookup(e["@type"]);if(t){var r="."===e["@type"].charAt(0)?e["@type"].substr(1):e["@type"];return this.create({type_url:"/"+r,value:t.encode(t.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var r,i;if(t&&t.json&&e.type_url&&e.value&&(r=e.type_url.substring(e.type_url.lastIndexOf("/")+1),(i=this.lookup(r))&&(e=i.decode(e.value))),e instanceof this.ctor||!(e instanceof n))return this.toObject(e,t);var o=e.$type.toObject(e,t);return o["@type"]=e.$type.fullName,o}}},function(e,t,r){"use strict";e.exports=h;var i=r(5);((h.prototype=Object.create(i.prototype)).constructor=h).className="Root";var n,o,s,a=r(4),f=r(2),l=r(10),u=r(0);function h(e){i.call(this,"",e),this.deferred=[],this.files=[]}function c(){}h.fromJSON=function(e,t){return t=t||new h,e.options&&t.setOptions(e.options),t.addJSON(e.nested)},h.prototype.resolvePath=u.path.resolve,h.prototype.load=function e(t,r,i){"function"==typeof r&&(i=r,r=void 0);var n=this;if(!i)return u.asPromise(e,n,t,r);var a=i===c;function f(e,t){if(i){var r=i;if(i=null,a)throw e;r(e,t)}}function l(e){var t=e.lastIndexOf("google/protobuf/");if(-1<t){var r=e.substring(t);if(r in s)return r}return null}function h(e,t){try{if(u.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),u.isString(t)){o.filename=e;var i,s=o(t,n,r),h=0;if(s.imports)for(;h<s.imports.length;++h)(i=l(s.imports[h])||n.resolvePath(e,s.imports[h]))&&d(i);if(s.weakImports)for(h=0;h<s.weakImports.length;++h)(i=l(s.weakImports[h])||n.resolvePath(e,s.weakImports[h]))&&d(i,!0)}else n.setOptions(t.options).addJSON(t.nested)}catch(e){f(e)}a||p||f(null,n)}function d(e,t){if(!(-1<n.files.indexOf(e)))if(n.files.push(e),e in s)a?h(e,s[e]):(++p,setTimeout((function(){--p,h(e,s[e])})));else if(a){var r;try{r=u.fs.readFileSync(e).toString("utf8")}catch(r){return void(t||f(r))}h(e,r)}else++p,u.fetch(e,(function(r,o){--p,i&&(r?t?p||f(null,n):f(r):h(e,o))}))}var p=0;u.isString(t)&&(t=[t]);for(var y,m=0;m<t.length;++m)(y=n.resolvePath("",t[m]))&&d(y);if(a)return n;p||f(null,n)},h.prototype.loadSync=function(e,t){if(!u.isNode)throw Error("not supported");return this.load(e,t,c)},h.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return i.prototype.resolveAll.call(this)};var d=/^[A-Z]/;function p(e,t){var r=t.parent.lookup(t.extend);if(r){var i=new a(t.fullName,t.id,t.type,t.rule,void 0,t.options);return(i.declaringField=t).extensionField=i,r.add(i),1}}h.prototype._handleAdd=function(e){if(e instanceof a)void 0===e.extend||e.extensionField||p(0,e)||this.deferred.push(e);else if(e instanceof f)d.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof l)){if(e instanceof n)for(var t=0;t<this.deferred.length;)p(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);d.test(e.name)&&(e.parent[e.name]=e)}},h.prototype._handleRemove=function(e){var t;if(e instanceof a)void 0!==e.extend&&(e.extensionField?(e.extensionField.parent.remove(e.extensionField),e.extensionField=null):-1<(t=this.deferred.indexOf(e))&&this.deferred.splice(t,1));else if(e instanceof f)d.test(e.name)&&delete e.parent[e.name];else if(e instanceof i){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);d.test(e.name)&&delete e.parent[e.name]}},h._configure=function(e,t,r){n=e,o=t,s=r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(28),n=r(48);t.loadSvga=function(e,t,r){n.default(e,(function(e){var r=e.movie;r.version=e.ver;var n=e.images,o=new i.VideoEntity(r,n);t(o)}),r)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(29),n=r(12),o=(s.prototype.resetSprites=function(e){e.sprites instanceof Array&&(this.sprites=e.sprites.map((function(e){return new i.SpriteEntity(e)})))},s.prototype.destroy=function(){},s);function s(e,t){this.version="",this.videoSize={width:0,height:0},this.FPS=20,this.frames=0,this.images={},this.hasBeenCached=!1,this.sprites=[],this.audios=[],"object"==typeof e&&e.$type==n.ProtoMovieEntity?("object"==typeof e.params&&(this.version=e.ver,this.videoSize.width=e.params.viewBoxWidth||0,this.videoSize.height=e.params.viewBoxHeight||0,this.FPS=e.params.fps||20,this.frames=e.params.frames||0),this.resetSprites(e),this.audios=e.audios):e&&(e.movie&&(e.movie.viewBox&&(this.videoSize.width=parseFloat(e.movie.viewBox.width)||0,this.videoSize.height=parseFloat(e.movie.viewBox.height)||0),this.version=e.ver,this.FPS=parseInt(e.movie.fps)||20,this.frames=parseInt(e.movie.frames)||0),this.resetSprites(e)),t&&(this.images=t)}t.VideoEntity=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(30);t.SpriteEntity=function(e){this.matteKey=null,this.imageKey=null,this.frames=[],this.matteKey=e.matteKey,this.imageKey=e.imageKey,e.frames&&(this.frames=e.frames.map((function(e){return new i.FrameEntity(e)})))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(31);t.FrameEntity=function e(t){this.alpha=0,this.transform={a:1,b:0,c:0,d:1,tx:0,ty:0},this.layout={x:0,y:0,width:0,height:0},this.nx=0,this.ny=0,this.maskPath=null,this.shapes=[],this.alpha=parseFloat(t.alpha)||0,t.layout&&(this.layout.x=parseFloat(t.layout.x)||0,this.layout.y=parseFloat(t.layout.y)||0,this.layout.width=parseFloat(t.layout.width)||0,this.layout.height=parseFloat(t.layout.height)||0),t.transform&&(this.transform.a=parseFloat(t.transform.a)||1,this.transform.b=parseFloat(t.transform.b)||0,this.transform.c=parseFloat(t.transform.c)||0,this.transform.d=parseFloat(t.transform.d)||1,this.transform.tx=parseFloat(t.transform.tx)||0,this.transform.ty=parseFloat(t.transform.ty)||0),t.clipPath&&0<t.clipPath.length&&(this.maskPath=new i.BezierPath(t.clipPath,void 0,{fill:"#000000"})),t.shapes&&(t.shapes instanceof Array&&t.shapes.forEach((function(e){switch(e.pathArgs=e.args,e.type){case 0:e.type="shape",e.pathArgs=e.shape;break;case 1:e.type="rect",e.pathArgs=e.rect;break;case 2:e.type="ellipse",e.pathArgs=e.ellipse;break;case 3:e.type="keep"}if(e.styles){e.styles.fill&&("number"==typeof e.styles.fill.r&&(e.styles.fill[0]=e.styles.fill.r),"number"==typeof e.styles.fill.g&&(e.styles.fill[1]=e.styles.fill.g),"number"==typeof e.styles.fill.b&&(e.styles.fill[2]=e.styles.fill.b),"number"==typeof e.styles.fill.a&&(e.styles.fill[3]=e.styles.fill.a)),e.styles.stroke&&("number"==typeof e.styles.stroke.r&&(e.styles.stroke[0]=e.styles.stroke.r),"number"==typeof e.styles.stroke.g&&(e.styles.stroke[1]=e.styles.stroke.g),"number"==typeof e.styles.stroke.b&&(e.styles.stroke[2]=e.styles.stroke.b),"number"==typeof e.styles.stroke.a&&(e.styles.stroke[3]=e.styles.stroke.a));var t=e.styles.lineDash||[];switch(0<e.styles.lineDashI&&t.push(e.styles.lineDashI),0<e.styles.lineDashII&&(t.length<1&&t.push(0),t.push(e.styles.lineDashII),t.push(0)),0<e.styles.lineDashIII&&(t.length<2&&(t.push(0),t.push(0)),t[2]=e.styles.lineDashIII),e.styles.lineDash=t,e.styles.lineJoin){case 0:e.styles.lineJoin="miter";break;case 1:e.styles.lineJoin="round";break;case 2:e.styles.lineJoin="bevel"}switch(e.styles.lineCap){case 0:e.styles.lineCap="butt";break;case 1:e.styles.lineCap="round";break;case 2:e.styles.lineCap="square"}}})),t.shapes[0]&&"keep"===t.shapes[0].type?this.shapes=e.lastShapes:(this.shapes=t.shapes,e.lastShapes=t.shapes));var r=this.transform.a*this.layout.x+this.transform.c*this.layout.y+this.transform.tx,n=this.transform.a*(this.layout.x+this.layout.width)+this.transform.c*this.layout.y+this.transform.tx,o=this.transform.a*this.layout.x+this.transform.c*(this.layout.y+this.layout.height)+this.transform.tx,s=this.transform.a*(this.layout.x+this.layout.width)+this.transform.c*(this.layout.y+this.layout.height)+this.transform.tx,a=this.transform.b*this.layout.x+this.transform.d*this.layout.y+this.transform.ty,f=this.transform.b*(this.layout.x+this.layout.width)+this.transform.d*this.layout.y+this.transform.ty,l=this.transform.b*this.layout.x+this.transform.d*(this.layout.y+this.layout.height)+this.transform.ty,u=this.transform.b*(this.layout.x+this.layout.width)+this.transform.d*(this.layout.y+this.layout.height)+this.transform.ty;this.nx=Math.min(Math.min(o,s),Math.min(r,n)),this.ny=Math.min(Math.min(l,u),Math.min(a,f))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BezierPath=function(e,t,r){this._d=e,this._transform=t,this._styles=r}},function(e,t,r){"use strict";e.exports=r(33)},function(e,t,r){"use strict";var i=e.exports=r(34);i.build="light",i.load=function(e,t,r){return(t="function"==typeof t?(r=t,new i.Root):t||new i.Root).load(e,r)},i.loadSync=function(e,t){return(t=t||new i.Root).loadSync(e)},i.encoder=r(17),i.decoder=r(22),i.verifier=r(23),i.converter=r(24),i.ReflectionObject=r(3),i.Namespace=r(5),i.Root=r(26),i.Enum=r(2),i.Type=r(18),i.Field=r(4),i.OneOf=r(10),i.MapField=r(19),i.Service=r(20),i.Method=r(21),i.Message=r(11),i.wrappers=r(25),i.types=r(6),i.util=r(0),i.ReflectionObject._configure(i.Root),i.Namespace._configure(i.Type,i.Service,i.Enum),i.Root._configure(i.Type),i.Field._configure(i.Type)},function(e,t,r){"use strict";var i=t;i.build="minimal",i.Writer=r(8),i.BufferWriter=r(42),i.Reader=r(9),i.BufferReader=r(43),i.util=r(1),i.rpc=r(15),i.roots=r(16),(i.configure=function(){i.util._configure(),i.Writer._configure(i.BufferWriter),i.Reader._configure(i.BufferReader)})()},function(e,t){var r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var i=t;i.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;1<--t%4&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var n=new Array(64),o=new Array(123),s=0;s<64;)o[n[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;i.encode=function(e,t,r){for(var i,o=null,s=[],a=0,f=0;t<r;){var l=e[t++];switch(f){case 0:s[a++]=n[l>>2],i=(3&l)<<4,f=1;break;case 1:s[a++]=n[i|l>>4],i=(15&l)<<2,f=2;break;case 2:s[a++]=n[i|l>>6],s[a++]=n[63&l],f=0}8191<a&&((o=o||[]).push(String.fromCharCode.apply(String,s)),a=0)}return f&&(s[a++]=n[i],s[a++]=61,1===f&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var a="invalid encoding";i.decode=function(e,t,r){for(var i,n=r,s=0,f=0;f<e.length;){var l=e.charCodeAt(f++);if(61===l&&1<s)break;if(void 0===(l=o[l]))throw Error(a);switch(s){case 0:i=l,s=1;break;case 1:t[r++]=i<<2|(48&l)>>4,i=l,s=2;break;case 2:t[r++]=(15&i)<<4|(60&l)>>2,i=l,s=3;break;case 3:t[r++]=(3&i)<<6|l,s=0}}if(1===s)throw Error(a);return r-n},i.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},function(e,t,r){"use strict";function i(){this._listeners={}}(e.exports=i).prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},i.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],i=0;i<r.length;)r[i].fn===t?r.splice(i,1):++i;return this},i.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],i=1;i<arguments.length;)r.push(arguments[i++]);for(i=0;i<t.length;)t[i].fn.apply(t[i++].ctx,r)}return this}},function(e,t,r){"use strict";function i(e){function t(e,t,r,i){var n,o=t<0?1:0;o&&(t=-t),0===t?e(0<1/t?0:2147483648,r,i):isNaN(t)?e(2143289344,r,i):e(34028234663852886e22<t?(o<<31|2139095040)>>>0:t<11754943508222875e-54?(o<<31|Math.round(t/1401298464324817e-60))>>>0:(o<<31|(n=Math.floor(Math.log(t)/Math.LN2))+127<<23|8388607&Math.round(t*Math.pow(2,-n)*8388608))>>>0,r,i)}function r(e,t,r){var i=e(t,r),n=2*(i>>31)+1,o=i>>>23&255,s=8388607&i;return 255==o?s?NaN:1/0*n:0==o?1401298464324817e-60*n*s:n*Math.pow(2,o-150)*(8388608+s)}function i(e,t,r){h[0]=e,t[r]=c[0],t[r+1]=c[1],t[r+2]=c[2],t[r+3]=c[3]}function f(e,t,r){h[0]=e,t[r]=c[3],t[r+1]=c[2],t[r+2]=c[1],t[r+3]=c[0]}function l(e,t){return c[0]=e[t],c[1]=e[t+1],c[2]=e[t+2],c[3]=e[t+3],h[0]}function u(e,t){return c[3]=e[t],c[2]=e[t+1],c[1]=e[t+2],c[0]=e[t+3],h[0]}var h,c,d,p,y,m;function v(e,t,r,i,n,o){var s,a,f=i<0?1:0;f&&(i=-i),0===i?(e(0,n,o+t),e(0<1/i?0:2147483648,n,o+r)):isNaN(i)?(e(0,n,o+t),e(2146959360,n,o+r)):17976931348623157e292<i?(e(0,n,o+t),e((f<<31|2146435072)>>>0,n,o+r)):i<22250738585072014e-324?(e((s=i/5e-324)>>>0,n,o+t),e((f<<31|s/4294967296)>>>0,n,o+r)):(1024===(a=Math.floor(Math.log(i)/Math.LN2))&&(a=1023),e(4503599627370496*(s=i*Math.pow(2,-a))>>>0,n,o+t),e((f<<31|a+1023<<20|1048576*s&1048575)>>>0,n,o+r))}function g(e,t,r,i,n){var o=e(i,n+t),s=e(i,n+r),a=2*(s>>31)+1,f=s>>>20&2047,l=4294967296*(1048575&s)+o;return 2047==f?l?NaN:1/0*a:0==f?5e-324*a*l:a*Math.pow(2,f-1075)*(l+4503599627370496)}function b(e,t,r){p[0]=e,t[r]=y[0],t[r+1]=y[1],t[r+2]=y[2],t[r+3]=y[3],t[r+4]=y[4],t[r+5]=y[5],t[r+6]=y[6],t[r+7]=y[7]}function w(e,t,r){p[0]=e,t[r]=y[7],t[r+1]=y[6],t[r+2]=y[5],t[r+3]=y[4],t[r+4]=y[3],t[r+5]=y[2],t[r+6]=y[1],t[r+7]=y[0]}function k(e,t){return y[0]=e[t],y[1]=e[t+1],y[2]=e[t+2],y[3]=e[t+3],y[4]=e[t+4],y[5]=e[t+5],y[6]=e[t+6],y[7]=e[t+7],p[0]}function _(e,t){return y[7]=e[t],y[6]=e[t+1],y[5]=e[t+2],y[4]=e[t+3],y[3]=e[t+4],y[2]=e[t+5],y[1]=e[t+6],y[0]=e[t+7],p[0]}return"undefined"!=typeof Float32Array?(h=new Float32Array([-0]),d=128===(c=new Uint8Array(h.buffer))[3],e.writeFloatLE=d?i:f,e.writeFloatBE=d?f:i,e.readFloatLE=d?l:u,e.readFloatBE=d?u:l):(e.writeFloatLE=t.bind(null,n),e.writeFloatBE=t.bind(null,o),e.readFloatLE=r.bind(null,s),e.readFloatBE=r.bind(null,a)),"undefined"!=typeof Float64Array?(p=new Float64Array([-0]),m=128===(y=new Uint8Array(p.buffer))[7],e.writeDoubleLE=m?b:w,e.writeDoubleBE=m?w:b,e.readDoubleLE=m?k:_,e.readDoubleBE=m?_:k):(e.writeDoubleLE=v.bind(null,n,0,4),e.writeDoubleBE=v.bind(null,o,4,0),e.readDoubleLE=g.bind(null,s,0,4),e.readDoubleBE=g.bind(null,a,4,0)),e}function n(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function o(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function s(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function a(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=i(i)},function(e,t,r){"use strict";var i=t;i.length=function(e){for(var t=0,r=0,i=0;i<e.length;++i)(r=e.charCodeAt(i))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(i+1))?(++i,t+=4):t+=3;return t},i.read=function(e,t,r){if(r-t<1)return"";for(var i,n=null,o=[],s=0;t<r;)(i=e[t++])<128?o[s++]=i:191<i&&i<224?o[s++]=(31&i)<<6|63&e[t++]:239<i&&i<365?(i=((7&i)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(i>>10),o[s++]=56320+(1023&i)):o[s++]=(15&i)<<12|(63&e[t++])<<6|63&e[t++],8191<s&&((n=n||[]).push(String.fromCharCode.apply(String,o)),s=0);return n?(s&&n.push(String.fromCharCode.apply(String,o.slice(0,s))),n.join("")):String.fromCharCode.apply(String,o.slice(0,s))},i.write=function(e,t,r){for(var i,n,o=r,s=0;s<e.length;++s)(i=e.charCodeAt(s))<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(55296==(64512&i)&&56320==(64512&(n=e.charCodeAt(s+1)))?(i=65536+((1023&i)<<10)+(1023&n),++s,t[r++]=i>>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128);return r-o}},function(e,t,r){"use strict";e.exports=function(e,t,r){var i=r||8192,n=i>>>1,o=null,s=i;return function(r){if(r<1||n<r)return e(r);i<s+r&&(o=e(i),s=0);var a=t.call(o,s,s+=r);return 7&s&&(s=1+(7|s)),a}}},function(e,t,r){"use strict";e.exports=n;var i=r(1);function n(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=n.zero=new n(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var r=e>>>0,i=(e-r)/4294967296>>>0;return t&&(i=~i>>>0,r=~r>>>0,4294967295<++r&&(r=0,4294967295<++i&&(i=0))),new n(r,i)},n.from=function(e){if("number"==typeof e)return n.fromNumber(e);if(i.isString(e)){if(!i.Long)return n.fromNumber(parseInt(e,10));e=i.Long.fromString(e)}return e.low||e.high?new n(e.low>>>0,e.high>>>0):o},n.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},n.prototype.toLong=function(e){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;n.fromHash=function(e){return e===s?o:new n((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},n.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},n.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},n.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},n.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0==r?0==t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},function(e,t,r){"use strict";e.exports=o;var i=r(8);(o.prototype=Object.create(i.prototype)).constructor=o;var n=r(1);function o(){i.call(this)}function s(e,t,r){e.length<40?n.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=n._Buffer_allocUnsafe,o.writeBytesBuffer=n.Buffer&&n.Buffer.prototype instanceof Uint8Array&&"set"===n.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var i=0;i<e.length;)t[r++]=e[i++]}},o.prototype.bytes=function(e){n.isString(e)&&(e=n._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=n.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},function(e,t,r){"use strict";e.exports=o;var i=r(9);(o.prototype=Object.create(i.prototype)).constructor=o;var n=r(1);function o(e){i.call(this,e)}o._configure=function(){n.Buffer&&(o.prototype._slice=n.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},function(e,t,r){"use strict";e.exports=n;var i=r(1);function n(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}((n.prototype=Object.create(i.EventEmitter.prototype)).constructor=n).prototype.rpcCall=function e(t,r,n,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return i.asPromise(e,a,t,r,n,o);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,r){if(e)return a.emit("error",e,t),s(e);if(null!==r){if(!(r instanceof n))try{r=n[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",r,t),s(null,r)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){s(e)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},n.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},function(e,t,r){"use strict";(e.exports=function e(t,r){"string"==typeof t&&(r=t,t=void 0);var i=[];function n(t){if("string"!=typeof t){var r=o();if(e.verbose&&console.log("codegen: "+r),r="return "+r,t){for(var s=Object.keys(t),a=new Array(s.length+1),f=new Array(s.length),l=0;l<s.length;)a[l]=s[l],f[l]=t[s[l++]];return a[l]=r,Function.apply(null,a).apply(null,f)}return Function(r)()}for(var u=new Array(arguments.length-1),h=0;h<u.length;)u[h]=arguments[++h];if(h=0,t=t.replace(/%([%dfijs])/g,(function(e,t){var r=u[h++];switch(t){case"d":case"f":return String(Number(r));case"i":return String(Math.floor(r));case"j":return JSON.stringify(r);case"s":return String(r)}return"%"})),h!==u.length)throw Error("parameter count mismatch");return i.push(t),n}function o(e){return"function "+(e||r||"")+"("+(t&&t.join(",")||"")+"){\n "+i.join("\n ")+"\n}"}return n.toString=o,n}).verbose=!1},function(e,t,r){"use strict";e.exports=o;var i=r(13),n=r(14)("fs");function o(e,t,r){return t="function"==typeof t?(r=t,{}):t||{},r?!t.xhr&&n&&n.readFile?n.readFile(e,(function(i,n){return i&&"undefined"!=typeof XMLHttpRequest?o.xhr(e,t,r):i?r(i):r(null,t.binary?n:n.toString("utf8"))})):o.xhr(e,t,r):i(o,this,e,t)}o.xhr=function(e,t,r){var i=new XMLHttpRequest;i.onreadystatechange=function(){if(4===i.readyState){if(0!==i.status&&200!==i.status)return r(Error("status "+i.status));if(t.binary){var e=i.response;if(!e){e=[];for(var n=0;n<i.responseText.length;++n)e.push(255&i.responseText.charCodeAt(n))}return r(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return r(null,i.responseText)}},t.binary&&("overrideMimeType"in i&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.responseType="arraybuffer"),i.open("GET",e),i.send()}},function(e,t,r){"use strict";var i=t,n=i.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},o=i.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),r=n(e),i="";r&&(i=t.shift()+"/");for(var o=0;o<t.length;)".."===t[o]?0<o&&".."!==t[o-1]?t.splice(--o,2):r?t.splice(o,1):++o:"."===t[o]?t.splice(o,1):++o;return i+t.join("/")};i.resolve=function(e,t,r){return r||(t=o(t)),n(t)?t:(r||(e=o(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?o(e+"/"+t):t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(12),n=r(7),o=r(49),s={};function a(e){for(var t=[],r=0;r<e.length;r+=32768)t.push(String.fromCharCode.apply(null,e.subarray(r,r+32768)));return t.join("")}n.utils.assign(s,o.default);var f={loadAssets:function(e,t,r){var i,n;try{i=my}catch(e){}i?i.request({url:e,method:"GET",dataType:"arraybuffer",success:function(e){f.load_viaProto(e.data,t,r)},fail:function(e){r(e)}}):((n=new XMLHttpRequest).open("GET",e,!0),n.responseType="arraybuffer",n.onloadend=function(){f.load_viaProto(n.response,t,r)},n.send())},load_viaProto:function(e,t,r){try{var n=s.inflate(e),o=i.ProtoMovieEntity.decode(n),a={};f._loadImages(a,void 0,o,(function(){o.ver="2.0",t({movie:o,images:a})}))}catch(e){throw r&&r(e),console.error(e),e}},_loadImages:function(e,t,r,n){if("object"==typeof r&&r.$type==i.ProtoMovieEntity){var o,s=!0;if(t){var l=function(i){if(r.images.hasOwnProperty(i)){var o=a(r.images[i]);return e.hasOwnProperty(i)?"continue":(s=!1,t.file(o+".png").async("base64").then(function(o){e[i]=o,f._loadImages(e,t,r,n)}.bind(u)),"break")}},u=this;for(var h in r.images)if("break"===l(h))break}else for(var c in r.images)r.images.hasOwnProperty(c)&&(o=a(r.images[c]),e[c]=btoa(o));s&&n.call(this)}else{for(var d in s=!0,r.images)if(r.images.hasOwnProperty(d)){var p=r.images[d];if(e.hasOwnProperty(d))continue;s=!1,t.file(p+".png").async("base64").then(function(i){e[d]=i,f._loadImages(e,t,r,n)}.bind(this));break}s&&n.call(this)}}};t.default=function(e,t,r){f.loadAssets(e,t,r)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(50),n=r(7),o=r(51),s=r(56),a=r(57),f=r(58),l=r(59),u=Object.prototype.toString;function h(e){this.options=n.utils.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f.default,this.strm.avail_out=0;var r=o.default.inflateInit2(this.strm,t.windowBits);if(r!==s.default.Z_OK)throw new Error(a.default[r]);if(this.header=new l.default,o.default.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=i.strings.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=o.default.inflateSetDictionary(this.strm,t.dictionary))!==s.default.Z_OK))throw new Error(a.default[r])}h.prototype.push=function(e,t){var r,a,f,l,h,c=this.strm,d=this.options.chunkSize,p=this.options.dictionary,y=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?s.default.Z_FINISH:s.default.Z_NO_FLUSH,"string"==typeof e?c.input=i.strings.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?c.input=new Uint8Array(e):c.input=e,c.next_in=0,c.avail_in=c.input.length;do{if(0===c.avail_out&&(c.output=new n.utils.Buf8(d),c.next_out=0,c.avail_out=d),(r=o.default.inflate(c,s.default.Z_NO_FLUSH))===s.default.Z_NEED_DICT&&p&&(r=o.default.inflateSetDictionary(this.strm,p)),r===s.default.Z_BUF_ERROR&&!0===y&&(r=s.default.Z_OK,y=!1),r!==s.default.Z_STREAM_END&&r!==s.default.Z_OK)return this.onEnd(r),!(this.ended=!0);c.next_out&&(0!==c.avail_out&&r!==s.default.Z_STREAM_END&&(0!==c.avail_in||a!==s.default.Z_FINISH&&a!==s.default.Z_SYNC_FLUSH)||("string"===this.options.to?(f=i.strings.utf8border(c.output,c.next_out),l=c.next_out-f,h=i.strings.buf2string(c.output,f),c.next_out=l,c.avail_out=d-l,l&&n.utils.arraySet(c.output,c.output,f,l,0),this.onData(h)):this.onData(n.utils.shrinkBuf(c.output,c.next_out)))),0===c.avail_in&&0===c.avail_out&&(y=!0)}while((0<c.avail_in||0===c.avail_out)&&r!==s.default.Z_STREAM_END);return r===s.default.Z_STREAM_END&&(a=s.default.Z_FINISH),a===s.default.Z_FINISH?(r=o.default.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===s.default.Z_OK):a!==s.default.Z_SYNC_FLUSH||(this.onEnd(s.default.Z_OK),!(c.avail_out=0))},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===s.default.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.utils.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.default={inflate:function(e,t){var r=new h(t);if(r.push(e,!0),r.err)throw r.msg||a.default[r.err];return r.result}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(7),n=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){o=!1}for(var s=new i.utils.Buf8(256),a=0;a<256;a++)s[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function f(e,t){if((t=t||e.length)<65534&&(e.subarray&&o||!e.subarray&&n))return String.fromCharCode.apply(null,i.utils.shrinkBuf(e,t));for(var r="",s=0;s<t;s++)r+=String.fromCharCode(e[s]);return r}s[254]=s[254]=1,t.strings={utf8border:function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return!(r<0)&&0!==r&&r+s[e[r]]>t?r:t},buf2string:function(e,t){for(var r,i,n=t||e.length,o=new Array(2*n),a=0,l=0;l<n;)if((r=e[l++])<128)o[a++]=r;else if(4<(i=s[r]))o[a++]=65533,l+=i-1;else{for(r&=2===i?31:3===i?15:7;1<i&&l<n;)r=r<<6|63&e[l++],i--;1<i?o[a++]=65533:r<65536?o[a++]=r:(r-=65536,o[a++]=55296|r>>10&1023,o[a++]=56320|1023&r)}return f(o,a)},binstring2buf:function(e){for(var t=new i.utils.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},buf2binstring:f,string2buf:function(e){for(var t,r,n,o,s=e.length,a=0,f=0;f<s;f++)55296==(64512&(r=e.charCodeAt(f)))&&f+1<s&&56320==(64512&(n=e.charCodeAt(f+1)))&&(r=65536+(r-55296<<10)+(n-56320),f++),a+=r<128?1:r<2048?2:r<65536?3:4;for(t=new i.utils.Buf8(a),f=o=0;o<a;f++)55296==(64512&(r=e.charCodeAt(f)))&&f+1<s&&56320==(64512&(n=e.charCodeAt(f+1)))&&(r=65536+(r-55296<<10)+(n-56320),f++),r<128?t[o++]=r:(r<2048?t[o++]=192|r>>>6:(r<65536?t[o++]=224|r>>>12:(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63),t[o++]=128|r>>>6&63),t[o++]=128|63&r);return t}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(7),n=r(52),o=r(53),s=r(54),a=r(55),f=-2;function l(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function u(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.utils.Buf16(320),this.work=new i.utils.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function h(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new i.utils.Buf32(852),t.distcode=t.distdyn=new i.utils.Buf32(592),t.sane=1,t.back=-1,0):f}function c(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,h(e)):f}function d(e,t){var r,i;return e&&e.state?(i=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?f:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,c(e))):f}function p(e,t){var r,i;return e?(i=new u,(e.state=i).window=null,0!==(r=d(e,t))&&(e.state=null),r):f}var y,m,v=!0;function g(e){if(v){var t;for(y=new i.utils.Buf32(512),m=new i.utils.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a.default(1,e.lens,0,288,y,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a.default(2,e.lens,0,32,m,0,e.work,{bits:5}),v=!1}e.lencode=y,e.lenbits=9,e.distcode=m,e.distbits=5}function b(e,t,r,n){var o,s=e.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new i.utils.Buf8(s.wsize)),n>=s.wsize?(i.utils.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n<(o=s.wsize-s.wnext)&&(o=n),i.utils.arraySet(s.window,t,r-n,o,s.wnext),(n-=o)?(i.utils.arraySet(s.window,t,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=o))),0}t.default={inflateReset:c,inflateReset2:d,inflateResetKeep:h,inflateInit:function(e){return p(e,15)},inflateInit2:p,inflate:function(e,t){var r,u,h,c,d,p,y,m,v,w,k,_,O,x,j,S,A,E,T,B,N,R,I,P,F=0,D=new i.utils.Buf8(4),C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return f;12===(r=e.state).mode&&(r.mode=13),d=e.next_out,h=e.output,y=e.avail_out,c=e.next_in,u=e.input,p=e.avail_in,m=r.hold,v=r.bits,w=p,k=y,R=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;v<16;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}if(2&r.wrap&&35615===m){D[r.check=0]=255&m,D[1]=m>>>8&255,r.check=o.default(r.check,D,2,0),v=m=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&m)<<8)+(m>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&m)){e.msg="unknown compression method",r.mode=30;break}if(v-=4,N=8+(15&(m>>>=4)),0===r.wbits)r.wbits=N;else if(N>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<N,e.adler=r.check=1,r.mode=512&m?10:12,v=m=0;break;case 2:for(;v<16;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}if(r.flags=m,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=m>>8&1),512&r.flags&&(D[0]=255&m,D[1]=m>>>8&255,r.check=o.default(r.check,D,2,0)),v=m=0,r.mode=3;case 3:for(;v<32;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}r.head&&(r.head.time=m),512&r.flags&&(D[0]=255&m,D[1]=m>>>8&255,D[2]=m>>>16&255,D[3]=m>>>24&255,r.check=o.default(r.check,D,4,0)),v=m=0,r.mode=4;case 4:for(;v<16;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}r.head&&(r.head.xflags=255&m,r.head.os=m>>8),512&r.flags&&(D[0]=255&m,D[1]=m>>>8&255,r.check=o.default(r.check,D,2,0)),v=m=0,r.mode=5;case 5:if(1024&r.flags){for(;v<16;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}r.length=m,r.head&&(r.head.extra_len=m),512&r.flags&&(D[0]=255&m,D[1]=m>>>8&255,r.check=o.default(r.check,D,2,0)),v=m=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(p<(_=r.length)&&(_=p),_&&(r.head&&(N=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),i.utils.arraySet(r.head.extra,u,c,_,N)),512&r.flags&&(r.check=o.default(r.check,u,_,c)),p-=_,c+=_,r.length-=_),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===p)break e;for(_=0;N=u[c+_++],r.head&&N&&r.length<65536&&(r.head.name+=String.fromCharCode(N)),N&&_<p;);if(512&r.flags&&(r.check=o.default(r.check,u,_,c)),p-=_,c+=_,N)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===p)break e;for(_=0;N=u[c+_++],r.head&&N&&r.length<65536&&(r.head.comment+=String.fromCharCode(N)),N&&_<p;);if(512&r.flags&&(r.check=o.default(r.check,u,_,c)),p-=_,c+=_,N)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;v<16;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}if(m!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}v=m=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;v<32;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}e.adler=r.check=l(m),v=m=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=d,e.avail_out=y,e.next_in=c,e.avail_in=p,r.hold=m,r.bits=v,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){m>>>=7&v,v-=7&v,r.mode=27;break}for(;v<3;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}switch(r.last=1&m,--v,3&(m>>>=1)){case 0:r.mode=14;break;case 1:if(g(r),r.mode=20,6!==t)break;m>>>=2,v-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}m>>>=2,v-=2;break;case 14:for(m>>>=7&v,v-=7&v;v<32;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}if((65535&m)!=(m>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&m,v=m=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(_=r.length){if(p<_&&(_=p),y<_&&(_=y),0===_)break e;i.utils.arraySet(h,u,c,_,d),p-=_,c+=_,y-=_,d+=_,r.length-=_;break}r.mode=12;break;case 17:for(;v<14;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}if(r.nlen=257+(31&m),m>>>=5,v-=5,r.ndist=1+(31&m),m>>>=5,v-=5,r.ncode=4+(15&m),m>>>=4,v-=4,286<r.nlen||30<r.ndist){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;v<3;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}r.lens[C[r.have++]]=7&m,m>>>=3,v-=3}for(;r.have<19;)r.lens[C[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,I={bits:r.lenbits},R=a.default(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,R){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;S=(F=r.lencode[m&(1<<r.lenbits)-1])>>>16&255,A=65535&F,!((j=F>>>24)<=v);){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}if(A<16)m>>>=j,v-=j,r.lens[r.have++]=A;else{if(16===A){for(P=j+2;v<P;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}if(m>>>=j,v-=j,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}N=r.lens[r.have-1],_=3+(3&m),m>>>=2,v-=2}else if(17===A){for(P=j+3;v<P;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}v-=j,N=0,_=3+(7&(m>>>=j)),m>>>=3,v-=3}else{for(P=j+7;v<P;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}v-=j,N=0,_=11+(127&(m>>>=j)),m>>>=7,v-=7}if(r.have+_>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;_--;)r.lens[r.have++]=N}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,I={bits:r.lenbits},R=a.default(1,r.lens,0,r.nlen,r.lencode,0,r.work,I),r.lenbits=I.bits,R){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},R=a.default(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,I),r.distbits=I.bits,R){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=p&&258<=y){e.next_out=d,e.avail_out=y,e.next_in=c,e.avail_in=p,r.hold=m,r.bits=v,s.default(e,k),d=e.next_out,h=e.output,y=e.avail_out,c=e.next_in,u=e.input,p=e.avail_in,m=r.hold,v=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;S=(F=r.lencode[m&(1<<r.lenbits)-1])>>>16&255,A=65535&F,!((j=F>>>24)<=v);){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}if(S&&0==(240&S)){for(E=j,T=S,B=A;S=(F=r.lencode[B+((m&(1<<E+T)-1)>>E)])>>>16&255,A=65535&F,!(E+(j=F>>>24)<=v);){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}m>>>=E,v-=E,r.back+=E}if(m>>>=j,v-=j,r.back+=j,r.length=A,0===S){r.mode=26;break}if(32&S){r.back=-1,r.mode=12;break}if(64&S){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&S,r.mode=22;case 22:if(r.extra){for(P=r.extra;v<P;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}r.length+=m&(1<<r.extra)-1,m>>>=r.extra,v-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;S=(F=r.distcode[m&(1<<r.distbits)-1])>>>16&255,A=65535&F,!((j=F>>>24)<=v);){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}if(0==(240&S)){for(E=j,T=S,B=A;S=(F=r.distcode[B+((m&(1<<E+T)-1)>>E)])>>>16&255,A=65535&F,!(E+(j=F>>>24)<=v);){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}m>>>=E,v-=E,r.back+=E}if(m>>>=j,v-=j,r.back+=j,64&S){e.msg="invalid distance code",r.mode=30;break}r.offset=A,r.extra=15&S,r.mode=24;case 24:if(r.extra){for(P=r.extra;v<P;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}r.offset+=m&(1<<r.extra)-1,m>>>=r.extra,v-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===y)break e;if(_=k-y,r.offset>_){if((_=r.offset-_)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}O=_>r.wnext?(_-=r.wnext,r.wsize-_):r.wnext-_,_>r.length&&(_=r.length),x=r.window}else x=h,O=d-r.offset,_=r.length;for(y<_&&(_=y),y-=_,r.length-=_;h[d++]=x[O++],--_;);0===r.length&&(r.mode=21);break;case 26:if(0===y)break e;h[d++]=r.length,y--,r.mode=21;break;case 27:if(r.wrap){for(;v<32;){if(0===p)break e;p--,m|=u[c++]<<v,v+=8}if(k-=y,e.total_out+=k,r.total+=k,k&&(e.adler=r.check=r.flags?o.default(r.check,h,k,d-k):n.default(r.check,h,k,d-k)),k=y,(r.flags?m:l(m))!==r.check){e.msg="incorrect data check",r.mode=30;break}v=m=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;v<32;){if(0===p)break e;p--,m+=u[c++]<<v,v+=8}if(m!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}v=m=0}r.mode=29;case 29:R=1;break e;case 30:R=-3;break e;case 31:return-4;case 32:default:return f}return e.next_out=d,e.avail_out=y,e.next_in=c,e.avail_in=p,r.hold=m,r.bits=v,(r.wsize||k!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&b(e,e.output,e.next_out,k-e.avail_out)?(r.mode=31,-4):(w-=e.avail_in,k-=e.avail_out,e.total_in+=w,e.total_out+=k,r.total+=k,r.wrap&&k&&(e.adler=r.check=r.flags?o.default(r.check,h,k,e.next_out-k):n.default(r.check,h,k,e.next_out-k)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0==w&&0===k||4===t)&&0===R&&(R=-5),R)},inflateEnd:function(e){if(!e||!e.state)return f;var t=e.state;return t.window&&(t.window=null),e.state=null,0},inflateGetHeader:function(e,t){var r;return e&&e.state&&0!=(2&(r=e.state).wrap)?((r.head=t).done=!1,0):f},inflateSetDictionary:function(e,t){var r,i,o=t.length;return!e||!e.state||0!==(r=e.state).wrap&&11!==r.mode?f:11===r.mode&&(i=1,(i=n.default(i,t,o,0))!==r.check)?-3:b(e,t,o,o)?(r.mode=31,-4):(r.havedict=1,0)},inflateInfo:"pako inflate (from Nodeca project)"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,i){for(var n=65535&e|0,o=e>>>16&65535|0,s=0;0!==r;){for(r-=s=2e3<r?2e3:r;o=o+(n=n+t[i++]|0)|0,--s;);n%=65521,o%=65521}return n|o<<16|0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.default=function(e,t,r,n){var o=i,s=n+r;e^=-1;for(var a=n;a<s;a++)e=e>>>8^o[255&(e^t[a])];return-1^e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var r,i,n,o,s,a,f=e.state,l=e.next_in,u=e.input,h=l+(e.avail_in-5),c=e.next_out,d=e.output,p=c-(t-e.avail_out),y=c+(e.avail_out-257),m=f.dmax,v=f.wsize,g=f.whave,b=f.wnext,w=f.window,k=f.hold,_=f.bits,O=f.lencode,x=f.distcode,j=(1<<f.lenbits)-1,S=(1<<f.distbits)-1;e:do{_<15&&(k+=u[l++]<<_,_+=8,k+=u[l++]<<_,_+=8),r=O[k&j];t:for(;;){if(k>>>=i=r>>>24,_-=i,0==(i=r>>>16&255))d[c++]=65535&r;else{if(!(16&i)){if(0==(64&i)){r=O[(65535&r)+(k&(1<<i)-1)];continue t}if(32&i){f.mode=12;break e}e.msg="invalid literal/length code",f.mode=30;break e}n=65535&r,(i&=15)&&(_<i&&(k+=u[l++]<<_,_+=8),n+=k&(1<<i)-1,k>>>=i,_-=i),_<15&&(k+=u[l++]<<_,_+=8,k+=u[l++]<<_,_+=8),r=x[k&S];r:for(;;){if(k>>>=i=r>>>24,_-=i,!(16&(i=r>>>16&255))){if(0==(64&i)){r=x[(65535&r)+(k&(1<<i)-1)];continue r}e.msg="invalid distance code",f.mode=30;break e}if(o=65535&r,_<(i&=15)&&(k+=u[l++]<<_,(_+=8)<i&&(k+=u[l++]<<_,_+=8)),m<(o+=k&(1<<i)-1)){e.msg="invalid distance too far back",f.mode=30;break e}if(k>>>=i,_-=i,(i=c-p)<o){if(g<(i=o-i)&&f.sane){e.msg="invalid distance too far back",f.mode=30;break e}if(a=w,(s=0)===b){if(s+=v-i,i<n){for(n-=i;d[c++]=w[s++],--i;);s=c-o,a=d}}else if(b<i){if(s+=v+b-i,(i-=b)<n){for(n-=i;d[c++]=w[s++],--i;);if(s=0,b<n){for(n-=i=b;d[c++]=w[s++],--i;);s=c-o,a=d}}}else if(s+=b-i,i<n){for(n-=i;d[c++]=w[s++],--i;);s=c-o,a=d}for(;2<n;)d[c++]=a[s++],d[c++]=a[s++],d[c++]=a[s++],n-=3;n&&(d[c++]=a[s++],1<n&&(d[c++]=a[s++]))}else{for(s=c-o;d[c++]=d[s++],d[c++]=d[s++],d[c++]=d[s++],2<(n-=3););n&&(d[c++]=d[s++],1<n&&(d[c++]=d[s++]))}break}}break}}while(l<h&&c<y);l-=n=_>>3,k&=(1<<(_-=n<<3))-1,e.next_in=l,e.next_out=c,e.avail_in=l<h?h-l+5:5-(l-h),e.avail_out=c<y?y-c+257:257-(c-y),f.hold=k,f.bits=_}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(7),n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.default=function(e,t,r,f,l,u,h,c){var d,p,y,m,v,g,b,w,k,_=c.bits,O=0,x=0,j=0,S=0,A=0,E=0,T=0,B=0,N=0,R=0,I=null,P=0,F=new i.utils.Buf16(16),D=new i.utils.Buf16(16),C=null,L=0;for(O=0;O<=15;O++)F[O]=0;for(x=0;x<f;x++)F[t[r+x]]++;for(A=_,S=15;1<=S&&0===F[S];S--);if(S<A&&(A=S),0===S)return l[u++]=20971520,l[u++]=20971520,c.bits=1,0;for(j=1;j<S&&0===F[j];j++);for(A<j&&(A=j),O=B=1;O<=15;O++)if(B<<=1,(B-=F[O])<0)return-1;if(0<B&&(0===e||1!==S))return-1;for(D[1]=0,O=1;O<15;O++)D[O+1]=D[O]+F[O];for(x=0;x<f;x++)0!==t[r+x]&&(h[D[t[r+x]]++]=x);if(g=0===e?(I=C=h,19):1===e?(I=n,P-=257,C=o,L-=257,256):(I=s,C=a,-1),O=j,v=u,T=x=R=0,y=-1,m=(N=1<<(E=A))-1,1===e&&852<N||2===e&&592<N)return 1;for(;;){for(b=O-T,k=h[x]<g?(w=0,h[x]):h[x]>g?(w=C[L+h[x]],I[P+h[x]]):(w=96,0),d=1<<O-T,j=p=1<<E;l[v+(R>>T)+(p-=d)]=b<<24|w<<16|k|0,0!==p;);for(d=1<<O-1;R&d;)d>>=1;if(0!==d?(R&=d-1,R+=d):R=0,x++,0==--F[O]){if(O===S)break;O=t[r+h[x]]}if(A<O&&(R&m)!==y){for(0===T&&(T=A),v+=j,B=1<<(E=O-T);E+T<S&&!((B-=F[E+T])<=0);)E++,B<<=1;if(N+=1<<E,1===e&&852<N||2===e&&592<N)return 1;l[y=R&m]=A<<24|E<<16|v-u|0}}return 0!==R&&(l[v+R]=O-T<<24|64<<16|0),c.bits=A,0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}}],e={},f.m=d,f.c=e,f.d=function(e,t,r){f.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,t){if(1&t&&(e=f(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(f.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)f.d(r,i,function(t){return e[t]}.bind(null,i));return r},f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,"a",t),t},f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f.p="",f(f.s=27);function f(t){if(e[t])return e[t].exports;var r=e[t]={i:t,l:!1,exports:{}};return d[t].call(r.exports,r,r.exports,f),r.l=!0,r.exports}var d,e}));
//// # sourceMappingURL=svgaParser.min.js.map
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
const path = require('path');
const config = {
'/ngame/new/datapash': {
data: './json/datapash.json'
}
}
for (let item in config) {
if (config.hasOwnProperty(item))
config[item].path = path.resolve(__dirname, config[item].data);
}
module.exports = config;
\ No newline at end of file
{
"code": "000000",
"data": 1,
"success": true,
"message": "成功"
}
\ No newline at end of file
{
"code": "000000",
"data": {
"tools": {
"HAMMERS": 1,
"STEPS": 0,
"BOOMS": 0
}
},
"success": true,
"message": "成功"
}
\ No newline at end of file
{
"code": "000000",
"data": {
"power": 3
},
"success": true,
"message": "成功"
}
\ No newline at end of file
{
"code": "530001",
"data": {
"power": 231,
"tools": {
"STEPS": 3,
"BOOMS": 4,
"HAMMERS": 5
},
"isvip": false,
"url": "//market.m.taobao.com/apps/market/shopmember/index.html?wh_weex=true&sellerId=2207623078795&extraInfo=%7B%22source%22%3A%22isvapp%22%2C%22entrance%22%3A%22duiba%22%7D"
},
"success": true,
"message": "需要成为会员"
}
{
"code": "000000",
"data": {
"currentLevel": 11,
"isPrizeLevel": false,
"tool": {
"type": "HAMMERS"
},
"prize": {
"image": "https://img.alicdn.com/imgextra/i1/2275046294/O1CN01xTeKMI1wMhRux48Y6_!!2275046294-2-miniprogram.png"
}
},
"success": true,
"message": "成功"
}
{
"code": "000000",
"data": {
"inviteFriends": {
"type": 2,
"value": 10,
"taskNum": 3
},
"openId": "AAFwCvE-ALiIWXYsJuTQVRpH",
"rule": "测试规则4455334354",
"updateTime": 1594627802429,
"title": "测试活动",
"toolsProbability": {
"HAMMERS": {
"properiodfrom": 1,
"properiodto": 500,
"probability": 5
},
"STEPS": {
"properiodfrom": 1001,
"properiodto": 1400,
"probability": 4
},
"BOOMS": {
"properiodfrom": 501,
"properiodto": 1000,
"probability": 5
}
},
"levelPrize": {
"level_60": "https://img.alicdn.com/imgextra/i3/2275046294/O1CN01Llkz1U1wMhRqE4D0f_!!2275046294-2-miniprogram.png",
"level_90": "https://img.alicdn.com/imgextra/i1/2275046294/O1CN01xTeKMI1wMhRux48Y6_!!2275046294-2-miniprogram.png",
"level_120": "https://img.alicdn.com/imgextra/i1/2275046294/O1CN01WvSfpG1wMhRrsjqFq_!!2275046294-2-miniprogram.png",
"level_30": "https://img.alicdn.com/imgextra/i3/2275046294/O1CN01Mf9wLi1wMhRoCuoOs_!!2275046294-2-miniprogram.png",
"level_10": "https://img.alicdn.com/imgextra/i3/2275046294/O1CN01bsypJm1wMhRsRMjh1_!!2275046294-2-miniprogram.png"
},
"buyCredits": {
"HAMMERS": "8",
"POWERS": "9",
"BOOMS": "6",
"STEPS": "7"
},
"beMembership": 65,
"openPrizeMsg": "",
"createTime": 1594361933457,
"deleteStatus": 1,
"browseGoods": {
"itemIds": "32223",
"type": 1,
"value": 10,
"taskNum": 3
},
"startTime": 1592448580000,
"_id": "5f08084ec3ad3494b9201c0e",
"endTime": 1594966980000,
"attentionStore": 7,
"openPrizeStatus": 3
},
"success": true,
"message": "成功"
}
{
"code": "000000",
"data": {
"currentLevel": 1,
"visitors": [
{
"activityId": "5f08084ec3ad3494b9201c0e",
"score": 10000,
"level": 120,
"createTime": 1594370024407,
"openId": "AAHuCvE-ALiIWXYsJuTb5S4W",
"isVisitSuccess": true,
"updateTime": 1594370024407,
"_id": "5f0827e89da67191b6b29261",
"stars": 3,
"isPrizeLevel": false,
"sendAwardType": true
},
{
"activityId": "5f08084ec3ad3494b9201c0e",
"score": 10000,
"level": 10,
"createTime": 1594370106090,
"openId": "AAHuCvE-ALiIWXYsJuTb5S4W",
"isVisitSuccess": true,
"updateTime": 1594370106090,
"_id": "5f08283a75cfb693ea1b3d5b",
"stars": 3,
"isPrizeLevel": true,
"sendAwardType": "prize"
},
{
"activityId": "5f08084ec3ad3494b9201c0e",
"score": 10000,
"level": 1,
"createTime": 1594369315957,
"openId": "AAHuCvE-ALiIWXYsJuTb5S4W",
"isVisitSuccess": true,
"updateTime": 1594369868256,
"_id": "5f082523c3ad3494b92036bf",
"stars": 3,
"isPrizeLevel": false,
"sendAwardType": true
}
],
"prizes": [
{
"receiveTime": "",
"level": 120,
"isReceive": false
}
],
"power": 3,
"tools": {
"HAMMERS": 1,
"STEPS": 0,
"BOOMS": 0
},
"topAward": ""
},
"success": true,
"message": "成功"
}
{
"success": true,
"code": "1111",
"message": "OK",
"data": {
"power": 0,
"currentLevel": 120,
"tools": {
"STEPS": 1,
"BOOMS": 2,
"HAMMERS": 3
},
"prizes": [
{
"receiveTime": "",
"level": 120,
"isReceive": false
},
{
"receiveTime": "",
"level": 90,
"isReceive": false
},
{
"receiveTime": "",
"level": 60,
"isReceive": false
},
{
"receiveTime": "",
"level": 30,
"isReceive": false
},
{
"receiveTime": "",
"level": 10,
"isReceive": false
}
],
"visitors": [
{
"level": 1,
"scores": 11111,
"stars": 1,
"isPrizeLevel": false,
"isVisitSuccess": true,
"sendAwardType": "prize"
},
{
"level": 2,
"scores": 22222,
"stars": 2,
"isPrizeLevel": false,
"isVisitSuccess": true,
"sendAwardType": "prize"
},
{
"level": 3,
"scores": 3333,
"stars": 3,
"isPrizeLevel": false,
"isVisitSuccess": true,
"sendAwardType": "prize"
},
{
"level": 4,
"scores": 44444,
"stars": 2,
"isPrizeLevel": false,
"isVisitSuccess": true,
"sendAwardType": "prize"
},
{
"level": 5,
"scores": 44444,
"stars": 2,
"isPrizeLevel": false,
"isVisitSuccess": true,
"sendAwardType": "prize"
},
{
"level": 6,
"scores": 44444,
"stars": 2,
"isPrizeLevel": false,
"isVisitSuccess": true,
"sendAwardType": "prize"
},
{
"level": 7,
"scores": 44444,
"stars": 2,
"isPrizeLevel": false,
"isVisitSuccess": true,
"sendAwardType": "prize"
},
{
"level": 4,
"scores": 44444,
"stars": 2,
"isPrizeLevel": false,
"isVisitSuccess": true,
"sendAwardType": "prize"
},
{
"level": 8,
"scores": 44444,
"stars": 2,
"isPrizeLevel": false,
"isVisitSuccess": true,
"sendAwardType": "prize"
},
{
"level": 9,
"scores": 44444,
"stars": 2,
"isPrizeLevel": false,
"isVisitSuccess": true,
"sendAwardType": "prize"
},
{
"level": 10,
"scores": 44444,
"stars": 2,
"isPrizeLevel": false,
"isVisitSuccess": true,
"sendAwardType": "prize"
}
],
"isFristLogin": false
}
}
{
"code": "000000",
"data": [
{
"switchStock": 1,
"image": "https://img.alicdn.com/imgextra/i2/2275046294/O1CN01c4rCs11wMhRrsjEep_!!2275046294-2-miniprogram.png",
"isBackUp": false,
"properiodto": 1600,
"level": 1,
"probability": "16",
"openId": "AAFwCvE-ALiIWXYsJuTQVRpH",
"prizeType": 60,
"updateTime": 1594623032191,
"type": 3,
"properiodfrom": 1,
"activityId": "5f08084ec3ad3494b9201c0e",
"ename": "",
"lockStatus": 1,
"credits": "",
"createTime": 1594361933509,
"deleteStatus": 1,
"name": "60关奖品3",
"useStock": 1,
"rank": "",
"_id": "5f08084e0cb7338a0a377c8e",
"id": "",
"stock": 200
},
{
"isBackUp": true,
"properiodto": 10000,
"level": 2,
"probability": "84",
"prizeType": 60,
"updateTime": 1594623032197,
"type": 5,
"properiodfrom": 1601,
"activityId": "5f08084ec3ad3494b9201c0e",
"lockStatus": 1,
"createTime": 1594623032197,
"deleteStatus": 1,
"name": "谢谢参与",
"useStock": 0,
"_id": "5f0c043852bbde91d1ca5682"
}
],
"success": true,
"message": "成功"
}
\ No newline at end of file
{
"code": "000000",
"data": [
{
"taskType": "browseGoods",
"times": 3,
"todayCompleteTimes": 0,
"waitReceive": 0,
"value": "",
"rewards": 10
},
{
"taskType": "invites",
"times": 3,
"todayCompleteTimes": 0,
"waitReceive": 0,
"value": "",
"rewards": 10
},
{
"taskType": "follow",
"times": 1,
"todayCompleteTimes": 0,
"waitReceive": 0,
"value": "",
"rewards": 7
},
{
"taskType": "member",
"times": 1,
"todayCompleteTimes": 1,
"waitReceive": 0,
"rewards": 65
}
],
"success": true,
"message": "成功"
}
{
"success": true,
"message": "您还不是会员",
"data": {
"isvip": false,
"url": "xxx",
"credits": 471
}
}
{
"code":"000000",
"data":1,
"success":true,
"message":"成功"
}
\ No newline at end of file
{
"success": true
}
\ No newline at end of file
{
"success": true,
"data": {
"avatar": "https://source.unsplash.com/user/erondu/76x76",
"nickName": "我啊是大请问",
"activityId": "string",
"openId": "string",
"inviteId": "string",
"isFollow": true
}
}
interface ResData {
/**
* 分组数据
*/
groups: GroupInt[];
//暂时没有工具,不用
resources?: any;
path?: string;
}
interface GroupInt {
/**
* 所有的资源名字,根据,分割,根据后缀区分类型
*
*/
keys: string;//"aa.png,bb.jpg,name.json"
/**
* 文件夹名字吧
*/
name: string;
/**
* 图集
* 线上打包合图可能有多张,暂时发现texturePacker版本问题只有一张
*/
atlas: {
[name: string]: {
"x": number,
"y": number,
"w": number,
"h": number,
"ox": number,
"oy": number,
"sw": number,
"sh": number,
"ro": boolean
},
};
}
interface SkinInt {
name: string,
x: 0,
y: 0,
type: 'container' | 'text' | 'button' | 'sprite' | 'rect' | 'skin',//skin的不初始化进节点,只作为数据
children?: SkinInt[],
id?: string,
alpha: number,
props?: {
source?: string,
text: string,
size: number,
fillColor: string,
textAlpha: number,
width: number,
height: number,
tUp: string,
tDown: string,
tDisable: string
}
}
/**
* 简单点,有工具的话像egret那样玩,可以自动生成图片组数据
*/
export namespace RES {
let resData: ResData
/**
* 资源路径
*/
export let resPath: string;
/**
* movieClip的ve数据
*/
let videoEntityHash: {
// [name: string]: FYGE.VideoEntity
} = {};
/**
* 音频的加载
*/
let soundHash = {}
/**
* 记录组加载完成
*/
let groupsCompleteHash: {
[name: string]: boolean
} = {}
/**
* 记录加载的promise
*/
let groupsPromiseHash: {
[name: string]: Promise<any>
} = {}
/**
* 单独资源加载的promise记录
*/
let singleResPromiseHash: {
[name: string]: Promise<any>
} = {}
/**
*
* @param res 资源数据,就是对象,不考虑加载json先
* res格式{
* path:1111/
* groups: [
* {
*
* }
* ];
* }
* @param path
*/
export function loadConfig(res) {
resData = res;
resPath = res.path;
}
export function loadSparkAssets(resList: any[]): Promise<any> {
let list = [];
for (let key in resList) {
list.push(resList[key]);
}
let p: Promise<any> = new Promise((resolve, reject) => {
loadResList((s) => {
if (s) {
resolve()
} else {
reject();
}
}, list/*, resPath + name*/)
})
return p;
}
/**
* 根据组名加载一组资源,通常用于加载一个视图的的所有资源
* 里的promise的resolve并没有返回值
* @param name
*/
export function loadGroup(name: string): Promise<any> {
//已经加载完成的直接返回
if (groupsCompleteHash[name]) {
return new Promise((resolve) => {
resolve()
})
}
//如果是正在加载中的,返回正在加载中的promise
if (groupsPromiseHash[name]) {
return groupsPromiseHash[name];
}
//如果首次加载
//获取资源组
let arr = getGroupResByName(name);
//如果不存在arr,直接返回空p,且标记完成
if (!arr || !arr.length) {
groupsCompleteHash[name] = true;
return new Promise((resolve) => {
resolve()
})
}
// 建一个promise
let p = new Promise((resolve, reject) => {
loadResList((s) => {
//移除
delete groupsPromiseHash[name];
if (s) {
groupsCompleteHash[name] = true;
resolve()
} else {
reject();
}
}, arr/*, resPath + name*/)
})
groupsPromiseHash[name] = p;
return p;
}
/**
* var textue = await RES.getResAsync(str);
* @param str 可以是网络图片路径或键值
* @param comFun 加载回调
* @param thisObj this指向
*/
export function getResAsync(str: string, comFun?: (res: any, str: string) => void, thisObj?: any): Promise<any> {
// var arr = str.split(".");
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((r) => {
r(FYGE.TextureCache[str])
})
}
else {
return new Promise((resolve, reject) => {
FYGE.GlobalLoader.loadImage((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)
})
}
}
}
/**
* 待写,根据网络路径加载图片
*/
export function getResByUrl() {
}
/**
* 获取素材,
* @param str
* @return 已加载好得素材或null
*/
export function getRes(str: string)/*: Texture | VideoEntity*/ {
var type = str.substring(str.lastIndexOf(".") + 1, str.length);
if (type == "png" || type == "jpg") {
return FYGE.TextureCache[str] || null;
}
}
/**
* 判断是否在资源组里
* 考虑是否init就做表
* 有就返回组名,为了加载路径,不然以后有工具可以放入resources
*/
function hasRes(str: string): string {
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;
}
//如果是图集的json,altas现在是图集
if (group.atlas && group.name + ".json" == str) {
return group.name;
}
}
return null
}
/**
* 处理数据,获得所有资源单项
* @param name
*/
function getGroupResByName(name: string) {
var group: GroupInt = getGroupByName(name);
if (!group) return null;
//判断加载图集还是单图
if (group.atlas) {
// var arr: string[] = [].concat(group.atlas.split(","));
var arr = [name + ".json"]
//再添加非图片的资源,和图集已排除jpg
if (group.keys) {
arr = arr.concat(group.keys.split(",").filter((k: string) => {
return k.substr(-4) != ".png" //&& k.substr(-4) != ".jpg"
}))
}
return arr
}
else if (group.keys) {
return group.keys.split(",")
} else {
return null
}
}
/**
* 根据名字找组
* @param name
*/
function getGroupByName(name: string): GroupInt {
var groups = resData.groups;
var group: GroupInt;
for (var i = 0; i < groups.length; i++) {
if (groups[i].name === name) {
group = groups[i];
break;
}
}
return group
}
/**
* 新版的加载一列资源
* @param callback
* @param arr
*/
export function loadResList(callback: (allLoaded: boolean) => void, arr: string[]) {
let count = 0;
let countAll = arr.length;
if (!countAll) callback(true);
let mark = true;
for (var i = 0; i < countAll; i++) {
let resName = arr[i]['url'];
getResAsync(resName, (res, str) => {
//标记失败,如果有一项资源加载失败,标记下
if (!res) mark = false
if (++count == countAll) callback(mark);
}, this)
}
}
/**
*
* @param str
* @param comFun
* @param thisObj
*/
function returnSingleResPromise(str: string, comFun?: (res: any, str: string) => void, thisObj?: any) {
//已判断是否存在
singleResPromiseHash[str].then(
(r) => {
comFun && comFun.call(thisObj, r, str)
},
() => {
comFun && comFun.call(thisObj, null, str)
}
)
return singleResPromiseHash[str];
}
//皮肤相关的也放在RES吧
let skinData: SkinInt
/**
* 添加皮肤配置文件
*/
export function loadSkinConfig(skinJson) {
skinData = skinJson;
}
/**
* 根据
* @param con 添加显示对象的容器
* @param skin 皮肤名字或数据
* @param root 根容器,为了添加自定义引用
*/
export function initSkinDisplay(con: FYGE.Container, skin: string | SkinInt, root?: FYGE.Container) {
//@ts-ignore
var data: SkinInt = typeof (skin) == 'string' ? getSkinDataByName(skin) : skin;
if (!data.children || !data.children.length) return;
// for (var i = data.children.length - 1; i >= 0; i--) {
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);
}
}
/**
* 遍历根据名字找节点数据,只会是container的
* @param skinName
*/
export function getSkinDataByName(skinName: string, skinNode: SkinInt = skinData): SkinInt {
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;
}
export function getSrcByUuid(resList: any[], uuid: string): string {
resList = resList || [];
for (let i = 0; i < resList.length; i++) {
if (resList[i].uuid == uuid) {
return resList[i].url
}
}
return "";
}
/**
* 通过数据创建显示对象
* @param data
*/
function getDisplayByData(data: SkinInt): FYGE.Container {
var dis: FYGE.Container;
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 (let 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.Graphics()
// .beginFill(data.props.fillColor)
// .drawRect(0, 0, data.props.width, data.props.height)
// .endFill();
dis = new FYGE.Shape()
//@ts-ignore
dis.beginFill(FYGE.string2hex(data.props.fillColor))
//@ts-ignore
dis.drawRect(0, 0, data.props.width, data.props.height)
//@ts-ignore
dis.endFill();
break;
}
dis.name = data.name;
dis.alpha = data.alpha || 1;
dis.position.set(data.x, data.y);
// if (data.type == "text") dis.y -= 4;//文本莫名偏下,移动下,手机调试的时候也试试
return dis;
}
//貌似不需要,为了加载过一次的资源不用重新加载
function destroyRES() {
}
}
import { destroyWaiting } from "./waitingCtrl";
import { Panel } from "../views/Panel";
import PanelCtrl from "./panelCtrl";
import SceneCtrl from "./sceneCtrl";
import { Scene } from "../views/Scene";
import { destroyToast } from "./toastCtrl";
import IConfirmPanel from "../../src/common/IConfirmPanel";
import ConfirmPanel from "../../src/common/IConfirmPanel";
import panelCtrl from "./panelCtrl";
export { showToast } from "./toastCtrl";
export * from "./waitingCtrl";
/**
* 展示弹框
* @param panel 弹框类
* @param data 数据
*/
export const showPanel = (panel: any, data?: any) => {
return PanelCtrl.instance.show(panel, data)
}
export const showConfirm = (panel: any, data?: any) => {
const confirmPanel: ConfirmPanel = PanelCtrl.instance.show(panel, data);
return confirmPanel.makePromise();
}
/**
* 关闭所有弹框
*/
export const closeAllPanels = () => {
PanelCtrl.instance.closeAll();
}
/**
* 关闭当前弹框
*/
export const closeCurrentPanel = () => {
PanelCtrl.instance.closeCurrent();
}
/**
* 替换场景
* @param scene
* @param data
*/
export const changeScene = (scene: any, data?: any) => {
SceneCtrl.instance.change(scene, data)
}
/**
* 获取当前场景
*/
export function getCurrentScene(): any {
return SceneCtrl.instance.currentScene
}
/**
* 淘宝小程序的alert
* @param {string} title
* @param {string} content
*/
export const showAlert = (title?: string, content?: string) => {
//@ts-ignore
if (my) {
//@ts-ignore
my.alert({
title: title || "",
content: content || ""
});
} else {
console.log(title, content)
}
}
/**
* 替换setTimeout 因为页面销毁时setTimeout不会停
* 所以干脆用Tween的
* @param {Function} callback
* @param {number} time 毫秒计
*/
export function wait(callback: () => void, time: number): {} {
let obj = {};
FYGE.Tween.get(obj)
.wait(time)
.call(callback)
return obj
}
export function clearWait(obj: {}) {
obj && FYGE.Tween.removeTweens(obj);
}
/**
* 递归清除显示对象里面所有的Tween
* @param obj
* @param isRecursive 默认true,递归移除子级
*/
export function removeTweens(obj, isRecursive: boolean = true) {
if (!obj) return
FYGE.Tween.removeTweens(obj);
if (!isRecursive || !obj.children || !obj.children.length) return
obj.children.forEach(child => {
removeTweens(child)
});
}
/**
* 销毁方法
*/
export function destroyAllCtrls() {
destroyToast();
destroyWaiting();
PanelCtrl.instance.destroy();
SceneCtrl.instance.destroy();
}
import { Panel } from "../views/Panel";
import { layers } from "../views/layers";
import { showWaiting, hideWaiting } from "./waitingCtrl";
import { showToast } from "./toastCtrl";
export default class PanelCtrl {
/**
* 父级容器
*/
private _parent: FYGE.Container;
/**
* 半透明黑色背景
*/
private _bg: FYGE.Graphics;
/**
* 所有的弹框
*/
private stacks: Panel[] = [];
private static _instance: PanelCtrl;
static get instance() {
return PanelCtrl._instance || (PanelCtrl._instance = new PanelCtrl())
}
init(parent: FYGE.Container) {
this._parent = parent;
let bg = new FYGE.Graphics();
bg.beginFill(0, 1);
bg.drawRect(//引用适配
layers.stageOffsetX - parent.x,
layers.stageOffsetY - parent.y,
layers.stageWidth,
layers.stageHeight
);
bg.endFill();
bg.visible = false;
this._parent.addChild(bg);
this._bg = bg;
}
/**
* 关闭所有弹框
*/
closeAll() {
this.stacks.forEach(e => e.hidePanel());
}
show<T extends Panel>(cls: any, data?: any): T {
showWaiting()
const panel: T = new cls(data);
this.add(panel);
this.stacks.push(panel);
panel.onLoaded = () => {
hideWaiting();
this.updateView();
//start只执行一边
panel.start(data);
}
//资源加载失败时
panel.onLoadError = () => {
hideWaiting();
showToast("资源加载失败")
panel.removeEventListener('onDestroy', this.onPanelHide, this);
this.remove(panel);
}
return panel;
}
private updateView() {
if (!this.stacks.length) {
this._bg.visible = false;
this._current = null;
this._parent.visible = false;
} else {
//显示弹框层
this._parent.visible = true;
//如果首次出现弹框,加个动画
if (this._bg.visible === false) {
this._bg.visible = true;
this._bg.alpha = 0;
FYGE.Tween.removeTweens(this._bg);
FYGE.Tween.get(this._bg).to({ alpha: 0.7 }, 200, FYGE.Ease.cubicOut)
}
}
for (let i = 0; i < this.stacks.length; i++) {
if (i < this.stacks.length - 1) {
this.stacks[i].visible = false;
} else {
this.stacks[i].visible = true;
this.stacks[i].showAni();
this._current = this.stacks[i];
}
}
}
/**
* 添加进父级并添加事件
* @param panel
*/
private add(panel: Panel) {
this._parent.addChild(panel);
panel.addEventListener('onDestroy', this.onPanelHide, this);
}
/**
* 移除
* @param panel
*/
private remove(panel: Panel) {
this._parent.removeChild(panel);
this.stacks = this.stacks.filter(e => e != panel);
}
/**
* 弹框移除时执行
* @param e
*/
private onPanelHide(e: FYGE.Event) {
const panel = e.target as Panel;
panel.removeEventListener('onDestroy', this.onPanelHide, this);
this.remove(panel);
this.updateView();
}
//当前弹框
private _current: Panel;
/**
* 关闭当前弹框
*/
closeCurrent() {
if (this._current) {
this._current.hidePanel();
// this._current.removeEventListener('onDestroy', this.onPanelHide, this);
// this.remove(this._current);
// this.updateView();
}
}
destroy() {
PanelCtrl._instance = null;
this.stacks = null;
this._current = null;
this._parent = null;
this._bg.destroy();
this._bg = null;
}
}
\ No newline at end of file
import { Panel } from "../views/Panel";
import { layers } from "../views/layers";
import { showWaiting, hideWaiting } from "./waitingCtrl";
import { showToast } from "./toastCtrl";
export default class PanelCtrl {
/**
* 父级容器
*/
private _parent: FYGE.Container;
/**
* 半透明黑色背景
*/
private _bg: FYGE.Shape;//FYGE.Graphics;
/**
* 所有的弹框
*/
private stacks: Panel[] = [];
private static _instance: PanelCtrl;
static get instance() {
return PanelCtrl._instance || (PanelCtrl._instance = new PanelCtrl())
}
init(parent: FYGE.Container) {
this._parent = parent;
let bg = new FYGE.Shape();//Graphics()//Shape();
bg.beginFill(0);
bg.drawRect(//引用适配
layers.stageOffsetX - parent.x,
layers.stageOffsetY - parent.y,
layers.stageWidth,
layers.stageHeight
);
bg.endFill();
bg.hitTestByPixel = false;
bg.visible = false;
this._parent.addChild(bg);
this._bg = bg;
}
/**
* 关闭所有弹框
*/
closeAll() {
this.stacks.forEach(e => e.hidePanel());
}
show<T extends Panel>(cls: any, data?: any): T {
showWaiting()
const panel: T = new cls(data);
this.add(panel);
this.stacks.push(panel);
panel.onLoaded = () => {
hideWaiting();
this.updateView(false);//这里更新不显示动画先,自行判断是否显示
//start只执行一边
panel.start(data);
//如果是最后一个才显示动画
if (panel.visible) panel.showAni();
}
//资源加载失败时
panel.onLoadError = () => {
hideWaiting();
showToast("资源加载失败")
panel.removeEventListener('onDestroy', this.onPanelHide, this);
this.remove(panel);
}
return panel;
}
private bgAni: "hide" | "show";
private updateView(showPanelAni: boolean = true) {
//没有弹框的时候
if (!this.stacks.length) {
// this._bg.visible = false;
// this._current = null;
// this._parent.visible = false;
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(() => {
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 (let 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];
}
}
}
/**
* 添加进父级并添加事件
* @param panel
*/
private add(panel: Panel) {
this._parent.addChild(panel);
panel.addEventListener('onDestroy', this.onPanelHide, this);
}
/**
* 移除
* @param panel
*/
private remove(panel: Panel) {
this._parent.removeChild(panel);
this.stacks = this.stacks.filter(e => e != panel);
}
/**
* 弹框移除时执行
* @param e
*/
private onPanelHide(e: FYGE.Event) {
const panel = e.target as Panel;
panel.removeEventListener('onDestroy', this.onPanelHide, this);
this.remove(panel);
this.updateView();
}
//当前弹框
private _current: Panel;
/**
* 关闭当前弹框
*/
closeCurrent() {
if (this._current) {
this._current.hidePanel();
// this._current.removeEventListener('onDestroy', this.onPanelHide, this);
// this.remove(this._current);
// this.updateView();
}
}
destroy() {
PanelCtrl._instance = null;
this.stacks = null;
this._current = null;
this._parent = null;
FYGE.Tween.removeTweens(this._bg);
this._bg = null;
}
}
\ No newline at end of file
import { Scene } from "../views/Scene";
import { showWaiting, hideWaiting } from "./waitingCtrl";
import { showToast } from "./toastCtrl";
export default class SceneCtrl {
private _parent: FYGE.Container;
private _currentScene: Scene;
private static _instance: SceneCtrl;
static get instance() {
return SceneCtrl._instance || (SceneCtrl._instance = new SceneCtrl())
}
init(parent: FYGE.Container) {
this._parent = parent;
}
change(cls: any, data?: any) {
//如果是同一个场景,考虑是替换还是return
// if (this._currentScene && this._currentScene instanceof cls) return;//new一个得了,playScene维护太蛋疼,到时看性能吧
let scene: Scene = new cls(data);
scene.visible = false;
showWaiting();
let preScene: Scene = this._currentScene;
scene.onLoaded = () => {
hideWaiting();
scene.showAni(() => {
if (preScene) preScene.destroy();
})
scene.visible = true;
//start里可能处理资源信息,所以在onLoaded后执行
scene.start(data);
}
//加载失败,继续用之前的场景,移除scene
scene.onLoadError = () => {
hideWaiting();
showToast("资源加载失败")
this._currentScene = preScene || null;
this._parent.removeChild(scene);
}
this._currentScene = scene;
this._parent.addChild(scene);
}
get currentScene() {
return this._currentScene
}
destroy() {
SceneCtrl._instance = null;
this._currentScene = null;
this._parent = null;
}
}
\ No newline at end of file
import { layers } from "../views/layers";
import { RES } from "../RES";
let inited = false;
let _toast: Toast;
let _parent: FYGE.Container;
let startY: number
let endY: number
const initToast = () => {
if (!inited) {
inited = true;
_toast = new Toast();
_parent = layers.toastLayer;
_toast.alpha = 0;
_toast.x = layers.stageOffsetX - _parent.x + (layers.stageWidth - _toast.width) / 2;
var h = _toast.height;
var y = layers.stageOffsetY - _parent.y;
startY = y - h;
endY = y + (layers.stageHeight - h) / 2;
}
}
export const showToast = (msg: string) => {
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(() => {
_parent.removeChild(_toast);
})
}
/**
* 对于之前淘宝小程序遇到的问题,需要销毁,否则会出问题
*/
export const destroyToast = () => {
if (inited && _toast && !_toast.destroyed) {
_toast.destroy();
_toast = null;
_parent = null;
inited = false;
}
}
/**
* toast类,不对外导出,适配居中有问题,有时间改
* 自身居中,
*/
class Toast extends FYGE.Container {
msg: FYGE.TextField;
bg: FYGE.Sprite;
PADDING = 40;
constructor() {
super();
this.mouseChildren = false;
this.mouseEnable = false;
var toastBgTexture: FYGE.Texture = RES.getRes("toastBg.png");
if (toastBgTexture) {
this.bg = new FYGE.Sprite(toastBgTexture);
// this.bg.x = (750 - 460) / 2// (layers.stageWidth - this.bg.width) / 2
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)
}
/**
* 显示时调用
* @param msg
*/
show(msg: string) {
this.msg.text = msg;
//文本居中适配
this.msg.x = ( (this.bg?this.bg.width:0) - this.msg.textWidth) / 2//(layers.stageWidth - this.msg.textWidth) / 2;
//是否需要根据文本宽度缩放背景
// this.bg.width = Math.min(this.msg.textWidth + this.PADDING * 2, 523);
//背景居中适配,由于上面一行注释,那这行就构造函数里只执行一次吧
// this.bg.x = (layers.stageWidth - this.bg.width) / 2
}
destroy() {
super.destroy();
this.msg = null
this.bg = null;
}
}
\ No newline at end of file
import { RES } from "../RES";
import { layers } from "../views/layers";
import { showAlert } from ".";
let inited = false;
let _waiting: Waiting;
let _parent: FYGE.Container
const initWaiting = () => {
if (!inited) {
inited = true;
const waiting = new Waiting();
_parent = layers.topLayer;
_waiting = waiting;
//居中偏移
var offX = (layers.stageWidth - 160/*_waiting.width*/) / 2;
var offY = (layers.stageHeight - _waiting.height) / 2;
//位置适配
_waiting.x = layers.stageOffsetX - _parent.x + offX;
_waiting.y = layers.stageOffsetY - _parent.y + offY;
//阻止事件用
var bg: FYGE.Graphics = new FYGE.Graphics()
.beginFill(0x000000)
.drawRect(-offX, -offY, layers.stageWidth, layers.stageHeight)
.endFill();
bg.alpha = 0;
_waiting.addChildAt(bg, 0);
}
}
/**
* 显示菊花圈
* @param msg 尽量三个字
*/
export const showWaiting = (msg?: string) => {
initWaiting();
_waiting.show(msg)
_parent.addChild(_waiting);
}
/**
* 隐藏菊花圈
*/
export const hideWaiting = () => {
_parent.removeChild(_waiting);
}
export const destroyWaiting = () => {
if (inited && _waiting && !_waiting.destroyed) {
_waiting.destroy();
_waiting = null;
_parent = null;
inited = false;
}
}
/**
* 菊花圈,有机会重写,应该适应所有场景居中
*/
class Waiting extends FYGE.Container {
msg: FYGE.TextField;
constructor() {
super();
//圆角矩形背景
var rectBgTexture: FYGE.Texture = RES.getRes("waitingBg.png")
if (rectBgTexture) {
var rectBg = new FYGE.Sprite(rectBgTexture);
this.addChild(rectBg);
var rotTexture: FYGE.Texture = RES.getRes("waitingRot.png")
let rot = new FYGE.Sprite(rotTexture);
rot.x = (rectBgTexture.width - rotTexture.width) / 2
rot.y = 47//533;
rot.anchorX = rotTexture.width / 2;
rot.anchorY = rotTexture.height / 2;
this.addChild(rot);
let count = 0;
rot.addEventListener(FYGE.Event.ENTER_FRAME, () => {
count++;
if (count % 30 == 0) rot.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);
}
show(msg: string = "加载中") {
this.msg.text = msg;
}
destroy() {
super.destroy();
this.msg = null;
}
}
const _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
/**
* base64编码汉字,
* 一般用于链接参数传递,
* 先base64.encode,再encodeURIComponent后带入,取参数时会decodeURIComponent,然后再base64.decode后
* 直接调用Base64.ins
*/
export class Base64 {
// private property
// _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
private static instance: Base64;
public static get ins(): Base64 {
if (!this.instance) {
this.instance = new Base64();
}
return this.instance;
}
constructor() {
}
// public method for encoding
encode(input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = this._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
_keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
_keyStr.charAt(enc3) + _keyStr.charAt(enc4);
}
return output;
}
// public method for decoding
decode(input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = _keyStr.indexOf(input.charAt(i++));
enc2 = _keyStr.indexOf(input.charAt(i++));
enc3 = _keyStr.indexOf(input.charAt(i++));
enc4 = _keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = this._utf8_decode(output);
return output;
}
// private method for UTF-8 encoding
private _utf8_encode(string) {
string = string.replace(/\r\n/g, "\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
} else if ((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
} else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
}
// private method for UTF-8 decoding
private _utf8_decode(utftext) {
var string = "";
var i = 0;
var c = 0;
var c2 = 0;
var c3 = 0
while (i < utftext.length) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
} else if ((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i + 1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
} else {
c2 = utftext.charCodeAt(i + 1);
c3 = utftext.charCodeAt(i + 2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}
\ No newline at end of file
/**
* 回收池
*/
export class GPool {
private static pool = {};
/**
* 取出
* @param name
*/
public static takeOut(name: string) {
if (this.pool[name] && this.pool[name].length) {
return this.pool[name].shift();
}
return null;
}
/**
* 回收
* @param name
* @param obj
*/
public static recover(name: string, obj) {
if (!this.pool[name]) {
this.pool[name] = [];
}
this.pool[name].push(obj);
}
}
\ No newline at end of file
/**
* 用到的和业务相关的
* 各种静态方法汇总
*
* 获取修改链接参数
* 获取cookie
* 缓存相关
* 数组相关
*
*/
export class GTool {
/**
* 替换或添加url里的参数,小程序有问题,别用,new RegExp有问题,在查
* @param url 修改的url
* @param arg 参数名
* @param arg_val 参数值
*/
public static changeURLArg(url: string, arg: string, arg_val: string | number) {
var pattern = arg + '=([^&]*)';
var replaceText = arg + '=' + arg_val;
if (url.match(pattern)) {
var tmp = '/(' + arg + '=)([^&]*)/gi';
// tmp = url.replace(eval(tmp), replaceText);
tmp = url.replace(new RegExp(tmp), replaceText);
return tmp;
} else {
if (url.match('[\?]')) {
return url + '&' + replaceText;
} else {
return url + '?' + replaceText;
}
}
}
/**
* 读取缓存 用到时重写
*/
public static readCache(key: string/*, type: string = 'localStorage'*/) {
//@ts-ignore
return my ? my.getStorageSync({ key: key }).data : localStorage.getItem(key);
// if (!window.localStorage) {
// return false;
// }
// return window[type].getItem(key);
}
/**
* 写缓存 用到时重写
*/
public static writeCache(key: string, value: any = 'true'/*, type: string = 'localStorage'*/) {
//@ts-ignore
my ? my.setStorageSync({ key: key, data: value }) : localStorage.setItem(key, value);
// if (!window.localStorage) {
// // trace(Func.replace(SysLang.lang_012, [type]));
// return;
// }
// window[type].setItem(key, value);
}
/**
* 获得cacheKey今日次数
* 第二天归0重新计数 用到时重写
* @param cacheKey
*/
public static returnTodayTimes(cacheKey: string): number {
var year1 = this.readCache("year" + cacheKey);
var month1 = this.readCache("month" + cacheKey);
var day1 = this.readCache("day" + cacheKey);
var date = new Date();
var year2 = date.getFullYear().toString();
var month2 = date.getMonth().toString();
var day2 = date.getDate().toString();
if (this.int(year2) <= this.int(year1)) {
if (this.int(month2) <= this.int(month1)) {
if (this.int(day2) <= this.int(day1)) {
return this.int(this.readCache(cacheKey));
}
}
}
//如果不是同一天了,归0
var today = "0";
this.writeCache("year" + cacheKey, year2);
this.writeCache("month" + cacheKey, month2);
this.writeCache("day" + cacheKey, day2);
this.writeCache(cacheKey, today);
return 0;
}
/**
* 随机,两个参数时是数值范围,比如randomT(1,10),一个参数时是数组
* @param e
* @param n
*/
public static randomT(e, n?) {
return e && "number" == typeof e.length && e.length ? e[Math.floor(Math.random() * e.length)] : ("number" != typeof n && (n = e || 1, e = 0), e + Math.random() * (n - e))
}
/**
* 从数组中移除一个元素
* @param e 元素
* @param arr 数组
*/
public static removeEle(e, arr) {
var index = arr.indexOf(e);
if (index >= 0) {
arr.splice(index, 1)
}
}
/**
* 数组中插入一个数值,按顺序的
* 数组是从小到大的
* @param num
* @param arr
*/
public static insert(num, arr) {
for (var i = arr.length - 1; i >= 0; i--) {
if (num > arr[i]) {
//在arr[i]后加num
arr.splice(i + 1, 0, num);
break
}
}
}
/**
* 获取start到end里的n个整数
* @param start 0
* @param end 19
* @param n 3
*/
public static getRandomNumber(start: number, end: number, n: number): number[] {
var arr = [];
for (var i = 0; i < n; i++) {
var number = Math.floor(Math.random() * (end - start + 1) + start);
if (arr.indexOf(number) < 0) {
arr.push(number);
} else {
i--;
}
}
return arr;
}
/**
* 打乱数字数组,改变原数组
* @param arr
*/
public static disturbNumberArr(arr: number[]) {
arr.sort(function () {
return (0.5 - Math.random());
});
}
/**
* 其实打乱数组取前几个就行
* 随机取数组arr中count个元素,不改变原数组
* @param arr
* @param count
*/
public static getRandomArrayElements(arr: any[], count: number) {
var shuffled = arr.slice(0), i = arr.length, min = i - count, temp, index;
//如果count大于等于数组长度,返回所有数组
if (min <= 0) return shuffled;
if (count <= 0) return [];
//随机排序,然后取出后面的元素
while (i-- > min) {
index = Math.floor((i + 1) * Math.random());
temp = shuffled[index];
shuffled[index] = shuffled[i];
shuffled[i] = temp;
}
return shuffled.slice(min);
}
/**
* 随机取数组arr中count个元素,原数组减少count个
* @param arr
* @param count
*/
public static getRandomArrayElementsEx(arr: any[], count: number): any[] {
//如果count大于等于数组长度,返回所有数组
if (arr.length <= count) return arr.slice();
if (count <= 0) return [];
var arrCopy = arr.slice();
var outArr = [];
while (count--) {
var rand = Math.floor(Math.random() * arrCopy.length);
var ele = arrCopy.splice(rand, 1)[0];
outArr.push(ele);
}
return outArr
}
/**
* 向下取整,或把字符串执行parseInt(字符串转数字取整数部分)
* @param n 数字或字符串
*/
private static int(n: any): number {
return n >> 0;//~~n
};
/**
* emoji正则式
*/
public static emojiReg = /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/ig
/**
* 在字符串间加空格
* @param str
*/
public static addSpaceInString(str: string) {
if (!str.length || str.length == 1) return str;
var txt = "";
//每个字符后加空格
for (var i = 0; i < str.length - 1; i++) {
txt = txt + str[i] + " ";
}
txt = txt + str[str.length - 1]
return txt
}
/**
* 毫秒剩余时间转成时分秒
* 1小时1分1秒
* @param timeStamp
*/
public static getShiFenMiaoByTimeStamp(timeStamp: number) {
var hours: any = Math.floor((timeStamp % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes: any = Math.floor((timeStamp % (1000 * 60 * 60)) / (1000 * 60));
// var seconds: any = (timeStamp % (1000 * 60)) / 1000;
var seconds: any = Math.floor((timeStamp % (1000 * 60)) / 1000);
hours = hours < 10 ? ('0' + hours) : hours;
minutes = minutes < 10 ? ('0' + minutes) : minutes;
seconds = seconds < 10 && seconds >= 1 ? ('0' + seconds) : seconds;
// return hours + " :" + minutes + " :" + seconds;
return hours + "小时" + minutes + "分" + seconds + "秒";
}
}
\ No newline at end of file
import { RES } from "../RES";
/**
* 暂时用列表的接口
*/
export class Item extends FYGE.Container implements FYGE.IScrollListItem {
get skinName(): string { return null };
constructor(data?) {
super();
if (this.skinName) RES.initSkinDisplay(this, this.skinName, this);
setTimeout(() => { this.initUi(data); })//考虑是否可以不加延时,加了会有问题,自行调用的updateData会先执行,不加的话继承类里initUi里的属性。。。
}
/**
* 自定义的初始布局方法
*/
initUi(data?) {
}
/**
* 自行调用的更新数据方法
*/
updateData(data?) {
}
/**
* 滚动列表的数据更新方法
* @param id
* @param data
*/
initData(id: number, data: any): void {
this.resetData();
}
id: number;
data: number;
/**
* 滚动列表ScrollList里专用
* 重置item里属性及显示对象属性的方法,
* 在每次initData会调用
*/
resetData() {
}
}
import { RES } from "../RES";
import { removeTweens } from "../ctrls";
/**
*
*/
export class Module extends FYGE.Container {
protected data: any;
constructor(data?: any) {
super();
this.data = data;
this.init();
}
/**
* 初始化资源和皮肤
*/
private init() {
this.preLoadRes().then(
() => {
//添加皮肤配置
if (this.skinName) RES.initSkinDisplay(this, this.skinName, this);
this.initUi();
this.onLoaded && this.onLoaded();
},
() => {
this.onLoadError && this.onLoadError();
}
);
}
/**
* 提前加载的资源
*/
protected preLoadRes() {
return new Promise((resolve, reject) => {
if (this.groupNames && this.groupNames.length) {
var arr: Promise<any>[] = [];
for (var i = 0; i < this.groupNames.length; i++) {
arr.push(RES.loadGroup(this.groupNames[i]))
}
Promise.all(arr).then(resolve, reject)
} else {
resolve()
}
})
}
/**
* 初始化ui
* 子类修改
*/
protected initUi() {
}
/**
* 资源加载完成后执行,用于场景及弹框控制
*/
onLoaded: () => void
/**
* 资源加载失败时执行,用于场景及弹框控制
*/
onLoadError: () => void;
/**
* 可以有多个组
*/
get groupNames(): string[] { return null }
/**
* 皮肤名字
*/
get skinName(): string { return null };
/**
* 在构造函数后执行
*/
start(data?: any) {
this.initEvents();
}
/**
* 添加事件
*/
initEvents(): void {
}
/**
* 移除事件
*/
removeEvents(): void {
}
/**
* 鼠标事件
* @param enable
*/
protected enableMouseEvt(enable: boolean): void {
this.mouseEnable = enable;
this.mouseChildren = enable;
}
/**
* 延时防连点
* @param target
* @param {number} delay
*/
protected btnDelay(target, delay = 2000) {
target.mouseEnable = false;
target.mouseChildren = false;
setTimeout(() => {
target.mouseEnable = true;
target.mouseChildren = true;
}, delay);
}
public destroy(): void {
//以防有些地方用了showAni
removeTweens(this);
// this.data = null;//看情况吧,有时候hidePanel后用了data,注意,还是先去掉吧
//移除事件
this.removeEvents();
//派发销毁事件,主要用于场景及弹框控制
this.dispatchEvent("onDestroy");
super.destroy();
}
}
import { Module } from "./Module";
export class Panel extends Module {
protected isShowing: boolean
showAni() {
if (this.isShowing) return;
this.isShowing = true;
let oriY = this.y || 0;
this.y = -200;
FYGE.Tween.get(this)
.to({y: oriY}, 500, FYGE.Ease.quartOut)
.call(() => {
this.isShowing = false;
})
}
initEvents() {
this.closeBtns.forEach(
btn => {
if (btn) btn.addEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this)
}
)
}
removeEvents() {
this.closeBtns.forEach(
btn => {
if (btn) btn.removeEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this)
}
)
}
/**
* 需要的放入,不重复写关闭按钮事件
*/
protected get closeBtns(): any[] {
return [this['closeBtn']]
}
hidePanel() {
this.destroy();
}
}
import { Module } from "./Module";
export class Scene extends Module {
/**
* 显示动画
* 继承时注意,回调要加
* 因为这种动画基本原场景最好不消失
*/
showAni(callback: Function) {
callback()
}
/**
* 统一更新方法
*/
updateScene() {
}
}
\ No newline at end of file
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from "../ctrls/sceneCtrl";
/**
* 添加进舞台的所有层级
* 仿白鹭的那套
*/
class Layers extends FYGE.Container {
private _bottomLayer: FYGE.Container;
private _sceneLayer: FYGE.Container;
private _popupLayer: FYGE.Container;
private _toastLayer: FYGE.Container;
private _topLayer: FYGE.Container;
private _shareLayer: FYGE.Container;
init(stage: FYGE.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();
//有些时候,定宽的时候,部分layer置顶,部分居中,再处理
//为了都置顶和置左,stage的方式永远居中视窗,要么改stage永远左上为00
// this[arr[i]].y = this.stageOffsetY;
//如果定宽这里没必要,肯定是0
// this[arr[i]].x = this.stageOffsetX;//去掉,定高时就居中了
this.addChild(this[arr[i]]);
}
//都以底部适配
this.sceneLayer.y = this.stageOffsetY;
// this.popupLayer.y = -this.stageOffsetY;
// this.popupLayer.y -= 420 / 2;
this.shareLayer.y = -this.stageOffsetY;
//初始化场景层级
SceneCtrl.instance.init(this.sceneLayer)
//初始化弹框层级
PanelCtrl.instance.init(this.popupLayer)
}
/**
* 底图所在层级,比如统一的背景
*/
get bottomLayer() { return this._bottomLayer }
/**
* 场景
*/
get sceneLayer() { return this._sceneLayer }
/**
* 弹框
*/
get popupLayer() { return this._popupLayer }
/**
* toast所在层级
*/
get toastLayer() { return this._toastLayer }
/**
* 顶层,比如统一标题栏等
*/
get topLayer() { return this._topLayer }
/**
* 分享引导层
*/
get shareLayer() { return this._shareLayer }
/**
* 舞台信息都放在layers里吧
* 舞台可见高度,初始化后才能使用
*/
get stageHeight() {
if (!this.stage) return 0;
return this.stage.viewRect.height;
}
/**
* 舞台可见宽度
*/
get stageWidth() {
if (!this.stage) return 0;
return this.stage.viewRect.width;
}
/**
* 适配方式x两边偏移的量,固定宽度x为0
*/
get stageOffsetX() {
if (!this.stage) return 0;
return this.stage.viewRect.x;
}
get stageOffsetY() {
if (!this.stage) return 0;
return this.stage.viewRect.y;
}
/**
* 舞台中心点位置x
*/
// get stageCenterX(): number {
// return this.stage.viewRect.x + this.stage.viewRect.width >> 1;
// }
/**
* 舞台中心点位置y,layer位置做过偏移的就不对了,所以还是自行算吧
*/
// get stageCenterY(): number {
// return this.stage.viewRect.y + this.stage.viewRect.height >> 1;
// }
}
export const layers = new Layers();
//先执行,在淘宝小程序中重新进入会再次初始化
export function destroyLayers() {
//所有层级移除,init会重新建
layers.removeChildren();
//从父级stage移除自己,init会重新加
if (layers.parent) layers.parent.removeChild(layers)
}
{
"name": "tbgame",
"version": "1.0.0",
"description": "",
"main": "index.html",
"devDependencies": {
"ali-oss": "^4.11.4",
"chalk": "^2.3.0",
"co": "^4.6.0",
"del": "^2.2.1",
"fs": "0.0.2",
"imagemin": "^7.0.1",
"imagemin-mozjpeg": "^8.0.0",
"imagemin-pngquant": "^8.0.0",
"mock-webpack-plugin": "^2.0.0",
"path": "^0.12.7",
"progress": "^2.0.0",
"ts-loader": "^4.0.0",
"tslint": "^5.9.1",
"typescript": "^2.7.2",
"webpack": "^4.1.0",
"webpack-cli": "^3.1.1",
"webpack-dev-server": "^3.1.0",
"webpack-merge": "^4.1.2",
"uglifyjs-webpack-plugin": "^2.1.2",
"psd": "^3.2.0"
},
"dependencies": {},
"scripts": {
"psd": "node scripts/psdH.js && node scripts/flushRes",
"createModule": "node scripts/createModule",
"flushRes": "node scripts/flushRes",
"handleRes": "node scripts/delRel && node scripts/copyRes && node scripts/createTm && node scripts/textureMerge && node scripts/delTm && node scripts/imageMin",
"upload": "node scripts/upload",
"build": "npm run handleRes && node scripts/mergeJson && npm run upload && npm run buildTS",
"watch": "webpack --watch",
"dev": "webpack-dev-server --open --config webpack.dev.js --host 0.0.0.0",
"buildTS": "webpack --config webpack.prod.js && node scripts/mergeJs",
"copyJs": "node scripts/copyJs"
},
"author": "MrKwon",
"license": "ISC"
}
{
"type": "activity",
"name": "babycare_xiaoxiao"
}
\ No newline at end of file
const resList = [
{
"name": "首页背景",
"ext": ".png",
"uuid": "3b3fc1da-24cc-486f-b4e8-9c709a75a999",
"url": "//yun.duiba.com.cn/spark/assets/df25ad82a96a406892ce239a2d5306debb947573.png"
},
{
"name": "one5",
"ext": ".png",
"uuid": "4c4f7e8f-fa2a-497b-ba96-14edb86f5651",
"url": "//yun.duiba.com.cn/spark/assets/4318da348b0444a64e74c641757b5372a1e34818.png"
},
{
"name": "zero5",
"ext": ".png",
"uuid": "858ff99a-c23f-4370-ac8a-d33607ea1e24",
"url": "//yun.duiba.com.cn/spark/assets/3b18448ebd9d18a18cdb0a7f3d8df89eea899c99.png"
},
{
"name": "bg5",
"ext": ".png",
"uuid": "b396aa87-69ce-483f-a903-e73af9d8a3a3",
"url": "//yun.duiba.com.cn/spark/assets/a43e6fa535f6fbc4d2e0ae08b6d259974a432f89.png"
},
{
"name": "one4",
"ext": ".png",
"uuid": "f53cfacc-068a-40d3-9de1-5438ffd8d43b",
"url": "//yun.duiba.com.cn/spark/assets/9077a33d2be2be7c622c9495bec250d034e98f87.png"
},
{
"name": "zero4",
"ext": ".png",
"uuid": "b0095834-59b6-4b49-93aa-88853b1ffdc2",
"url": "//yun.duiba.com.cn/spark/assets/2ae5c222d33792d3381f270221e6e8e825be741c.png"
},
{
"name": "bg4",
"ext": ".png",
"uuid": "aa5a04f1-ec78-4281-b189-208665ccd0c7",
"url": "//yun.duiba.com.cn/spark/assets/64a89157fd4457dfd83ad7ed656580eec59a96e1.png"
},
{
"name": "one3",
"ext": ".png",
"uuid": "3230d506-e914-4636-b11f-55f4064b4e02",
"url": "//yun.duiba.com.cn/spark/assets/d2643ae6e513b0cee10754d1f3dc2ee81b955019.png"
},
{
"name": "zero3",
"ext": ".png",
"uuid": "dd525255-e0a2-4bc1-a618-dbe509e90c83",
"url": "//yun.duiba.com.cn/spark/assets/471e2ccb36b1ccecd8361864ba8dcb1593b65597.png"
},
{
"name": "bg3",
"ext": ".png",
"uuid": "65d20d84-d74a-4ea8-a034-561446d773a4",
"url": "//yun.duiba.com.cn/spark/assets/326d3813ffeb46830514eec42e085add03e9cfcf.png"
},
{
"name": "one2",
"ext": ".png",
"uuid": "33e52b25-fc70-4472-8d00-39322ff53b14",
"url": "//yun.duiba.com.cn/spark/assets/f8cdbf36715b918aa75058887e964baddbbeb018.png"
},
{
"name": "zero2",
"ext": ".png",
"uuid": "d1eb7462-d729-4914-85d2-0d8350c75122",
"url": "//yun.duiba.com.cn/spark/assets/4d63516e9dc3b90bf5e96fe364cb8483458bfa75.png"
},
{
"name": "one1",
"ext": ".png",
"uuid": "ee65da42-9e27-443d-a192-d57eaa9c5e00",
"url": "//yun.duiba.com.cn/spark/assets/930ce9edc446d8730fd92479997e18f222983b3a.png"
},
{
"name": "zero1",
"ext": ".png",
"uuid": "6abcdace-fbf5-4e9a-a979-c003a3deae22",
"url": "//yun.duiba.com.cn/spark/assets/75559ed55f33fd1a22cfc7a1fc92a0a18edb8e5d.png"
},
{
"name": "bg1",
"ext": ".png",
"uuid": "f4d81213-1c64-4566-88e9-f0ede1c2396a",
"url": "//yun.duiba.com.cn/spark/assets/6b272bb4ef573a1468fce7ba14e9448347626d9f.png"
},
{
"name": "one",
"ext": ".png",
"uuid": "1ed0359b-b671-45b4-b2df-d8fcbeb12c78",
"url": "//yun.duiba.com.cn/spark/assets/bb71f76ba835514b85ed90c100f11b12b497fbe8.png"
},
{
"name": "zero",
"ext": ".png",
"uuid": "55707441-1e3a-4248-9e3b-2190f2b3d8eb",
"url": "//yun.duiba.com.cn/spark/assets/e6e8e7f29647f06d11b6a36395ac9053c89c7e1b.png"
},
{
"name": "bg",
"ext": ".png",
"uuid": "b76ff9aa-a410-4b12-b5e3-54aace0d2023",
"url": "//yun.duiba.com.cn/spark/assets/64db901ccc969ec061daca3566ad99d9f5b2e459.png"
},
{
"name": "召唤按钮 ",
"ext": ".png",
"uuid": "e0ac998f-f006-4b6d-abd9-d1c075ab975f",
"url": "//yun.duiba.com.cn/spark/assets/f57fadc1de5bfe126d044856c3ffef64206ae6e3.png"
},
{
"name": "召唤按钮-置灰",
"ext": ".png",
"uuid": "1348f382-511a-494c-a1ac-4e86e1877e6e",
"url": "//yun.duiba.com.cn/spark/assets/6df546392479e37233a4a3be3ff5b0edc6d487de.png"
},
{
"name": "助力明细按钮",
"ext": ".png",
"uuid": "0f40c63e-891a-4742-9a94-8061b29780f3",
"url": "//yun.duiba.com.cn/spark/assets/0e805d05cda2bca6d52344c024f62afeb1454040.png"
},
{
"name": "翻牌按钮",
"ext": ".png",
"uuid": "de107f35-fdfd-4ded-9766-e1eb2c8ca233",
"url": "//yun.duiba.com.cn/spark/assets/f149033b3a3f863425e9366f43a2bb086d435360.png"
},
{
"name": "牌",
"ext": ".png",
"uuid": "e072ea7e-6ccf-4762-9cc5-dad17dc6d5b7",
"url": "//yun.duiba.com.cn/spark/assets/873c74bf810623ff6b430de7f6ff2e15eb5b99e2.png"
},
{
"name": "翻",
"ext": ".png",
"uuid": "0226ab0f-6966-41c5-8e0d-eb90b2713cbb",
"url": "//yun.duiba.com.cn/spark/assets/50526768eeba39c808f4d05e61222ace41680f16.png"
},
{
"name": "请",
"ext": ".png",
"uuid": "0fa69229-54da-48b4-a49c-763c3f9d0bdb",
"url": "//yun.duiba.com.cn/spark/assets/5c735b72a10cbb89f056d2a98f4bed35ed11c8ed.png"
},
{
"name": "活动规则",
"ext": ".png",
"uuid": "0afdec46-69ad-4c95-83e7-cddae6f28f18",
"url": "//yun.duiba.com.cn/spark/assets/818b7cdbee52bf992ddfa274cf575c78875aa6a7.png"
},
{
"name": "奖品",
"ext": ".png",
"uuid": "8c3f9e66-6abe-4450-ad2e-f188a2236259",
"url": "//yun.duiba.com.cn/spark/assets/544aabca1336bd77ad243f81641a386c39f35757.png"
},
{
"name": "背景",
"ext": ".png",
"uuid": "cee6f836-ddbe-4ede-ab7b-3e9bec6fb07f",
"url": "//yun.duiba.com.cn/spark/assets/eb106be9a6e9940bc006fc040fdf6f495d121292.png"
},
{
"name": "邀请按钮10",
"ext": ".png",
"uuid": "4678fa12-0f31-40d7-84bb-89f323755faa",
"url": "//yun.duiba.com.cn/spark/assets/38ce6f82a9fc0522c51eef42590401340dc88368.png"
},
{
"name": "集齐书卡背景",
"ext": ".png",
"uuid": "061a32b5-a936-49c7-bf07-c6c6c086498b",
"url": "//yun.duiba.com.cn/spark/assets/38b92aad5f576993f2aa1fba5cc473d943d91bc7.png"
},
{
"name": "领取按钮",
"ext": ".png",
"uuid": "fd51b4e8-cd67-4ab2-a8dd-8470d7fda03b",
"url": "//yun.duiba.com.cn/spark/assets/de208daba893341ef41bcdda80e568fdb1275595.png"
},
{
"name": "关闭按钮",
"ext": ".png",
"uuid": "20429695-3be2-41d8-9640-d2dbc2ecf910",
"url": "//yun.duiba.com.cn/spark/assets/dfa06672b5ec93397ff9fdccf04b48850d668923.png"
},
{
"name": "被抢光背景",
"ext": ".png",
"uuid": "2b070729-c537-4b7a-a0b6-f1d539db36b9",
"url": "//yun.duiba.com.cn/spark/assets/091e5bdd4d8fb5646680b92c0f4938832ee49344.png"
},
{
"name": "知道按钮2",
"ext": ".png",
"uuid": "495892fb-4858-43f2-bc2e-6e9fe3ed892d",
"url": "//yun.duiba.com.cn/spark/assets/987ce1d4060d1ced715e9f044995d789a133ee9f.png"
},
{
"name": "继续按钮4",
"ext": ".png",
"uuid": "da32c6e4-03bf-476b-a70d-e576f10b473f",
"url": "//yun.duiba.com.cn/spark/assets/a937c15b1de3bec520368a4286f75e9d2163033d.png"
},
{
"name": "卡片背景",
"ext": ".png",
"uuid": "78eb8f94-aed7-4e8d-81d1-5d5cf18c1fb4",
"url": "//yun.duiba.com.cn/spark/assets/e2499de2fa72ef7b0f816524b3d39ac26369dc8d.png"
},
{
"name": "继续按钮3",
"ext": ".png",
"uuid": "60b0d023-0d6e-431e-b0c4-58cb29e53aa8",
"url": "//yun.duiba.com.cn/spark/assets/2d02fc74a7203c93d00dd99688fad0d9e3c84e57.png"
},
{
"name": "助力成功背景",
"ext": ".png",
"uuid": "260d0ac9-d53d-4eae-ab36-a3ecaaf8713a",
"url": "//yun.duiba.com.cn/spark/assets/2f5c62c415ced58212b46030aa446c19647f008a.png"
},
{
"name": "继续按钮2",
"ext": ".png",
"uuid": "6913c81e-4d4a-4300-8e46-a4a302f44c87",
"url": "//yun.duiba.com.cn/spark/assets/eccdf602166756d4b93f2f4a0b65e5e9c7dff1ef.png"
},
{
"name": "很遗憾背景",
"ext": ".png",
"uuid": "c401735f-d64e-464b-b23c-c927ce263d2e",
"url": "//yun.duiba.com.cn/spark/assets/2061d2c0fbbe5010de86f7524dfdc7cd59100850.png"
},
{
"name": "次数用完背景",
"ext": ".png",
"uuid": "86a3ec85-7492-40be-9305-65f90cb1651a",
"url": "//yun.duiba.com.cn/spark/assets/8e7b856b8c369dee7485abecc6a6833d3700d957.png"
},
{
"name": "邀请按钮",
"ext": ".png",
"uuid": "d2e82b07-ddab-4e2a-8d63-26eabd6bc960",
"url": "//yun.duiba.com.cn/spark/assets/29c7477b0a74115ddd5a2f4e45139c90301e2a32.png"
},
{
"name": "静态",
"ext": ".png",
"uuid": "61e345d9-f6ba-49e3-9df9-62cf04a5f10a",
"url": "//yun.duiba.com.cn/spark/assets/e2519d3f0a711d8309cc81cc239131679a39b261.png"
},
{
"name": "知道按钮",
"ext": ".png",
"uuid": "7de15c0a-a245-460f-8967-aaa786e9dccb",
"url": "//yun.duiba.com.cn/spark/assets/2b57d4ecda2faa12228dfcddfd74bc2482e09369.png"
},
{
"name": "端外助力背景",
"ext": ".png",
"uuid": "bb3fa187-b99e-4a03-9431-615e54544c46",
"url": "//yun.duiba.com.cn/spark/assets/c0ed60c826b537e236d33c53a0702971cf97b648.png"
},
{
"name": "帮他助力按钮",
"ext": ".png",
"uuid": "ac60a8a5-ab2d-4cbc-9fa4-15e764af991f",
"url": "//yun.duiba.com.cn/spark/assets/86cdb9b7e1ffa4ed5d382490042473beb3d8c5ce.png"
},
{
"name": "立即参与按钮",
"ext": ".png",
"uuid": "2a667012-b77d-44c1-aa48-da82a70b2216",
"url": "//yun.duiba.com.cn/spark/assets/5e35ad651cda5da5a32f19c3364a44853c721a03.png"
},
{
"name": "底部",
"ext": ".png",
"uuid": "4dd0bfac-44e0-480c-8456-73f0d96be646",
"url": "//yun.duiba.com.cn/spark/assets/5e3f91601c7e2eac408987627287fe18d6624bc9.png"
},
{
"name": "端内助力背景",
"ext": ".png",
"uuid": "d7ff77ed-0522-4f2b-b7e0-457d64ae2dbe",
"url": "//yun.duiba.com.cn/spark/assets/1565acc5feb57050c9893618924de67d2b12b12c.png"
},
{
"name": "助力榜",
"ext": ".png",
"uuid": "7084c2ab-1522-440f-9661-9d2f6a09abda",
"url": "//yun.duiba.com.cn/spark/assets/7e07d3f8b159d6ae22c6f5db383a3a195e1c820b.png"
},
{
"name": "活动规则背景",
"ext": ".png",
"uuid": "5a07c20f-e527-49a1-8e52-e8da89b0bba6",
"url": "//yun.duiba.com.cn/spark/assets/c84c98ea19084446dfb3580db37a480e06399998.png"
}
]
export default resList;
{
"groups": [
{
"keys": "comCloseBtn.png,toastBg.png,waitingBg.png,waitingRot.png",
"name": "common"
},
{
"keys": "map_bg1.jpg",
"name": "startScene"
}
],
"path": "./resource/"
}
\ No newline at end of file
var fs = require("fs");
var iconv = require('iconv-lite');
return
//读取json文件
var data = iconv.decode(fs.readFileSync("./resource/skin.json"), "utf-8");//GBK
//反序列化
data = JSON.parse(data); //eval(data)
reverseChildren(data);
const outJsonData = JSON.stringify(data, "", "\t");
var endPath = './src/';
var endFile = `export const SkinJson = ${outJsonData}`
fs.writeFileSync(endPath + "SkinJson.ts", endFile);
/**
*
* @param {*} arr
*/
function reverseChildren(arr) {
arr.children.reverse();
arr.children.forEach(element => { if (element.children && element.children.length) reverseChildren(element) });
}
\ No newline at end of file
var fs = require("fs");
var path = require('path');
var del = require('del');
var pathName = "./resource";
var inPath = "./resource/common/";
{
key: ["aa", "bb"]
}
var hash = {};//记录名字和所在文件夹
var files = fs.readdirSync(pathName);
files.forEach(function (file) {
//文件common,不处理
if (file == "common") return
//路径
let fPath = path.join(pathName, file);
//只处理文件夹
if (fs.statSync(fPath).isDirectory()) {
var sonFiles = fs.readdirSync(fPath);
//没有文件
if (!sonFiles.length) return;
sonFiles.forEach(function (s) {
if (!hash[s]) hash[s] = [];
hash[s + ""].push(file);
})
}
})
//遍历
for (var key in hash) {
//有重复的,拷贝到common,删除原文件夹里的文件,
if (hash[key].length > 1) {
// 拷贝到common
fs.writeFileSync(inPath + key, fs.readFileSync(pathName + "/" + hash[key][0] + "/" + key));
console.log("重复资源:" + key)
//删除原文件夹里的文件,
hash[key].forEach(function (s) {
del(pathName + "/" + s + "/" + key)
})
}
}
console.log("重复资源处理完成")
\ No newline at end of file
var fs = require("fs");
// fs.writeFileSync(
// "./released/output.js",
// fs.readFileSync("./output.js")
// )
// var endPath = 'D:/duibaGame/测试项目0527/taobaominiTest/client/pages/index1/';
var endPath = 'D:/duibaGame/淘宝项目/babycareXiaoxiaoleTBminiTry/client/pages/index/';
var version = Math.round(new Date().getTime() / 1000);
// fs.writeFileSync(endPath + "output." + version + ".js", fs.readFileSync("./released/output.js"));
fs.writeFileSync(endPath + "output.js", fs.readFileSync("./released/output.js"));
// console.log("js覆盖完成")
console.log(`版本号:
${version}`)
\ No newline at end of file
var fs = require('fs');
var path = require("path");
function writeFile(p, text) {
fs.writeFile(p, text, function (err) {
// if (!err)
// console.log("写入成功!")
})
}
//递归创建目录 同步方法
function mkdirsSync(dirname) {
if (fs.existsSync(dirname)) {
return true;
} else {
if (mkdirsSync(path.dirname(dirname))) {
// console.log("mkdirsSync = " + dirname);
fs.mkdirSync(dirname);
return true;
}
}
}
function _copy(src, dist) {
var paths = fs.readdirSync(src)
paths.forEach(function (p) {
var _src = src + '/' + p;
var _dist = dist + '/' + p;
var stat = fs.statSync(_src)
if (stat.isFile()) {// 判断是文件还是目录
fs.writeFileSync(_dist, fs.readFileSync(_src));
} else if (stat.isDirectory()) {
copyDir(_src, _dist)// 当是目录是,递归复制
}
})
}
/*
* 复制目录、子目录,及其中的文件
* @param src {String} 要复制的目录
* @param dist {String} 复制到目标目录
*/
function copyDir(src, dist) {
var b = fs.existsSync(dist)
// console.log("dist = " + dist)
if (!b) {
// console.log("mk dist = ",dist)
mkdirsSync(dist);//创建目录
}
// console.log("_copy start")
_copy(src, dist);
}
function createDocs(src, dist, callback) {
// console.log("createDocs...")
copyDir(src, dist);
// console.log("copyDir finish exec callback")
if (callback) {
callback();
}
}
createDocs("./resource", "./released/resource/", function () {
console.log("资源拷贝成功")
})
\ No newline at end of file
var fs = require("fs");
//类型对应
const DISRES = {
'container': "Container",
'text': "TextField",
'button': "Button",
'sprite': "Sprite",
'rect': "Graphics",
// 'skin'
}
const skinDataAll = JSON.parse(fs.readFileSync("./resource/skin.json"))
//取指令后的参数
let arg = process.argv.splice(2);
//类名
var className = arg[0];
//皮肤名字
var skinName = arg[0]; //arg[1];
//是否弹框,存在参数就是场景
var moduleType = className.indexOf("Scene") > -1 ? "Scene" : "Panel";
// console.log('类名:',className)
// console.log('皮肤名字:',skinName)
var skinData = getSkinDataByName(skinName, skinDataAll);
if (!skinData) {
console.log(skinName + "皮肤不存在");
return
}
var groupName = skinData.name;
var endPath = moduleType == "Panel" ? "./src/panels/" : "./src/scenes/";
// var ids = skinData.ids ? cutIds(skinData.ids) : ""
var template =
(moduleType == "Panel" ?
'import { Panel } from "../../module/views/Panel";\n' :
'import { Scene } from "../../module/views/Scene";\n') +
'export class ' + className + ' extends ' + moduleType + ' {\n' +
'\tget groupNames() { return ["' + groupName + '"] }\n' +
'\tget skinName() { return "' + skinName + '" }\n' +
'\t' + getIds(skinData) + "\n" +
'\tinitUi() {\n' +
' \n' +
'\t}\n' +
'\tstart(data) {\n' +
'\t\tsuper.start();\n' +
'\t}\n' +
'\tinitEvents() {\n' +
'\t\tsuper.initEvents();' +
' \n' +
'\t}\n' +
'\tremoveEvents() {\n' +
'\t\tsuper.removeEvents();' +
' \n' +
'\t}\n' +
'}\n'
//取出skinName里的Item
var skins = getItemSkins(skinData)
if (skins.length) template = 'import { Item } from "../../module/views/Item";\n' + template;
for (var i = 0; i < skins.length; i++) {
var skin = skins[i];
template +=
'class ' + upperCaseFirstChar(skin.name) + ' extends Item {\n' +
'\tget skinName() { return "' + skin.name + '" }\n' +
'\t' + getIds(skin) + "\n" +
'\tinitUi(data?) {\n' +
' \n' +
'\t}\n' +
'\tupdateData(data?) {\n' +
' \n' +
'\t}\n' +
'\tinitData(id: number, data: any): void {\n' +
'\t\tsuper.initData(id,data);\n' +
' \n' +
'\t}\n' +
'\tresetData() {\n' +
' \n' +
'\t}\n' +
'}\n'
}
fs.writeFileSync(endPath + className + ".ts", template)
// function cutIds(ids) {
// var str = ''
// var arr = ids.split(";")
// // console.log(arr)
// arr.forEach(element => {
// if (element) str += element + ";\n\t"
// });
// return str
// }
/**
* 获取皮肤数据
* @param {*} skinName
* @param {*} skinNode
*/
function getSkinDataByName(skinName, skinNode) {
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;
}
//取出所有的
function getItemSkins(skinNode) {
var arr = []
for (var i = 0; i < skinNode.children.length; i++) {
var c = skinNode.children[i];
if (c.type == 'skin') arr.push(c);
}
return arr
}
function getIds(skinNode, str) {
str = str || ''
for (var i = 0; i < skinNode.children.length; i++) {
var c = skinNode.children[i];
if (c.id) str += c.id + ":FYGE." + DISRES[c.type] + ";\n\t";
if (c.type == "container" && c.type != "skin") str = getIds(c, str);
}
return str
}
function upperCaseFirstChar(str) {
return str.charAt(0).toUpperCase() + str.slice(1)
}
var fs = require("fs");
var iconv = require('iconv-lite');
var del = require('del');
var readPath = "./released/resource/";
//读取json文件
var data = iconv.decode(fs.readFileSync(readPath + "res.json"), "utf-8");//GBK
//反序列化
data = JSON.parse(data); //eval(data)
//取出里面的图片,暂存到tm文件夹中,同时删除文件夹里的,和本身json里的
if (!fs.existsSync("./released/tm"))
fs.mkdirSync("./released/tm");
for (var i = 0; i < data.groups.length; i++) {
var name = data.groups[i].name;
var path = readPath + name + "/";
var arr = data.groups[i].keys.split(",");
//取出图片的,注意已排除jpg
var images = arr.filter((f) => { return (f.substr(-4) == ".png" /*|| f.substr(-4) == ".jpg"*/) })
//没有图片,
if (!images.length) continue;
//去掉原先数据里的
// data.groups[i].keys = arr.filter((f) => { return (f.substr(-4) != ".png" && f.substr(-4) != ".jpg") }).join(",");
//添加新的json,加到atlas里
// if (data.groups[i].keys) data.groups[i].keys += ","
data.groups[i].atlas = name + ".json"
//读取原先路径里的图片,写到tm的文件夹里,并删除原文件夹里的图片
fs.mkdirSync("./released/tm/" + name);
for (var m = 0; m < images.length; m++) {
fs.writeFileSync(
"./released/tm/" + name + "/" + images[m],
fs.readFileSync(path + images[m])
)
del(path + images[m])
}
}
//序列化
fs.writeFileSync(readPath + "res.json", JSON.stringify(data, "", "\t"));
var fs = require("fs");
var del = require('del');
function delDir(path, isSelf) {
let files = [];
if (fs.existsSync(path)) {
files = fs.readdirSync(path);
files.forEach((file, index) => {
let curPath = path + "/" + file;
if (fs.statSync(curPath).isDirectory()) {
delDir(curPath); //递归删除文件夹
} else {
fs.unlinkSync(curPath); //删除文件
}
});
if (!isSelf) fs.rmdirSync(path);
}
}
var paths = './released/';//设置删除路径
// delDir(paths, true);//删除文件夹
del(paths).then(() => {
fs.mkdirSync(paths);
}).catch(()=>{
fs.mkdirSync(paths);
})
// var tasks = [];
// function addTask(task) {
// tasks.push(task);
// }
// function next() {
// if (tasks.length > 0) {
// tasks.shift()();
// } else {
// return;
// }
// }
// var delRel = function () {
// del(paths).then(() => {
// // console.log("del")
// next();
// })
// }
// var createRel = function () {
// fs.mkdirSync(paths);
// // console.log("create")
// next();
// }
// addTask(delRel)
// addTask(createRel)
// next();
\ No newline at end of file
var del = require('del');
del("./released/tm")
\ No newline at end of file
//生成res.json
//遍历资源文件夹,生成
var fs = require('fs');
var path = require("path");
var readPath = "./resource/"
var files = fs.readdirSync(readPath);
var obj = { groups: [] };//每项包括keys合name
files.forEach(function (file) {
//路径
let fPath = path.join(readPath, file);
//只处理文件夹
if (fs.statSync(fPath).isDirectory()) {
//继续读每个子文件夹,json和png名字有相同的,只留json,
var sonFiles = fs.readdirSync(fPath);
//没有文件
if (!sonFiles.length) return
//取出所有json
var jsons = sonFiles.filter((f) => { return f.substr(-5) == ".json" })
//去掉json所带png的图片
sonFiles = sonFiles.filter((f) => { return jsons.indexOf(f.substring(0, f.length - 4) + ".json") == -1 })
//去掉mac上的缓存文件
sonFiles = sonFiles.filter((f) => { return f != '.DS_Store' })
var group = {
keys: "",
name: file
}
for (var i = 0; i < sonFiles.length; i++) {
if (i != 0) group.keys += ",";
group.keys += sonFiles[i]
}
obj.groups.push(group)
}
})
obj.path="./resource/"
console.log("资源更新完成")
//生成json
fs.writeFileSync(readPath + "res.json", JSON.stringify(obj, "", "\t"));
//TS也更新
var endPath = './src/';
var endFile = `export const ResJson = ${JSON.stringify(obj, "", "\t")}`
fs.writeFileSync(endPath + "ResJson.ts", endFile);
\ No newline at end of file
const imagemin = require('imagemin');
// const imageminJpegtran = require('imagemin-jpegtran');imagemin-mozjpeg
const imageminJpegtran = require('imagemin-mozjpeg');
const imageminPngquant = require('imagemin-pngquant');
var fs = require('fs');
var path = require('path');
// 要处理的图片文件夹路径
var altasPath = "./released/resource/"
var folders = getFolders(altasPath);
folders.map(async function (folder) {
const files = await imagemin([altasPath + folder + '/*.{png,jpg}'], {
destination: altasPath + folder,
plugins: [
imageminJpegtran(),
imageminPngquant({
quality: [0.6, 0.8]
})
]
});
if (files && files.length) {
files.forEach((v) => {
console.log("压缩图片成功:", v.sourcePath.substring(v.sourcePath.lastIndexOf("/") + 1, v.sourcePath.length))
})
}
});
function getFolders(dir) {
return fs.readdirSync(dir)
.filter(function (file) {
return fs.statSync(path.join(dir, file)).isDirectory();
});
}
\ No newline at end of file
var fs = require("fs");
// fs.writeFileSync(
// "./released/output.js",
// fs.readFileSync("./output.js")
// )
var endPath = './released/';
if(!fs.existsSync(endPath))
{
fs.mkdirSync(endPath);
}
fs.writeFileSync(endPath + "output.js",
'import * as FYGE from "fyge-tbmini";\n' +
// 'import * as SvgaParser from "svga-parser";\n' +
fs.readFileSync("./output.js"));
console.log("js生成")
var fs = require("fs");
var path = require('path');
var del = require('del');
var iconv = require('iconv-lite');
const join = require('path').join;
//写入图集的文件夹,将文件夹内所有的json合并,并删除原先json
var readPath = "./released/resource/";
//读取json文件
var data = iconv.decode(fs.readFileSync(readPath + "res.json"), "utf-8");//GBK
//反序列化
data = JSON.parse(data);
var files = fs.readdirSync(readPath);
// let obj = {};
let count = 0;
let countAll = files.length
files.forEach(function (file) {
//路径
let fPath = join(readPath, file);
//只处理文件夹
if (fs.statSync(fPath).isDirectory()) {
//读文件夹fPath里的json文件
fs.readdir(fPath, function (err, files) {
if (err) {
console.warn(err)
} else {
var hasJson
//遍历
for (var i = 0; i < files.length; i++) {
let filename = files[i];
if (filename.indexOf(".json") == -1) continue
hasJson = true;
//获取当前文件的绝对路径
let filedir = path.join(fPath, filename);
let content = fs.readFileSync(filedir, 'utf-8');
let group = getGroupByName(filename.replace(".json", ""), data.groups)
group.atlas = JSON.parse(content);
//删除原先json
del(filedir)
if (++count == countAll) endFun();
}
if(!hasJson)if (++count == countAll) endFun();
//序列化,不格式化,节省内存
}
})
} else {
if (++count == countAll) endFun();
}
})
function endFun() {
console.log("资源配置js生成完毕")
// del(join(readPath, "res.json"))
fs.writeFileSync(readPath + "res.json", JSON.stringify(data, "", "\t"));
}
function getGroupByName(name, groups) {
var group;
for (var i = 0; i < groups.length; i++) {
if (groups[i].name === name) {
group = groups[i];
break;
}
}
return group
}
var fs = require("fs");
var PSD = require('psd');
var path = require('path');
// const mkdirp = require('mkdirp');
//千万别再执行,否则覆盖
return
var options = {
//导出图片的目录,没有就导在psd所在目录
outImgDir: "./resource/",
//导出Json的目录,没有就不导出
outJsonDir: "./resource/",
}
//psd文件所在文件夹目录
var pathName = "./psd";
var files = fs.readdirSync(pathName);
//只输出一个数据,就算多个psd,也按照每个psd的第一级进入root的children
var rootStructure = {
'x': 0,
'y': 0,
'type': "container",
'children': []
}
files.forEach(async function (psdFileName) {
//获取当前文件的后缀名
var extname = path.extname(psdFileName);
//后缀psd的,进行切图
if (extname.indexOf(".psd") >= 0) {
const psdFile = pathName + "/" + psdFileName
const psdFilePath = path.resolve(psdFile);
var pathInfo = path.parse(psdFile);
const psdData = PSD.fromFile(psdFilePath);//open(异步),fromDroppedFile(异步,拖入文件),fromFile
psdData.parse();
const rootNode = psdData.tree();
//按照第一层的进行分组导出
for (let i = 0; i < rootNode._children.length; i++) {
//一个组,比如开始页面,游戏页面等
const group111 = rootNode._children[i]
const queueNodes = [];
const queueNodesIndex = [];
const queueNodesName = [];
const queueNodesStructure = [];
//如果不是组,直接导common文件夹
if (!group111._children || !group111._children.length) {
saveAsPng("common", group111.name, group111)
} else {
const groupName = rootNode._children[i].name;
//颠倒一下
// group111._children.reverse()
queueNodes.push(group111._children);
queueNodesIndex.push(0);
queueNodesName.push(undefined);
//首层的容器默认都是0,0,所以他的left和top修改下
group111.left = group111.top = 0;
const psdStructure = {
// 'ids': "",
"name": groupName,
'x': 0,
'y': 0,
'type': "container",
'children': []
};
queueNodesStructure.push(psdStructure);
queueLoop: while (0 < queueNodes.length) {
const queueIndex = queueNodes.length - 1;
const nodes = queueNodes[queueIndex];
const nodesStructure = queueNodesStructure[queueIndex];
let nodesIndex = queueNodesIndex[queueIndex];
let nodesName = queueNodesName[queueIndex];
if (nodesName === undefined) {
nodesName = '';
} else {
nodesName += path.sep;
}
while (nodesIndex < nodes.length) {
const node = nodes[nodesIndex];
nodesIndex++;
// if (node.layer.visible === false) continue;
//分割一下
const splitArr = node.name.split("_");
if (node.type === 'group') {
//如果是按钮的组,就单纯按钮的三种贴图,第一个是正常,第二个是无法点击,第三个down
if (splitArr[1] == "btn") {
const structure = {
'name': splitArr[0],
'x': node.left - (node.parent ? node.parent.left : 0),
'y': node.top - (node.parent ? node.parent.top : 0),
'type': "button",
};
structure.props = {}
// structure.source = splitArr[0] + ".png"
if (splitArr[2]) {
structure.id = splitArr[2];
// psdStructure.ids += splitArr[2] + ":FYGE.Button;"
}
saveAsPng(groupName, node._children[0].name, node._children[0]);
structure.props.tUp = node._children[0].name + ".png";
if (node._children[1]) {
saveAsPng(groupName, node._children[1].name, node._children[1]);
structure.props.tDisable = node._children[1].name + ".png";
}
if (node._children[2]) {
saveAsPng(groupName, node._children[2].name, node._children[2]);
structure.props.tDown = node._children[2].name + ".png";
}
nodesStructure.children.push(structure);
}
//单纯的组
else {
//颠倒一下
// node._children.reverse()
queueNodes.push(node._children);
queueNodesIndex[queueIndex] = nodesIndex;
queueNodesIndex.push(0);
queueNodesName.push(nodesName + node.name);
const structure = {
'name': splitArr[0],
'x': node.left - (node.parent ? node.parent.left : 0),
'y': node.top - (node.parent ? node.parent.top : 0),
// 'id': splitArr[2]||,//对于group
'type': "container",
'children': [],
};
if (splitArr[1] == "skin") {//这种情况不该有id,但是貌似没法集合id了
structure.type = "skin"
} else if (splitArr[1]) {
structure.id = splitArr[1];
// psdStructure.ids += splitArr[1] + ":FYGE.Container;"
}
nodesStructure.children.push(structure);
queueNodesStructure.push(structure);
continue queueLoop;
}
} else {
//如果单纯作为贴图,只保存,不进入节点
if (splitArr[1] == "tex") {
saveAsPng(groupName, splitArr[0], node)
continue;
}
const structure = {
'name': splitArr[0],
'x': node/*.layer*/.left - (node.parent ? node.parent.left : 0),
'y': node/*.layer*/.top - (node.parent ? node.parent.top : 0),
// 'width': node.layer.width,
// 'height': node.layer.height
'alpha': node.layer.opacity / 255,
};
//如果是文本
if (node.layer.typeTool) {
structure.type = "text";
const text = node.layer.typeTool();
const sizes = text.sizes();
// if (splitArr[0] == "20%") console.log(sizes)
// var size = sizes && sizes.length > 1 ? sizes[0] || 12 :
// sizes ? (sizes[0] || 24) / 2 : 12
var size = sizes ? sizes[0] || 12 : 12 //这个psd又是正常的
const colors = text.colors()[0];
structure.props = {
text: text.textValue.replace("\r", "\n"),
size,
fillColor: rgb2String(colors),
textAlpha: colors[3] / 255 || 1,
}
if (splitArr[1]) {
//加入全局,方便复制
// psdStructure.ids += splitArr[1] + ":FYGE.TextField;";
structure.id = splitArr[1];
}
}
//如果是矢量图,考虑是否需要,简单点判断吧
else if (node.layer.solidColor &&
node.layer.vectorMask().paths[2].numPoints == 4 &&
(!node.layer.vectorMask().paths[3] || node.layer.vectorMask().paths[3].recordType == 2)
) {
const { r, g, b } = node.layer.solidColor();
let fillColor = rgb2String([r, g, b]);
structure.type = 'rect';
structure.props = {
width: node.width,
height: node.height,
fillColor
}
if (splitArr[1]) {
structure.id = splitArr[1];
// psdStructure.ids += splitArr[1] + ":FYGE.Graphics;"
}
}
//标记过按钮的
else if (splitArr[1] == "btn") {
structure.type = "button";
structure.props = {
tUp: splitArr[0] + ".png"
}
// structure.source = splitArr[0] + ".png"
if (splitArr[2]) {
structure.id = splitArr[2];
// psdStructure.ids += splitArr[2] + ":FYGE.Button;"
}
saveAsPng(groupName, splitArr[0], node)
}
//保存图片
else {
structure.type = "sprite";
//如果标记过jpg的
if (splitArr[1] == "jpg") {
structure.props = {
source: splitArr[0] + ".jpg"
}
// structure.source = splitArr[0] + ".jpg"
saveAsPng(groupName, splitArr[0], node, "jpg");
if (splitArr[2]) {
structure.id = splitArr[2];
// psdStructure.ids += splitArr[2] + ":FYGE.Sprite;"
}
} else {
structure.props = {
source: splitArr[0] + ".png"
}
// structure.source = splitArr[0] + ".png"
saveAsPng(groupName, splitArr[0], node);
if (splitArr[1]) {
structure.id = splitArr[1];
// psdStructure.ids += splitArr[1] + ":FYGE.Sprite;"
}
}
}
nodesStructure.children.push(structure);
}
}
queueNodes.pop();
queueNodesIndex.pop();
queueNodesName.pop();
queueNodesStructure.pop();
}
//存入root
rootStructure.children.push(psdStructure)
// const outJsonData = JSON.stringify(psdStructure/*.group*/, "", "\t");
//如果需要导出ui数据
// if (options.outJsonDir) {
// const outJsonDirPath = path.resolve(options.outJsonDir + groupName);
// const outJsonPath = path.join(outJsonDirPath, groupName + '.json');
// // make output directory.
// if (!fs.existsSync(outJsonDirPath)) {
// fs.mkdirSync(outJsonDirPath);
// }
// // output file.
// fs.writeFileSync(outJsonPath, outJsonData);
// }
}
}
}
})
//导出所有的数据
if (options.outJsonDir) {
//倒转一下所有children的层级
const outJsonData = JSON.stringify(rootStructure/*.group*/, "", "\t");
const outJsonDirPath = path.resolve(options.outJsonDir);
const outJsonPath = path.join(outJsonDirPath, 'skin.json');
if (!fs.existsSync(outJsonDirPath)) {
fs.mkdirSync(outJsonDirPath);
}
fs.writeFileSync(outJsonPath, outJsonData);
//代码也保存
var endPath = './src/';
var endFile = `export const SkinJson = ${outJsonData}`
fs.writeFileSync(endPath + "SkinJson.ts", endFile);
}
function rgb2String(rgb) {
var hex = ((rgb[0] << 16) + (rgb[1] << 8) + (rgb[2] | 0));
hex = hex.toString(16);
hex = '000000'.substr(0, 6 - hex.length) + hex;
return `#${hex}`;
}
/**
*
* @param {string} dirName 文件夹名字
* @param {string} name 图片名称
* @param {*} node
* @param {*} format 保存图片格式,默认png
*/
function saveAsPng(dirName, name, node, format = "png") {
const outImgDirPath = options.outImgDir + dirName;
// mkdirp.sync(outImgDirPath);
if (!fs.existsSync(outImgDirPath)) fs.mkdirSync(outImgDirPath);
console.log('保存图片:' + name + '.' + format);
//保存成图片
node.layer.image.saveAsPng(path.join(outImgDirPath, name + '.' + format));
}
/**
*
* @param {*} arr
*/
function reverseChildren(arr) {
arr.children.reverse();
arr.children.forEach(element => { if (element.children && element.children.length) reverseChildren(element) });
}
var fs = require("fs");
var exec = require('child_process').exec;
var iconv = require('iconv-lite');
var del = require('del');
const join = require('path').join;
//写入图集的文件夹
var outPath = "./released/resource/";
//读取散图的文件夹
var readPath = "./released/tm/";
var files = fs.readdirSync(readPath);
files.forEach(function (file) {
//路径
let fPath = join(readPath, file);
//只处理文件夹
if (fs.statSync(fPath).isDirectory()) {
//判断文件夹内是否有图片
if (!judgeHasImage(fPath)) return;
var cli = getTmCmd(fPath, outPath + file + "/", file);
//如果文件夹不存在
if (!fs.existsSync(outPath + file)) {
fs.mkdirSync(outPath + file);
}
else {
//图集文件存在就删除
if (fs.existsSync(outPath + file + "/" + file + ".json")) {
del(outPath + file + "/" + file + ".json")
}
if (fs.existsSync(outPath + file + "/" + file + ".png")) {
del(outPath + file + "/" + file + ".png")
}
}
//执行合图指令
exec(cli, { encoding: 'utf8' }, function (err, stdout, stderr) {
if (err) {
console.log(err);
return;
}
// console.log('stdout:' + stdout);
// console.log('stderr:' + stderr);
console.log('生成图集:' + file);
var pathname = outPath + file + "/" + file + ".json";
//有中文命名时处理
var data = iconv.decode(fs.readFileSync(pathname), "GBK");//GBK,window版本只能GBK,TexturePacker版本问题,mac改成utf-8
// console.log(data)
//反序列化
data = JSON.parse(data); //eval(data)
//重写数据
var obj = {};
var frames = data.frames;
var frameKeys = Object.keys(frames);
for (var i = 0; i < frameKeys.length; i++) {
const name = frameKeys[i];
const data = frames[name];
if (!data.frame) continue;
const sourceSize = data.trimmed !== false && data.sourceSize
? data.sourceSize : data.frame;
obj[name] = {
"x": data.frame.x,
"y": data.frame.y,
"w": data.frame.w,
"h": data.frame.h,
"ox": data.trimmed ? data.spriteSourceSize.x : 0,
"oy": data.trimmed ? data.spriteSourceSize.y : 0,
"sw": sourceSize.w,
"sh": sourceSize.h,
"ro": data.rotated,
}
}
//序列化,不格式化,节省内存
fs.writeFileSync(pathname, JSON.stringify(obj, "", "\t"));
})
}
})
//不同版本参数可能不同,具体情况具体分析
function getTmCmd(src, outPath, name) {
var cli =
'TexturePacker ' + //基础指令
src + //要合图集的文件夹路径
' --format json' + //图集数据格式
' --max-size 4096' + //最大尺寸
' --allow-free-size' +//允许使用最小尺寸输出,webgl最好别设置,现在小程序只有canvas模式,所以用最小尺寸导出吧
' --shape-padding 2' + //图片间隔
' --border-padding 2' + //边界间隔
' --enable-rotation' + //旋转 diable-rotation
' --opt RGBA8888' + //图片像素格式
' --trim' + //裁切透明像素 no-trim
' --sheet ' + outPath + name + '.png' + //图片名字
' --data ' + outPath + name + '.json'; //数据名字
return cli
}
/**
* 对文件使用utf8编码
* @param {string} pathname
*/
function applyUtf8(pathname) {
fs.writeFile(pathname, iconv.decode(fs.readFileSync(pathname), "GBK"), {
encoding: "UTF8"
}, function (err) {
if (err) {
throw err;
}
});
}
/**
* 判断文件夹内是否有图片
* @param {*} path
*/
function judgeHasImage(path) {
var files = fs.readdirSync(path);
for (var i = 0; i < files.length; i++) {
var itm = files[i]
var stat = fs.statSync(path + "/" + itm);
if (stat.isDirectory()) {
//递归读取文件
if (judgeHasImage(path + "/" + itm + "/")) return true;
} else {
if (itm.substr(-4) == ".jpg" || itm.substr(-4) == ".png") return true;
}
}
return false;
}
\ No newline at end of file
var fs = require('fs');
var path = require('path');
const co = require('co');
const OSS = require('ali-oss');
const chalk = require('chalk');
const ProgressBar = require('progress');
class TuiaAutoUpload {
constructor(props, type) {
this.type = type;
const defaultOptions = {
dir: undefined,
originDir: undefined
}
this.options = Object.assign({}, defaultOptions, props);
if (!this.options.dir || !this.options.originDir) {
console.log(chalk.red('缺少参数,初始化失败'))
return;
}
this.init();
}
init() {
var _this = this;
this.client = new OSS({
region: 'oss-cn-hangzhou',
accessKeyId: 'LTAI4Fw25WcfcGv7FvcHoiHK',
accessKeySecret: 'NZk1NtT9J5HFaAolNbtQdzTzLLvLYm',
bucket: _this.type === 'prod' ? 'duiba' : 'daily-duiba'
});
this.bar = new ProgressBar(chalk.yellow(` 文件上传中 [:bar] :current/${this.files().length} :percent :elapseds`), {
complete: '●',
incomplete: '○',
width: 20,
total: this.files().length,
callback: () => {
console.log(chalk.green('\n All complete.'));
console.log(chalk.blue(`\n 本次队列文件共${this.files().length}个,已存在文件${this.existFiles}个,上传文件${this.uploadFiles}个,上传失败文件${this.errorFiles}个\n`));
}
})
return this;
}
files() {
var _this = this;
if (this._files) return this._files;
this._files = [];
/**
* 文件遍历方法
* @param filePath 需要遍历的文件路径
*/
function fileDisplay(filePath) {
//根据文件路径读取文件,返回文件列表
var files = fs.readdirSync(filePath);
files.forEach(function (filename) {
//获取当前文件的绝对路径
var filedir = path.join(filePath, filename);
//根据文件路径获取文件信息,返回一个fs.Stats对象
var stats = fs.statSync(filedir);
var isFile = stats.isFile();//是文件
var isDir = stats.isDirectory();//是文件夹
if (isFile) {
var sep = '/';
if ('win32' == process.platform)
sep = '\\';
var newDirArr = filedir.split(sep);
newDirArr.shift();
_this._files.push(newDirArr.join('/'));
}
if (isDir) {
fileDisplay(filedir);//递归,如果是文件夹,就继续遍历该文件夹下面的文件
}
});
}
//调用文件遍历方法
fileDisplay(this.options.dir);
return this._files;
}
start() {
this.files().map((file, index) => {
let _this = this;
const path1 = path.join(path.resolve(__dirname, '..'), 'released', file);
let originFile;
this.existFiles = 0;
this.uploadFiles = 0;
this.errorFiles = 0;
co(function* () {
const originPath = `${_this.options.originDir}${file}`;
try {
originFile = yield _this.client.head(originPath);
} catch (error) {
originFile = error;
}
if (_this.type === 'prod') {
if (originFile.status === 404) {
yield _this.client.put(originPath, path1);
_this.uploadFiles += 1;
} else {
_this.existFiles += 1;
}
} else if (_this.type === 'dev') {
if (originFile.status === 404 || originFile.status === 200) {
_this.existFiles += 1;
}
yield _this.client.put(originPath, path1, {
headers: {
'Cache-Control': 'no-cache'
}
})
_this.uploadFiles += 1;
}
_this.bar.tick();
}).catch(function (err) {
_this.errorFiles += 1;
console.log(err);
});
});
}
}
const configFileName = 'project.json';
if (!fs.existsSync(configFileName)) {
throw new Error(`${configFileName}不存在.`)
}
let config = fs.readFileSync('project.json');
config = JSON.parse(config + '');
if (!config.type) {
throw new Error(`${configFileName}的type不存在.`)
}
if (!config.name) {
throw new Error(`${configFileName}的name不存在.`)
}
const now = new Date();
const version = Math.round(now.getTime() / 1000);
console.log(`版本号:
${version}`)
const autoupload = new TuiaAutoUpload({
dir: './released/',
// dir: path.join(__dirname, './released/'),
originDir: `/db_games/${config.type}/${config.name}/${version}/`
}, "prod")
autoupload.start()
var iconv = require('iconv-lite');
var readPath = "./released/resource/";
//读取json文件
var data = iconv.decode(fs.readFileSync(readPath + "res.json"), "utf-8");//GBK
//反序列化
data = JSON.parse(data);
data.path = `https://yun.duiba.com.cn/db_games/${config.type}/${config.name}/${version}/resource/`
//写入目标文件夹,可配置,每个项目必须修改,或者直接和project的保持一致(淘宝项目文件固定后)
var endPath = './src/';
var endFile = `export const ResJson = ${JSON.stringify(data, "", "\t")}`
fs.writeFileSync(endPath + "ResJson.ts", endFile);
\ No newline at end of file
import { RES } from "../module/RES";
import { layers, destroyLayers } from "../module/views/layers";
import { ResJson } from "./ResJson";
import { G_EVENT } from "./common/G_EVENT";
import { destroyAllCtrls, changeScene } from "../module/ctrls";
import { StartScene } from "./scenes/StartScene";
import { destroyNetData } from "./TaoBaoNet";
import resCanvasList from '../resCanvasList';
/**
* 全局事件,为了和小程序交互
* 有可能多处页面用到,所以单开
*/
export const GDispatcher = new FYGE.EventDispatcher();
export class Main {
//主舞台
stage: FYGE.Stage;
private requestID;
private _pause: boolean;
constructor(canvas: HTMLCanvasElement) {
var sysInfo;
//@ts-ignore 存在my就初始化
if (my) {
FYGE.initedByCanvas(canvas)
//@ts-ignore 存在my就初始化
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;
//开始循环
// FYGE.Stage.flushAll();
//stage初始化
stage.addEventListener(FYGE.Event.INIT_STAGE, this.onAddToStage, this);
//帧率
// var stats = new FYGE.Stats("canva4stats");
//循环
var self = this;
// console.log(FYGE)
loop();
function loop() {
if (!self._pause) {
// stats.begin();
FYGE.Tween.flush()
stage.flush();
// stats.end();
}
//@ts-ignore
self.requestID = FYGE.getRequestAnimationFrame()(loop);
}
}
private async onAddToStage() {
//初始化层级
layers.init(this.stage);
console.log("初始化层级完成")
//初始化资源配置
// RES.loadConfig(ResJson);
// console.log("初始化资源配置完成")
//皮肤配置加载
// RES.loadSkinConfig(SkinJson);
//加载通用资源
// await RES.loadGroup("common");
await RES.loadSparkAssets(resCanvasList);
console.log("通用资源加载完成")
//打开开始场景
changeScene(StartScene);
// changeScene(LoadingScene);
// changeScene(SStartScene);
// changeScene(StoryScene);
// changeScene(AdoptScene);
// console.log("恶趣味去")
// showPanel(NoStepPanel)
//测试
// sendTbNet(TbNetName.aaa, {}, (s, res) => {
// console.log(res)
// })
//获取数据,,必成功
// showWaiting();
// sendTbNet(TbNetName.getAppData, {}, (s, res) => {
// hideWaiting();
// Tool.globalData = res.data;
// changeScene(PlayScene);
// //先去获取下任务列表的商品信息吧
// sendTbNet(TbNetName.getTaskList, { activityId: Tool.globalData.activityId }, (s, res) => {
// if (s) Tool.browseItems = res.data.browseItemIds.content;
// })
// })
}
//在小程序显示时调用onShow
run() {
this._pause = false
//@ts-ignore Tween计时清零
// FYGE.Tween._lastTime = null //下面的_pause 不执行,先去掉,试试有没有问题
GDispatcher.dispatchEvent(G_EVENT.ON_SHOW);
}
//在小程序隐藏时调用onHide
pause() {
// this._pause = true;//先去掉吧
GDispatcher.dispatchEvent(G_EVENT.ON_HIDE);
}
/**
* 添加全局事件,用于小程序的交互调用
* 一直很犹豫要不要放在main的实例里,还是和Main同级导出,还有上面的pause,run,下面的事件等
* @param name
* @param fun
* @param thisObj
*/
addGlobalEvent(name: string, fun: Function, thisObj?: any, once: boolean = false) {
if (once) {
GDispatcher.once(name, fun, thisObj)
} else {
GDispatcher.addEventListener(name, fun, thisObj)
}
}
/**
* 派发全局事件,用于小程序的交互调用
* @param name 可以是事件名,也可以是事件
* @param data
*/
dispatchGlobalEvent(name: string | any, data?: any) {
GDispatcher.dispatchEvent(name, data)
}
/**
* 移除全局事件,用于小程序交互调用
* @param name
* @param fun
* @param thisObj
*/
removeGlobalEvent(name: string, fun: Function, thisObj?: any) {
GDispatcher.removeEventListener(name, fun, thisObj)
}
//在小程序页面卸载时调用onUnload,多次销毁后会有问题,再检查
destroy() {
//Tween都移除,注意吧,可能原先的也被移除
FYGE.Tween.removeAllTweens()
// removeAllTimeoutId();//这个再看,尽量用tween的修改
//停掉计时器
FYGE.getCancelAnimationFrame()(this.requestID);
//层级销毁
destroyLayers()
//销毁控制器
destroyAllCtrls();
//舞台销毁
this.stage.destroy();
//全局事件置空
GDispatcher.removeAllEventListener();
//网络数据记录清空
destroyNetData();
}
}
export const ResJson = {
"groups": [
{
"keys": "comCloseBtn.png,toastBg.png,waitingBg.png,waitingRot.png",
"name": "common"
},
{
"keys": "map_bg1.jpg",
"name": "startScene"
}
],
"path": "./resource/"
}
\ No newline at end of file
import { showToast, wait, clearWait } from "../module/ctrls";
import { GDispatcher } from "./Main";
//接口枚举,包括需要调用淘宝的api,用是否含有兑吧区分,或者单独区分
export enum TbNetName {
/**
* 埋点统计 到时改名字
* activityId params elemType
*/
trackingReport = "squirrelsAdoptRest2c.trackingReport",
/**
* 进入活动调用, 刷新数据不调用该接口
* activityId userNick avatar follow inviteId
*/
getIndex = "babycare.getIndex",
/**
* 活动基本信息
* @param activityId
* @type {string}
*/
getActivityBaseInfoById = "babycare.getActivityBaseInfoById",
/**
* 获取游戏信息
* activityId
*/
getGameInfo = "babycare.getGameInfo",
/**
* 消耗道具 ,会返回剩余所有道具数量
* activityId type
*/
consumerTools = "babycare.consumerTools",
/**
* 提交分数
* activityId level score stars isVisitSuccess(是否通关)
*/
gameOver = "babycare.gameOver",
/**
* 领取任务奖励
* activityId taskType
*/
receiveTaskRewards = "babycare.receiveTaskRewards",
/**
* 积分兑换道具和体力
* activityId type credits
*/
exchange = "babycare.exchange",
/**
* 根据等级获取奖品列表
* activityId level
*/
getPrizesByLevel = "babycare.getPrizesByLevel",
/**
* 查询用户积分
* activityId
*/
queryCredits = "babycare.queryCredits",
/**
* 开始闯关,会返回体力值
* activityId level
*/
dojoin = "babycare.dojoin",
/**
* 完成任务(浏览商品详情页, 关注店铺)
* activityId taskType
*/
completeTask = "babycare.completeTask",
/**
* 任务列表
* activityId
*/
getTaskList = "babycare.getTaskList",
///////////////////前端调用接口都加个mine
////带用户操作,和index.js特殊操作的
/**
* 用户授权
*/
authorize = 'mine.authorize',
/**
* 关注店铺
*/
favorShop = "mine.favorShop",
/**
* 获取用户地址及确认
* prizeId
*/
getUserAddress = "mine.getUserAddress",
/**
* 获取名字
* type
*/
getAdoptName = "mine.getAdoptName",
///////////////////////////基本都是前端同步方法
/**
* 获取参数
*/
getAppData = "mine.getAppData",
/**
* 小程序内跳到其他页面
* url
*/
navigateToOutside = "mine.navigateToOutside",
/**
* 跳转到小程序的其他页面
* url
*/
navigateTo = "mine.navigateTo",
/**
* 返回上一页或多页
* delta,页面数,不传默认1
*/
navigateBack = "mine.navigateBack",
/**
* 分享面板
* openId
*/
showSharePanel = "mine.showSharePanel",
/**
* 打开详情页
* itemId
*/
openDetail = "mine.openDetail",
/**
* 自定义埋点
* logkey
*/
reportAnalytics = "mine.reportAnalytics"
}
//返回数据类型,到时再调整
// interface dataIn {
// netName: TbNetName
// data: any
// }
//返回数据类型
interface dataOut {
success: boolean,
data?: any
code?: string,
message?: string
}
//记录数据
let dataRecord: {
[name: string]: any
} = {};
//云函数
let fc;
/**
* 发送接口
* @param netName
* @param parameter
* @param callback
* @param hideMsg
*/
export function sendTbNet(
netName: TbNetName,
parameter?: any,
callback?: (success: boolean, res?: dataOut) => void,
hideMsg: boolean = false
): Promise<dataOut> {
return new Promise((resolve, reject) => {
//网络超时
let waitObj;
//@ts-ignore 本地开发,直接取数据
if (!my) {
var url = "../../mock/miniTb/" + netName + ".json";
fetchAsync(url)
.then((data) => {
//清除超时
// clearWait(waitObj)
//记录数据
dataRecord[netName] = data;
//统一错误信息提示
if (!hideMsg && !data.success) 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
);
}, () => {
})
return
}
let fun = function (e: { type: string, data: dataOut }) {
//清除超时记录
clearWait(waitObj)
//移除事件
GDispatcher.removeEventListener(netName, fun);
var d = e.data;
//记录数据
dataRecord[netName] = d;
//统一错误信息提示,d.data为了区分网络超时
if (!hideMsg && !d.success) 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
);
}
//添加事件接收接口返回信息
GDispatcher.addEventListener(netName, fun);
//网络超时
waitObj = wait(() => {
//是用户操作,不设置超时
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)
//用事件方式吧,派发事件发接口,,,,注意很多独有的事件名别重了,onHide,onShow,onMessage等 放到最后,因为有同步的情况
GDispatcher.dispatchEvent({ type: "onMessage" }, { netName, parameter })
})
//@ts-ignore
// if (!fc) fc = getApp().cloud.function;
// //第一个参数视项目而定
// fc.invoke("becheery", parameter, netName)
// .then((res: dataOut) => {
// clearWait(waitObj);
// //记录数据
// dataRecord[netName] = res;
// // console.log("返回数据" + JSON.stringify(res));
// //统一错误信息提示
// if (!hideMsg && !res.success) showToast(codeMsg[res.code] || res.message || "网络异常")
// //回调
// callback(res.success, res);
// })
}
/**
* 获取数据
* @param netName
*/
export function getTbData(netName: TbNetName): dataOut {
return dataRecord[netName] || null;
}
//销毁数据
export function destroyNetData() {
dataRecord = {}
}
//webview里调用无效,用postMessage去调
// export const navigateToOutside = (url) => {
// my.call("navigateToOutside", {
// url
// }, (res) => {
// // my.alert({ content: "success - " + JSON.stringify(res)})
// });
// }
async function fetchAsync(url: string) {
// await response of fetch call
let response = await fetch(url);
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
return data;
}
// const { cloud } = window["getApp"]();
// const { function: fc } = cloud;
// fc.invoke("duiba.sign.doJoin", { signActivityId: 1 })
// .then(res => {
// console.log(res);
// })
/**
* 错误码列表,字段不设枚举了
*/
const 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": "请至我的奖品页重新领取",//重新领取
}
import { RES } from "../module/RES";
import { layers } from "../module/views/layers";
import Tween = FYGE.Tween;
import DisplayObject = FYGE.DisplayObject;
import Ease = FYGE.Ease;
/**
* 定制,记录一些全局量和方法
*/
export class Tools {
/**
* 缓存key
*/
public static cacheKey: string = "guideThreeSquirrels"
public static isMember: boolean;
/**
* 全局数据,重要数据
*/
public static globalData: {
"avatar": string,
"nickName": string,
"activityId": string,
"openId": string,
"inviteId": string,
"isFollow": boolean
}
/**
* 游戏数据,需要根据接口维护
*/
public static gameData: {
"currentLevel": number,
"visitors": {
"score": number,
"level": number,
"isVisitSuccess": boolean,
"stars": number,
sendAwardType: any
}[],
"prizes": {
"receiveTime": string,//number
"level": number,
"isReceive": boolean
}[],
"power": number,
"tools": {
"HAMMERS": number,
"STEPS": number,
"BOOMS": number
},
"isFristLogin": boolean,//是否是首次
"topAward": any//120关自动开奖
}
public static baseInfo: {
prizeLevels: number[],
inviteFriends: any,
openId: string,
rule: string,
updateTime: number,
title: string,
toolsProbability: any,
levelPrize: any,
buyCredits: any, /// TODO ……
};// 活动基本信息
/**
* 询问权限用
*/
public static async checkPermission() {
//@ts-ignore
var tbMy = my
if (!tbMy) return;
//@ts-ignore
const { cloud } = getApp();
//测试地址//到时云存储传一个小json,,改路径
var url = "cloud://B4F0300E5148F478B506DEDC26EA4C6C//butterfly0.svga";
//获取临时地址
var urls = await cloud.file.getTempFileURL({ fileId: [url] })
url = urls[0].url.replace('-internal', '');
tbMy.downloadFile({
url: url,
success(res) {
var i = res.apFilePath;
tbMy.getFileSystemManager().readFile({
filePath: i,
// encoding: "utf8",
success: function (r) {
},
fail: function (res) {
}
})
},
fail(res) {
},
});
}
public static getSprite(imageName: string, x: number = 0, y: number = 0) {
var sprite = new FYGE.Sprite(RES.getRes(imageName));
sprite.x = x;
sprite.y = y
return sprite
}
/**
*
* @param txt
* @param size
* @param color
* @param textWidth
* @param align
* @param x
* @param y
*/
public static getText(
txt: string,
size: number,
color: string = "#000000",
align: FYGE.TEXT_ALIGN = FYGE.TEXT_ALIGN.LEFT,
textWidth: number = 0,
x: number = 0,
y: number = 0
): FYGE.TextField {
var text = new FYGE.TextField();
text.fillColor = color;
text.size = size;
text.textWidth = textWidth;
text.textAlign = align;
text.x = x;
text.y = y;
text.text = txt;
return text
}
/**
* 左上角原点
* @param width
* @param height
* @param color
* @param alpha
* @param radius
* @param x
* @param y
*/
public static getRect(
width: number,
height: number,
color: number = 0xff0000,
alpha: number = 1,
radius: number = 0,
x: number = 0,
y: number = 0,
): FYGE.Graphics {
var g = new FYGE.Graphics();
g.beginFill(color);
g.alpha = alpha;
if (!radius) {
g.drawRect(0, 0, width, height)
} else {
g.drawRoundedRect(0, 0, width, height, radius)
}
g.endFill();
g.position.set(x, y);
return g
}
public static getCircle(
radius: number = 10,
color: number = 0xff0000,
alpha: number = 1,
x: number = 0,
y: number = 0
): FYGE.Graphics {
var g = new FYGE.Graphics();
g.beginFill(color);
g.alpha = alpha;
g.drawCircle(0, 0, radius)
g.endFill();
g.position.set(x, y);
return g
}
/**
* 高度适配
* 遮挡上面的情况
* 顶部部ui要适配
* @param maxDis 最大距离
* @param minDis 最小距离
* @param type 适配类型
* @return y值
*/
public static getAdjustHeight(maxDis: number, minDis: number, type: "top" | "mid" | "bot" = "bot"): number {
//图层偏移量
var offsetY: number = (() => {
//顶部适配。layers会被置顶,返回0
if (type == "top") return 0;
//底部适配。layers会置底,返回两倍的
if (type == "bot") return layers.stageOffsetY * 2;
return layers.stageOffsetY;
})()
//小于1206时固定距离顶部高度
if (layers.stageHeight <= 1206) return minDis + offsetY;
//大于1206时取插值
return (layers.stageHeight - 1206) / (1624 - 1206) * (maxDis - minDis) + minDis + offsetY;
}
/**
* 修改皮肤上的文本对齐方式,原先默认是左的
* @param text
* @param align
* @param textWidth
*/
public static changeTextAlign(text: FYGE.TextField, align: FYGE.TEXT_ALIGN, textWidth?: number) {
if (align == FYGE.TEXT_ALIGN.LEFT) return;
text.textAlign = align;
if (!textWidth) return;
//修改位置
if (align == FYGE.TEXT_ALIGN.CENTER) text.x -= (textWidth - text.textWidth) / 2;
if (align == FYGE.TEXT_ALIGN.RIGHT) text.x -= textWidth - text.textWidth
text.textWidth = textWidth;
}
public static customToast(
target: FYGE.DisplayObject,
call: Function = () => 0,
time: number = 2000,
showTime: number = 300
) {
Tween.get(target)
.set({ alpha: 0, visible: true })
.to({ alpha: 1 }, showTime, Ease.quadIn)
.wait(time)
.to({ alpha: 0 }, showTime, Ease.quadOut)
.set({ alpha: 0, visible: false })
.call(() => {
call();
});
}
/**
* 延时防连点
* @param target
* @param {number} delay
*/
public static btnDelay(target, delay = 2000) {
target.mouseEnable = false;
target.mouseChildren = false;
setTimeout(() => {
target.mouseEnable = true;
target.mouseChildren = true;
}, delay);
}
/**
* 根据名字获取0到9的贴图
* @param name
*/
public static getNumTextures(name: string): { [key: number]: FYGE.Texture } {
var arr = {}
for (var i = 0; i <= 9; i++) arr[i] = RES.getRes(name + i + ".png")
return arr
}
}
export enum G_EVENT {
ON_SHOW = 'onShow', // 页面显示
ON_HIDE = 'onHide', // 页面隐藏
UPDATE_TASK = 'UpdateTask', // 更新任务
}
import { Panel } from "../../module/views/Panel";
// interface IConfirmPanel {
//
// resolve: Function;
// reject: Function;
// promise: Promise<any>;
//
// make(): Promise<any>;
//
// }
export default class ConfirmPanel extends Panel {
resolve: Function = null;
reject: Function = null;
promise: Promise<any> = null;
public makePromise(): Promise<any> {
this.promise = new Promise<any>((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
return this.promise;
}
}
import { RES } from "../../module/RES";
/**
* 旋转光
*/
export class Light extends FYGE.Sprite {
constructor() {
super();
this.texture = RES.getRes("light.png");
this.anchorTexture.set(0.5, 0.5);
this.addEventListener(FYGE.Event.ENTER_FRAME, () => {
this.rotation += 1;
}, this)
}
}
\ No newline at end of file
import { Tools } from "../Tools";
import { RES } from "../../module/RES";
/**
* 纯色进度条
*/
export class ProgressBar extends FYGE.Container {
/**
* 0到1的进度
*/
private _value = 0;
private upImage: FYGE.Graphics;
private progressTxt: FYGE.TextField;
private maxLength: number;
constructor() {
super()
this.maxLength = 377//最大长度
this._value = 0;
this.upImage = this.addChild(new FYGE.Graphics())
.beginFill(0xf8c862)
.drawRoundedRect(0, 0, this.value * this.maxLength, 19, 10)
.endFill();
this.progressTxt = this.addChild(Tools.getText(
"0%",
22,
"#f8c862",
FYGE.TEXT_ALIGN.CENTER,
80,
(this.maxLength - 80) / 2,
36,
))
}
get value() {
return this._value;
}
set value(v) {
if (v < 0) v = 0;
if (v > 1) v = 1;
this._value = v;
this.progressTxt.text = ((v * 100) >> 0) + "%";
var length = this._value * this.maxLength
this.upImage.clear()
.beginFill(0xf8c862)
.drawRoundedRect(0, 0, length, 19, 10)
.endFill();
}
}
import { Tools } from "../Tools";
import { RES } from "../../module/RES";
/**
* 传入文案和进度条图片
* 进度条图片位移,固定遮罩
* 貌似这样就不需要继承显示类了
*/
export class ProgressBarS {
/**
* 0到1的进度
*/
private _value = 0;
private upImage: FYGE.Sprite;
private progressTxt: FYGE.TextField;
private maxLength: number;
private oriX: number
constructor(upImage: FYGE.Sprite, txt?: FYGE.TextField) {
this.maxLength = upImage.width;//最大长度,直接取图片宽度
this.upImage = upImage;
this.progressTxt = txt;
this.oriX = upImage.x;
var delta = 0
//传入的也可能是帧动画,这样原点就有问题了
if (upImage instanceof FYGE.FrameAni) delta = 0.5
//给图片加个矩形遮罩
this.upImage.mask = this.upImage.parent.addChild(new FYGE.Graphics())
.beginFill(0xf8c862)
.drawRoundedRect(
upImage.x - upImage.width * delta,
upImage.y - upImage.height * delta,
upImage.width,
upImage.height,
111
)
.endFill();
this.value = 0;
}
get value() {
return this._value;
}
set value(v) {
if (v < 0) v = 0;
if (v > 1) v = 1;
this._value = v;
if (this.progressTxt) this.progressTxt.text = ((v * 100) >> 0) + "%";
this.upImage.x = this.oriX - (1 - this._value) * this.maxLength
}
}
import { Scene } from '../../module/views/Scene';
import { RES } from '../../module/RES';
import resCanvasList from '../../resCanvasList';
export class StartScene extends Scene {
initUi() {
super.initUi();
var gamecanvas: FYGE.Container = new FYGE.Container();
gamecanvas.position.set(0, 0);
this.addChild(gamecanvas);
}
}
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"noImplicitAny": false,
"sourceMap": true,
"removeComments": true,
"noEmitOnError":true,
"outDir":"dist",
/*"outFile": "./index.js",*/
"lib": [
"es5",
"dom",
"es2015.promise"
]
},
"exclude": [
"node_modules"
]
}
\ No newline at end of file
const path = require('path');
module.exports = {
entry: './src/Main.ts',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
output: {
filename: 'output.js',
path: __dirname,
libraryTarget: 'umd',
}
};
\ No newline at end of file
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const webpack = require('webpack');
const MockWebpackPlugin = require('mock-webpack-plugin');
const mockConfig = require('./mock/config.js');
module.exports = merge(common, {
devtool: 'eval-source-map',
devServer: {
contentBase: '.',
proxy: {
'/plugin/*':'http://localhost:3000',
'/ngapi/*': 'http://localhost:3000',
'/ngame/*': 'http://localhost:3000',
}
},
plugins: [
new MockWebpackPlugin({
config: mockConfig,
port: 3000
})
]
});
\ No newline at end of file
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const webpack = require('webpack');
module.exports = merge(common, {
mode: "development",//production
devtool: 'source-map',
plugins: [
// new UglifyJSPlugin(
// { sourceMap: false }
// ),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
})
]
});
\ No newline at end of file
'use strict';
import React, { Component } from 'react';
import './output.js';
//import API from '../../api';
class PageCanvas extends Component {
constructor(props) {
super(props);
this.state = this.state || { };
}
componentDidMount() {
let main = this.spark_startEngine();
//main.addEventListener....
}
/**
* 模板自动生成。不参与转换,请勿在此方法内修改逻辑。
*/
spark_startEngine() {
if(typeof Main !== 'function')
{
console.error("ERROR::::先发布引擎后,将output.js放入同目录下");
return null;
}
var canvas = document.getElementById("canvas");
canvas.width = document.body.clientWidth * (window.devicePixelRatio || 1)
canvas.height = document.body.clientHeight * (window.devicePixelRatio || 1);
var main = new Main(canvas);
var mouseEvent = main.stage.onMouseEvent.bind(main.stage);
canvas.addEventListener("touchstart", mouseEvent, false);
canvas.addEventListener('touchmove', mouseEvent, false);
canvas.addEventListener('touchend', mouseEvent, false);
return main;
}
render() {
return (<div>
<canvas id="canvas" style={{ width: "100%", height: "100%" }}></canvas>
</div>)
}
}
export default PageCanvas;
'use strict';
import React, { Component } from 'react';
import resList from '../../resconfig/resList';
//import API from '../../api';
import './pagegamescene.less';
class Pagegamescene extends Component {
constructor(props) {
super(props);
this.state = { resList: resList };
}
render() {
return (
<div className="gamescene ">
<div>
<canvas id="canvas" style={{ width: '100%', height: '100%' }}></canvas>
</div>
</div>
);
}
}
export default Pagegamescene;
.gamescene {
top: 0px;
left: 0px;
width: 750px;
height: 1624px;
display: block;
position: absolute;
.gamecanvas {
width: 300px;
height: 300px;
opacity: 1;
display: block;
left: 0px;
top: 0px;
position: absolute;
transform-origin: 0px 0px 0px;
}
}
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