Commit d914feca authored by rockyl's avatar rockyl

提交一波

parent f0684238
......@@ -398,5 +398,5 @@
}
},
"id": "jump-high",
"code": "(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :\n\ttypeof define === 'function' && define.amd ? define(['tslib'], factory) :\n\t(global = global || self, global['jump-high'] = factory(global.tslib));\n}(this, (function (tslib) { 'use strict';\n\n\tvar props = {};\n\tfunction prepareProps() {\n\t var metaProps = getProps();\n\t engine.injectProp(props, metaProps);\n\t}\n\tfunction injectProps(p) {\n\t engine.injectProp(props, p);\n\t}\n\t//# sourceMappingURL=props.js.map\n\n\tfunction getTexture(uuid) {\n\t return engine.Texture.from(getAssetByUUID(uuid).uuid);\n\t}\n\tfunction getTextureByName(name) {\n\t return getTexture(engine.getAssetByName(name).uuid);\n\t}\n\tfunction getBlockAsset(type) {\n\t return engine.getAssetByName(props.blockAssets[type]);\n\t}\n\tfunction createSvga(name, anchorName) {\n\t var inst = new svga.Svga();\n\t inst.source = 'asset://' + engine.getAssetByName(name).uuid;\n\t var anchor = props[(anchorName)];\n\t if (anchor) {\n\t inst.x = -anchor.x;\n\t inst.y = -anchor.y;\n\t inst.anchorX = anchor.x;\n\t inst.anchorY = anchor.y;\n\t }\n\t return inst;\n\t}\n\tfunction playSound(name) {\n\t engine.playSound(engine.getAssetByName(name).uuid, { keep: true });\n\t}\n\t//# sourceMappingURL=utils.js.map\n\n\tvar Block = (function (_super) {\n\t tslib.__extends(Block, _super);\n\t function Block() {\n\t var _this = _super.call(this) || this;\n\t var body = _this.body = new svga.Svga();\n\t body.x = -props.blockWidth / 2;\n\t body.y = -props.blockHitHeight - props.blockPaddingTop;\n\t _this.addChild(body);\n\t return _this;\n\t }\n\t Block.prototype.reset = function (_a) {\n\t var type = _a.type;\n\t this.dir = Math.random() > 0.5 ? 1 : -1;\n\t if (this.type != type) {\n\t this.type = type;\n\t var asset = getBlockAsset(type);\n\t this.body.source = 'asset://' + asset.uuid;\n\t }\n\t this.scaleX = this.dir;\n\t this.body.gotoAndStop(1);\n\t };\n\t Block.prototype.playEnter = function (index, animation) {\n\t var _this = this;\n\t this.visible = true;\n\t this.x = this.dir * this.stage.width;\n\t var _a = props.blockDurationRange, min = _a[0], max = _a[1];\n\t var duration = Math.max(max - index * props.blockDurationStep, min);\n\t duration = duration + max * Math.random() * props.blockDurationRandom * (Math.random() > 0.5 ? 1 : -1);\n\t return new Promise(function (resolve) {\n\t if (animation) {\n\t engine.Tween.get(_this, null, null, true)\n\t .to({ x: 0, }, duration)\n\t .call(resolve);\n\t }\n\t else {\n\t _this.x = 0;\n\t setTimeout(function () {\n\t console.log(_this.body);\n\t }, 200);\n\t resolve();\n\t }\n\t });\n\t };\n\t Block.prototype.playLeave = function () {\n\t this.visible = false;\n\t };\n\t Block.prototype.playEffect = function () {\n\t var body = this.body;\n\t body.play(true, false);\n\t body.once(engine.Event.END_FRAME, function () {\n\t body.gotoAndStop(1);\n\t }, this);\n\t };\n\t Block.prototype.stop = function () {\n\t engine.Tween.removeTweens(this);\n\t };\n\t return Block;\n\t}(engine.Container));\n\t//# sourceMappingURL=Block.js.map\n\n\tvar Background = (function (_super) {\n\t tslib.__extends(Background, _super);\n\t function Background() {\n\t return _super.call(this) || this;\n\t }\n\t Background.prototype.setup = function () {\n\t var _a = this.stage, width = _a.width, height = _a.height;\n\t var bg = this._bg = new engine.Image(getTextureByName('背景图'));\n\t bg.anchorX = bg.width / 2;\n\t bg.anchorY = bg.height / 2;\n\t bg.x = -(bg.width - width) / 2;\n\t bg.y = -(bg.height - height) / 2;\n\t this.addChild(bg);\n\t this._minScale = width / bg.width;\n\t };\n\t Background.prototype.playZoom = function (type, duration) {\n\t var _this = this;\n\t if (duration === void 0) { duration = 700; }\n\t return new Promise(function (resolve) {\n\t var scale = type === 'in' ? 1 : _this._minScale;\n\t engine.Tween.get(_this._bg, null, null, true)\n\t .to({ scaleX: scale, scaleY: scale }, duration, engine.Ease.cubicInOut)\n\t .call(resolve);\n\t });\n\t };\n\t return Background;\n\t}(engine.Container));\n\t//# sourceMappingURL=Background.js.map\n\n\tvar svgaAssets = {\n\t aniReady: { name: '准备立正', dir: 1 },\n\t aniJump: { name: '跳上升', dir: 1 },\n\t aniFall: { name: '跳下落', dir: 1 },\n\t aniLandNormal: { name: '普通着地', dir: 1 },\n\t aniLandSide: { name: '边缘着地', dir: -1 },\n\t aniHit: { name: '被撞开', dir: -1 },\n\t aniParachute: { name: '降落', dir: -1 },\n\t};\n\tvar Player = (function (_super) {\n\t tslib.__extends(Player, _super);\n\t function Player() {\n\t var _this = _super.call(this) || this;\n\t _this.g = props.gravity;\n\t _this.addEventListener(engine.Event.ENTER_FRAME, _this.onEnterFrame, _this);\n\t return _this;\n\t }\n\t Player.prototype.switchAni = function (name, dir, play, loop) {\n\t var _this = this;\n\t if (dir === void 0) { dir = 1; }\n\t if (play === void 0) { play = true; }\n\t if (loop === void 0) { loop = false; }\n\t return new Promise(function (resolve) {\n\t _this.scaleX = dir;\n\t if (_this._aniName !== name) {\n\t _this._aniName = name;\n\t var oldAni = _this.removeChild(_this.getChildByName('body'));\n\t if (oldAni) {\n\t oldAni.stop();\n\t }\n\t var ani = _this._currentAni = _this['ani' + name];\n\t _this.addChild(ani);\n\t if (play) {\n\t ani.play(false, loop);\n\t if (loop) {\n\t resolve();\n\t }\n\t else {\n\t ani.once(engine.Event.END_FRAME, resolve);\n\t }\n\t }\n\t else {\n\t ani.gotoAndStop(1);\n\t resolve();\n\t }\n\t }\n\t });\n\t };\n\t Player.prototype.setup = function () {\n\t this.prefectEffect = createSvga('完美着地特效', 'playerLandPrefectAnchor');\n\t this.landEffect = createSvga('着地特效', 'playerLandEffectAnchor');\n\t for (var key in svgaAssets) {\n\t var _a = svgaAssets[key], name = _a.name, dir = _a.dir;\n\t var body = this[key] = createSvga(name, key.replace('ani', 'player') + 'Anchor');\n\t body.name = 'body';\n\t body.scaleX = dir;\n\t }\n\t };\n\t Player.prototype.reset = function (revive) {\n\t this.x = 0;\n\t this.rotation = 0;\n\t this.scaleX = this.scaleY = 1;\n\t this._prefectLandCounting = 0;\n\t engine.Tween.removeTweens(this);\n\t if (revive) {\n\t this.switchAni('Jump', 1, false);\n\t }\n\t };\n\t Player.prototype.playReady = function () {\n\t var _this = this;\n\t return new Promise(function (resolve) {\n\t _this.switchAni('Ready', 1);\n\t _this._currentAni.once(engine.Event.END_FRAME, function () {\n\t this.switchAni('Jump', 1, false);\n\t resolve();\n\t }, _this);\n\t });\n\t };\n\t Player.prototype.onEnterFrame = function (event) {\n\t if (!this.playing) {\n\t return;\n\t }\n\t this.vy += this.g;\n\t this.y += this.vy;\n\t if (this.vy > 0 && this._aniName !== 'Fall') {\n\t this.dispatchEvent('jump-on-top');\n\t this.switchAni('Fall');\n\t }\n\t if (this.y > this.baseY) {\n\t this.y = this.baseY;\n\t this.playing = false;\n\t this.jumpPromise && this.jumpPromise({\n\t aboveBlock: this.aboveBlock,\n\t });\n\t this.jumpPromise = null;\n\t }\n\t };\n\t Player.prototype.changeBaseY = function (v) {\n\t if (this.baseY == v) {\n\t return;\n\t }\n\t this.aboveBlock = true;\n\t this.baseY = v;\n\t };\n\t Player.prototype.jump = function () {\n\t var _this = this;\n\t playSound('跳起音效');\n\t this.switchAni('Jump', 1, false);\n\t this._currentAni.play(false, false);\n\t this.aboveBlock = false;\n\t this.playing = true;\n\t this.baseY = this.y;\n\t this.vy = -props.jumpSpeed;\n\t return new Promise(function (resolve) {\n\t _this.jumpPromise = resolve;\n\t });\n\t };\n\t Player.prototype.playLand = function (type, dir) {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var _a, prefectEffect_1, landEffect_1;\n\t return tslib.__generator(this, function (_b) {\n\t switch (_b.label) {\n\t case 0:\n\t _a = type;\n\t switch (_a) {\n\t case 0: return [3, 1];\n\t case 1: return [3, 3];\n\t case 2: return [3, 3];\n\t case 3: return [3, 4];\n\t }\n\t return [3, 5];\n\t case 1:\n\t this._prefectLandCounting++;\n\t playSound('完美落地音效' + Math.min(4, this._prefectLandCounting));\n\t prefectEffect_1 = this.prefectEffect;\n\t this.addChildAt(prefectEffect_1, 0);\n\t prefectEffect_1.gotoAndPlay(1);\n\t prefectEffect_1.once(engine.Event.END_FRAME, function () {\n\t this.removeChild(prefectEffect_1);\n\t }, this);\n\t landEffect_1 = this.landEffect;\n\t this.addChildAt(landEffect_1, 0);\n\t landEffect_1.gotoAndPlay(1);\n\t landEffect_1.once(engine.Event.END_FRAME, function () {\n\t this.removeChild(landEffect_1);\n\t }, this);\n\t return [4, this.switchAni('LandNormal')];\n\t case 2:\n\t _b.sent();\n\t return [3, 5];\n\t case 3:\n\t this._prefectLandCounting = 0;\n\t playSound('普通落地音效');\n\t this.switchAni('LandNormal');\n\t return [3, 5];\n\t case 4:\n\t this._prefectLandCounting = 0;\n\t playSound('边缘落地音效');\n\t this.switchAni('LandSide', dir);\n\t return [3, 5];\n\t case 5: return [2];\n\t }\n\t });\n\t });\n\t };\n\t Player.prototype.hitAway = function (dir) {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var _this = this;\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t this.jumpPromise && this.jumpPromise();\n\t this.jumpPromise = null;\n\t playSound('被撞开音效');\n\t this.switchAni('Hit', dir);\n\t this.vy = 0;\n\t return [4, new Promise(function (resolve) {\n\t engine.Tween.get(_this)\n\t .to({\n\t x: -dir * props.hitAwayDistance.x,\n\t }, props.hitAwayDuration, engine.Ease.quartOut);\n\t engine.Tween.get(_this)\n\t .to({\n\t y: _this.y + props.hitAwayDistance.y,\n\t }, props.hitAwayDuration, engine.Ease.cubicOut)\n\t .call(resolve);\n\t })];\n\t case 1:\n\t _a.sent();\n\t return [2];\n\t }\n\t });\n\t });\n\t };\n\t Player.prototype.parachute = function (dir) {\n\t var _this = this;\n\t this.switchAni('Parachute', dir);\n\t return new Promise(function (resolve) {\n\t engine.Tween.get(_this)\n\t .wait(200)\n\t .call(function () {\n\t playSound('降落伞下落音效');\n\t })\n\t .wait(300)\n\t .to({ y: _this.y + props.parachuteDistance }, props.parachuteDuration)\n\t .set({ anchorOffsetY: 0 })\n\t .call(resolve);\n\t });\n\t };\n\t return Player;\n\t}(engine.Container));\n\t//# sourceMappingURL=Player.js.map\n\n\tvar Base = (function (_super) {\n\t tslib.__extends(Base, _super);\n\t function Base() {\n\t return _super.call(this, getTextureByName('底座')) || this;\n\t }\n\t Base.prototype.setup = function () {\n\t this.x = -(this.width) / 2;\n\t };\n\t Base.prototype.reset = function () {\n\t this.y = -props.baseOffset;\n\t };\n\t return Base;\n\t}(engine.Image));\n\t//# sourceMappingURL=Base.js.map\n\n\tvar GuideLayer = (function (_super) {\n\t tslib.__extends(GuideLayer, _super);\n\t function GuideLayer() {\n\t var _this = _super.call(this) || this;\n\t _this.setup();\n\t return _this;\n\t }\n\t GuideLayer.prototype.setup = function () {\n\t };\n\t GuideLayer.prototype.show = function (id, options) {\n\t var _this = this;\n\t return new Promise(function (resolve) {\n\t _this.visible = true;\n\t if (!_this.guideMask) {\n\t var _a = _this.stage, width = _a.width, height = _a.height;\n\t var guideMask = _this.guideMask = new engine.Container();\n\t var guideHole = new engine.Image(getTextureByName('引导遮罩'));\n\t guideHole.x = (width - guideHole.width) / 2;\n\t guideHole.y = options.y;\n\t guideMask.addChild(guideHole);\n\t _this.createRect(guideMask, 0, 0, width, guideHole.y);\n\t _this.createRect(guideMask, 0, guideHole.y, guideHole.x, guideHole.height);\n\t _this.createRect(guideMask, guideHole.x + guideHole.width, guideHole.y, width - guideHole.x - guideHole.width, guideHole.height);\n\t _this.createRect(guideMask, 0, guideHole.y + guideHole.height, width, height - guideHole.y - guideHole.height);\n\t var label = _this.label = new engine.Label();\n\t label.fillColor = 'white';\n\t label.size = 25;\n\t label.text = props.guideText;\n\t label.x = (width - label.width) / 2;\n\t label.y = guideHole.y + guideHole.height + 50;\n\t guideMask.addChild(label);\n\t _this.addChild(guideMask);\n\t }\n\t _this.once(engine.MouseEvent.CLICK, function () {\n\t this.visible = false;\n\t resolve();\n\t }, _this);\n\t });\n\t };\n\t GuideLayer.prototype.createRect = function (container, x, y, width, height) {\n\t var rect = new engine.Rect();\n\t rect.x = x;\n\t rect.y = y;\n\t rect.width = width;\n\t rect.height = height;\n\t rect.fillColor = 'black';\n\t rect.alpha = 0.7;\n\t container.addChild(rect);\n\t };\n\t return GuideLayer;\n\t}(engine.Container));\n\t//# sourceMappingURL=GuideLayer.js.map\n\n\tvar GoldBag = (function (_super) {\n\t tslib.__extends(GoldBag, _super);\n\t function GoldBag() {\n\t var _this = _super.call(this) || this;\n\t _this.setup();\n\t return _this;\n\t }\n\t GoldBag.prototype.setup = function () {\n\t var avatar = this.avatar = new engine.Sprite(getTextureByName('钱袋-静态'));\n\t avatar.x = -props.goldPackAvatarAnchor.x;\n\t avatar.y = -props.goldPackAvatarAnchor.y;\n\t this.addChild(avatar);\n\t var svga = this.svga = createSvga('钱袋', 'goldPackAnchor');\n\t svga.visible = false;\n\t this.addChild(svga);\n\t };\n\t GoldBag.prototype.reset = function (data) {\n\t this.y = data.y;\n\t this.avatar.visible = true;\n\t this.svga.visible = false;\n\t this.svga.gotoAndStop(1);\n\t this.remain = data.remain;\n\t };\n\t GoldBag.prototype.playOpen = function () {\n\t var _this = this;\n\t this.avatar.visible = false;\n\t this.svga.visible = true;\n\t return new Promise(function (resolve) {\n\t _this.svga.play(true, false);\n\t _this.svga.once(engine.Event.END_FRAME, function () {\n\t this.svga.visible = false;\n\t resolve();\n\t }, _this);\n\t });\n\t };\n\t return GoldBag;\n\t}(engine.Container));\n\t//# sourceMappingURL=GoldBag.js.map\n\n\tvar ObjectPool = engine.ObjectPool;\n\tvar PoolName = 'gold-bag';\n\tObjectPool.registerPool(PoolName, function () {\n\t return new GoldBag();\n\t}, function (item, data) {\n\t item.reset(data);\n\t});\n\tvar GameView = (function (_super) {\n\t tslib.__extends(GameView, _super);\n\t function GameView() {\n\t var _this = _super.call(this) || this;\n\t _this.index = -1;\n\t _this.goldBags = [];\n\t _this.baseOffset = -props.baseOffset + props.playerOffset;\n\t _this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);\n\t return _this;\n\t }\n\t GameView.prototype.setup = function () {\n\t if (this._hasSetup) {\n\t return;\n\t }\n\t this._hasSetup = true;\n\t var _a = this.stage, width = _a.width, height = _a.height;\n\t var background = this.background = new Background();\n\t this.addChild(background);\n\t background.setup();\n\t var frontContainer = this.frontContainer = new engine.Container();\n\t frontContainer.x = width / 2;\n\t this.addChild(frontContainer);\n\t var guideLayer = this.guideLayer = new GuideLayer();\n\t this.addChild(guideLayer);\n\t var base = this.base = new Base();\n\t frontContainer.addChild(base);\n\t base.setup();\n\t var blockContainer = this.blockContainer = new engine.Container();\n\t frontContainer.addChild(blockContainer);\n\t var player = this.player = new Player();\n\t frontContainer.addChild(player);\n\t player.setup();\n\t player.addEventListener('jump-on-top', this.onPlayerJumpOnTop, this);\n\t ObjectPool.recycleObject(PoolName, ObjectPool.getObject(PoolName, {\n\t y: 0,\n\t remain: 0,\n\t }));\n\t this.hitEffect = createSvga('被撞烟雾', 'hitEffectAnchor');\n\t this.pos = 0;\n\t this.background.setup();\n\t this.addEventListener(engine.Event.ENTER_FRAME, this.onEnterFrame, this);\n\t this.reset();\n\t };\n\t GameView.prototype.reset = function (revive) {\n\t if (revive === void 0) { revive = false; }\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var blockContainer, i, li, block, i, i, li, goldBag;\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t this.base.reset();\n\t this.index = -1;\n\t this._score = 0;\n\t if (revive) ;\n\t else {\n\t this.pos = 0;\n\t blockContainer = this.blockContainer;\n\t for (i = 0, li = blockContainer.children.length; i < li; i++) {\n\t block = blockContainer.getChildAt(i);\n\t block.playLeave();\n\t }\n\t }\n\t for (i = 0; i < props.initBlockCount; i++) {\n\t this.addBlock(false);\n\t }\n\t for (i = 0, li = this.goldBags.length; i < li; i++) {\n\t goldBag = this.goldBags[i];\n\t this.frontContainer.removeChild(goldBag);\n\t ObjectPool.recycleObject(PoolName, goldBag);\n\t }\n\t this.goldBags.splice(0);\n\t this.playZoom('in');\n\t return [4, this.resetPlayer(revive)];\n\t case 1:\n\t _a.sent();\n\t return [2];\n\t }\n\t });\n\t });\n\t };\n\t GameView.prototype.resetPlayer = function (revive) {\n\t if (revive === void 0) { revive = false; }\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t return tslib.__generator(this, function (_a) {\n\t this.player.reset(revive);\n\t this.player.y = this.baseOffset - (this.index + 1) * props.blockHitHeight;\n\t return [2];\n\t });\n\t });\n\t };\n\t GameView.prototype.start = function (revive) {\n\t if (revive === void 0) { revive = false; }\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var guideFlagKey, guideFlag;\n\t var _this = this;\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t if (!!revive) return [3, 2];\n\t return [4, this.player.playReady()];\n\t case 1:\n\t _a.sent();\n\t _a.label = 2;\n\t case 2:\n\t guideFlagKey = 'jump-high-guide_' + props.guideFlagKey;\n\t guideFlag = localStorage.getItem(guideFlagKey);\n\t if (!!guideFlag) return [3, 4];\n\t localStorage.setItem(guideFlagKey, '1');\n\t return [4, this.guideLayer.show('', { y: this.stage.height + this.player.y - 280 })];\n\t case 3:\n\t _a.sent();\n\t _a.label = 4;\n\t case 4:\n\t this.lastLandType = 0;\n\t this._remainToShowGoldBag = props.goldBagScoreMultiple - props.goldBagScoreSubtraction;\n\t this._touchEnabled = true;\n\t setTimeout(function () {\n\t _this.addBlock();\n\t }, 100);\n\t engine.globalEvent.dispatchEvent('jump-high-game-start');\n\t return [2];\n\t }\n\t });\n\t });\n\t };\n\t GameView.prototype.pause = function () {\n\t if (this.currentBlock) {\n\t engine.Tween.pauseTweens(this.currentBlock);\n\t }\n\t engine.Tween.pauseTweens(this.player);\n\t };\n\t GameView.prototype.resume = function () {\n\t if (this.currentBlock) {\n\t engine.Tween.resumeTweens(this.currentBlock);\n\t }\n\t engine.Tween.resumeTweens(this.player);\n\t };\n\t GameView.prototype.revive = function () {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t this.blockContainer.getChildAt(this.index).visible = false;\n\t this.index--;\n\t return [4, this.resetPlayer(true)];\n\t case 1:\n\t _a.sent();\n\t return [4, this.playZoom('in')];\n\t case 2:\n\t _a.sent();\n\t this.start(true);\n\t return [2];\n\t }\n\t });\n\t });\n\t };\n\t GameView.prototype.addBlock = function (animation) {\n\t var _this = this;\n\t if (animation === void 0) { animation = true; }\n\t this.index++;\n\t var blockContainer = this.blockContainer;\n\t var block;\n\t if (blockContainer.children.length > this.index) {\n\t block = blockContainer.getChildAt(this.index);\n\t block.visible = true;\n\t }\n\t else {\n\t block = new Block();\n\t blockContainer.addChild(block);\n\t }\n\t block.reset({\n\t type: Math.floor(Math.random() * props.blockAssets.length),\n\t });\n\t block.y = this.baseOffset - this.index * props.blockHitHeight;\n\t this.blockComplete = false;\n\t block.playEnter(this.index, animation).then(function (data) {\n\t _this.blockComplete = true;\n\t });\n\t if (animation) {\n\t this.needHitTest = true;\n\t }\n\t this.currentBlock = block;\n\t };\n\t GameView.prototype.addGoldBag = function () {\n\t var goldBag = ObjectPool.getObject(PoolName, {\n\t y: this.baseOffset - (this.blockCount + props.goldBagDistance + props.goldBagJumpSubtraction) * props.blockHitHeight,\n\t remain: props.goldBagDistance,\n\t });\n\t this.frontContainer.addChild(goldBag);\n\t this.goldBags.push(goldBag);\n\t };\n\t GameView.prototype.playOpenGoldBag = function () {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var i, li, goldBag;\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t i = 0, li = this.goldBags.length;\n\t _a.label = 1;\n\t case 1:\n\t if (!(i < li)) return [3, 4];\n\t goldBag = this.goldBags[i];\n\t goldBag.remain--;\n\t if (!(goldBag.remain <= 0)) return [3, 3];\n\t this.goldBags.splice(i, 1);\n\t i--;\n\t li--;\n\t this.nextToUpdateScore = true;\n\t return [4, goldBag.playOpen()];\n\t case 2:\n\t _a.sent();\n\t this.frontContainer.removeChild(goldBag);\n\t ObjectPool.recycleObject(PoolName, goldBag);\n\t _a.label = 3;\n\t case 3:\n\t i++;\n\t return [3, 1];\n\t case 4: return [2];\n\t }\n\t });\n\t });\n\t };\n\t GameView.prototype.onPlayerJumpOnTop = function () {\n\t if (this.nextToUpdateScore) {\n\t this.nextToUpdateScore = false;\n\t this.scoreChange(4);\n\t playSound('撞击钱袋音效');\n\t }\n\t };\n\t Object.defineProperty(GameView.prototype, \"blockCount\", {\n\t get: function () {\n\t return this.index - props.initBlockCount + 1;\n\t },\n\t enumerable: true,\n\t configurable: true\n\t });\n\t Object.defineProperty(GameView.prototype, \"pos\", {\n\t get: function () {\n\t return this._pos;\n\t },\n\t set: function (v) {\n\t this._pos = v;\n\t this.updatePos();\n\t },\n\t enumerable: true,\n\t configurable: true\n\t });\n\t GameView.prototype.updatePos = function () {\n\t this.frontContainer.y = this.stage.height + this._pos;\n\t };\n\t GameView.prototype.onEnterFrame = function (event) {\n\t if (this.needHitTest) {\n\t if (this.currentBlock) {\n\t var _a = this.currentBlock, bx = _a.x, by = _a.y, dir = _a.dir;\n\t var _b = this.player, px = _b.x, py = _b.y;\n\t var blockHitWidth = props.blockHitWidth, blockHitHeight = props.blockHitHeight, playerWidth = props.playerWidth;\n\t var hitOn = false;\n\t if (Math.abs(px - bx) < (blockHitWidth + playerWidth) / 2) {\n\t this.player.changeBaseY(by - blockHitHeight);\n\t if (py > by - blockHitHeight) {\n\t hitOn = true;\n\t }\n\t }\n\t if (hitOn) {\n\t this.onHitOn(dir);\n\t }\n\t }\n\t }\n\t };\n\t GameView.prototype.onHitOn = function (dir) {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t this._touchEnabled = false;\n\t this.needHitTest = false;\n\t clearInterval(this.timer);\n\t this.currentBlock.stop();\n\t this.playHitEffect(dir);\n\t return [4, this.player.hitAway(dir)];\n\t case 1:\n\t _a.sent();\n\t this.playZoom('out');\n\t return [4, this.player.parachute(dir)];\n\t case 2:\n\t _a.sent();\n\t engine.globalEvent.dispatchEvent('jump-high-game-end');\n\t return [2];\n\t }\n\t });\n\t });\n\t };\n\t GameView.prototype.jump = function () {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var result, pos, type, lastLandType;\n\t var _this = this;\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t if (!this._touchEnabled) {\n\t return [2];\n\t }\n\t this._touchEnabled = false;\n\t this.playOpenGoldBag();\n\t return [4, this.player.jump()];\n\t case 1:\n\t result = _a.sent();\n\t if (!result) return [3, 5];\n\t if (!result.aboveBlock) return [3, 4];\n\t pos = Math.abs(this.currentBlock.x);\n\t type = 0;\n\t if (pos > 0) {\n\t type = pos > 0 && pos < props.scoreThreshold ? 2 : 3;\n\t }\n\t lastLandType = this.lastLandType;\n\t this.lastLandType = type;\n\t if (type === 0) {\n\t if (lastLandType !== type) {\n\t type = 1;\n\t }\n\t }\n\t if (type < 3) {\n\t this.currentBlock.playEffect();\n\t }\n\t this.player.playLand(type, this.currentBlock.dir);\n\t this.currentBlock.stop();\n\t this.scoreChange(type);\n\t return [4, this.playShake()];\n\t case 2:\n\t _a.sent();\n\t return [4, new Promise(function (resolve) {\n\t engine.Tween.get(_this, null, null, true)\n\t .to({ pos: props.blockHitHeight * _this.index }, 300, engine.Ease.cubicOut)\n\t .call(resolve);\n\t })];\n\t case 3:\n\t _a.sent();\n\t this.addBlock();\n\t _a.label = 4;\n\t case 4:\n\t this._touchEnabled = true;\n\t _a.label = 5;\n\t case 5: return [2];\n\t }\n\t });\n\t });\n\t };\n\t GameView.prototype.scoreChange = function (type) {\n\t var scoreAdd = props.scoreWeights[type];\n\t this._score += scoreAdd;\n\t this._remainToShowGoldBag -= scoreAdd;\n\t var score = this._score;\n\t engine.globalEvent.dispatchEvent('jump-high-score', {\n\t type: type,\n\t score: score,\n\t scoreAdd: scoreAdd,\n\t });\n\t console.log(score, this._remainToShowGoldBag);\n\t if (this._remainToShowGoldBag <= 0) {\n\t this._remainToShowGoldBag += props.goldBagScoreMultiple;\n\t this.addGoldBag();\n\t console.log('addGoldBag');\n\t }\n\t };\n\t GameView.prototype.playHitEffect = function (dir) {\n\t var hitEffect = this.hitEffect;\n\t hitEffect.scaleX = dir;\n\t hitEffect.y = this.player.y - props.hitEffectAnchor.y;\n\t hitEffect.play(true, false);\n\t hitEffect.once(engine.Event.END_FRAME, function () {\n\t this.frontContainer.removeChild(hitEffect);\n\t }, this);\n\t this.frontContainer.addChild(hitEffect);\n\t };\n\t GameView.prototype.playZoom = function (type, duration) {\n\t var _this = this;\n\t if (duration === void 0) { duration = 700; }\n\t this.background.playZoom(type, duration);\n\t var count = this.stage.height / props.blockHitHeight;\n\t return new Promise(function (resolve) {\n\t _this.frontContainer.anchorY = -props.blockHitHeight * (_this.index + count * 1.3) + props.baseOffset;\n\t var scale = type === 'in' ? 1 : Math.min((_this.stage.height / props.blockHitHeight / (_this.index + count)), props.maxScale);\n\t console.log(scale);\n\t engine.Tween.get(_this.frontContainer, null, null, true)\n\t .to({ scaleX: scale, scaleY: scale }, duration, engine.Ease.cubicInOut)\n\t .call(resolve);\n\t });\n\t };\n\t GameView.prototype.playShake = function () {\n\t var _this = this;\n\t var _a = this.frontContainer, x = _a.x, y = _a.y;\n\t return new Promise(function (resolve) {\n\t var shakeOffset = 7;\n\t var duration = 30;\n\t engine.Tween.get(_this.frontContainer, null, null, true)\n\t .to({ x: x, y: y - shakeOffset }, duration)\n\t .to({ x: x, y: y + shakeOffset }, duration)\n\t .to({ x: x + shakeOffset, y: y }, duration)\n\t .to({ x: x - shakeOffset, y: y }, duration)\n\t .to({ x: x, y: y }, duration)\n\t .call(resolve);\n\t });\n\t };\n\t return GameView;\n\t}(engine.Container));\n\n\tvar JumpHigh = (function (_super) {\n\t tslib.__extends(JumpHigh, _super);\n\t function JumpHigh() {\n\t var _this = _super.call(this) || this;\n\t engine.globalEvent.addEventListener('jump-high-reset', _this.reset, _this);\n\t engine.globalEvent.addEventListener('jump-high-start', _this.start, _this);\n\t engine.globalEvent.addEventListener('jump-high-pause', _this.pause, _this);\n\t engine.globalEvent.addEventListener('jump-high-resume', _this.resume, _this);\n\t engine.globalEvent.addEventListener('jump-high-revive', _this.revive, _this);\n\t _this.addEventListener(engine.MouseEvent.MOUSE_DOWN, _this.onTap, _this);\n\t var gameView = _this._gameView = new GameView();\n\t _this.addChild(gameView);\n\t return _this;\n\t }\n\t JumpHigh.prototype.reset = function () {\n\t this._gameView.reset();\n\t };\n\t JumpHigh.prototype.start = function (event) {\n\t {\n\t injectProps(event.data);\n\t }\n\t this._status = 1;\n\t this._gameView.start();\n\t };\n\t JumpHigh.prototype.pause = function () {\n\t this._gameView.pause();\n\t };\n\t JumpHigh.prototype.resume = function () {\n\t this._gameView.resume();\n\t };\n\t JumpHigh.prototype.revive = function () {\n\t this._gameView.revive();\n\t };\n\t JumpHigh.prototype.onTap = function (event) {\n\t this._gameView.jump();\n\t };\n\t return JumpHigh;\n\t}(engine.Container));\n\t//# sourceMappingURL=JumpHigh.js.map\n\n\tfunction index (props) {\n\t prepareProps();\n\t injectProps(props);\n\t var instance = new JumpHigh();\n\t return instance;\n\t}\n\t//# sourceMappingURL=index.js.map\n\n\treturn index;\n\n})));\n"
"code": "(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :\n\ttypeof define === 'function' && define.amd ? define(['tslib'], factory) :\n\t(global = global || self, global['jump-high'] = factory(global.tslib));\n}(this, (function (tslib) { 'use strict';\n\n\tvar props = {};\n\tfunction prepareProps() {\n\t var metaProps = getProps();\n\t engine.injectProp(props, metaProps);\n\t}\n\tfunction injectProps(p) {\n\t engine.injectProp(props, p);\n\t}\n\t//# sourceMappingURL=props.js.map\n\n\tfunction getTexture(uuid) {\n\t return engine.Texture.from(uuid);\n\t}\n\tfunction getTextureByName(name) {\n\t return getTexture(getAssetByName(name).uuid);\n\t}\n\tfunction getBlockAsset(type) {\n\t return engine.getAssetByName(props.blockAssets[type]);\n\t}\n\tfunction createSvga(name, anchorName) {\n\t var inst = new svga.Svga();\n\t inst.source = 'asset://' + getAssetByName(name).uuid;\n\t var anchor = props[anchorName];\n\t if (anchor) {\n\t inst.x = -anchor.x;\n\t inst.y = -anchor.y;\n\t inst.anchorX = anchor.x;\n\t inst.anchorY = anchor.y;\n\t }\n\t return inst;\n\t}\n\tfunction playSound(name) {\n\t engine.playSound(getAssetByName(name).uuid, { keep: true });\n\t}\n\n\tvar Block = (function (_super) {\n\t tslib.__extends(Block, _super);\n\t function Block() {\n\t var _this = _super.call(this) || this;\n\t var body = _this.body = new svga.Svga();\n\t body.x = -props.blockWidth / 2;\n\t body.y = -props.blockHitHeight - props.blockPaddingTop;\n\t _this.addChild(body);\n\t return _this;\n\t }\n\t Block.prototype.reset = function (_a) {\n\t var type = _a.type;\n\t this.dir = Math.random() > 0.5 ? 1 : -1;\n\t if (this.type != type) {\n\t this.type = type;\n\t var asset = getBlockAsset(type);\n\t this.body.source = 'asset://' + asset.uuid;\n\t }\n\t this.scaleX = this.dir;\n\t this.body.gotoAndStop(1);\n\t };\n\t Block.prototype.playEnter = function (index, animation) {\n\t var _this = this;\n\t this.visible = true;\n\t this.x = this.dir * this.stage.width;\n\t var _a = props.blockDurationRange, min = _a[0], max = _a[1];\n\t var duration = Math.max(max - index * props.blockDurationStep, min);\n\t duration = duration + max * Math.random() * props.blockDurationRandom * (Math.random() > 0.5 ? 1 : -1);\n\t return new Promise(function (resolve) {\n\t if (animation) {\n\t engine.Tween.get(_this, null, null, true)\n\t .to({ x: 0, }, duration)\n\t .call(resolve);\n\t }\n\t else {\n\t _this.x = 0;\n\t setTimeout(function () {\n\t console.log(_this.body);\n\t }, 200);\n\t resolve();\n\t }\n\t });\n\t };\n\t Block.prototype.playLeave = function () {\n\t this.visible = false;\n\t };\n\t Block.prototype.playEffect = function () {\n\t var body = this.body;\n\t body.play(true, false);\n\t body.once(engine.Event.END_FRAME, function () {\n\t body.gotoAndStop(1);\n\t }, this);\n\t };\n\t Block.prototype.stop = function () {\n\t engine.Tween.removeTweens(this);\n\t };\n\t return Block;\n\t}(engine.Container));\n\t//# sourceMappingURL=Block.js.map\n\n\tvar Background = (function (_super) {\n\t tslib.__extends(Background, _super);\n\t function Background() {\n\t return _super.call(this) || this;\n\t }\n\t Background.prototype.setup = function () {\n\t var _a = this.stage, width = _a.width, height = _a.height;\n\t var bg = this._bg = new engine.Image(getTextureByName('背景图'));\n\t bg.anchorX = bg.width / 2;\n\t bg.anchorY = bg.height / 2;\n\t bg.x = -(bg.width - width) / 2;\n\t bg.y = -(bg.height - height) / 2;\n\t this.addChild(bg);\n\t this._minScale = width / bg.width;\n\t };\n\t Background.prototype.playZoom = function (type, duration) {\n\t var _this = this;\n\t if (duration === void 0) { duration = 700; }\n\t return new Promise(function (resolve) {\n\t var scale = type === 'in' ? 1 : _this._minScale;\n\t engine.Tween.get(_this._bg, null, null, true)\n\t .to({ scaleX: scale, scaleY: scale }, duration, engine.Ease.cubicInOut)\n\t .call(resolve);\n\t });\n\t };\n\t return Background;\n\t}(engine.Container));\n\t//# sourceMappingURL=Background.js.map\n\n\tvar svgaAssets = {\n\t aniReady: { name: '准备立正', dir: 1 },\n\t aniJump: { name: '跳上升', dir: 1 },\n\t aniFall: { name: '跳下落', dir: 1 },\n\t aniLandNormal: { name: '普通着地', dir: 1 },\n\t aniLandSide: { name: '边缘着地', dir: -1 },\n\t aniHit: { name: '被撞开', dir: -1 },\n\t aniParachute: { name: '降落', dir: -1 },\n\t};\n\tvar Player = (function (_super) {\n\t tslib.__extends(Player, _super);\n\t function Player() {\n\t var _this = _super.call(this) || this;\n\t _this.g = props.gravity;\n\t _this.addEventListener(engine.Event.ENTER_FRAME, _this.onEnterFrame, _this);\n\t return _this;\n\t }\n\t Player.prototype.switchAni = function (name, dir, play, loop) {\n\t var _this = this;\n\t if (dir === void 0) { dir = 1; }\n\t if (play === void 0) { play = true; }\n\t if (loop === void 0) { loop = false; }\n\t return new Promise(function (resolve) {\n\t _this.scaleX = dir;\n\t if (_this._aniName !== name) {\n\t _this._aniName = name;\n\t var oldAni = _this.removeChild(_this.getChildByName('body'));\n\t if (oldAni) {\n\t oldAni.stop();\n\t }\n\t var ani = _this._currentAni = _this['ani' + name];\n\t _this.addChild(ani);\n\t if (play) {\n\t ani.play(false, loop);\n\t if (loop) {\n\t resolve();\n\t }\n\t else {\n\t ani.once(engine.Event.END_FRAME, resolve);\n\t }\n\t }\n\t else {\n\t ani.gotoAndStop(1);\n\t resolve();\n\t }\n\t }\n\t });\n\t };\n\t Player.prototype.setup = function () {\n\t this.prefectEffect = createSvga('完美着地特效', 'playerLandPrefectAnchor');\n\t this.landEffect = createSvga('着地特效', 'playerLandEffectAnchor');\n\t for (var key in svgaAssets) {\n\t var _a = svgaAssets[key], name = _a.name, dir = _a.dir;\n\t var body = this[key] = createSvga(name, key.replace('ani', 'player') + 'Anchor');\n\t body.name = 'body';\n\t body.scaleX = dir;\n\t }\n\t };\n\t Player.prototype.reset = function (revive) {\n\t this.x = 0;\n\t this.rotation = 0;\n\t this.scaleX = this.scaleY = 1;\n\t this._prefectLandCounting = 0;\n\t engine.Tween.removeTweens(this);\n\t if (revive) {\n\t this.switchAni('Jump', 1, false);\n\t }\n\t };\n\t Player.prototype.playReady = function () {\n\t var _this = this;\n\t return new Promise(function (resolve) {\n\t _this.switchAni('Ready', 1);\n\t _this._currentAni.once(engine.Event.END_FRAME, function () {\n\t this.switchAni('Jump', 1, false);\n\t resolve();\n\t }, _this);\n\t });\n\t };\n\t Player.prototype.onEnterFrame = function (event) {\n\t if (!this.playing) {\n\t return;\n\t }\n\t this.vy += this.g;\n\t this.y += this.vy;\n\t if (this.vy > 0 && this._aniName !== 'Fall') {\n\t this.dispatchEvent('jump-on-top');\n\t this.switchAni('Fall');\n\t }\n\t if (this.y > this.baseY) {\n\t this.y = this.baseY;\n\t this.playing = false;\n\t this.jumpPromise && this.jumpPromise({\n\t aboveBlock: this.aboveBlock,\n\t });\n\t this.jumpPromise = null;\n\t }\n\t };\n\t Player.prototype.changeBaseY = function (v) {\n\t if (this.baseY == v) {\n\t return;\n\t }\n\t this.aboveBlock = true;\n\t this.baseY = v;\n\t };\n\t Player.prototype.jump = function () {\n\t var _this = this;\n\t playSound('跳起音效');\n\t this.switchAni('Jump', 1, false);\n\t this._currentAni.play(false, false);\n\t this.aboveBlock = false;\n\t this.playing = true;\n\t this.baseY = this.y;\n\t this.vy = -props.jumpSpeed;\n\t return new Promise(function (resolve) {\n\t _this.jumpPromise = resolve;\n\t });\n\t };\n\t Player.prototype.playLand = function (type, dir) {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var _a, prefectEffect_1, landEffect_1;\n\t return tslib.__generator(this, function (_b) {\n\t switch (_b.label) {\n\t case 0:\n\t _a = type;\n\t switch (_a) {\n\t case 0: return [3, 1];\n\t case 1: return [3, 3];\n\t case 2: return [3, 3];\n\t case 3: return [3, 4];\n\t }\n\t return [3, 5];\n\t case 1:\n\t this._prefectLandCounting++;\n\t playSound('完美落地音效' + Math.min(4, this._prefectLandCounting));\n\t prefectEffect_1 = this.prefectEffect;\n\t this.addChildAt(prefectEffect_1, 0);\n\t prefectEffect_1.gotoAndPlay(1);\n\t prefectEffect_1.once(engine.Event.END_FRAME, function () {\n\t this.removeChild(prefectEffect_1);\n\t }, this);\n\t landEffect_1 = this.landEffect;\n\t this.addChildAt(landEffect_1, 0);\n\t landEffect_1.gotoAndPlay(1);\n\t landEffect_1.once(engine.Event.END_FRAME, function () {\n\t this.removeChild(landEffect_1);\n\t }, this);\n\t return [4, this.switchAni('LandNormal')];\n\t case 2:\n\t _b.sent();\n\t return [3, 5];\n\t case 3:\n\t this._prefectLandCounting = 0;\n\t playSound('普通落地音效');\n\t this.switchAni('LandNormal');\n\t return [3, 5];\n\t case 4:\n\t this._prefectLandCounting = 0;\n\t playSound('边缘落地音效');\n\t this.switchAni('LandSide', dir);\n\t return [3, 5];\n\t case 5: return [2];\n\t }\n\t });\n\t });\n\t };\n\t Player.prototype.hitAway = function (dir) {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var _this = this;\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t this.jumpPromise && this.jumpPromise();\n\t this.jumpPromise = null;\n\t playSound('被撞开音效');\n\t this.switchAni('Hit', dir);\n\t this.vy = 0;\n\t return [4, new Promise(function (resolve) {\n\t engine.Tween.get(_this)\n\t .to({\n\t x: -dir * props.hitAwayDistance.x,\n\t }, props.hitAwayDuration, engine.Ease.quartOut);\n\t engine.Tween.get(_this)\n\t .to({\n\t y: _this.y + props.hitAwayDistance.y,\n\t }, props.hitAwayDuration, engine.Ease.cubicOut)\n\t .call(resolve);\n\t })];\n\t case 1:\n\t _a.sent();\n\t return [2];\n\t }\n\t });\n\t });\n\t };\n\t Player.prototype.parachute = function (dir) {\n\t var _this = this;\n\t this.switchAni('Parachute', dir);\n\t return new Promise(function (resolve) {\n\t engine.Tween.get(_this)\n\t .wait(200)\n\t .call(function () {\n\t playSound('降落伞下落音效');\n\t })\n\t .wait(300)\n\t .to({ y: _this.y + props.parachuteDistance }, props.parachuteDuration)\n\t .set({ anchorOffsetY: 0 })\n\t .call(resolve);\n\t });\n\t };\n\t return Player;\n\t}(engine.Container));\n\t//# sourceMappingURL=Player.js.map\n\n\tvar Base = (function (_super) {\n\t tslib.__extends(Base, _super);\n\t function Base() {\n\t return _super.call(this, getTextureByName('底座')) || this;\n\t }\n\t Base.prototype.setup = function () {\n\t this.x = -(this.width) / 2;\n\t };\n\t Base.prototype.reset = function () {\n\t this.y = -props.baseOffset;\n\t };\n\t return Base;\n\t}(engine.Image));\n\t//# sourceMappingURL=Base.js.map\n\n\tvar GuideLayer = (function (_super) {\n\t tslib.__extends(GuideLayer, _super);\n\t function GuideLayer() {\n\t var _this = _super.call(this) || this;\n\t _this.setup();\n\t return _this;\n\t }\n\t GuideLayer.prototype.setup = function () {\n\t };\n\t GuideLayer.prototype.show = function (id, options) {\n\t var _this = this;\n\t return new Promise(function (resolve) {\n\t _this.visible = true;\n\t if (!_this.guideMask) {\n\t var _a = _this.stage, width = _a.width, height = _a.height;\n\t var guideMask = _this.guideMask = new engine.Container();\n\t var guideHole = new engine.Image(getTextureByName('引导遮罩'));\n\t guideHole.x = (width - guideHole.width) / 2;\n\t guideHole.y = options.y;\n\t guideMask.addChild(guideHole);\n\t _this.createRect(guideMask, 0, 0, width, guideHole.y);\n\t _this.createRect(guideMask, 0, guideHole.y, guideHole.x, guideHole.height);\n\t _this.createRect(guideMask, guideHole.x + guideHole.width, guideHole.y, width - guideHole.x - guideHole.width, guideHole.height);\n\t _this.createRect(guideMask, 0, guideHole.y + guideHole.height, width, height - guideHole.y - guideHole.height);\n\t var label = _this.label = new engine.Label();\n\t label.fillColor = 'white';\n\t label.size = 25;\n\t label.text = props.guideText;\n\t label.x = (width - label.width) / 2;\n\t label.y = guideHole.y + guideHole.height + 50;\n\t guideMask.addChild(label);\n\t _this.addChild(guideMask);\n\t }\n\t _this.once(engine.MouseEvent.CLICK, function () {\n\t this.visible = false;\n\t resolve();\n\t }, _this);\n\t });\n\t };\n\t GuideLayer.prototype.createRect = function (container, x, y, width, height) {\n\t var rect = new engine.Rect();\n\t rect.x = x;\n\t rect.y = y;\n\t rect.width = width;\n\t rect.height = height;\n\t rect.fillColor = 'black';\n\t rect.alpha = 0.7;\n\t container.addChild(rect);\n\t };\n\t return GuideLayer;\n\t}(engine.Container));\n\t//# sourceMappingURL=GuideLayer.js.map\n\n\tvar GoldBag = (function (_super) {\n\t tslib.__extends(GoldBag, _super);\n\t function GoldBag() {\n\t var _this = _super.call(this) || this;\n\t _this.setup();\n\t return _this;\n\t }\n\t GoldBag.prototype.setup = function () {\n\t var avatar = this.avatar = new engine.Sprite(getTextureByName('钱袋-静态'));\n\t avatar.x = -props.goldPackAvatarAnchor.x;\n\t avatar.y = -props.goldPackAvatarAnchor.y;\n\t this.addChild(avatar);\n\t var svga = this.svga = createSvga('钱袋', 'goldPackAnchor');\n\t svga.visible = false;\n\t this.addChild(svga);\n\t };\n\t GoldBag.prototype.reset = function (data) {\n\t this.y = data.y;\n\t this.avatar.visible = true;\n\t this.svga.visible = false;\n\t this.svga.gotoAndStop(1);\n\t this.remain = data.remain;\n\t };\n\t GoldBag.prototype.playOpen = function () {\n\t var _this = this;\n\t this.avatar.visible = false;\n\t this.svga.visible = true;\n\t return new Promise(function (resolve) {\n\t _this.svga.play(true, false);\n\t _this.svga.once(engine.Event.END_FRAME, function () {\n\t this.svga.visible = false;\n\t resolve();\n\t }, _this);\n\t });\n\t };\n\t return GoldBag;\n\t}(engine.Container));\n\t//# sourceMappingURL=GoldBag.js.map\n\n\tvar ObjectPool = engine.ObjectPool;\n\tvar PoolName = 'gold-bag';\n\tObjectPool.registerPool(PoolName, function () {\n\t return new GoldBag();\n\t}, function (item, data) {\n\t item.reset(data);\n\t});\n\tvar GameView = (function (_super) {\n\t tslib.__extends(GameView, _super);\n\t function GameView() {\n\t var _this = _super.call(this) || this;\n\t _this.index = -1;\n\t _this.goldBags = [];\n\t _this.baseOffset = -props.baseOffset + props.playerOffset;\n\t _this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);\n\t return _this;\n\t }\n\t GameView.prototype.setup = function () {\n\t if (this._hasSetup) {\n\t return;\n\t }\n\t this._hasSetup = true;\n\t var _a = this.stage, width = _a.width, height = _a.height;\n\t var background = this.background = new Background();\n\t this.addChild(background);\n\t background.setup();\n\t var frontContainer = this.frontContainer = new engine.Container();\n\t frontContainer.x = width / 2;\n\t this.addChild(frontContainer);\n\t var guideLayer = this.guideLayer = new GuideLayer();\n\t this.addChild(guideLayer);\n\t var base = this.base = new Base();\n\t frontContainer.addChild(base);\n\t base.setup();\n\t var blockContainer = this.blockContainer = new engine.Container();\n\t frontContainer.addChild(blockContainer);\n\t var player = this.player = new Player();\n\t frontContainer.addChild(player);\n\t player.setup();\n\t player.addEventListener('jump-on-top', this.onPlayerJumpOnTop, this);\n\t ObjectPool.recycleObject(PoolName, ObjectPool.getObject(PoolName, {\n\t y: 0,\n\t remain: 0,\n\t }));\n\t this.hitEffect = createSvga('被撞烟雾', 'hitEffectAnchor');\n\t this.pos = 0;\n\t this.background.setup();\n\t this.addEventListener(engine.Event.ENTER_FRAME, this.onEnterFrame, this);\n\t this.reset();\n\t };\n\t GameView.prototype.reset = function (revive) {\n\t if (revive === void 0) { revive = false; }\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var blockContainer, i, li, block, i, i, li, goldBag;\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t this.base.reset();\n\t this.index = -1;\n\t this._score = 0;\n\t if (revive) ;\n\t else {\n\t this.pos = 0;\n\t blockContainer = this.blockContainer;\n\t for (i = 0, li = blockContainer.children.length; i < li; i++) {\n\t block = blockContainer.getChildAt(i);\n\t block.playLeave();\n\t }\n\t }\n\t for (i = 0; i < props.initBlockCount; i++) {\n\t this.addBlock(false);\n\t }\n\t for (i = 0, li = this.goldBags.length; i < li; i++) {\n\t goldBag = this.goldBags[i];\n\t this.frontContainer.removeChild(goldBag);\n\t ObjectPool.recycleObject(PoolName, goldBag);\n\t }\n\t this.goldBags.splice(0);\n\t this.playZoom('in');\n\t return [4, this.resetPlayer(revive)];\n\t case 1:\n\t _a.sent();\n\t return [2];\n\t }\n\t });\n\t });\n\t };\n\t GameView.prototype.resetPlayer = function (revive) {\n\t if (revive === void 0) { revive = false; }\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t return tslib.__generator(this, function (_a) {\n\t this.player.reset(revive);\n\t this.player.y = this.baseOffset - (this.index + 1) * props.blockHitHeight;\n\t return [2];\n\t });\n\t });\n\t };\n\t GameView.prototype.start = function (revive) {\n\t if (revive === void 0) { revive = false; }\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var guideFlagKey, guideFlag;\n\t var _this = this;\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t if (!!revive) return [3, 2];\n\t return [4, this.player.playReady()];\n\t case 1:\n\t _a.sent();\n\t _a.label = 2;\n\t case 2:\n\t guideFlagKey = 'jump-high-guide_' + props.guideFlagKey;\n\t guideFlag = localStorage.getItem(guideFlagKey);\n\t if (!!guideFlag) return [3, 4];\n\t localStorage.setItem(guideFlagKey, '1');\n\t return [4, this.guideLayer.show('', { y: this.stage.height + this.player.y - 280 })];\n\t case 3:\n\t _a.sent();\n\t _a.label = 4;\n\t case 4:\n\t this.lastLandType = 0;\n\t this._remainToShowGoldBag = props.goldBagScoreMultiple - props.goldBagScoreSubtraction;\n\t this._touchEnabled = true;\n\t setTimeout(function () {\n\t _this.addBlock();\n\t }, 100);\n\t engine.globalEvent.dispatchEvent('jump-high-game-start');\n\t return [2];\n\t }\n\t });\n\t });\n\t };\n\t GameView.prototype.pause = function () {\n\t if (this.currentBlock) {\n\t engine.Tween.pauseTweens(this.currentBlock);\n\t }\n\t engine.Tween.pauseTweens(this.player);\n\t };\n\t GameView.prototype.resume = function () {\n\t if (this.currentBlock) {\n\t engine.Tween.resumeTweens(this.currentBlock);\n\t }\n\t engine.Tween.resumeTweens(this.player);\n\t };\n\t GameView.prototype.revive = function () {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t this.blockContainer.getChildAt(this.index).visible = false;\n\t this.index--;\n\t return [4, this.resetPlayer(true)];\n\t case 1:\n\t _a.sent();\n\t return [4, this.playZoom('in')];\n\t case 2:\n\t _a.sent();\n\t this.start(true);\n\t return [2];\n\t }\n\t });\n\t });\n\t };\n\t GameView.prototype.addBlock = function (animation) {\n\t var _this = this;\n\t if (animation === void 0) { animation = true; }\n\t this.index++;\n\t var blockContainer = this.blockContainer;\n\t var block;\n\t if (blockContainer.children.length > this.index) {\n\t block = blockContainer.getChildAt(this.index);\n\t block.visible = true;\n\t }\n\t else {\n\t block = new Block();\n\t blockContainer.addChild(block);\n\t }\n\t block.reset({\n\t type: Math.floor(Math.random() * props.blockAssets.length),\n\t });\n\t block.y = this.baseOffset - this.index * props.blockHitHeight;\n\t this.blockComplete = false;\n\t block.playEnter(this.index, animation).then(function (data) {\n\t _this.blockComplete = true;\n\t });\n\t if (animation) {\n\t this.needHitTest = true;\n\t }\n\t this.currentBlock = block;\n\t };\n\t GameView.prototype.addGoldBag = function () {\n\t var goldBag = ObjectPool.getObject(PoolName, {\n\t y: this.baseOffset - (this.blockCount + props.goldBagDistance + props.goldBagJumpSubtraction) * props.blockHitHeight,\n\t remain: props.goldBagDistance,\n\t });\n\t this.frontContainer.addChild(goldBag);\n\t this.goldBags.push(goldBag);\n\t };\n\t GameView.prototype.playOpenGoldBag = function () {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var i, li, goldBag;\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t i = 0, li = this.goldBags.length;\n\t _a.label = 1;\n\t case 1:\n\t if (!(i < li)) return [3, 4];\n\t goldBag = this.goldBags[i];\n\t goldBag.remain--;\n\t if (!(goldBag.remain <= 0)) return [3, 3];\n\t this.goldBags.splice(i, 1);\n\t i--;\n\t li--;\n\t this.nextToUpdateScore = true;\n\t return [4, goldBag.playOpen()];\n\t case 2:\n\t _a.sent();\n\t this.frontContainer.removeChild(goldBag);\n\t ObjectPool.recycleObject(PoolName, goldBag);\n\t _a.label = 3;\n\t case 3:\n\t i++;\n\t return [3, 1];\n\t case 4: return [2];\n\t }\n\t });\n\t });\n\t };\n\t GameView.prototype.onPlayerJumpOnTop = function () {\n\t if (this.nextToUpdateScore) {\n\t this.nextToUpdateScore = false;\n\t this.scoreChange(4);\n\t playSound('撞击钱袋音效');\n\t }\n\t };\n\t Object.defineProperty(GameView.prototype, \"blockCount\", {\n\t get: function () {\n\t return this.index - props.initBlockCount + 1;\n\t },\n\t enumerable: true,\n\t configurable: true\n\t });\n\t Object.defineProperty(GameView.prototype, \"pos\", {\n\t get: function () {\n\t return this._pos;\n\t },\n\t set: function (v) {\n\t this._pos = v;\n\t this.updatePos();\n\t },\n\t enumerable: true,\n\t configurable: true\n\t });\n\t GameView.prototype.updatePos = function () {\n\t this.frontContainer.y = this.stage.height + this._pos;\n\t };\n\t GameView.prototype.onEnterFrame = function (event) {\n\t if (this.needHitTest) {\n\t if (this.currentBlock) {\n\t var _a = this.currentBlock, bx = _a.x, by = _a.y, dir = _a.dir;\n\t var _b = this.player, px = _b.x, py = _b.y;\n\t var blockHitWidth = props.blockHitWidth, blockHitHeight = props.blockHitHeight, playerWidth = props.playerWidth;\n\t var hitOn = false;\n\t if (Math.abs(px - bx) < (blockHitWidth + playerWidth) / 2) {\n\t this.player.changeBaseY(by - blockHitHeight);\n\t if (py > by - blockHitHeight) {\n\t hitOn = true;\n\t }\n\t }\n\t if (hitOn) {\n\t this.onHitOn(dir);\n\t }\n\t }\n\t }\n\t };\n\t GameView.prototype.onHitOn = function (dir) {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t this._touchEnabled = false;\n\t this.needHitTest = false;\n\t clearInterval(this.timer);\n\t this.currentBlock.stop();\n\t this.playHitEffect(dir);\n\t return [4, this.player.hitAway(dir)];\n\t case 1:\n\t _a.sent();\n\t this.playZoom('out');\n\t return [4, this.player.parachute(dir)];\n\t case 2:\n\t _a.sent();\n\t engine.globalEvent.dispatchEvent('jump-high-game-end');\n\t return [2];\n\t }\n\t });\n\t });\n\t };\n\t GameView.prototype.jump = function () {\n\t return tslib.__awaiter(this, void 0, void 0, function () {\n\t var result, pos, type, lastLandType;\n\t var _this = this;\n\t return tslib.__generator(this, function (_a) {\n\t switch (_a.label) {\n\t case 0:\n\t if (!this._touchEnabled) {\n\t return [2];\n\t }\n\t this._touchEnabled = false;\n\t this.playOpenGoldBag();\n\t return [4, this.player.jump()];\n\t case 1:\n\t result = _a.sent();\n\t if (!result) return [3, 5];\n\t if (!result.aboveBlock) return [3, 4];\n\t pos = Math.abs(this.currentBlock.x);\n\t type = 0;\n\t if (pos > 0) {\n\t type = pos > 0 && pos < props.scoreThreshold ? 2 : 3;\n\t }\n\t lastLandType = this.lastLandType;\n\t this.lastLandType = type;\n\t if (type === 0) {\n\t if (lastLandType !== type) {\n\t type = 1;\n\t }\n\t }\n\t if (type < 3) {\n\t this.currentBlock.playEffect();\n\t }\n\t this.player.playLand(type, this.currentBlock.dir);\n\t this.currentBlock.stop();\n\t this.scoreChange(type);\n\t return [4, this.playShake()];\n\t case 2:\n\t _a.sent();\n\t return [4, new Promise(function (resolve) {\n\t engine.Tween.get(_this, null, null, true)\n\t .to({ pos: props.blockHitHeight * _this.index }, 300, engine.Ease.cubicOut)\n\t .call(resolve);\n\t })];\n\t case 3:\n\t _a.sent();\n\t this.addBlock();\n\t _a.label = 4;\n\t case 4:\n\t this._touchEnabled = true;\n\t _a.label = 5;\n\t case 5: return [2];\n\t }\n\t });\n\t });\n\t };\n\t GameView.prototype.scoreChange = function (type) {\n\t var scoreAdd = props.scoreWeights[type];\n\t this._score += scoreAdd;\n\t this._remainToShowGoldBag -= scoreAdd;\n\t var score = this._score;\n\t engine.globalEvent.dispatchEvent('jump-high-score', {\n\t type: type,\n\t score: score,\n\t scoreAdd: scoreAdd,\n\t });\n\t console.log(score, this._remainToShowGoldBag);\n\t if (this._remainToShowGoldBag <= 0) {\n\t this._remainToShowGoldBag += props.goldBagScoreMultiple;\n\t this.addGoldBag();\n\t console.log('addGoldBag');\n\t }\n\t };\n\t GameView.prototype.playHitEffect = function (dir) {\n\t var hitEffect = this.hitEffect;\n\t hitEffect.scaleX = dir;\n\t hitEffect.y = this.player.y - props.hitEffectAnchor.y;\n\t hitEffect.play(true, false);\n\t hitEffect.once(engine.Event.END_FRAME, function () {\n\t this.frontContainer.removeChild(hitEffect);\n\t }, this);\n\t this.frontContainer.addChild(hitEffect);\n\t };\n\t GameView.prototype.playZoom = function (type, duration) {\n\t var _this = this;\n\t if (duration === void 0) { duration = 700; }\n\t this.background.playZoom(type, duration);\n\t var count = this.stage.height / props.blockHitHeight;\n\t return new Promise(function (resolve) {\n\t _this.frontContainer.anchorY = -props.blockHitHeight * (_this.index + count * 1.3) + props.baseOffset;\n\t var scale = type === 'in' ? 1 : Math.min((_this.stage.height / props.blockHitHeight / (_this.index + count)), props.maxScale);\n\t console.log(scale);\n\t engine.Tween.get(_this.frontContainer, null, null, true)\n\t .to({ scaleX: scale, scaleY: scale }, duration, engine.Ease.cubicInOut)\n\t .call(resolve);\n\t });\n\t };\n\t GameView.prototype.playShake = function () {\n\t var _this = this;\n\t var _a = this.frontContainer, x = _a.x, y = _a.y;\n\t return new Promise(function (resolve) {\n\t var shakeOffset = 7;\n\t var duration = 30;\n\t engine.Tween.get(_this.frontContainer, null, null, true)\n\t .to({ x: x, y: y - shakeOffset }, duration)\n\t .to({ x: x, y: y + shakeOffset }, duration)\n\t .to({ x: x + shakeOffset, y: y }, duration)\n\t .to({ x: x - shakeOffset, y: y }, duration)\n\t .to({ x: x, y: y }, duration)\n\t .call(resolve);\n\t });\n\t };\n\t return GameView;\n\t}(engine.Container));\n\t//# sourceMappingURL=GameView.js.map\n\n\tvar JumpHigh = (function (_super) {\n\t tslib.__extends(JumpHigh, _super);\n\t function JumpHigh() {\n\t var _this = _super.call(this) || this;\n\t engine.globalEvent.addEventListener('jump-high-reset', _this.reset, _this);\n\t engine.globalEvent.addEventListener('jump-high-start', _this.start, _this);\n\t engine.globalEvent.addEventListener('jump-high-pause', _this.pause, _this);\n\t engine.globalEvent.addEventListener('jump-high-resume', _this.resume, _this);\n\t engine.globalEvent.addEventListener('jump-high-revive', _this.revive, _this);\n\t _this.addEventListener(engine.MouseEvent.MOUSE_DOWN, _this.onTap, _this);\n\t var gameView = _this._gameView = new GameView();\n\t _this.addChild(gameView);\n\t return _this;\n\t }\n\t JumpHigh.prototype.reset = function () {\n\t this._gameView.reset();\n\t };\n\t JumpHigh.prototype.start = function (event) {\n\t {\n\t injectProps(event.data);\n\t }\n\t this._status = 1;\n\t this._gameView.start();\n\t };\n\t JumpHigh.prototype.pause = function () {\n\t this._gameView.pause();\n\t };\n\t JumpHigh.prototype.resume = function () {\n\t this._gameView.resume();\n\t };\n\t JumpHigh.prototype.revive = function () {\n\t this._gameView.revive();\n\t };\n\t JumpHigh.prototype.onTap = function (event) {\n\t this._gameView.jump();\n\t };\n\t return JumpHigh;\n\t}(engine.Container));\n\t//# sourceMappingURL=JumpHigh.js.map\n\n\tfunction index (props) {\n\t prepareProps();\n\t injectProps(props);\n\t var instance = new JumpHigh();\n\t return instance;\n\t}\n\t//# sourceMappingURL=index.js.map\n\n\treturn index;\n\n})));\n"
}
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"
}
{
"props": {
"weichatShareView": {
"type": "string",
"enum": [],
"alias": "微信分享引导弹窗"
},
"shareSuccessView": {
"type": "string",
"enum": [],
"alias": "分享成功弹窗"
},
"successEvent": {
"type": "string",
"enum": [],
"alias": "成功事件"
}
},
"name": "执行分享逻辑",
"output": [],
"sub": {
"55d7b124-59ae-4436-bcda-0a0c96426f7a": {
"uuid": "55d7b124-59ae-4436-bcda-0a0c96426f7a",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"845311af-a1ed-4f59-a162-e8115f5f9d1b"
]
}
},
"845311af-a1ed-4f59-a162-e8115f5f9d1b": {
"uuid": "845311af-a1ed-4f59-a162-e8115f5f9d1b",
"meta": "f822b421-a9ee-4507-84cc-3a73c7409be1",
"design": {
"x": 194,
"y": 57,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 17.5
}
],
"failed": [
{
"x": 124.5,
"y": 31.5
}
],
"weichat": [
{
"x": 124.5,
"y": 45.5
}
]
}
},
"props": {},
"output": {
"success": [
"77a3ef2d-b7bf-4502-8711-1eb7bedff765"
],
"failed": [],
"weichat": [
"d9b45fb9-a353-4888-afe8-def5de615818"
]
}
},
"77a3ef2d-b7bf-4502-8711-1eb7bedff765": {
"uuid": "77a3ef2d-b7bf-4502-8711-1eb7bedff765",
"meta": "api-request",
"design": {
"x": 410,
"y": 6,
"input": {
"default": [
{
"x": 5.5,
"y": 82.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 68.5
}
],
"failed": [
{
"x": 124.5,
"y": 82.5
}
],
"exception": [
{
"x": 124.5,
"y": 96.5
}
]
}
},
"props": {
"uri": "lipstick/share.do",
"params": {
"type": "map",
"value": {
"channelType": {
"type": "env",
"value": "channelType"
}
}
}
},
"output": {
"success": [
"598b346d-0959-4a85-8a0a-76b6bda9181f"
],
"failed": [
"b50492a4-ef2c-4cd5-afd9-52db7d472edf"
],
"exception": [
"b50492a4-ef2c-4cd5-afd9-52db7d472edf"
]
}
},
"1decb2de-a422-4cc4-8700-1945e4bcbed3": {
"uuid": "1decb2de-a422-4cc4-8700-1945e4bcbed3",
"meta": "pop-dialog",
"design": {
"x": 919,
"y": 94,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 40
}
]
}
},
"props": {},
"output": {}
},
"d9b45fb9-a353-4888-afe8-def5de615818": {
"uuid": "d9b45fb9-a353-4888-afe8-def5de615818",
"meta": "push-dialog",
"design": {
"x": 411,
"y": 235,
"input": {
"default": [
{
"x": 5.5,
"y": 48.5
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 48.5
}
]
}
},
"props": {
"viewName": {
"type": "link",
"alias": "weichatShareView"
}
},
"output": {},
"alias": "微信分享引导弹窗"
},
"598b346d-0959-4a85-8a0a-76b6bda9181f": {
"uuid": "598b346d-0959-4a85-8a0a-76b6bda9181f",
"meta": "d2cf224c-e451-447e-8c5a-1c963f7a01b0",
"design": {
"x": 636,
"y": 0,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"close": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {
"success": [
"54ecdde8-5ef1-47ef-95a3-a49d8f13f345"
],
"failed": [],
"close": [
"1decb2de-a422-4cc4-8700-1945e4bcbed3"
]
}
},
"b50492a4-ef2c-4cd5-afd9-52db7d472edf": {
"uuid": "b50492a4-ef2c-4cd5-afd9-52db7d472edf",
"meta": "6f5e39c3-341e-4b90-9690-783de5466937",
"design": {
"x": 668,
"y": 253,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {}
},
"54ecdde8-5ef1-47ef-95a3-a49d8f13f345": {
"uuid": "54ecdde8-5ef1-47ef-95a3-a49d8f13f345",
"meta": "b54bfb2f-57fe-407d-b71a-1ebab5eb59cf",
"design": {
"x": 924,
"y": -15,
"input": {
"default": [
{
"x": 5.5,
"y": 48.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 41.5
}
],
"failed": [
{
"x": 124.5,
"y": 55.5
}
]
}
},
"props": {
"shareSuccessView": {
"type": "link",
"alias": "shareSuccessView"
},
"successEvent": {
"type": "link",
"alias": "successEvent"
}
},
"output": {}
}
},
"subEntry": "55d7b124-59ae-4436-bcda-0a0c96426f7a",
"metas": [
{
"id": "f822b421-a9ee-4507-84cc-3a73c7409be1",
"script": "\nif(engine.env.channelType==\"1\"){\n let opts={\n shareTitle:engine.env.shareTitle,\n shareContent:engine.env.shareContent,\n shareUrl:engine.env.shareUrl,\n shareThumbnail:engine.env.shareThumbnail,\n }\n window[\"requireShare\"](opts,()=>{\n next(\"success\")\n },()=>{\n next(\"failed\")\n });\n}else{\n next(\"weichat\")\n}",
"props": {},
"isInline": true,
"name": "执行分享方法",
"output": [
"success",
"failed",
"weichat"
],
"sub": {
"9391b950-6e2e-477c-93d4-1bfb377cc647": {
"uuid": "9391b950-6e2e-477c-93d4-1bfb377cc647",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {}
}
},
"subEntry": "9391b950-6e2e-477c-93d4-1bfb377cc647"
},
{
"id": "d2cf224c-e451-447e-8c5a-1c963f7a01b0",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "组件异常处理",
"output": [
"success",
"close"
],
"sub": {
"626001a8-2b34-4640-9be8-129c1f4a020b": {
"uuid": "626001a8-2b34-4640-9be8-129c1f4a020b",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"a38e20b5-d00e-4c55-94b5-e44d2c28ee1a"
]
}
},
"a38e20b5-d00e-4c55-94b5-e44d2c28ee1a": {
"uuid": "a38e20b5-d00e-4c55-94b5-e44d2c28ee1a",
"meta": "232e7e7c-b355-4a8f-9e71-922e0f53bf87",
"design": {
"x": 210,
"y": 75,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {
"failed": [
"d9897477-c675-4562-bc0e-5e6c554e80b0"
]
}
},
"d9897477-c675-4562-bc0e-5e6c554e80b0": {
"uuid": "d9897477-c675-4562-bc0e-5e6c554e80b0",
"meta": "show-toast",
"design": {
"x": 447,
"y": 102,
"input": {
"default": [
{
"x": 5.5,
"y": 82.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 82.5
}
]
}
},
"props": {
"padding": 10,
"duration": 1000,
"showDuration": 300,
"hideDuration": 200
},
"output": {
"success": [
"af837ac1-6da5-4913-b945-10eab22fba07"
]
}
},
"af837ac1-6da5-4913-b945-10eab22fba07": {
"uuid": "af837ac1-6da5-4913-b945-10eab22fba07",
"meta": "f2578ea7-67c7-45b1-b41b-7663361957f7",
"design": {
"x": 692,
"y": 171,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"close": [
{
"x": 124.5,
"y": 31.5
}
]
}
},
"props": {},
"output": {}
}
},
"subEntry": "626001a8-2b34-4640-9be8-129c1f4a020b",
"metas": [
{
"id": "232e7e7c-b355-4a8f-9e71-922e0f53bf87",
"script": "if(args.interrupt){\n if(args.errorMessage){\n next(\"failed\",{text:args.errorMessage})\n }else{\n next(\"failed\",{text:\"当前网络有些开小差,请稍等\"})\n }\n \n}else{\n next(\"success\",args)\n}",
"props": {},
"isInline": true,
"from": "custom",
"name": "判错逻辑",
"output": [
"success",
"failed"
]
},
{
"id": "f2578ea7-67c7-45b1-b41b-7663361957f7",
"script": "next(\"close\",args)",
"props": {},
"isInline": true,
"from": "custom",
"name": "终止",
"output": [
"close"
]
}
]
},
{
"id": "6f5e39c3-341e-4b90-9690-783de5466937",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "接口异常Toast",
"output": [
"success",
"failed"
],
"sub": {
"6c6b9ec9-76dc-44a4-a436-7c016e4f2599": {
"uuid": "6c6b9ec9-76dc-44a4-a436-7c016e4f2599",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"3d797ee7-1e6e-4ae1-9718-13292001b2b4"
]
}
},
"3d797ee7-1e6e-4ae1-9718-13292001b2b4": {
"uuid": "3d797ee7-1e6e-4ae1-9718-13292001b2b4",
"meta": "096eec4b-4603-4c5e-b762-498915345e18",
"design": {
"x": 201,
"y": 199,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {
"success": [],
"failed": [
"4d0225a7-24bb-4a1d-b14c-13d6a15e304b"
]
}
},
"57b7e460-2717-479a-a789-a25d1b9373f4": {
"uuid": "57b7e460-2717-479a-a789-a25d1b9373f4",
"meta": "show-toast",
"design": {
"x": 684,
"y": 218,
"input": {
"default": [
{
"x": 5.5,
"y": 82.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 82.5
}
]
}
},
"props": {
"padding": 10,
"duration": 1000,
"showDuration": 300,
"hideDuration": 200,
"viewName": ""
},
"output": {}
},
"4d0225a7-24bb-4a1d-b14c-13d6a15e304b": {
"uuid": "4d0225a7-24bb-4a1d-b14c-13d6a15e304b",
"meta": "fadbbfe0-aff9-401d-a001-9b1091fb464e",
"design": {
"x": 414,
"y": 219,
"input": {
"default": [
{
"x": 5.5,
"y": 56.5
}
]
},
"output": {
"p0": [
{
"x": 124.5,
"y": 49.5
}
],
"p1": [
{
"x": 124.5,
"y": 63.5
}
]
}
},
"props": {},
"output": {
"p0": [
"57b7e460-2717-479a-a789-a25d1b9373f4"
],
"p1": [
"c456022e-25b9-44dd-9bf6-e7973b173922"
]
}
},
"c456022e-25b9-44dd-9bf6-e7973b173922": {
"uuid": "c456022e-25b9-44dd-9bf6-e7973b173922",
"meta": "wait",
"design": {
"x": 678,
"y": 410,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 40
}
]
}
},
"props": {
"duration": 1000
},
"output": {
"complete": [
"e02a8757-cfaa-47cc-8c4a-2965d18e63c8"
]
}
},
"e02a8757-cfaa-47cc-8c4a-2965d18e63c8": {
"uuid": "e02a8757-cfaa-47cc-8c4a-2965d18e63c8",
"meta": "f3b3d538-e0a3-49bc-8363-4520b691710b",
"design": {
"x": 956,
"y": 483,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 31.5
}
]
}
},
"props": {},
"output": {}
}
},
"subEntry": "6c6b9ec9-76dc-44a4-a436-7c016e4f2599",
"metas": [
{
"id": "096eec4b-4603-4c5e-b762-498915345e18",
"script": "console.log(args)\nif(!args){\n next(\"failed\",{text:\"当前网络有些开小差,请稍等\"})\n}else{\n if(args.message){\n if(args.code!='100001'){\n next(\"failed\",{text:args.message})\n }\n }else{\n next(\"failed\",{text:\"当前网络有些开小差,请稍等\"})\n }\n}\n",
"props": {},
"isInline": true,
"from": "custom",
"name": "判错逻辑",
"output": [
"success",
"failed"
]
},
{
"id": "fadbbfe0-aff9-401d-a001-9b1091fb464e",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "分流节点",
"output": [
"p0",
"p1"
],
"isDivider": true
},
{
"id": "f3b3d538-e0a3-49bc-8363-4520b691710b",
"script": "next(\"success\")",
"props": {},
"isInline": true,
"from": "custom",
"name": "终止",
"output": [
"success"
]
}
]
},
{
"id": "b54bfb2f-57fe-407d-b71a-1ebab5eb59cf",
"script": "",
"props": {
"shareSuccessView": {
"type": "string",
"enum": [],
"alias": "分享成功弹窗"
},
"successEvent": {
"type": "string",
"enum": [],
"alias": "成功事件"
}
},
"isInline": true,
"from": "custom",
"name": "分享成功处理",
"output": [
"success",
"failed"
],
"sub": {
"95048c23-a7af-4b75-b6ae-86150441fbe2": {
"uuid": "95048c23-a7af-4b75-b6ae-86150441fbe2",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"250e5a77-be2d-4d20-9551-d4f723105621"
]
}
},
"250e5a77-be2d-4d20-9551-d4f723105621": {
"uuid": "250e5a77-be2d-4d20-9551-d4f723105621",
"meta": "pop-dialog",
"design": {
"x": 211,
"y": 63,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 40
}
]
}
},
"props": {
"closeAll": true
},
"output": {
"complete": [
"32f37033-67af-4c71-bf8f-ac1dead6e150"
]
}
},
"32f37033-67af-4c71-bf8f-ac1dead6e150": {
"uuid": "32f37033-67af-4c71-bf8f-ac1dead6e150",
"meta": "ce2a1072-edd1-42b8-b65a-ca137d1d5fdd",
"design": {
"x": 415,
"y": 80,
"input": {
"default": [
{
"x": 5.5,
"y": 56.5
}
]
},
"output": {
"p0": [
{
"x": 124.5,
"y": 49.5
}
],
"p1": [
{
"x": 124.5,
"y": 63.5
}
]
}
},
"props": {},
"output": {
"p0": [
"38041cd7-fc6c-4fd1-9aef-bf6f26ea4546"
],
"p1": [
"0fbf93fb-3946-41dd-9d15-9d7e3bb9e489"
]
}
},
"38041cd7-fc6c-4fd1-9aef-bf6f26ea4546": {
"uuid": "38041cd7-fc6c-4fd1-9aef-bf6f26ea4546",
"meta": "dispatch-event",
"design": {
"x": 648,
"y": 24,
"input": {
"default": [
{
"x": 5.5,
"y": 57
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 57
}
]
}
},
"props": {
"eventName": {
"type": "link",
"alias": "successEvent"
}
},
"output": {},
"alias": "派发分享成功事件"
},
"0fbf93fb-3946-41dd-9d15-9d7e3bb9e489": {
"uuid": "0fbf93fb-3946-41dd-9d15-9d7e3bb9e489",
"meta": "13fdecf7-ebc9-4c33-b040-775a34a2eea3",
"design": {
"x": 647,
"y": 177,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {
"failed": [
"af9f7e73-50cb-4b7e-a5bc-134e81214008"
]
}
},
"af9f7e73-50cb-4b7e-a5bc-134e81214008": {
"uuid": "af9f7e73-50cb-4b7e-a5bc-134e81214008",
"meta": "push-dialog",
"design": {
"x": 860,
"y": 202,
"input": {
"default": [
{
"x": 5.5,
"y": 48.5
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 48.5
}
]
}
},
"props": {
"viewName": {
"type": "link",
"alias": "shareSuccessView"
}
},
"output": {},
"alias": "分享成功弹窗"
}
},
"subEntry": "95048c23-a7af-4b75-b6ae-86150441fbe2",
"metas": [
{
"id": "ce2a1072-edd1-42b8-b65a-ca137d1d5fdd",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "分流节点",
"output": [
"p0",
"p1"
],
"isDivider": true
},
{
"id": "13fdecf7-ebc9-4c33-b040-775a34a2eea3",
"script": " if(global.dataCenter.store.coop_config[\"rpb.lipstick.share.appShareWay\"]==\"true\"||global.dataCenter.store.coop_config[\"rpb.lipstick.share.officalAccountShareWay\"]==\"true\"){\n next(\"success\",args)\n }else{\n next(\"failed\",args)\n }",
"props": {},
"isInline": true,
"from": "custom",
"name": "是否为真分享",
"output": [
"success",
"failed"
]
}
]
}
],
"isPrefab": true,
"id": "do-share",
"group": "prefabs",
"type": "builtin"
}
{
"props": {},
"from": "custom",
"name": "设置分享信息",
"output": [
"success",
"failed"
],
"sub": {
"a75eb5c6-b147-4b19-97eb-a31cf7667fff": {
"uuid": "a75eb5c6-b147-4b19-97eb-a31cf7667fff",
"meta": "entry",
"design": {
"x": -342,
"y": 70,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"e8c7c2d5-fc7e-444a-89f2-252cb8cd6b25"
]
}
},
"2a88bbc9-6d81-43d7-ad1a-a129a9f7e8e6": {
"uuid": "2a88bbc9-6d81-43d7-ad1a-a129a9f7e8e6",
"meta": "api-request",
"design": {
"x": 220,
"y": -99,
"input": {
"default": [
{
"x": 5.5,
"y": 82.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 68.5
}
],
"failed": [
{
"x": 124.5,
"y": 82.5
}
],
"exception": [
{
"x": 124.5,
"y": 96.5
}
]
}
},
"props": {
"uri": "lipstick/getShareInfo.do",
"dataName": "getShareInfo",
"params": {
"type": "map",
"value": {}
}
},
"output": {
"success": [
"0cde2623-e145-41ed-bd6c-f313f19adb88"
],
"failed": [
"d5ed77ee-4774-4395-aa4a-60301ba4561f"
],
"exception": [
"d5ed77ee-4774-4395-aa4a-60301ba4561f"
]
}
},
"0cde2623-e145-41ed-bd6c-f313f19adb88": {
"uuid": "0cde2623-e145-41ed-bd6c-f313f19adb88",
"meta": "b283de43-2d3a-4721-965f-90c8a70c5162",
"design": {
"x": 480,
"y": -115,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 31.5
}
]
}
},
"props": {},
"output": {
"success": [
"8e6024ea-574e-49d0-99f8-13719f7b2c12"
]
}
},
"38471b30-788a-4384-abe3-02961eaa246d": {
"uuid": "38471b30-788a-4384-abe3-02961eaa246d",
"meta": "duiba-api",
"design": {
"x": 231,
"y": 144,
"input": {
"default": [
{
"x": 5.5,
"y": 82.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 75.5
}
],
"failed": [
{
"x": 124.5,
"y": 89.5
}
]
}
},
"props": {
"url": {
"type": "static",
"value": "/aaw/projectx/getDevAppInfo"
},
"name": "getDevAppInfo",
"method": "get",
"params": {
"type": "map",
"value": {
"appId": {
"type": "env",
"value": "appID"
}
}
}
},
"output": {
"success": [
"4abafb99-df41-4378-8c4d-37acbc489d5b"
],
"failed": [
"2bc1c4ea-5301-40ab-8dca-d2818c4732e4"
]
}
},
"123fc8e9-6b60-45d5-8e54-4ccfec181619": {
"uuid": "123fc8e9-6b60-45d5-8e54-4ccfec181619",
"meta": "duiba-api",
"design": {
"x": 228,
"y": 310,
"input": {
"default": [
{
"x": 5.5,
"y": 82.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 75.5
}
],
"failed": [
{
"x": 124.5,
"y": 89.5
}
]
}
},
"props": {
"url": {
"type": "static",
"value": "/aaw/projectx/getAppWechatInfo"
},
"name": "getAppWechatInfo",
"method": "get",
"params": {
"type": "map",
"value": {
"appId": {
"type": "env",
"value": "appID"
}
}
}
},
"output": {
"failed": [
"2bc1c4ea-5301-40ab-8dca-d2818c4732e4"
]
}
},
"e8c7c2d5-fc7e-444a-89f2-252cb8cd6b25": {
"uuid": "e8c7c2d5-fc7e-444a-89f2-252cb8cd6b25",
"meta": "541c8476-34bf-4c5d-805e-2e4906791cb6",
"design": {
"x": -169,
"y": 100,
"input": {
"default": [
{
"x": 5.5,
"y": 56.5
}
]
},
"output": {
"p0": [
{
"x": 124.5,
"y": 49.5
}
],
"p1": [
{
"x": 124.5,
"y": 63.5
}
]
}
},
"props": {},
"output": {
"p0": [
"abfd8d40-2ba6-4227-8f71-eb12d4c993a3"
],
"p1": [
"3acb15f0-5e7c-453e-8d74-459b0c27c0cf"
]
}
},
"abfd8d40-2ba6-4227-8f71-eb12d4c993a3": {
"uuid": "abfd8d40-2ba6-4227-8f71-eb12d4c993a3",
"meta": "c4f60371-5a9a-4f02-92c9-1f24d310c68a",
"design": {
"x": 18,
"y": 23,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 33
}
],
"failed": [
{
"x": 124.5,
"y": 47
}
]
}
},
"props": {},
"output": {
"success": [
"2a88bbc9-6d81-43d7-ad1a-a129a9f7e8e6"
],
"failed": [
"8e6024ea-574e-49d0-99f8-13719f7b2c12"
]
}
},
"3acb15f0-5e7c-453e-8d74-459b0c27c0cf": {
"uuid": "3acb15f0-5e7c-453e-8d74-459b0c27c0cf",
"meta": "63f6956c-1a4f-4395-aeb2-2790b10df37d",
"design": {
"x": 18,
"y": 172,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"yes": [
{
"x": 124.5,
"y": 24.5
}
],
"no": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {
"yes": [
"38471b30-788a-4384-abe3-02961eaa246d"
],
"no": [
"123fc8e9-6b60-45d5-8e54-4ccfec181619"
]
}
},
"4abafb99-df41-4378-8c4d-37acbc489d5b": {
"uuid": "4abafb99-df41-4378-8c4d-37acbc489d5b",
"meta": "59bb3740-de75-4ef8-b1c0-244103d9b69a",
"design": {
"x": 550,
"y": 226,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {}
},
"props": {},
"output": {}
},
"8e6024ea-574e-49d0-99f8-13719f7b2c12": {
"uuid": "8e6024ea-574e-49d0-99f8-13719f7b2c12",
"meta": "63f6956c-1a4f-4395-aeb2-2790b10df37d",
"design": {
"x": 590,
"y": 71,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"yes": [
{
"x": 124.5,
"y": 24.5
}
],
"no": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {
"no": [
"971ab334-faeb-4a70-964c-c62f8b97920a"
]
}
},
"d5ed77ee-4774-4395-aa4a-60301ba4561f": {
"uuid": "d5ed77ee-4774-4395-aa4a-60301ba4561f",
"meta": "464fc17d-ab77-4ef7-b6ce-7501a4847d23",
"design": {
"x": 429,
"y": -31,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {}
},
"2bc1c4ea-5301-40ab-8dca-d2818c4732e4": {
"uuid": "2bc1c4ea-5301-40ab-8dca-d2818c4732e4",
"meta": "464fc17d-ab77-4ef7-b6ce-7501a4847d23",
"design": {
"x": 502,
"y": 314,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {}
},
"971ab334-faeb-4a70-964c-c62f8b97920a": {
"uuid": "971ab334-faeb-4a70-964c-c62f8b97920a",
"meta": "0fa05fb3-c179-461b-b088-de0e3be40449",
"design": {
"x": 799,
"y": 136,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {}
}
},
"subEntry": "a75eb5c6-b147-4b19-97eb-a31cf7667fff",
"metas": [
{
"id": "b283de43-2d3a-4721-965f-90c8a70c5162",
"script": "if(global.dataCenter.store.coop_config[\"rpb.lipstick.share.appShareWay\"]==\"true\"||global.dataCenter.store.coop_config[\"rpb.lipstick.share.officalAccountShareWay\"]==\"true\"){\n if(engine.env.shareUrl.indexOf(\"shareCode\")==-1){\n engine.env.shareUrl+=`&shareCode=${args.raw.shareCode}`\n }\n}\nnext(\"success\",args)",
"props": {},
"isInline": true,
"from": "custom",
"name": "拼接shareCode",
"output": [
"success"
],
"sub": {
"f1fad633-f8eb-4ed4-9c8f-3bc4b470f801": {
"uuid": "f1fad633-f8eb-4ed4-9c8f-3bc4b470f801",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {}
}
},
"subEntry": "f1fad633-f8eb-4ed4-9c8f-3bc4b470f801"
},
{
"id": "541c8476-34bf-4c5d-805e-2e4906791cb6",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "分流节点",
"output": [
"p0",
"p1"
],
"isDivider": true
},
{
"id": "c4f60371-5a9a-4f02-92c9-1f24d310c68a",
"script": "if(props.hasShareRequest){\n next(\"success\",args)\n}else{\n next(\"failed\",args)\n}",
"props": {
"hasShareRequest": {
"type": "boolean",
"enum": [],
"default": true,
"alias": "是否配置分享模块"
}
},
"isInline": true,
"from": "custom",
"name": "是否配置分享模块",
"output": [
"success",
"failed"
]
},
{
"id": "63f6956c-1a4f-4395-aeb2-2790b10df37d",
"script": "if(engine.env.channelType==\"1\"){\n next(\"yes\",args)\n}else{\n next(\"no\",args)\n}",
"props": {},
"isInline": true,
"from": "custom",
"name": "是否为app渠道",
"output": [
"yes",
"no"
]
},
{
"id": "59bb3740-de75-4ef8-b1c0-244103d9b69a",
"script": "if(!global.loginCodeState){\n global.loginCodeState=1\n window[\"$\"](\"body\").append(args.appLoginJs)\n var u = navigator.userAgent;\n var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端\n if(isAndroid){\n window[\"$\"](\"body\").append(args.androidShareJs)\n }else{\n window[\"$\"](\"body\").append(args.iosShareJs)\n }\n}",
"props": {},
"isInline": true,
"from": "custom",
"name": "生成分享方法",
"output": []
},
{
"id": "464fc17d-ab77-4ef7-b6ce-7501a4847d23",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "接口异常Toast",
"output": [
"success",
"failed"
],
"sub": {
"557c28e1-568b-49cf-a145-c48f9f180ab8": {
"uuid": "557c28e1-568b-49cf-a145-c48f9f180ab8",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"4baae08e-0691-4a65-8e3f-6460d1547a15"
]
}
},
"4baae08e-0691-4a65-8e3f-6460d1547a15": {
"uuid": "4baae08e-0691-4a65-8e3f-6460d1547a15",
"meta": "974da71f-8a91-495f-be6c-8e521dd82df4",
"design": {
"x": 230,
"y": 82,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {
"failed": [
"fc8aab82-772f-4d76-813a-0bec9b3e0760"
]
}
},
"fc8aab82-772f-4d76-813a-0bec9b3e0760": {
"uuid": "fc8aab82-772f-4d76-813a-0bec9b3e0760",
"meta": "9e196854-4c2d-4784-afc8-e8dcb17c79c2",
"design": {
"x": 412,
"y": 164,
"input": {
"default": [
{
"x": 5.5,
"y": 56.5
}
]
},
"output": {
"p0": [
{
"x": 124.5,
"y": 49.5
}
],
"p1": [
{
"x": 124.5,
"y": 63.5
}
]
}
},
"props": {},
"output": {
"p0": [
"efe82744-e381-4cdc-964d-651f516545a4"
],
"p1": [
"197e1d2f-21e6-4568-b0f7-4b8405ad6e9b"
]
}
},
"efe82744-e381-4cdc-964d-651f516545a4": {
"uuid": "efe82744-e381-4cdc-964d-651f516545a4",
"meta": "show-toast",
"design": {
"x": 657,
"y": 131,
"input": {
"default": [
{
"x": 5.5,
"y": 82.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 82.5
}
]
}
},
"props": {
"padding": 10,
"duration": 1000,
"showDuration": 300,
"hideDuration": 200,
"viewName": ""
},
"output": {}
},
"197e1d2f-21e6-4568-b0f7-4b8405ad6e9b": {
"uuid": "197e1d2f-21e6-4568-b0f7-4b8405ad6e9b",
"meta": "wait",
"design": {
"x": 654,
"y": 363,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 40
}
]
}
},
"props": {
"duration": 1000
},
"output": {
"complete": [
"cc6a31a2-cf54-4397-aca0-e17f9c19b441"
]
}
},
"cc6a31a2-cf54-4397-aca0-e17f9c19b441": {
"uuid": "cc6a31a2-cf54-4397-aca0-e17f9c19b441",
"meta": "990b7cff-5817-484c-8b96-57a1fc194676",
"design": {
"x": 869,
"y": 376,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 31.5
}
]
}
},
"props": {},
"output": {}
}
},
"subEntry": "557c28e1-568b-49cf-a145-c48f9f180ab8",
"metas": [
{
"id": "974da71f-8a91-495f-be6c-8e521dd82df4",
"script": "console.log(args)\nif(!args){\n next(\"failed\",{text:\"当前网络有些开小差,请稍等\"})\n}else{\n if(args.message){\n if(args.code!='100001'){\n next(\"failed\",{text:args.message})\n }\n }else{\n next(\"failed\",{text:\"当前网络有些开小差,请稍等\"})\n }\n}\n\n",
"props": {},
"isInline": true,
"from": "custom",
"name": "判错逻辑",
"output": [
"success",
"failed"
]
},
{
"id": "9e196854-4c2d-4784-afc8-e8dcb17c79c2",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "分流节点",
"output": [
"p0",
"p1"
],
"isDivider": true
},
{
"id": "990b7cff-5817-484c-8b96-57a1fc194676",
"script": "next(\"success\")",
"props": {},
"isInline": true,
"from": "custom",
"name": "结束",
"output": [
"success"
]
}
]
},
{
"id": "0fa05fb3-c179-461b-b088-de0e3be40449",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "初始化微信分享",
"output": [
"success",
"failed"
],
"sub": {
"f48cbb42-5672-4ea2-9329-3b1c7c448621": {
"uuid": "f48cbb42-5672-4ea2-9329-3b1c7c448621",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"85c9cf91-f94d-4be2-a776-6ce88a5e8733"
]
}
},
"85c9cf91-f94d-4be2-a776-6ce88a5e8733": {
"uuid": "85c9cf91-f94d-4be2-a776-6ce88a5e8733",
"meta": "init-weixin-env",
"design": {
"x": 253,
"y": 72,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 40
}
]
}
},
"props": {
"debug": false
},
"output": {
"success": [
"ac5445fa-dbd9-4610-9cd4-6ce7f2b2d826"
]
}
},
"ac5445fa-dbd9-4610-9cd4-6ce7f2b2d826": {
"uuid": "ac5445fa-dbd9-4610-9cd4-6ce7f2b2d826",
"meta": "78e53207-b558-4344-8385-e8df8eba6bfe",
"design": {
"x": 529,
"y": 140,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 33
}
],
"failed": [
{
"x": 124.5,
"y": 47
}
]
}
},
"props": {
"update": true
},
"output": {}
}
},
"subEntry": "f48cbb42-5672-4ea2-9329-3b1c7c448621",
"metas": [
{
"id": "78e53207-b558-4344-8385-e8df8eba6bfe",
"script": "",
"props": {
"update": {
"type": "boolean",
"enum": []
}
},
"isInline": true,
"from": "custom",
"name": "微信分享操作",
"output": [
"success",
"failed"
],
"sub": {
"608177d2-eb20-4334-b718-205144d60c48": {
"uuid": "608177d2-eb20-4334-b718-205144d60c48",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"0bdc725d-a906-4b3a-ab43-53c0f75b9221"
]
}
},
"0bdc725d-a906-4b3a-ab43-53c0f75b9221": {
"uuid": "0bdc725d-a906-4b3a-ab43-53c0f75b9221",
"meta": "share-preprocessing",
"design": {
"x": 201,
"y": 51,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 31.5
}
]
}
},
"props": {},
"output": {
"success": [
"ee4390b8-ae46-4000-b139-c6060d1f1316"
]
}
},
"ee4390b8-ae46-4000-b139-c6060d1f1316": {
"uuid": "ee4390b8-ae46-4000-b139-c6060d1f1316",
"meta": "env-judge",
"design": {
"x": 419,
"y": 93,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 31.5
}
]
}
},
"props": {},
"output": {
"success": [
"1503216d-be13-484c-92f3-d8168f076674"
]
}
},
"1503216d-be13-484c-92f3-d8168f076674": {
"uuid": "1503216d-be13-484c-92f3-d8168f076674",
"meta": "share-weixin",
"design": {
"x": 651,
"y": 95,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 19
}
],
"failed": [
{
"x": 124.5,
"y": 33
}
],
"pass": [
{
"x": 124.5,
"y": 47
}
],
"guide": [
{
"x": 124.5,
"y": 61
}
]
}
},
"props": {
"update": {
"type": "link"
}
},
"output": {}
}
},
"subEntry": "608177d2-eb20-4334-b718-205144d60c48"
}
]
}
],
"isPrefab": true,
"id": "init-share",
"group": "prefabs",
"type": "builtin"
}
{
"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"
}
{
"name": "缩放滚动",
"props": {
"autoInit": {
"alias": "自动初始化",
"type": "boolean",
"default": true
},
"duration": {
"alias": "时间",
"type": "number",
......@@ -43,5 +48,5 @@
}
},
"id": "zoom-scroll",
"code": "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ZoomScroll = (function (_super) {\n __extends(ZoomScroll, _super);\n function ZoomScroll() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.duration = 1000;\n _this.index = 0;\n _this.itemWidth = 0;\n _this.itemHeight = 0;\n _this.scaleMin = 0.7;\n _this.scaleMax = 1;\n _this.alphaOut = 0.5;\n _this.alphaIn = 1;\n _this._startDragOffset = { x: 0, y: 0 };\n _this._dragOffset = { x: 0, y: 0 };\n return _this;\n }\n ZoomScroll.prototype.mounted = function () {\n this._centerOffset = this.host.width / 2;\n this.init();\n this.host.addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDragStart, this);\n };\n ZoomScroll.prototype.sleep = function () {\n };\n ZoomScroll.prototype.update = function (t) {\n };\n ZoomScroll.prototype.init = function () {\n for (var i = 0, li = this.host.children.length; i < li; i++) {\n var child = this.host.children[i];\n child.anchorX = child.width / 2;\n child.anchorY = child.height / 2;\n child.x = child.ix = i * this.itemWidth + this._centerOffset - this.itemWidth / 2;\n }\n this.scrollTo(0, false);\n };\n ZoomScroll.prototype.updateOffset = function (offset) {\n this._dragOffset.x = this._startDragOffset.x + offset.x;\n for (var i = 0, li = this.host.children.length; i < li; i++) {\n var child = this.host.children[i];\n var x = child.x = child.ix + this._dragOffset.x;\n var s = 40 / Math.abs(x - this._centerOffset + this.itemWidth / 2);\n child.scaleX = child.scaleY = x === 0 ? 1 : Math.min(s + this.scaleMin, this.scaleMax);\n child.alpha = x === 0 ? 1 : Math.min(s + this.alphaOut, this.alphaIn);\n }\n };\n ZoomScroll.prototype.onDragStart = function (event) {\n this.host.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE, this.onDraging, this);\n this.host.stage.addEventListener(engine.MouseEvent.MOUSE_UP, this.onDragEnd, this);\n this._startDragPos = {\n x: event.stageX,\n y: event.stageY,\n };\n this._startDragOffset.x = this._dragOffset.x;\n this._startDragOffset.y = this._dragOffset.y;\n };\n ZoomScroll.prototype.onDraging = function (event) {\n if (!this._startDragPos) {\n return;\n }\n var _a = this._startDragPos, x = _a.x, y = _a.y;\n var stageX = event.stageX, stageY = event.stageY;\n var offset = {\n x: stageX - x,\n y: stageY - y,\n };\n this.updateOffset(offset);\n };\n ZoomScroll.prototype.onDragEnd = function (event) {\n this.host.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE, this.onDraging, this);\n this.host.stage.removeEventListener(engine.MouseEvent.MOUSE_UP, this.onDragEnd, this);\n if (!this._startDragPos) {\n return;\n }\n this._startDragOffset.x = 0;\n this._startDragOffset.y = 0;\n var index = Math.round(this._dragOffset.x / this.itemWidth);\n index = -Math.min(0, Math.max(1 - this.host.children.length, index));\n this['_index'] = index;\n this.scrollTo(index);\n this._startDragPos = null;\n };\n Object.defineProperty(ZoomScroll.prototype, \"t\", {\n get: function () {\n return this._dragOffset.x;\n },\n set: function (v) {\n this.updateOffset({ x: v, y: 0 });\n },\n enumerable: true,\n configurable: true\n });\n ZoomScroll.prototype.scrollTo = function (index, animation) {\n if (animation === void 0) { animation = true; }\n var indexPos = -index * this.itemWidth;\n if (animation) {\n engine.Tween.get(this, null, null, true)\n .to({ t: indexPos }, 100, engine.Ease.cubicOut);\n }\n else {\n this.t = indexPos;\n }\n };\n ZoomScroll.prototype.onModify = function (value, key, oldValue) {\n var _this = this;\n switch (key) {\n case 'index':\n var index_1 = value;\n if (oldValue !== undefined) {\n index_1 = Math.max(0, Math.min(this.host.children.length - 1, value));\n this['_index'] = index_1;\n }\n setTimeout(function () {\n _this.scrollTo(index_1, oldValue !== undefined);\n });\n break;\n }\n };\n ZoomScroll.id = 'zoom-scroll';\n __decorate([\n engine.dirtyFieldTrigger\n ], ZoomScroll.prototype, \"index\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], ZoomScroll.prototype, \"itemWidth\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], ZoomScroll.prototype, \"itemHeight\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], ZoomScroll.prototype, \"scaleMin\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], ZoomScroll.prototype, \"scaleMax\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], ZoomScroll.prototype, \"alphaOut\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], ZoomScroll.prototype, \"alphaIn\", void 0);\n return ZoomScroll;\n}(engine.ScriptBase));\nexports.default = ZoomScroll;\n"
"code": "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ZoomScroll = (function (_super) {\n __extends(ZoomScroll, _super);\n function ZoomScroll() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.autoInit = true;\n _this.duration = 1000;\n _this.index = 0;\n _this.itemWidth = 0;\n _this.itemHeight = 0;\n _this.scaleMin = 0.7;\n _this.scaleMax = 1;\n _this.alphaOut = 0.5;\n _this.alphaIn = 1;\n _this._startDragOffset = { x: 0, y: 0 };\n _this._dragOffset = { x: 0, y: 0 };\n return _this;\n }\n ZoomScroll.prototype.mounted = function () {\n this._centerOffset = this.host.width / 2;\n if (this.autoInit) {\n this.init();\n }\n };\n ZoomScroll.prototype.sleep = function () {\n };\n ZoomScroll.prototype.update = function (t) {\n };\n ZoomScroll.prototype.init = function () {\n for (var i = 0, li = this.host.children.length; i < li; i++) {\n var child = this.host.children[i];\n child.anchorX = child.width / 2;\n child.anchorY = child.height / 2;\n child.x = child.ix = i * this.itemWidth + this._centerOffset - this.itemWidth / 2;\n }\n this.scrollTo(0, false);\n this.host.addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDragStart, this);\n };\n ZoomScroll.prototype.updateOffset = function (offset) {\n this._dragOffset.x = this._startDragOffset.x + offset.x;\n for (var i = 0, li = this.host.children.length; i < li; i++) {\n var child = this.host.children[i];\n var x = child.x = child.ix + this._dragOffset.x;\n var s = 40 / Math.abs(x - this._centerOffset + this.itemWidth / 2);\n child.scaleX = child.scaleY = x === 0 ? 1 : Math.min(s + this.scaleMin, this.scaleMax);\n child.alpha = x === 0 ? 1 : Math.min(s + this.alphaOut, this.alphaIn);\n }\n };\n ZoomScroll.prototype.onDragStart = function (event) {\n this.host.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE, this.onDraging, this);\n this.host.stage.addEventListener(engine.MouseEvent.MOUSE_UP, this.onDragEnd, this);\n this._startDragPos = {\n x: event.stageX,\n y: event.stageY,\n };\n this._startDragOffset.x = this._dragOffset.x;\n this._startDragOffset.y = this._dragOffset.y;\n };\n ZoomScroll.prototype.onDraging = function (event) {\n if (!this._startDragPos) {\n return;\n }\n var _a = this._startDragPos, x = _a.x, y = _a.y;\n var stageX = event.stageX, stageY = event.stageY;\n var offset = {\n x: stageX - x,\n y: stageY - y,\n };\n this.updateOffset(offset);\n };\n ZoomScroll.prototype.onDragEnd = function (event) {\n this.host.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE, this.onDraging, this);\n this.host.stage.removeEventListener(engine.MouseEvent.MOUSE_UP, this.onDragEnd, this);\n if (!this._startDragPos) {\n return;\n }\n this._startDragOffset.x = 0;\n this._startDragOffset.y = 0;\n var index = Math.round(this._dragOffset.x / this.itemWidth);\n index = -Math.min(0, Math.max(1 - this.host.children.length, index));\n this['_index'] = index;\n this.scrollTo(index);\n this._startDragPos = null;\n };\n Object.defineProperty(ZoomScroll.prototype, \"t\", {\n get: function () {\n return this._dragOffset.x;\n },\n set: function (v) {\n this.updateOffset({ x: v, y: 0 });\n },\n enumerable: true,\n configurable: true\n });\n ZoomScroll.prototype.scrollTo = function (index, animation) {\n if (animation === void 0) { animation = true; }\n var indexPos = -index * this.itemWidth;\n if (animation) {\n engine.Tween.get(this, null, null, true)\n .to({ t: indexPos }, 100, engine.Ease.cubicOut);\n }\n else {\n this.t = indexPos;\n }\n };\n ZoomScroll.prototype.onModify = function (value, key, oldValue) {\n var _this = this;\n switch (key) {\n case 'index':\n var index_1 = value;\n if (oldValue !== undefined) {\n index_1 = Math.max(0, Math.min(this.host.children.length - 1, value));\n this['_index'] = index_1;\n }\n setTimeout(function () {\n _this.scrollTo(index_1, oldValue !== undefined);\n });\n break;\n }\n };\n ZoomScroll.id = 'zoom-scroll';\n __decorate([\n engine.dirtyFieldTrigger\n ], ZoomScroll.prototype, \"index\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], ZoomScroll.prototype, \"itemWidth\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], ZoomScroll.prototype, \"itemHeight\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], ZoomScroll.prototype, \"scaleMin\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], ZoomScroll.prototype, \"scaleMax\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], ZoomScroll.prototype, \"alphaOut\", void 0);\n __decorate([\n engine.dirtyFieldTrigger\n ], ZoomScroll.prototype, \"alphaIn\", void 0);\n return ZoomScroll;\n}(engine.ScriptBase));\nexports.default = ZoomScroll;\n"
}
"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 source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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",
......
{
"props": {
"weichatShareView": {
"type": "string",
"enum": [],
"alias": "微信分享引导弹窗"
},
"shareSuccessView": {
"type": "string",
"enum": [],
"alias": "分享成功弹窗"
},
"successEvent": {
"type": "string",
"enum": [],
"alias": "成功事件"
}
},
"name": "执行分享逻辑",
"output": [],
"sub": {
"55d7b124-59ae-4436-bcda-0a0c96426f7a": {
"uuid": "55d7b124-59ae-4436-bcda-0a0c96426f7a",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"845311af-a1ed-4f59-a162-e8115f5f9d1b"
]
}
},
"845311af-a1ed-4f59-a162-e8115f5f9d1b": {
"uuid": "845311af-a1ed-4f59-a162-e8115f5f9d1b",
"meta": "f822b421-a9ee-4507-84cc-3a73c7409be1",
"design": {
"x": 194,
"y": 57,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 17.5
}
],
"failed": [
{
"x": 124.5,
"y": 31.5
}
],
"weichat": [
{
"x": 124.5,
"y": 45.5
}
]
}
},
"props": {},
"output": {
"success": [
"77a3ef2d-b7bf-4502-8711-1eb7bedff765"
],
"failed": [],
"weichat": [
"d9b45fb9-a353-4888-afe8-def5de615818"
]
}
},
"77a3ef2d-b7bf-4502-8711-1eb7bedff765": {
"uuid": "77a3ef2d-b7bf-4502-8711-1eb7bedff765",
"meta": "api-request",
"design": {
"x": 410,
"y": 6,
"input": {
"default": [
{
"x": 5.5,
"y": 82.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 68.5
}
],
"failed": [
{
"x": 124.5,
"y": 82.5
}
],
"exception": [
{
"x": 124.5,
"y": 96.5
}
]
}
},
"props": {
"uri": "lipstick/share.do",
"params": {
"type": "map",
"value": {
"channelType": {
"type": "env",
"value": "channelType"
}
}
}
},
"output": {
"success": [
"598b346d-0959-4a85-8a0a-76b6bda9181f"
],
"failed": [
"b50492a4-ef2c-4cd5-afd9-52db7d472edf"
],
"exception": [
"b50492a4-ef2c-4cd5-afd9-52db7d472edf"
]
}
},
"1decb2de-a422-4cc4-8700-1945e4bcbed3": {
"uuid": "1decb2de-a422-4cc4-8700-1945e4bcbed3",
"meta": "pop-dialog",
"design": {
"x": 919,
"y": 94,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 40
}
]
}
},
"props": {},
"output": {}
},
"d9b45fb9-a353-4888-afe8-def5de615818": {
"uuid": "d9b45fb9-a353-4888-afe8-def5de615818",
"meta": "push-dialog",
"design": {
"x": 411,
"y": 235,
"input": {
"default": [
{
"x": 5.5,
"y": 48.5
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 48.5
}
]
}
},
"props": {
"viewName": {
"type": "link",
"alias": "weichatShareView"
}
},
"output": {},
"alias": "微信分享引导弹窗"
},
"598b346d-0959-4a85-8a0a-76b6bda9181f": {
"uuid": "598b346d-0959-4a85-8a0a-76b6bda9181f",
"meta": "d2cf224c-e451-447e-8c5a-1c963f7a01b0",
"design": {
"x": 636,
"y": 0,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"close": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {
"success": [
"54ecdde8-5ef1-47ef-95a3-a49d8f13f345"
],
"failed": [],
"close": [
"1decb2de-a422-4cc4-8700-1945e4bcbed3"
]
}
},
"b50492a4-ef2c-4cd5-afd9-52db7d472edf": {
"uuid": "b50492a4-ef2c-4cd5-afd9-52db7d472edf",
"meta": "6f5e39c3-341e-4b90-9690-783de5466937",
"design": {
"x": 668,
"y": 253,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {}
},
"54ecdde8-5ef1-47ef-95a3-a49d8f13f345": {
"uuid": "54ecdde8-5ef1-47ef-95a3-a49d8f13f345",
"meta": "b54bfb2f-57fe-407d-b71a-1ebab5eb59cf",
"design": {
"x": 924,
"y": -15,
"input": {
"default": [
{
"x": 5.5,
"y": 48.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 41.5
}
],
"failed": [
{
"x": 124.5,
"y": 55.5
}
]
}
},
"props": {
"shareSuccessView": {
"type": "link",
"alias": "shareSuccessView"
},
"successEvent": {
"type": "link",
"alias": "successEvent"
}
},
"output": {}
}
},
"subEntry": "55d7b124-59ae-4436-bcda-0a0c96426f7a",
"metas": [
{
"id": "f822b421-a9ee-4507-84cc-3a73c7409be1",
"script": "\nif(engine.env.channelType==\"1\"){\n let opts={\n shareTitle:engine.env.shareTitle,\n shareContent:engine.env.shareContent,\n shareUrl:engine.env.shareUrl,\n shareThumbnail:engine.env.shareThumbnail,\n }\n window[\"requireShare\"](opts,()=>{\n next(\"success\")\n },()=>{\n next(\"failed\")\n });\n}else{\n next(\"weichat\")\n}",
"props": {},
"isInline": true,
"name": "执行分享方法",
"output": [
"success",
"failed",
"weichat"
],
"sub": {
"9391b950-6e2e-477c-93d4-1bfb377cc647": {
"uuid": "9391b950-6e2e-477c-93d4-1bfb377cc647",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {}
}
},
"subEntry": "9391b950-6e2e-477c-93d4-1bfb377cc647"
},
{
"id": "d2cf224c-e451-447e-8c5a-1c963f7a01b0",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "组件异常处理",
"output": [
"success",
"close"
],
"sub": {
"626001a8-2b34-4640-9be8-129c1f4a020b": {
"uuid": "626001a8-2b34-4640-9be8-129c1f4a020b",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"a38e20b5-d00e-4c55-94b5-e44d2c28ee1a"
]
}
},
"a38e20b5-d00e-4c55-94b5-e44d2c28ee1a": {
"uuid": "a38e20b5-d00e-4c55-94b5-e44d2c28ee1a",
"meta": "232e7e7c-b355-4a8f-9e71-922e0f53bf87",
"design": {
"x": 210,
"y": 75,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {
"failed": [
"d9897477-c675-4562-bc0e-5e6c554e80b0"
]
}
},
"d9897477-c675-4562-bc0e-5e6c554e80b0": {
"uuid": "d9897477-c675-4562-bc0e-5e6c554e80b0",
"meta": "show-toast",
"design": {
"x": 447,
"y": 102,
"input": {
"default": [
{
"x": 5.5,
"y": 82.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 82.5
}
]
}
},
"props": {
"padding": 10,
"duration": 1000,
"showDuration": 300,
"hideDuration": 200
},
"output": {
"success": [
"af837ac1-6da5-4913-b945-10eab22fba07"
]
}
},
"af837ac1-6da5-4913-b945-10eab22fba07": {
"uuid": "af837ac1-6da5-4913-b945-10eab22fba07",
"meta": "f2578ea7-67c7-45b1-b41b-7663361957f7",
"design": {
"x": 692,
"y": 171,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"close": [
{
"x": 124.5,
"y": 31.5
}
]
}
},
"props": {},
"output": {}
}
},
"subEntry": "626001a8-2b34-4640-9be8-129c1f4a020b",
"metas": [
{
"id": "232e7e7c-b355-4a8f-9e71-922e0f53bf87",
"script": "if(args.interrupt){\n if(args.errorMessage){\n next(\"failed\",{text:args.errorMessage})\n }else{\n next(\"failed\",{text:\"当前网络有些开小差,请稍等\"})\n }\n \n}else{\n next(\"success\",args)\n}",
"props": {},
"isInline": true,
"from": "custom",
"name": "判错逻辑",
"output": [
"success",
"failed"
]
},
{
"id": "f2578ea7-67c7-45b1-b41b-7663361957f7",
"script": "next(\"close\",args)",
"props": {},
"isInline": true,
"from": "custom",
"name": "终止",
"output": [
"close"
]
}
]
},
{
"id": "6f5e39c3-341e-4b90-9690-783de5466937",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "接口异常Toast",
"output": [
"success",
"failed"
],
"sub": {
"6c6b9ec9-76dc-44a4-a436-7c016e4f2599": {
"uuid": "6c6b9ec9-76dc-44a4-a436-7c016e4f2599",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"3d797ee7-1e6e-4ae1-9718-13292001b2b4"
]
}
},
"3d797ee7-1e6e-4ae1-9718-13292001b2b4": {
"uuid": "3d797ee7-1e6e-4ae1-9718-13292001b2b4",
"meta": "096eec4b-4603-4c5e-b762-498915345e18",
"design": {
"x": 201,
"y": 199,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {
"success": [],
"failed": [
"4d0225a7-24bb-4a1d-b14c-13d6a15e304b"
]
}
},
"57b7e460-2717-479a-a789-a25d1b9373f4": {
"uuid": "57b7e460-2717-479a-a789-a25d1b9373f4",
"meta": "show-toast",
"design": {
"x": 684,
"y": 218,
"input": {
"default": [
{
"x": 5.5,
"y": 82.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 82.5
}
]
}
},
"props": {
"padding": 10,
"duration": 1000,
"showDuration": 300,
"hideDuration": 200,
"viewName": ""
},
"output": {}
},
"4d0225a7-24bb-4a1d-b14c-13d6a15e304b": {
"uuid": "4d0225a7-24bb-4a1d-b14c-13d6a15e304b",
"meta": "fadbbfe0-aff9-401d-a001-9b1091fb464e",
"design": {
"x": 414,
"y": 219,
"input": {
"default": [
{
"x": 5.5,
"y": 56.5
}
]
},
"output": {
"p0": [
{
"x": 124.5,
"y": 49.5
}
],
"p1": [
{
"x": 124.5,
"y": 63.5
}
]
}
},
"props": {},
"output": {
"p0": [
"57b7e460-2717-479a-a789-a25d1b9373f4"
],
"p1": [
"c456022e-25b9-44dd-9bf6-e7973b173922"
]
}
},
"c456022e-25b9-44dd-9bf6-e7973b173922": {
"uuid": "c456022e-25b9-44dd-9bf6-e7973b173922",
"meta": "wait",
"design": {
"x": 678,
"y": 410,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 40
}
]
}
},
"props": {
"duration": 1000
},
"output": {
"complete": [
"e02a8757-cfaa-47cc-8c4a-2965d18e63c8"
]
}
},
"e02a8757-cfaa-47cc-8c4a-2965d18e63c8": {
"uuid": "e02a8757-cfaa-47cc-8c4a-2965d18e63c8",
"meta": "f3b3d538-e0a3-49bc-8363-4520b691710b",
"design": {
"x": 956,
"y": 483,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 31.5
}
]
}
},
"props": {},
"output": {}
}
},
"subEntry": "6c6b9ec9-76dc-44a4-a436-7c016e4f2599",
"metas": [
{
"id": "096eec4b-4603-4c5e-b762-498915345e18",
"script": "console.log(args)\nif(!args){\n next(\"failed\",{text:\"当前网络有些开小差,请稍等\"})\n}else{\n if(args.message){\n if(args.code!='100001'){\n next(\"failed\",{text:args.message})\n }\n }else{\n next(\"failed\",{text:\"当前网络有些开小差,请稍等\"})\n }\n}\n",
"props": {},
"isInline": true,
"from": "custom",
"name": "判错逻辑",
"output": [
"success",
"failed"
]
},
{
"id": "fadbbfe0-aff9-401d-a001-9b1091fb464e",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "分流节点",
"output": [
"p0",
"p1"
],
"isDivider": true
},
{
"id": "f3b3d538-e0a3-49bc-8363-4520b691710b",
"script": "next(\"success\")",
"props": {},
"isInline": true,
"from": "custom",
"name": "终止",
"output": [
"success"
]
}
]
},
{
"id": "b54bfb2f-57fe-407d-b71a-1ebab5eb59cf",
"script": "",
"props": {
"shareSuccessView": {
"type": "string",
"enum": [],
"alias": "分享成功弹窗"
},
"successEvent": {
"type": "string",
"enum": [],
"alias": "成功事件"
}
},
"isInline": true,
"from": "custom",
"name": "分享成功处理",
"output": [
"success",
"failed"
],
"sub": {
"95048c23-a7af-4b75-b6ae-86150441fbe2": {
"uuid": "95048c23-a7af-4b75-b6ae-86150441fbe2",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"250e5a77-be2d-4d20-9551-d4f723105621"
]
}
},
"250e5a77-be2d-4d20-9551-d4f723105621": {
"uuid": "250e5a77-be2d-4d20-9551-d4f723105621",
"meta": "pop-dialog",
"design": {
"x": 211,
"y": 63,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 40
}
]
}
},
"props": {
"closeAll": true
},
"output": {
"complete": [
"32f37033-67af-4c71-bf8f-ac1dead6e150"
]
}
},
"32f37033-67af-4c71-bf8f-ac1dead6e150": {
"uuid": "32f37033-67af-4c71-bf8f-ac1dead6e150",
"meta": "ce2a1072-edd1-42b8-b65a-ca137d1d5fdd",
"design": {
"x": 415,
"y": 80,
"input": {
"default": [
{
"x": 5.5,
"y": 56.5
}
]
},
"output": {
"p0": [
{
"x": 124.5,
"y": 49.5
}
],
"p1": [
{
"x": 124.5,
"y": 63.5
}
]
}
},
"props": {},
"output": {
"p0": [
"38041cd7-fc6c-4fd1-9aef-bf6f26ea4546"
],
"p1": [
"0fbf93fb-3946-41dd-9d15-9d7e3bb9e489"
]
}
},
"38041cd7-fc6c-4fd1-9aef-bf6f26ea4546": {
"uuid": "38041cd7-fc6c-4fd1-9aef-bf6f26ea4546",
"meta": "dispatch-event",
"design": {
"x": 648,
"y": 24,
"input": {
"default": [
{
"x": 5.5,
"y": 57
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 57
}
]
}
},
"props": {
"eventName": {
"type": "link",
"alias": "successEvent"
}
},
"output": {},
"alias": "派发分享成功事件"
},
"0fbf93fb-3946-41dd-9d15-9d7e3bb9e489": {
"uuid": "0fbf93fb-3946-41dd-9d15-9d7e3bb9e489",
"meta": "13fdecf7-ebc9-4c33-b040-775a34a2eea3",
"design": {
"x": 647,
"y": 177,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {
"failed": [
"af9f7e73-50cb-4b7e-a5bc-134e81214008"
]
}
},
"af9f7e73-50cb-4b7e-a5bc-134e81214008": {
"uuid": "af9f7e73-50cb-4b7e-a5bc-134e81214008",
"meta": "push-dialog",
"design": {
"x": 860,
"y": 202,
"input": {
"default": [
{
"x": 5.5,
"y": 48.5
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 48.5
}
]
}
},
"props": {
"viewName": {
"type": "link",
"alias": "shareSuccessView"
}
},
"output": {},
"alias": "分享成功弹窗"
}
},
"subEntry": "95048c23-a7af-4b75-b6ae-86150441fbe2",
"metas": [
{
"id": "ce2a1072-edd1-42b8-b65a-ca137d1d5fdd",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "分流节点",
"output": [
"p0",
"p1"
],
"isDivider": true
},
{
"id": "13fdecf7-ebc9-4c33-b040-775a34a2eea3",
"script": " if(global.dataCenter.store.coop_config[\"rpb.lipstick.share.appShareWay\"]==\"true\"||global.dataCenter.store.coop_config[\"rpb.lipstick.share.officalAccountShareWay\"]==\"true\"){\n next(\"success\",args)\n }else{\n next(\"failed\",args)\n }",
"props": {},
"isInline": true,
"from": "custom",
"name": "是否为真分享",
"output": [
"success",
"failed"
]
}
]
}
],
"isPrefab": true
}
\ No newline at end of file
{
"props": {},
"from": "custom",
"name": "设置分享信息",
"output": [
"success",
"failed"
],
"sub": {
"a75eb5c6-b147-4b19-97eb-a31cf7667fff": {
"uuid": "a75eb5c6-b147-4b19-97eb-a31cf7667fff",
"meta": "entry",
"design": {
"x": -342,
"y": 70,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"e8c7c2d5-fc7e-444a-89f2-252cb8cd6b25"
]
}
},
"2a88bbc9-6d81-43d7-ad1a-a129a9f7e8e6": {
"uuid": "2a88bbc9-6d81-43d7-ad1a-a129a9f7e8e6",
"meta": "api-request",
"design": {
"x": 220,
"y": -99,
"input": {
"default": [
{
"x": 5.5,
"y": 82.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 68.5
}
],
"failed": [
{
"x": 124.5,
"y": 82.5
}
],
"exception": [
{
"x": 124.5,
"y": 96.5
}
]
}
},
"props": {
"uri": "lipstick/getShareInfo.do",
"dataName": "getShareInfo",
"params": {
"type": "map",
"value": {}
}
},
"output": {
"success": [
"0cde2623-e145-41ed-bd6c-f313f19adb88"
],
"failed": [
"d5ed77ee-4774-4395-aa4a-60301ba4561f"
],
"exception": [
"d5ed77ee-4774-4395-aa4a-60301ba4561f"
]
}
},
"0cde2623-e145-41ed-bd6c-f313f19adb88": {
"uuid": "0cde2623-e145-41ed-bd6c-f313f19adb88",
"meta": "b283de43-2d3a-4721-965f-90c8a70c5162",
"design": {
"x": 480,
"y": -115,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 31.5
}
]
}
},
"props": {},
"output": {
"success": [
"8e6024ea-574e-49d0-99f8-13719f7b2c12"
]
}
},
"38471b30-788a-4384-abe3-02961eaa246d": {
"uuid": "38471b30-788a-4384-abe3-02961eaa246d",
"meta": "duiba-api",
"design": {
"x": 231,
"y": 144,
"input": {
"default": [
{
"x": 5.5,
"y": 82.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 75.5
}
],
"failed": [
{
"x": 124.5,
"y": 89.5
}
]
}
},
"props": {
"url": {
"type": "static",
"value": "/aaw/projectx/getDevAppInfo"
},
"name": "getDevAppInfo",
"method": "get",
"params": {
"type": "map",
"value": {
"appId": {
"type": "env",
"value": "appID"
}
}
}
},
"output": {
"success": [
"4abafb99-df41-4378-8c4d-37acbc489d5b"
],
"failed": [
"2bc1c4ea-5301-40ab-8dca-d2818c4732e4"
]
}
},
"123fc8e9-6b60-45d5-8e54-4ccfec181619": {
"uuid": "123fc8e9-6b60-45d5-8e54-4ccfec181619",
"meta": "duiba-api",
"design": {
"x": 228,
"y": 310,
"input": {
"default": [
{
"x": 5.5,
"y": 82.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 75.5
}
],
"failed": [
{
"x": 124.5,
"y": 89.5
}
]
}
},
"props": {
"url": {
"type": "static",
"value": "/aaw/projectx/getAppWechatInfo"
},
"name": "getAppWechatInfo",
"method": "get",
"params": {
"type": "map",
"value": {
"appId": {
"type": "env",
"value": "appID"
}
}
}
},
"output": {
"failed": [
"2bc1c4ea-5301-40ab-8dca-d2818c4732e4"
]
}
},
"e8c7c2d5-fc7e-444a-89f2-252cb8cd6b25": {
"uuid": "e8c7c2d5-fc7e-444a-89f2-252cb8cd6b25",
"meta": "541c8476-34bf-4c5d-805e-2e4906791cb6",
"design": {
"x": -169,
"y": 100,
"input": {
"default": [
{
"x": 5.5,
"y": 56.5
}
]
},
"output": {
"p0": [
{
"x": 124.5,
"y": 49.5
}
],
"p1": [
{
"x": 124.5,
"y": 63.5
}
]
}
},
"props": {},
"output": {
"p0": [
"abfd8d40-2ba6-4227-8f71-eb12d4c993a3"
],
"p1": [
"3acb15f0-5e7c-453e-8d74-459b0c27c0cf"
]
}
},
"abfd8d40-2ba6-4227-8f71-eb12d4c993a3": {
"uuid": "abfd8d40-2ba6-4227-8f71-eb12d4c993a3",
"meta": "c4f60371-5a9a-4f02-92c9-1f24d310c68a",
"design": {
"x": 18,
"y": 23,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 33
}
],
"failed": [
{
"x": 124.5,
"y": 47
}
]
}
},
"props": {},
"output": {
"success": [
"2a88bbc9-6d81-43d7-ad1a-a129a9f7e8e6"
],
"failed": [
"8e6024ea-574e-49d0-99f8-13719f7b2c12"
]
}
},
"3acb15f0-5e7c-453e-8d74-459b0c27c0cf": {
"uuid": "3acb15f0-5e7c-453e-8d74-459b0c27c0cf",
"meta": "63f6956c-1a4f-4395-aeb2-2790b10df37d",
"design": {
"x": 18,
"y": 172,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"yes": [
{
"x": 124.5,
"y": 24.5
}
],
"no": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {
"yes": [
"38471b30-788a-4384-abe3-02961eaa246d"
],
"no": [
"123fc8e9-6b60-45d5-8e54-4ccfec181619"
]
}
},
"4abafb99-df41-4378-8c4d-37acbc489d5b": {
"uuid": "4abafb99-df41-4378-8c4d-37acbc489d5b",
"meta": "59bb3740-de75-4ef8-b1c0-244103d9b69a",
"design": {
"x": 550,
"y": 226,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {}
},
"props": {},
"output": {}
},
"8e6024ea-574e-49d0-99f8-13719f7b2c12": {
"uuid": "8e6024ea-574e-49d0-99f8-13719f7b2c12",
"meta": "63f6956c-1a4f-4395-aeb2-2790b10df37d",
"design": {
"x": 590,
"y": 71,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"yes": [
{
"x": 124.5,
"y": 24.5
}
],
"no": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {
"no": [
"971ab334-faeb-4a70-964c-c62f8b97920a"
]
}
},
"d5ed77ee-4774-4395-aa4a-60301ba4561f": {
"uuid": "d5ed77ee-4774-4395-aa4a-60301ba4561f",
"meta": "464fc17d-ab77-4ef7-b6ce-7501a4847d23",
"design": {
"x": 429,
"y": -31,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {}
},
"2bc1c4ea-5301-40ab-8dca-d2818c4732e4": {
"uuid": "2bc1c4ea-5301-40ab-8dca-d2818c4732e4",
"meta": "464fc17d-ab77-4ef7-b6ce-7501a4847d23",
"design": {
"x": 502,
"y": 314,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {}
},
"971ab334-faeb-4a70-964c-c62f8b97920a": {
"uuid": "971ab334-faeb-4a70-964c-c62f8b97920a",
"meta": "0fa05fb3-c179-461b-b088-de0e3be40449",
"design": {
"x": 799,
"y": 136,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {}
}
},
"subEntry": "a75eb5c6-b147-4b19-97eb-a31cf7667fff",
"metas": [
{
"id": "b283de43-2d3a-4721-965f-90c8a70c5162",
"script": "if(global.dataCenter.store.coop_config[\"rpb.lipstick.share.appShareWay\"]==\"true\"||global.dataCenter.store.coop_config[\"rpb.lipstick.share.officalAccountShareWay\"]==\"true\"){\n if(engine.env.shareUrl.indexOf(\"shareCode\")==-1){\n engine.env.shareUrl+=`&shareCode=${args.raw.shareCode}`\n }\n}\nnext(\"success\",args)",
"props": {},
"isInline": true,
"from": "custom",
"name": "拼接shareCode",
"output": [
"success"
],
"sub": {
"f1fad633-f8eb-4ed4-9c8f-3bc4b470f801": {
"uuid": "f1fad633-f8eb-4ed4-9c8f-3bc4b470f801",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {}
}
},
"subEntry": "f1fad633-f8eb-4ed4-9c8f-3bc4b470f801"
},
{
"id": "541c8476-34bf-4c5d-805e-2e4906791cb6",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "分流节点",
"output": [
"p0",
"p1"
],
"isDivider": true
},
{
"id": "c4f60371-5a9a-4f02-92c9-1f24d310c68a",
"script": "if(props.hasShareRequest){\n next(\"success\",args)\n}else{\n next(\"failed\",args)\n}",
"props": {
"hasShareRequest": {
"type": "boolean",
"enum": [],
"default": true,
"alias": "是否配置分享模块"
}
},
"isInline": true,
"from": "custom",
"name": "是否配置分享模块",
"output": [
"success",
"failed"
]
},
{
"id": "63f6956c-1a4f-4395-aeb2-2790b10df37d",
"script": "if(engine.env.channelType==\"1\"){\n next(\"yes\",args)\n}else{\n next(\"no\",args)\n}",
"props": {},
"isInline": true,
"from": "custom",
"name": "是否为app渠道",
"output": [
"yes",
"no"
]
},
{
"id": "59bb3740-de75-4ef8-b1c0-244103d9b69a",
"script": "if(!global.loginCodeState){\n global.loginCodeState=1\n window[\"$\"](\"body\").append(args.appLoginJs)\n var u = navigator.userAgent;\n var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端\n if(isAndroid){\n window[\"$\"](\"body\").append(args.androidShareJs)\n }else{\n window[\"$\"](\"body\").append(args.iosShareJs)\n }\n}",
"props": {},
"isInline": true,
"from": "custom",
"name": "生成分享方法",
"output": []
},
{
"id": "464fc17d-ab77-4ef7-b6ce-7501a4847d23",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "接口异常Toast",
"output": [
"success",
"failed"
],
"sub": {
"557c28e1-568b-49cf-a145-c48f9f180ab8": {
"uuid": "557c28e1-568b-49cf-a145-c48f9f180ab8",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"4baae08e-0691-4a65-8e3f-6460d1547a15"
]
}
},
"4baae08e-0691-4a65-8e3f-6460d1547a15": {
"uuid": "4baae08e-0691-4a65-8e3f-6460d1547a15",
"meta": "974da71f-8a91-495f-be6c-8e521dd82df4",
"design": {
"x": 230,
"y": 82,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 24.5
}
],
"failed": [
{
"x": 124.5,
"y": 38.5
}
]
}
},
"props": {},
"output": {
"failed": [
"fc8aab82-772f-4d76-813a-0bec9b3e0760"
]
}
},
"fc8aab82-772f-4d76-813a-0bec9b3e0760": {
"uuid": "fc8aab82-772f-4d76-813a-0bec9b3e0760",
"meta": "9e196854-4c2d-4784-afc8-e8dcb17c79c2",
"design": {
"x": 412,
"y": 164,
"input": {
"default": [
{
"x": 5.5,
"y": 56.5
}
]
},
"output": {
"p0": [
{
"x": 124.5,
"y": 49.5
}
],
"p1": [
{
"x": 124.5,
"y": 63.5
}
]
}
},
"props": {},
"output": {
"p0": [
"efe82744-e381-4cdc-964d-651f516545a4"
],
"p1": [
"197e1d2f-21e6-4568-b0f7-4b8405ad6e9b"
]
}
},
"efe82744-e381-4cdc-964d-651f516545a4": {
"uuid": "efe82744-e381-4cdc-964d-651f516545a4",
"meta": "show-toast",
"design": {
"x": 657,
"y": 131,
"input": {
"default": [
{
"x": 5.5,
"y": 82.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 82.5
}
]
}
},
"props": {
"padding": 10,
"duration": 1000,
"showDuration": 300,
"hideDuration": 200,
"viewName": ""
},
"output": {}
},
"197e1d2f-21e6-4568-b0f7-4b8405ad6e9b": {
"uuid": "197e1d2f-21e6-4568-b0f7-4b8405ad6e9b",
"meta": "wait",
"design": {
"x": 654,
"y": 363,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"complete": [
{
"x": 124.5,
"y": 40
}
]
}
},
"props": {
"duration": 1000
},
"output": {
"complete": [
"cc6a31a2-cf54-4397-aca0-e17f9c19b441"
]
}
},
"cc6a31a2-cf54-4397-aca0-e17f9c19b441": {
"uuid": "cc6a31a2-cf54-4397-aca0-e17f9c19b441",
"meta": "990b7cff-5817-484c-8b96-57a1fc194676",
"design": {
"x": 869,
"y": 376,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 31.5
}
]
}
},
"props": {},
"output": {}
}
},
"subEntry": "557c28e1-568b-49cf-a145-c48f9f180ab8",
"metas": [
{
"id": "974da71f-8a91-495f-be6c-8e521dd82df4",
"script": "console.log(args)\nif(!args){\n next(\"failed\",{text:\"当前网络有些开小差,请稍等\"})\n}else{\n if(args.message){\n if(args.code!='100001'){\n next(\"failed\",{text:args.message})\n }\n }else{\n next(\"failed\",{text:\"当前网络有些开小差,请稍等\"})\n }\n}\n\n",
"props": {},
"isInline": true,
"from": "custom",
"name": "判错逻辑",
"output": [
"success",
"failed"
]
},
{
"id": "9e196854-4c2d-4784-afc8-e8dcb17c79c2",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "分流节点",
"output": [
"p0",
"p1"
],
"isDivider": true
},
{
"id": "990b7cff-5817-484c-8b96-57a1fc194676",
"script": "next(\"success\")",
"props": {},
"isInline": true,
"from": "custom",
"name": "结束",
"output": [
"success"
]
}
]
},
{
"id": "0fa05fb3-c179-461b-b088-de0e3be40449",
"script": "",
"props": {},
"isInline": true,
"from": "custom",
"name": "初始化微信分享",
"output": [
"success",
"failed"
],
"sub": {
"f48cbb42-5672-4ea2-9329-3b1c7c448621": {
"uuid": "f48cbb42-5672-4ea2-9329-3b1c7c448621",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"85c9cf91-f94d-4be2-a776-6ce88a5e8733"
]
}
},
"85c9cf91-f94d-4be2-a776-6ce88a5e8733": {
"uuid": "85c9cf91-f94d-4be2-a776-6ce88a5e8733",
"meta": "init-weixin-env",
"design": {
"x": 253,
"y": 72,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 40
}
]
}
},
"props": {
"debug": false
},
"output": {
"success": [
"ac5445fa-dbd9-4610-9cd4-6ce7f2b2d826"
]
}
},
"ac5445fa-dbd9-4610-9cd4-6ce7f2b2d826": {
"uuid": "ac5445fa-dbd9-4610-9cd4-6ce7f2b2d826",
"meta": "78e53207-b558-4344-8385-e8df8eba6bfe",
"design": {
"x": 529,
"y": 140,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 33
}
],
"failed": [
{
"x": 124.5,
"y": 47
}
]
}
},
"props": {
"update": true
},
"output": {}
}
},
"subEntry": "f48cbb42-5672-4ea2-9329-3b1c7c448621",
"metas": [
{
"id": "78e53207-b558-4344-8385-e8df8eba6bfe",
"script": "",
"props": {
"update": {
"type": "boolean",
"enum": []
}
},
"isInline": true,
"from": "custom",
"name": "微信分享操作",
"output": [
"success",
"failed"
],
"sub": {
"608177d2-eb20-4334-b718-205144d60c48": {
"uuid": "608177d2-eb20-4334-b718-205144d60c48",
"meta": "entry",
"design": {
"x": 10,
"y": 10,
"input": {},
"output": {
"success": [
{
"x": 124.5,
"y": 32
}
]
}
},
"props": {},
"output": {
"success": [
"0bdc725d-a906-4b3a-ab43-53c0f75b9221"
]
}
},
"0bdc725d-a906-4b3a-ab43-53c0f75b9221": {
"uuid": "0bdc725d-a906-4b3a-ab43-53c0f75b9221",
"meta": "share-preprocessing",
"design": {
"x": 201,
"y": 51,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 31.5
}
]
}
},
"props": {},
"output": {
"success": [
"ee4390b8-ae46-4000-b139-c6060d1f1316"
]
}
},
"ee4390b8-ae46-4000-b139-c6060d1f1316": {
"uuid": "ee4390b8-ae46-4000-b139-c6060d1f1316",
"meta": "env-judge",
"design": {
"x": 419,
"y": 93,
"input": {
"default": [
{
"x": 5.5,
"y": 31.5
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 31.5
}
]
}
},
"props": {},
"output": {
"success": [
"1503216d-be13-484c-92f3-d8168f076674"
]
}
},
"1503216d-be13-484c-92f3-d8168f076674": {
"uuid": "1503216d-be13-484c-92f3-d8168f076674",
"meta": "share-weixin",
"design": {
"x": 651,
"y": 95,
"input": {
"default": [
{
"x": 5.5,
"y": 40
}
]
},
"output": {
"success": [
{
"x": 124.5,
"y": 19
}
],
"failed": [
{
"x": 124.5,
"y": 33
}
],
"pass": [
{
"x": 124.5,
"y": 47
}
],
"guide": [
{
"x": 124.5,
"y": 61
}
]
}
},
"props": {
"update": {
"type": "link"
}
},
"output": {}
}
},
"subEntry": "608177d2-eb20-4334-b718-205144d60c48"
}
]
}
],
"isPrefab": true
}
\ No newline at end of file
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