Commit d914feca authored by rockyl's avatar rockyl

提交一波

parent f0684238
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -14,13 +14,18 @@
"type": "boolean",
"alias": "是否捕获",
"default": true
},
"isGlobal": {
"type": "boolean",
"alias": "是否全局",
"default": true
}
},
"output": [
"success"
],
"id": "dispatch-event",
"script": "var eventName = engine.findVariable('eventName', args, props);\nvar data = engine.findVariable('data', args, props);\nvar useCapture = engine.findVariable('useCapture', args, props);\nif (eventName) {\n engine.globalEvent.dispatchEvent(eventName, data, useCapture);\n}\nnext('success', args);\n",
"script": "var eventName = engine.findVariable('eventName', args, props);\nvar data = engine.findVariable('data', args, props);\nvar useCapture = engine.findVariable('useCapture', args, props);\nvar isGlobal = engine.findVariable('isGlobal', args, props);\nif (eventName) {\n var sender = isGlobal ? engine.globalEvent : target;\n sender.dispatchEvent(eventName, data, useCapture);\n}\nnext('success', args);\n",
"group": "base",
"type": "builtin"
}
{
"props": {},
"props": {
"map": {
"alias": "UA包含表",
"type": "map"
}
},
"name": "环境判断",
"output": [
"success"
],
"id": "env-judge",
"script": "var ua = navigator.userAgent.toLowerCase();\nvar env;\nif (ua.indexOf('eversunshine') >= 0) {\n env = 'eversunshine';\n}\nelse if (ua.indexOf('micromessenger') >= 0) {\n env = 'weixin';\n}\nconsole.log('env:', env);\nvar payload = args || {};\npayload.env = env;\nnext('success', payload);\n",
"script": "var map = engine.findVariable('map', args, props);\nvar ua = navigator.userAgent.toLowerCase();\nvar env;\nif (map) {\n for (var key in map) {\n if (ua.indexOf(key) >= 0) {\n env = map[key];\n break;\n }\n }\n}\nvar payload = args || {};\npayload.env = env;\nnext('success', payload);\n",
"group": "base",
"type": "builtin"
}
......@@ -121,7 +121,7 @@
"metas": [
{
"id": "duiba-api-transform",
"script": "if (args.success) {\n next('success', args.data);\n}\nelse {\n\tengine.globalEvent.dispatchEvent('net-failed', args);\n next('failed', args);\n}\n",
"script": "if (args.success) {\n\tvar payload;\n\n\tif (typeof args.data === 'object') {\n\t\tpayload = engine.objClone(args.data);\n\n\t\tvar origin = engine.objClone(args);\n\t\tObject.defineProperty(payload, '__origin', {\n\t\t\tget: function () {\n\t\t\t\treturn origin\n\t\t\t},\n\t\t\tenumerable: false\n\t\t});\n\t} else {\n\t\tpayload = args.data;\n\t}\n\tnext('success', payload);\n}\nelse {\n\tengine.globalEvent.dispatchEvent('net-failed', args);\n\tnext('failed', args);\n}",
"props": {},
"isInline": true,
"name": "兑吧接口转换",
......
{
"name": "兑吧接口轮询",
"props": {
"url": {
"type": "string",
"alias": "链接"
},
"method": {
"type": "enum",
"enum": [
"get",
"post"
],
"alias": "方法",
"default": "get"
},
"count": {
"type": "number",
"alias": "次数",
"default": 10
},
"delay": {
"type": "number",
"default": 500,
"alias": "单次延时"
},
"name": {
"type": "string",
"alias": "数据名"
},
"field": {
"type": "string",
"alias": "字段名"
},
"successValues": {
"type": "string",
"alias": "成功值"
},
"params": {
"type": "map",
"alias": "参数"
},
"headers": {
"type": "map",
"alias": "头部"
}
},
"output": [
"success",
"failed",
"timeout"
],
"sub": {
"442452af-e4d2-47be-b931-86fef866056f": {
"uuid": "442452af-e4d2-47be-b931-86fef866056f",
"meta": "entry",
"props": {},
"output": {
"success": [
"2b895831-d362-491a-a57b-cd6e2d7223a8"
]
}
},
"9def8371-1326-4daa-8220-78cf888297e3": {
"uuid": "9def8371-1326-4daa-8220-78cf888297e3",
"meta": "wait",
"props": {
"duration": {
"type": "link",
"alias": "delay"
}
},
"output": {
"complete": [
"2b895831-d362-491a-a57b-cd6e2d7223a8"
]
}
},
"b88c8995-28eb-470f-a8a2-7484c9f98e05": {
"uuid": "b88c8995-28eb-470f-a8a2-7484c9f98e05",
"meta": "http-polling-judge",
"props": {
"count": {
"type": "link"
},
"field": {
"type": "link"
},
"successValues": {
"type": "link"
}
},
"output": {
"continue": [
"9def8371-1326-4daa-8220-78cf888297e3"
]
}
},
"2b895831-d362-491a-a57b-cd6e2d7223a8": {
"uuid": "2b895831-d362-491a-a57b-cd6e2d7223a8",
"meta": "duiba-api",
"props": {
"url": {
"type": "link"
},
"method": {
"type": "link"
},
"name": {
"type": "link"
},
"params": {
"type": "link"
},
"headers": {
"type": "link"
}
},
"output": {
"success": [
"b88c8995-28eb-470f-a8a2-7484c9f98e05"
]
}
}
},
"subEntry": "442452af-e4d2-47be-b931-86fef866056f",
"metas": [
{
"script": "var count = props.count, field = props.field, successValues = props.successValues;\nvar key = 'counting-' + vm.id;\nvar counting = global[key] || 0;\ncounting++;\nvar successValue = engine.getDataByPath(args, field) + '';\nvar successArr = successValues.split(',');\nif (successArr.indexOf(successValue) >= 0) {\n delete global[key];\n next('success', args);\n}\nelse if (counting < count) {\n global[key] = counting;\n next('continue');\n}\nelse {\n delete global[key];\n next('timeout');\n}",
"props": {
"count": {
"type": "number",
"default": 5,
"alias": "次数"
},
"field": {
"type": "string",
"alias": "字段名",
"default": "status"
},
"successValues": {
"type": "string",
"alias": "成功值"
}
},
"name": "轮询判断",
"output": [
"success",
"continue",
"timeout"
],
"id": "http-polling-judge",
"group": "net",
"type": "builtin"
}
],
"id": "duiba-polling",
"group": "duiba",
"type": "builtin"
}
This diff is collapsed.
This diff is collapsed.
{
"name": "获取星速台Token",
"props": {
"comment": {
"type": "string",
"alias": "星速台通用token"
}
},
"output": [
"success",
"failed",
"invalid",
"error"
],
"id": "px-token",
"script": "if (window['getPxToken']) {\n window['getPxToken'](function (e, token) {\n switch (e) {\n case 'net error':\n next('error', { type: 'error' });\n break;\n case 'need login':\n next('failed', { type: 'failed' });\n break;\n case 'state invalid':\n next('invalid', { type: 'invalid' });\n break;\n default:\n if (token) {\n scope.token = token;\n next('success', args);\n }\n else {\n next('invalid', { type: 'invalid key' });\n }\n }\n });\n}\nelse {\n next('error', { type: 'no ready' });\n}\n",
"group": "projectX",
"type": "builtin"
}
......@@ -13,10 +13,11 @@
}
},
"output": [
"complete"
"complete",
"exception"
],
"id": "pop-scene",
"script": "if (props.closeAll) {\n if (!props.viewName) {\n console.log('没有设置视图名');\n next('exception', '没有设置视图名');\n }\n else {\n var gameStage = engine.gameStage;\n var viewConfig = gameStage.getViewConfigByName(props.viewName);\n if (viewConfig) {\n var view = engine.instantiate(viewConfig);\n gameStage.sceneContainer.push(view);\n }\n else {\n console.error('view config not exists');\n }\n next('complete');\n }\n}\nelse {\n engine.gameStage.sceneContainer.pop();\n next('complete');\n}\n",
"script": "if (props.popAll) {\n if (!props.viewName) {\n console.log('没有设置视图名');\n next('exception', '没有设置视图名');\n }\n else {\n var gameStage = engine.gameStage;\n var view = gameStage.instantiateView(props.viewName);\n if (view) {\n gameStage.sceneContainer.popAll(view);\n next('complete');\n }\n else {\n next('exception', '视图不存在');\n }\n }\n}\nelse {\n engine.gameStage.sceneContainer.pop();\n next('complete');\n}\n",
"group": "view",
"type": "builtin"
}
......@@ -46,5 +46,5 @@
}
},
"id": "buried-point",
"code": "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar BuriedPoint = (function (_super) {\n __extends(BuriedPoint, _super);\n function BuriedPoint() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.dpm = 'appID.0.0.0';\n _this.dcm = '202.projectID.0.0';\n _this.dom = '0.0.0.0';\n _this.autoExposure = true;\n _this.onceAutoExposure = false;\n _this.autoExposureType = 'visible';\n _this.autoClick = true;\n _this.checkFps = 5;\n _this._autoExposured = false;\n _this._hostVisible = false;\n _this.checkVisibility = function () {\n var worldVisible = _this.host.worldVisible;\n if (worldVisible !== _this._hostVisible) {\n _this._hostVisible = worldVisible;\n if (worldVisible) {\n _this._onVisible();\n }\n }\n };\n return _this;\n }\n BuriedPoint.prototype.onModify = function (value, key, oldValue) {\n switch (key) {\n case 'dpm':\n case 'dcm':\n case 'dom':\n this['__' + key] = fill(value);\n break;\n }\n };\n BuriedPoint.prototype.mounted = function () {\n this.host.addEventListener(engine.MouseEvent.CLICK, this._onClick, this);\n setInterval(this.checkVisibility, 1000 / this.checkFps);\n };\n BuriedPoint.prototype.awake = function () {\n if (this.autoExposure && this.autoExposureType === 'awake') {\n this.autoLogExposure();\n }\n };\n BuriedPoint.prototype._onVisible = function (e) {\n if (e === void 0) { e = null; }\n if (this.autoExposure && this.autoExposureType === 'visible') {\n this.autoLogExposure();\n }\n };\n BuriedPoint.prototype.autoLogExposure = function () {\n if (!this._autoExposured) {\n if (this.onceAutoExposure) {\n this._autoExposured = true;\n }\n this.logExposure();\n }\n };\n BuriedPoint.prototype._onClick = function (e) {\n if (this.autoClick) {\n this.logClick();\n }\n };\n BuriedPoint.prototype.logExposure = function () {\n this.log('exposure');\n };\n BuriedPoint.prototype.logClick = function () {\n this.log('click');\n };\n BuriedPoint.prototype.log = function (type) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4, log(type, {\n dpm: this['__dpm'],\n dcm: this['__dcm'],\n dom: this['__dom'],\n })];\n case 1:\n _a.sent();\n if (this.id !== undefined) {\n engine.globalEvent.dispatchEvent('buried-point-success', {\n type: type,\n id: this.id,\n });\n }\n return [2];\n }\n });\n });\n };\n BuriedPoint.id = 'buried-point';\n __decorate([\n engine.dirtyFieldTrigger\n ], BuriedPoint.prototype, \"dpm\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], BuriedPoint.prototype, \"dcm\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], BuriedPoint.prototype, \"dom\", void 0);\n return BuriedPoint;\n}(engine.ScriptBase));\nexports.default = BuriedPoint;\nfunction fill(src) {\n var result = src;\n for (var key in engine.env) {\n result = result.replace(key, engine.env[key]);\n }\n return result;\n}\nfunction log(type, data) {\n var dpm = data.dpm, dcm = data.dcm, dom = data.dom;\n var params = {\n dpm: dpm, dcm: dcm, appId: engine.env.appID\n };\n if (dom !== '0.0.0.0') {\n params.dom = dom;\n }\n var isExposure = type === 'exposure';\n return engine.httpRequest(isExposure ? '//embedlog.duiba.com.cn/exposure/standard' : '/log/click', 'get', params, isExposure ? 'jsonp' : 'text');\n}\n"
"code": "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar BuriedPoint = (function (_super) {\n __extends(BuriedPoint, _super);\n function BuriedPoint() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.dpm = 'appID.0.0.0';\n _this.dcm = '202.projectID.0.0';\n _this.dom = '0.0.0.0';\n _this.autoExposure = true;\n _this.onceAutoExposure = false;\n _this.autoExposureType = 'visible';\n _this.autoClick = true;\n _this.checkFps = 5;\n _this._autoExposured = false;\n _this._hostVisible = false;\n _this.checkVisibility = function () {\n var worldVisible = _this.host.worldVisible;\n if (worldVisible !== _this._hostVisible) {\n _this._hostVisible = worldVisible;\n if (worldVisible) {\n _this._onVisible();\n }\n }\n };\n return _this;\n }\n BuriedPoint.prototype.onModify = function (value, key, oldValue) {\n switch (key) {\n case 'dpm':\n case 'dcm':\n case 'dom':\n this['__' + key] = fill(value);\n break;\n }\n };\n BuriedPoint.prototype.mounted = function () {\n this.host.addEventListener(engine.MouseEvent.CLICK, this._onClick, this);\n this._timer = setInterval(this.checkVisibility, 1000 / this.checkFps);\n };\n BuriedPoint.prototype.destroy = function () {\n this.host.removeEventListener(engine.MouseEvent.CLICK, this._onClick, this);\n if (this._timer) {\n clearInterval(this._timer);\n this._timer = null;\n }\n };\n BuriedPoint.prototype.awake = function () {\n if (this.autoExposure && this.autoExposureType === 'awake') {\n this.autoLogExposure();\n }\n };\n BuriedPoint.prototype._onVisible = function (e) {\n if (e === void 0) { e = null; }\n if (this.autoExposure && this.autoExposureType === 'visible') {\n this.autoLogExposure();\n }\n };\n BuriedPoint.prototype.autoLogExposure = function () {\n if (!this._autoExposured) {\n if (this.onceAutoExposure) {\n this._autoExposured = true;\n }\n this.logExposure();\n }\n };\n BuriedPoint.prototype._onClick = function (e) {\n if (this.autoClick) {\n this.logClick();\n }\n };\n BuriedPoint.prototype.logExposure = function () {\n this.log('exposure');\n };\n BuriedPoint.prototype.logClick = function () {\n this.log('click');\n };\n BuriedPoint.prototype.log = function (type) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4, log(type, {\n dpm: this['__dpm'],\n dcm: this['__dcm'],\n dom: this['__dom'],\n })];\n case 1:\n _a.sent();\n if (this.id !== undefined) {\n engine.globalEvent.dispatchEvent('buried-point-success', {\n type: type,\n id: this.id,\n });\n }\n return [2];\n }\n });\n });\n };\n BuriedPoint.id = 'buried-point';\n __decorate([\n engine.dirtyFieldTrigger\n ], BuriedPoint.prototype, \"dpm\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], BuriedPoint.prototype, \"dcm\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], BuriedPoint.prototype, \"dom\", void 0);\n return BuriedPoint;\n}(engine.ScriptBase));\nexports.default = BuriedPoint;\nfunction fill(src) {\n var result = src;\n for (var key in engine.env) {\n result = result.replace(key, engine.env[key]);\n }\n return result;\n}\nfunction log(type, data) {\n var dpm = data.dpm, dcm = data.dcm, dom = data.dom;\n var params = {\n dpm: dpm, dcm: dcm, appId: engine.env.appID\n };\n if (dom !== '0.0.0.0') {\n params.dom = dom;\n }\n var isExposure = type === 'exposure';\n return engine.httpRequest(isExposure ? '//embedlog.duiba.com.cn/exposure/standard' : '/log/click', 'get', params, isExposure ? 'jsonp' : 'text');\n}\n"
}
This diff is collapsed.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var props_1 = require("../props");
var utils_1 = require("./utils");
var ObjectPool = engine.ObjectPool;
var object_pool_init_1 = require("./object-pool-init");
var GameView = (function (_super) {
__extends(GameView, _super);
function GameView() {
var _this = _super.call(this) || this;
_this.goodsItems = [];
_this.moveCatchX = 0;
_this.playerCatchX = 0;
_this.onDownStage = function (e) {
_this.moveCatchX = e.localX;
_this.playerCatchX = _this.player.x;
};
_this.onMoveStage = function (e) {
if (_this.gameIng) {
_this.player.x = _this.playerCatchX + (e.localX - _this.moveCatchX);
}
};
_this.onOutStage = function (e) {
_this.moveCatchX = 0;
};
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
return _this;
}
GameView.prototype.setup = function () {
var _this = this;
if (this._hasSetup) {
return;
}
this._hasSetup = true;
this.NpcBg = new engine.Container();
this.NpcBg.alpha = 1;
this.NpcBg.width = 0;
this.NpcBg.height = 0;
this.addChild(this.NpcBg);
this.player = new engine.Container();
this.player.mouseEnabled = false;
this.addChild(this.player);
this.waterSvga = utils_1.createSvga("水花");
this.playerSvga = utils_1.createSvga("玩家");
this.boomSvga = utils_1.createSvga("炸弹svga");
this.player.addChild(this.playerSvga);
this.player.addChild(this.waterSvga);
this.player.addChild(this.boomSvga);
this.playerSvga.gotoAndPlay(1);
this.visible = false;
setTimeout(function () {
_this.visible = true;
_this.player.anchorY = _this.player.height / 2;
_this.player.anchorX = _this.player.width / 2;
console.log(_this.player.width);
console.log(_this.playerSvga.width);
_this.player.x = 375 - _this.player.width / 2;
_this.player.y = props_1.props.playerPositionY;
}, 300);
this.rectBg = new engine.Rect();
this.rectBg.alpha = 0;
this.rectBg.width = 750;
this.rectBg.height = 1624;
this.addChild(this.rectBg);
this.rectBg.addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDownStage, this);
this.rectBg.addEventListener(engine.MouseEvent.MOUSE_MOVE, this.onMoveStage, this);
this.rectBg.addEventListener(engine.MouseEvent.MOUSE_OUT, this.onOutStage, this);
};
GameView.prototype.reset = function () {
this.recycleGoods();
};
GameView.prototype.start = function () {
var _this = this;
this.score = 0;
this.speed = 1;
this.gameIng = true;
this.creatNpc();
this.beginNpc();
this.countdown = props_1.props.countDown;
this.countdownTimer = setInterval(function () {
if (_this.gameIng) {
if (_this.countdown > 0) {
engine.globalEvent.dispatchEvent('food-fell-time-update', {
time: _this.countdown,
});
_this.countdown -= 1;
}
else {
engine.globalEvent.dispatchEvent('food-fell-game-over', {
score: _this.score,
reason: 1
});
_this.died();
}
}
}, 1000);
};
GameView.prototype.beginNpc = function () {
var _this = this;
this.timer = setTimeout(function () {
if (_this.gameIng) {
_this.speed += props_1.props.acceleratedSpeed;
_this.creatNpc();
}
_this.beginNpc();
}, 2000 / this.speed);
};
GameView.prototype.pause = function () {
this.gameIng = false;
};
GameView.prototype.revive = function () {
this.gameIng = true;
};
GameView.prototype.resume = function () {
this.reset();
this.start();
};
GameView.prototype.creatNpc = function () {
var _this = this;
var goods = this._goods = ObjectPool.getObject(object_pool_init_1.PoolName);
this.goodsItems.push(goods);
this.NpcBg.addChild(goods);
goods.addEventListener(engine.Event.ENTER_FRAME, goods["onGoodsEnter"] = function () {
if (goods.y > 1624) {
_this.removeNpc(goods);
}
else {
if (_this.gameIng) {
goods.y += (4 * _this.speed);
if (_this.hasHit(_this.player, goods)) {
if (goods["npcType"] == "rain") {
console.log("碰到雨滴");
_this.score += props_1.props.rainScore;
_this.waterSvga.visible = true;
_this.waterSvga.play(false, false);
_this.waterSvga.once(engine.Event.END_FRAME, function () {
_this.waterSvga.visible = false;
}, _this);
}
else if (goods["npcType"] == "stone") {
console.log("碰到石头");
_this.score += props_1.props.stoneScore;
}
else if (goods["npcType"] == "boom") {
console.log("碰到炸弹");
_this.boomSvga.visible = true;
_this.boomSvga.play(false, false);
_this.boomSvga.once(engine.Event.END_FRAME, function () {
_this.boomSvga.visible = false;
}, _this);
engine.globalEvent.dispatchEvent('food-fell-game-over', {
score: _this.score,
reason: 2
});
_this.died();
}
engine.globalEvent.dispatchEvent('food-fell-score-update', {
score: _this.score,
});
_this.removeNpc(goods);
}
}
}
}, this);
};
GameView.prototype.died = function () {
this.score = 0;
this.pause();
};
GameView.prototype.removeNpc = function (goods) {
this.NpcBg.removeChild(goods);
ObjectPool.recycleObject(object_pool_init_1.PoolName, goods);
goods.removeEventListener(engine.Event.ENTER_FRAME, goods["onGoodsEnter"], this);
var index = this.goodsItems.indexOf(goods);
if (index > -1) {
this.goodsItems.splice(index, 1);
}
};
GameView.prototype.recycleGoods = function () {
clearTimeout(this.timer);
clearInterval(this.countdownTimer);
for (var _i = 0, _a = this.goodsItems; _i < _a.length; _i++) {
var goods = _a[_i];
if (goods) {
this.removeChild(goods);
ObjectPool.recycleObject(object_pool_init_1.PoolName, goods);
goods.removeEventListener(engine.Event.ENTER_FRAME, goods["onGoodsEnter"], this);
}
}
this.goodsItems = [];
};
GameView.prototype.hasHit = function (a, b) {
if (Math.abs((a.x + a.width / 2) - (b.x + b.width / 2)) < a.width / 2 + b.width / 2
&&
Math.abs((a.y + a.height / 2) - (b.y + b.height / 2)) < a.height / 2 + b.height / 2) {
return true;
}
else {
return false;
}
};
return GameView;
}(engine.Container));
exports.default = GameView;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GameView_1 = require("./GameView");
var props_1 = require("../props");
var GameWrapper = (function (_super) {
__extends(GameWrapper, _super);
function GameWrapper() {
var _this = _super.call(this) || this;
engine.globalEvent.addEventListener('food-fell-reset', _this.reset, _this);
engine.globalEvent.addEventListener('food-fell-start', _this.start, _this);
engine.globalEvent.addEventListener('food-fell-pause', _this.pause, _this);
engine.globalEvent.addEventListener('food-fell-resume', _this.resume, _this);
engine.globalEvent.addEventListener('food-fell-revive', _this.revive, _this);
engine.globalEvent.addEventListener('food-fell-clear', _this.clear, _this);
_this.addEventListener(engine.MouseEvent.CLICK, _this.onTap, _this);
var gameView = _this._gameView = new GameView_1.default();
_this.addChild(gameView);
return _this;
}
GameWrapper.prototype.reset = function (event) {
props_1.injectProps(event.data);
this._gameView.visible = true;
this._gameView.reset();
};
GameWrapper.prototype.start = function (event) {
props_1.injectProps(event.data);
this._status = 1;
this._gameView.start();
};
GameWrapper.prototype.pause = function () {
this._gameView.pause();
};
GameWrapper.prototype.resume = function () {
this._gameView.resume();
};
GameWrapper.prototype.revive = function () {
this._gameView.revive();
};
GameWrapper.prototype.clear = function () {
this._gameView.visible = false;
};
GameWrapper.prototype.onTap = function (event) {
};
return GameWrapper;
}(engine.Container));
exports.GameWrapper = GameWrapper;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("./utils");
var props_1 = require("../props");
var Goods = (function (_super) {
__extends(Goods, _super);
function Goods() {
var _this = _super.call(this) || this;
var body;
body = _this._body = new engine.Rect();
var rain = new engine.Sprite(utils_1.getTextureByName('雨滴'));
rain["npcType"] = "rain";
var stone = new engine.Sprite(utils_1.getTextureByName('石块'));
stone["npcType"] = "stone";
var boom = new engine.Sprite(utils_1.getTextureByName('炸弹'));
boom["npcType"] = "boom";
rain.visible = false;
stone.visible = false;
boom.visible = false;
body.addChild(rain);
body.addChild(stone);
body.addChild(boom);
_this.addChild(body);
body.width = .0001;
body.height = .0001;
body.mouseEnabled = false;
return _this;
}
Goods.prototype.getRandomNumberByRange = function (start, end) {
return Math.floor(Math.random() * (end - start) + start);
};
Goods.prototype.reset = function () {
this.visible = true;
this.rotation = 0;
this.anchorOffsetY = 0;
this.y = 0;
this.x = (750 - 120) * Math.random() + 30;
this.rotation = 0;
var random = Math.random();
if (random < props_1.props.goodsProbability[0]) {
this.showNpc("rain");
}
else if (random >= props_1.props.goodsProbability[0] && random <= (props_1.props.goodsProbability[0] + props_1.props.goodsProbability[1])) {
this.showNpc("stone");
}
else if (random > (props_1.props.goodsProbability[0] + props_1.props.goodsProbability[1])) {
this.showNpc("boom");
}
};
Goods.prototype.showNpc = function (type) {
for (var i = 0; i < this._body.children.length; i++) {
this._body.children[i].visible = false;
this._body.children[i].mouseEnabled = false;
}
for (var i = 0; i < this._body.children.length; i++) {
if (this._body.children[i]["npcType"] == type) {
this["npcType"] = type;
this._body.children[i].visible = true;
this._body.children[i].mouseEnabled = false;
}
}
};
Object.defineProperty(Goods.prototype, "anchorOffsetY", {
set: function (v) {
this._body.y = v;
},
enumerable: true,
configurable: true
});
return Goods;
}(engine.Container));
exports.Goods = Goods;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Goods_1 = require("./Goods");
var ObjectPool = engine.ObjectPool;
exports.PoolName = 'goods';
ObjectPool.registerPool(exports.PoolName, function () {
return new Goods_1.Goods();
}, function (item, data) {
item.reset();
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
}
exports.getTexture = getTexture;
function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
}
exports.getTextureByName = getTextureByName;
function playSound(name) {
engine.playSound(engine.getAssetByName(name).uuid, { keep: true });
}
exports.playSound = playSound;
function createSvga(name, anchorName) {
var inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
return inst;
}
exports.createSvga = createSvga;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GameWrapper_1 = require("./game/GameWrapper");
var props_1 = require("./props");
function default_1(props) {
props_1.prepareProps();
props_1.injectProps(props);
var instance = new GameWrapper_1.GameWrapper();
return instance;
}
exports.default = default_1;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.props = {};
function prepareProps() {
var metaProps = getProps();
engine.injectProp(exports.props, metaProps);
}
exports.prepareProps = prepareProps;
function injectProps(p) {
engine.injectProp(exports.props, p);
}
exports.injectProps = injectProps;
......@@ -2,11 +2,11 @@
Object.defineProperty(exports, "__esModule", { value: true });
var props_1 = require("../props");
function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
return engine.Texture.from(uuid);
}
exports.getTexture = getTexture;
function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
return getTexture(getAssetByName(name).uuid);
}
exports.getTextureByName = getTextureByName;
function getBlockAsset(type) {
......@@ -15,8 +15,8 @@ function getBlockAsset(type) {
exports.getBlockAsset = getBlockAsset;
function createSvga(name, anchorName) {
var inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
var anchor = props_1.props[(anchorName)];
inst.source = 'asset://' + getAssetByName(name).uuid;
var anchor = props_1.props[anchorName];
if (anchor) {
inst.x = -anchor.x;
inst.y = -anchor.y;
......@@ -27,6 +27,6 @@ function createSvga(name, anchorName) {
}
exports.createSvga = createSvga;
function playSound(name) {
engine.playSound(engine.getAssetByName(name).uuid, { keep: true });
engine.playSound(getAssetByName(name).uuid, { keep: true });
}
exports.playSound = playSound;
......@@ -24,7 +24,7 @@ var GuideMask = (function (_super) {
var alpha = 0.7;
var top = new engine.Shape();
top.beginFill(color, alpha);
top.drawRect(0, 0, sw, y);
top.drawRect(0, -sh, sw, y + sh);
top.endFill();
_this.addChild(top);
var bottom = new engine.Shape();
......
......@@ -29,6 +29,13 @@ var GuideMgr = (function () {
enumerable: true,
configurable: true
});
Object.defineProperty(GuideMgr.prototype, "container", {
set: function (c) {
this._container = c;
},
enumerable: true,
configurable: true
});
Object.defineProperty(GuideMgr.prototype, "guideDone", {
get: function () {
return !this.guideFlag || this.done.length >= Object.keys(MConfigs_1.MConfigs.guide).length;
......@@ -54,7 +61,7 @@ var GuideMgr = (function () {
_this.guideFlag = false;
}
};
engine.gameStage.addChild(this.currentGuideMask);
this._container.addChild(this.currentGuideMask);
};
GuideMgr._instance = null;
return GuideMgr;
......
......@@ -21,7 +21,9 @@ var ShootPlanet = (function (_super) {
return _this;
}
ShootPlanet.prototype.onActive = function () {
if (!this.game) {
this.game = new Game_1.default(this);
}
if (GuideMgr_1.default.instance.guideFlag == true) {
var car = this.game._car;
GuideMgr_1.default.instance.runGuide(0, car.x + car.width / 2, car.y + car.height / 2);
......
var map = engine.findVariable('map', args, props);
var ua = navigator.userAgent.toLowerCase();
var env;
if (map) {
for (var key_1 in map) {
if (ua.indexOf(key_1) >= 0) {
env = map[key_1];
break;
}
}
}
var payload = args || {};
payload.env = env;
next('success', payload);
if (window['getPxToken']) {
window['getPxToken'](function (e, token) {
switch (e) {
case 'net error':
next('error', { type: 'error' });
break;
case 'need login':
next('failed', { type: 'failed' });
break;
case 'state invalid':
next('invalid', { type: 'invalid' });
break;
default:
if (token) {
scope.token = token;
next('success', args);
}
else {
next('invalid', { type: 'invalid key' });
}
}
});
}
else {
next('error', { type: 'no ready' });
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ZoomScroll = (function (_super) {
__extends(ZoomScroll, _super);
function ZoomScroll() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.autoInit = true;
_this.duration = 1000;
_this.index = 0;
_this.itemWidth = 0;
_this.itemHeight = 0;
_this.scaleMin = 0.7;
_this.scaleMax = 1;
_this.alphaOut = 0.5;
_this.alphaIn = 1;
_this._startDragOffset = { x: 0, y: 0 };
_this._dragOffset = { x: 0, y: 0 };
return _this;
}
ZoomScroll.prototype.mounted = function () {
this._centerOffset = this.host.width / 2;
if (this.autoInit) {
this.init();
}
};
ZoomScroll.prototype.sleep = function () {
};
ZoomScroll.prototype.update = function (t) {
};
ZoomScroll.prototype.init = function () {
for (var i = 0, li = this.host.children.length; i < li; i++) {
var child = this.host.children[i];
child.anchorX = child.width / 2;
child.anchorY = child.height / 2;
child.x = child.ix = i * this.itemWidth + this._centerOffset - this.itemWidth / 2;
}
this.scrollTo(0, false);
this.host.addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDragStart, this);
};
ZoomScroll.prototype.updateOffset = function (offset) {
this._dragOffset.x = this._startDragOffset.x + offset.x;
for (var i = 0, li = this.host.children.length; i < li; i++) {
var child = this.host.children[i];
var x = child.x = child.ix + this._dragOffset.x;
var s = 40 / Math.abs(x - this._centerOffset + this.itemWidth / 2);
child.scaleX = child.scaleY = x === 0 ? 1 : Math.min(s + this.scaleMin, this.scaleMax);
child.alpha = x === 0 ? 1 : Math.min(s + this.alphaOut, this.alphaIn);
}
};
ZoomScroll.prototype.onDragStart = function (event) {
this.host.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE, this.onDraging, this);
this.host.stage.addEventListener(engine.MouseEvent.MOUSE_UP, this.onDragEnd, this);
this._startDragPos = {
x: event.stageX,
y: event.stageY,
};
this._startDragOffset.x = this._dragOffset.x;
this._startDragOffset.y = this._dragOffset.y;
};
ZoomScroll.prototype.onDraging = function (event) {
if (!this._startDragPos) {
return;
}
var _a = this._startDragPos, x = _a.x, y = _a.y;
var stageX = event.stageX, stageY = event.stageY;
var offset = {
x: stageX - x,
y: stageY - y,
};
this.updateOffset(offset);
};
ZoomScroll.prototype.onDragEnd = function (event) {
this.host.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE, this.onDraging, this);
this.host.stage.removeEventListener(engine.MouseEvent.MOUSE_UP, this.onDragEnd, this);
if (!this._startDragPos) {
return;
}
this._startDragOffset.x = 0;
this._startDragOffset.y = 0;
var index = Math.round(this._dragOffset.x / this.itemWidth);
index = -Math.min(0, Math.max(1 - this.host.children.length, index));
this['_index'] = index;
this.scrollTo(index);
this._startDragPos = null;
};
Object.defineProperty(ZoomScroll.prototype, "t", {
get: function () {
return this._dragOffset.x;
},
set: function (v) {
this.updateOffset({ x: v, y: 0 });
},
enumerable: true,
configurable: true
});
ZoomScroll.prototype.scrollTo = function (index, animation) {
if (animation === void 0) { animation = true; }
var indexPos = -index * this.itemWidth;
if (animation) {
engine.Tween.get(this, null, null, true)
.to({ t: indexPos }, 100, engine.Ease.cubicOut);
}
else {
this.t = indexPos;
}
};
ZoomScroll.prototype.onModify = function (value, key, oldValue) {
var _this = this;
switch (key) {
case 'index':
var index_1 = value;
if (oldValue !== undefined) {
index_1 = Math.max(0, Math.min(this.host.children.length - 1, value));
this['_index'] = index_1;
}
setTimeout(function () {
_this.scrollTo(index_1, oldValue !== undefined);
});
break;
}
};
ZoomScroll.id = 'zoom-scroll';
__decorate([
engine.dirtyFieldTrigger
], ZoomScroll.prototype, "index", void 0);
__decorate([
engine.dirtyFieldTrigger
], ZoomScroll.prototype, "itemWidth", void 0);
__decorate([
engine.dirtyFieldTrigger
], ZoomScroll.prototype, "itemHeight", void 0);
__decorate([
engine.dirtyFieldTrigger
], ZoomScroll.prototype, "scaleMin", void 0);
__decorate([
engine.dirtyFieldTrigger
], ZoomScroll.prototype, "scaleMax", void 0);
__decorate([
engine.dirtyFieldTrigger
], ZoomScroll.prototype, "alphaOut", void 0);
__decorate([
engine.dirtyFieldTrigger
], ZoomScroll.prototype, "alphaIn", void 0);
return ZoomScroll;
}(engine.ScriptBase));
exports.default = ZoomScroll;
declare function getAssetByUUID(uuid: string);
declare function getAssetByName(name: string);
declare function getProps():any;
......@@ -53,6 +53,9 @@ function launchWithCustomModule(customModule) {
function getAssetByUUID(uuid) {
return engine.resolveCustomAsset(customId, uuid);
}
function getAssetByName(name){
return getAssetByUUID(engine.getAssetByName(name).uuid);
}
function getProps() {
return engine.getProps(customId);
......
......@@ -15,18 +15,18 @@
//# sourceMappingURL=props.js.map
function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
return engine.Texture.from(uuid);
}
function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
return getTexture(getAssetByName(name).uuid);
}
function getBlockAsset(type) {
return engine.getAssetByName(props.blockAssets[type]);
}
function createSvga(name, anchorName) {
var inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
var anchor = props[(anchorName)];
inst.source = 'asset://' + getAssetByName(name).uuid;
var anchor = props[anchorName];
if (anchor) {
inst.x = -anchor.x;
inst.y = -anchor.y;
......@@ -36,9 +36,8 @@
return inst;
}
function playSound(name) {
engine.playSound(engine.getAssetByName(name).uuid, { keep: true });
engine.playSound(getAssetByName(name).uuid, { keep: true });
}
//# sourceMappingURL=utils.js.map
var Block = (function (_super) {
tslib.__extends(Block, _super);
......@@ -861,6 +860,7 @@
};
return GameView;
}(engine.Container));
//# sourceMappingURL=GameView.js.map
var JumpHigh = (function (_super) {
tslib.__extends(JumpHigh, _super);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -5,7 +5,7 @@ import Block from "./Block";
import {Background} from "./Background";
import Player from "./Player";
import {props} from "../props";
import {createSvga, getTextureByName, playSound} from "./utils";
import {createSvga, playSound} from "./utils";
import {Base} from "./Base";
import {GuideLayer} from "./GuideLayer";
import {GoldBag} from "./GoldBag";
......
......@@ -4,11 +4,11 @@
import {props} from "../props";
export function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
return engine.Texture.from(uuid);
}
export function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
return getTexture(getAssetByName(name).uuid);
}
export function getBlockAsset(type) {
......@@ -17,8 +17,8 @@ export function getBlockAsset(type) {
export function createSvga(name, anchorName) {
let inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
let anchor = props[(anchorName)];
inst.source = 'asset://' + getAssetByName(name).uuid;
let anchor = props[anchorName];
if (anchor) {
inst.x = -anchor.x;
inst.y = -anchor.y;
......@@ -30,5 +30,5 @@ export function createSvga(name, anchorName) {
}
export function playSound(name) {
engine.playSound(engine.getAssetByName(name).uuid, {keep: true});
engine.playSound(getAssetByName(name).uuid, {keep: true});
}
......@@ -69,6 +69,7 @@
};
return GameObject;
}(engine.Container));
//# sourceMappingURL=GameObject.js.map
var GameComponent = (function () {
function GameComponent(owner) {
......@@ -102,12 +103,14 @@
});
return GameComponent;
}());
//# sourceMappingURL=GameComponent.js.map
var DataMgr;
(function (DataMgr) {
DataMgr.game = null;
DataMgr.minEnableCaptchaScore = null;
})(DataMgr || (DataMgr = {}));
//# sourceMappingURL=DataMgr.js.map
var Physics = (function (_super) {
tslib.__extends(Physics, _super);
......@@ -168,6 +171,7 @@
};
return Physics;
}(GameComponent));
//# sourceMappingURL=Physics.js.map
var Collider = (function (_super) {
tslib.__extends(Collider, _super);
......@@ -308,6 +312,7 @@
ColliderType[ColliderType["Rect"] = 1] = "Rect";
ColliderType[ColliderType["Point"] = 2] = "Point";
})(ColliderType || (ColliderType = {}));
//# sourceMappingURL=Collider.js.map
var MConst;
(function (MConst) {
......@@ -347,6 +352,7 @@
MConst.WenzhouLocation = new engine.Rectangle(119.37, 27.03, 1.81, 1.33);
MConst.HangzhouLocation = new engine.Rectangle(118.21, 29.11, 2.09, 1.22);
})(MConst || (MConst = {}));
//# sourceMappingURL=MConst.js.map
var MoveObjcet = (function (_super) {
tslib.__extends(MoveObjcet, _super);
......@@ -358,6 +364,7 @@
}
return MoveObjcet;
}(GameObject));
//# sourceMappingURL=MoveObject.js.map
var MEvent = (function () {
function MEvent() {
......@@ -420,6 +427,7 @@
};
return MEvent;
}());
//# sourceMappingURL=MEvent.js.map
var MTimer = (function () {
function MTimer() {
......@@ -505,6 +513,7 @@
_onFrame.call(MTimer.deltaTime);
timerTickEvent.call();
}
//# sourceMappingURL=MTimer.js.map
var GameMgr = (function () {
function GameMgr(name) {
......@@ -521,6 +530,7 @@
};
return GameMgr;
}());
//# sourceMappingURL=GameMgr.js.map
function getTexture(uuid) {
var config = getAssetByUUID(uuid);
......@@ -533,6 +543,7 @@
function clamp(target, min, max) {
return Math.min(max, Math.max(min, target));
}
//# sourceMappingURL=utils.js.map
var bulletSpeedValue = 20;
var frameCountThatBulletsMoveInX = 4;
......@@ -610,6 +621,7 @@
};
return HorizontalMoveMgr;
}(GameMgr));
//# sourceMappingURL=Bullet.js.map
var SoundMgr = (function () {
function SoundMgr() {
......@@ -648,6 +660,7 @@
dong: "7fc04e43-1465-4336-92a3-d6039ee88cb3",
boom: "ca6b799f-be85-4e94-99df-812f31801490"
};
//# sourceMappingURL=SoundMgr.js.map
var props = {};
function prepareProps() {
......@@ -657,6 +670,7 @@
function injectProps(p) {
engine.injectProp(props, p);
}
//# sourceMappingURL=props.js.map
var Car = (function (_super) {
tslib.__extends(Car, _super);
......@@ -778,6 +792,7 @@
};
return Car;
}(GameObject));
//# sourceMappingURL=Car.js.map
var PlayerController = (function (_super) {
tslib.__extends(PlayerController, _super);
......@@ -814,6 +829,7 @@
}
return PlayerController;
}(engine.Container));
//# sourceMappingURL=PlayerController.js.map
var MConfigs;
(function (MConfigs) {
......@@ -914,6 +930,7 @@
},
};
})(MConfigs || (MConfigs = {}));
//# sourceMappingURL=MConfigs.js.map
var MUtils;
(function (MUtils) {
......@@ -973,6 +990,7 @@
}
MUtils.setColorFilter = setColorFilter;
})(MUtils || (MUtils = {}));
//# sourceMappingURL=MUtils.js.map
function getBallScore(bulletScore, powerScore, colorIndex) {
var getScoreFromRange = function (_a) {
......@@ -1060,6 +1078,7 @@
}
return newArray;
}
//# sourceMappingURL=GUtils.js.map
var UILayer = (function (_super) {
tslib.__extends(UILayer, _super);
......@@ -1071,6 +1090,7 @@
}
return UILayer;
}(engine.Container));
//# sourceMappingURL=UILayer.js.map
var DebugMgr = (function (_super) {
tslib.__extends(DebugMgr, _super);
......@@ -1225,6 +1245,7 @@
DebugMgr._instance = null;
return DebugMgr;
}(UILayer));
//# sourceMappingURL=DebugMgr.js.map
var instanceId1 = null;
var instanceId2 = null;
......@@ -1462,6 +1483,7 @@
7: 2
};
var GroupMaxIndex = 7;
//# sourceMappingURL=PhycicsSystem.js.map
var PoolGroup = (function () {
function PoolGroup(layer) {
......@@ -1484,6 +1506,7 @@
};
return Pool;
}());
//# sourceMappingURL=Pool.js.map
var padding = 10;
var GuideMask = (function (_super) {
......@@ -1505,7 +1528,7 @@
var alpha = 0.7;
var top = new engine.Shape();
top.beginFill(color, alpha);
top.drawRect(0, 0, sw, y);
top.drawRect(0, -sh, sw, y + sh);
top.endFill();
_this.addChild(top);
var bottom = new engine.Shape();
......@@ -1581,6 +1604,13 @@
enumerable: true,
configurable: true
});
Object.defineProperty(GuideMgr.prototype, "container", {
set: function (c) {
this._container = c;
},
enumerable: true,
configurable: true
});
Object.defineProperty(GuideMgr.prototype, "guideDone", {
get: function () {
return !this.guideFlag || this.done.length >= Object.keys(MConfigs.guide).length;
......@@ -1606,11 +1636,12 @@
_this.guideFlag = false;
}
};
engine.gameStage.addChild(this.currentGuideMask);
this._container.addChild(this.currentGuideMask);
};
GuideMgr._instance = null;
return GuideMgr;
}());
//# sourceMappingURL=GuideMgr.js.map
var tempPower = null;
var imageNames = [
......@@ -1857,6 +1888,7 @@
Ball.textures = [];
return Ball;
}(MoveObjcet));
//# sourceMappingURL=Ball.js.map
var BallPool = (function (_super) {
tslib.__extends(BallPool, _super);
......@@ -1898,6 +1930,7 @@
};
return BallPoolGroup;
}(PoolGroup));
//# sourceMappingURL=BallPool.js.map
var FrameAnimationMgr = (function (_super) {
tslib.__extends(FrameAnimationMgr, _super);
......@@ -1998,6 +2031,7 @@
FrameAnimation.caches = {};
return FrameAnimation;
}(engine.Container));
//# sourceMappingURL=FrameAnimation.js.map
var PoolFrameAnimation = (function (_super) {
tslib.__extends(PoolFrameAnimation, _super);
......@@ -2046,6 +2080,7 @@
};
return AnimationPoolGroup;
}(PoolGroup));
//# sourceMappingURL=AnimationPool.js.map
var BulletPool = (function (_super) {
tslib.__extends(BulletPool, _super);
......@@ -2066,6 +2101,7 @@
};
return BulletPool;
}(Pool));
//# sourceMappingURL=BulletPool.js.map
var TextureMgr;
(function (TextureMgr) {
......@@ -2101,6 +2137,7 @@
}
TextureMgr.get = get;
})(TextureMgr || (TextureMgr = {}));
//# sourceMappingURL=TextureMgr.js.map
var InitSpeedValue = 0.08;
var alphaDuration = 300;
......@@ -2233,6 +2270,7 @@
};
return SpBoomEffectPoolGroup;
}(PoolGroup));
//# sourceMappingURL=SpBoomEffect.js.map
var dropImgNames = [
"f7221f86-f376-40ce-b0e8-f7ea573ec780",
......@@ -2352,6 +2390,7 @@
};
return Drop;
}(MoveObjcet));
//# sourceMappingURL=Drop.js.map
var DropPool = (function (_super) {
tslib.__extends(DropPool, _super);
......@@ -2385,6 +2424,7 @@
};
return DropPoolGroup;
}(PoolGroup));
//# sourceMappingURL=DropPool.js.map
var DropBlinkMgr = (function (_super) {
tslib.__extends(DropBlinkMgr, _super);
......@@ -2428,6 +2468,7 @@
return DropBlinkMgr;
}(GameMgr));
var BlinkDuration = 3;
//# sourceMappingURL=DropBlinkMgr.js.map
var Game = (function () {
function Game(parent) {
......@@ -2465,6 +2506,7 @@
this.pause = false;
this.loadRes();
parent.addChild(this.node);
GuideMgr.instance.container = parent;
this.node.width = MConst.DesignResolution.width;
this.node.height = MConst.DesignResolution.height;
var bg = new engine.Image(getTexture("d99368b8-af5d-4d9e-981e-7bce3e1c1e84"));
......@@ -2762,6 +2804,7 @@
});
return Game;
}());
//# sourceMappingURL=Game.js.map
var ShootPlanet = (function (_super) {
tslib.__extends(ShootPlanet, _super);
......@@ -2780,7 +2823,9 @@
return _this;
}
ShootPlanet.prototype.onActive = function () {
if (!this.game) {
this.game = new Game(this);
}
if (GuideMgr.instance.guideFlag == true) {
var car = this.game._car;
GuideMgr.instance.runGuide(0, car.x + car.width / 2, car.y + car.height / 2);
......@@ -2818,6 +2863,7 @@
};
return ShootPlanet;
}(engine.Container));
//# sourceMappingURL=ShootPlanet.js.map
function index (props) {
prepareProps();
......@@ -2825,6 +2871,7 @@
var instance = new ShootPlanet();
return instance;
}
//# sourceMappingURL=index.js.map
return index;
......
This diff is collapsed.
......@@ -152,6 +152,8 @@ export default class Game {
this.loadRes();
parent.addChild(this.node);
GuideMgr.instance.container = parent;
this.node.width = MConst.DesignResolution.width;
this.node.height = MConst.DesignResolution.height;
let bg = new engine.Image(getTexture("d99368b8-af5d-4d9e-981e-7bce3e1c1e84"));
......
......@@ -28,7 +28,7 @@ export default class GuideMask extends engine.Container {
let top = new engine.Shape();
top.beginFill(color, alpha);
top.drawRect(0, 0, sw, y);
top.drawRect(0, -sh, sw, y + sh);
top.endFill();
this.addChild(top);
......
......@@ -22,7 +22,12 @@ export default class GuideMgr {
localStorage.setItem("shoot-planet_" + props.guideFlagKey, v ? "true" : "false");
}
set container(c){
this._container = c;
}
private done: number[] = [];
private _container: engine.Container;
get guideDone(){
return !this.guideFlag || this.done.length >= Object.keys(MConfigs.guide).length;
......@@ -46,6 +51,6 @@ export default class GuideMgr {
this.guideFlag = false;
}
};
engine.gameStage.addChild(this.currentGuideMask);
this._container.addChild(this.currentGuideMask);
}
}
\ No newline at end of file
......@@ -25,7 +25,9 @@ export class ShootPlanet extends engine.Container {
}
public onActive() {
if(!this.game){
this.game = new Game(this);
}
if (GuideMgr.instance.guideFlag == true) {
const car = this.game._car;
GuideMgr.instance.runGuide(0, car.x + car.width / 2, car.y + car.height / 2 /* - 130 */);
......
......@@ -5,9 +5,11 @@
const eventName = engine.findVariable('eventName', args, props);
const data = engine.findVariable('data', args, props);
const useCapture = engine.findVariable('useCapture', args, props);
const isGlobal = engine.findVariable('isGlobal', args, props);
if(eventName){
engine.globalEvent.dispatchEvent(eventName, data, useCapture);
let sender = isGlobal ? engine.globalEvent : target;
sender.dispatchEvent(eventName, data, useCapture);
}
next('success', args);
......@@ -14,6 +14,11 @@
"type": "boolean",
"alias": "是否捕获",
"default": true
},
"isGlobal": {
"type": "boolean",
"alias": "是否全局",
"default": true
}
},
"output": [
......
......@@ -2,16 +2,19 @@
* Created by rockyl on 2019-12-05.
*/
const map = engine.findVariable('map', args, props);
const ua = navigator.userAgent.toLowerCase();
let env;
if(ua.indexOf('eversunshine') >= 0){
env = 'eversunshine'
}else if(ua.indexOf('micromessenger') >= 0){
env = 'weixin'
}
var env;
console.log('env:', env);
if(map){
for (let key in map) {
if (ua.indexOf(key) >= 0) {
env = map[key];
break;
}
}
}
const payload = args || {};
payload.env = env;
......
{
"props": {},
"props": {
"map": {
"alias": "UA包含表",
"type": "map"
}
},
"name": "环境判断",
"output": [
"success"
......
......@@ -121,7 +121,7 @@
"metas": [
{
"id": "duiba-api-transform",
"script": "if (args.success) {\n next('success', args.data);\n}\nelse {\n\tengine.globalEvent.dispatchEvent('net-failed', args);\n next('failed', args);\n}\n",
"script": "if (args.success) {\n\tvar payload;\n\n\tif (typeof args.data === 'object') {\n\t\tpayload = engine.objClone(args.data);\n\n\t\tvar origin = engine.objClone(args);\n\t\tObject.defineProperty(payload, '__origin', {\n\t\t\tget: function () {\n\t\t\t\treturn origin\n\t\t\t},\n\t\t\tenumerable: false\n\t\t});\n\t} else {\n\t\tpayload = args.data;\n\t}\n\tnext('success', payload);\n}\nelse {\n\tengine.globalEvent.dispatchEvent('net-failed', args);\n\tnext('failed', args);\n}",
"props": {},
"isInline": true,
"name": "兑吧接口转换",
......
{
"name": "Http轮询",
"name": "兑吧接口轮询",
"props": {
"url": {
"type": "string",
......@@ -123,7 +123,7 @@
"subEntry": "442452af-e4d2-47be-b931-86fef866056f",
"metas": [
{
"script": "var count = props.count, field = props.field, successValues = props.successValues;\nvar key = 'counting-' + vm.id;\nvar counting = global[key] || 0;\ncounting++;\nvar successArr = successValues.split(',');\nif (successArr.indexOf(args[field] + '') >= 0) {\n delete global[key];\n next('success', args);\n}\nelse if (counting < count) {\n global[key] = counting;\n next('continue');\n}\nelse {\n delete global[key];\n next('timeout');\n}\n",
"script": "var count = props.count, field = props.field, successValues = props.successValues;\nvar key = 'counting-' + vm.id;\nvar counting = global[key] || 0;\ncounting++;\nvar successValue = engine.getDataByPath(args, field) + '';\nvar successArr = successValues.split(',');\nif (successArr.indexOf(successValue) >= 0) {\n delete global[key];\n next('success', args);\n}\nelse if (counting < count) {\n global[key] = counting;\n next('continue');\n}\nelse {\n delete global[key];\n next('timeout');\n}",
"props": {
"count": {
"type": "number",
......
This diff is collapsed.
This diff is collapsed.
if (window['getPxToken']) {
window['getPxToken'](function (e, token) {
switch (e) {
case 'net error':
next('error', {type: 'error'});
break;
case 'need login':
next('failed', {type: 'failed'});
break;
case 'state invalid':
next('invalid', {type: 'invalid'});
break;
default:
if(token){
scope.token = token;
next('success', args);
}else{
next('invalid', {type: 'invalid key'});
}
}
});
} else {
next('error', {type: 'no ready'});
}
{
"name": "获取星速台Token",
"props": {
"comment": {
"type": "string",
"alias": "星速台通用token"
}
},
"output": [
"success",
"failed",
"invalid",
"error"
]
}
\ No newline at end of file
......@@ -2,22 +2,19 @@
* Created by rockyl on 2019-11-16.
*/
if(props.closeAll){
if(props.popAll){
if (!props.viewName) {
console.log('没有设置视图名');
next('exception', '没有设置视图名');
}else{
let gameStage = engine.gameStage;
let viewConfig = gameStage.getViewConfigByName(props.viewName);
if (viewConfig) {
let view = engine.instantiate(viewConfig);
gameStage.sceneContainer.push(view);
} else {
console.error('view config not exists');
}
let view = gameStage.instantiateView(props.viewName);
if (view) {
gameStage.sceneContainer.popAll(view);
next('complete');
}else{
next('exception', '视图不存在');
}
}
}else{
engine.gameStage.sceneContainer.pop();
......
......@@ -13,6 +13,7 @@
}
},
"output": [
"complete"
"complete",
"exception"
]
}
\ No newline at end of file
......@@ -21,6 +21,7 @@ export default class BuriedPoint extends engine.ScriptBase {
private _autoExposured = false;
private _hostVisible = false;
private _timer;
onModify(value, key, oldValue) {
switch (key) {
......@@ -36,7 +37,15 @@ export default class BuriedPoint extends engine.ScriptBase {
this.host.addEventListener(engine.MouseEvent.CLICK, this._onClick, this);
//this.host.addEventListener(engine.Event.VISIBLE, this._onVisible, this);
setInterval(this.checkVisibility, 1000 / this.checkFps);
this._timer = setInterval(this.checkVisibility, 1000 / this.checkFps);
}
destroy(): void {
this.host.removeEventListener(engine.MouseEvent.CLICK, this._onClick, this);
if (this._timer) {
clearInterval(this._timer);
this._timer = null;
}
}
awake(): void {
......@@ -55,7 +64,7 @@ export default class BuriedPoint extends engine.ScriptBase {
let worldVisible = this.host.worldVisible;
if (worldVisible !== this._hostVisible) {
this._hostVisible = worldVisible;
if(worldVisible){
if (worldVisible) {
this._onVisible();
}
}
......@@ -90,7 +99,7 @@ export default class BuriedPoint extends engine.ScriptBase {
dcm: this['__dcm'],
dom: this['__dom'],
});
if(this.id !== undefined){
if (this.id !== undefined) {
engine.globalEvent.dispatchEvent('buried-point-success', {
type,
id: this.id,
......
......@@ -5,6 +5,7 @@
export default class ZoomScroll extends engine.ScriptBase {
static id = 'zoom-scroll';
autoInit: boolean = true;
duration: number = 1000;
@engine.dirtyFieldTrigger
index: number = 0;
......@@ -28,8 +29,10 @@ export default class ZoomScroll extends engine.ScriptBase {
mounted() {
this._centerOffset = this.host.width / 2;
if(this.autoInit){
this.init();
this.host.addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDragStart, this);
}
}
sleep(): void {
......@@ -49,6 +52,7 @@ export default class ZoomScroll extends engine.ScriptBase {
}
this.scrollTo(0, false);
this.host.addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDragStart, this);
}
updateOffset(offset) {
......
{
"name": "缩放滚动",
"props": {
"autoInit": {
"alias": "自动初始化",
"type": "boolean",
"default": true
},
"duration": {
"alias": "时间",
"type": "number",
......
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