Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-libs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
zeroing-libs
Commits
564408cc
Commit
564408cc
authored
Jun 29, 2020
by
任建锋
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://gitlab2.dui88.com/laoqifeng/zeroing-libs
into dev
parents
0e85c3c0
35cac742
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
176 additions
and
99 deletions
+176
-99
jump-high.json
dist/customs/jump-high.json
+1
-1
pick-image.json
dist/processes/other/pick-image.json
+1
-1
resize-image.json
dist/processes/other/resize-image.json
+1
-1
show-toast.json
dist/processes/view/show-toast.json
+30
-1
main.js
src/custom/jump-high/debug/main.js
+1
-5
main.js.map
src/custom/jump-high/debug/main.js.map
+1
-1
utils.ts
src/custom/jump-high/src/game/utils.ts
+1
-1
index.ts
src/process/other/pick-image/index.ts
+101
-14
index.ts
src/process/other/resize-image/index.ts
+17
-72
meta.json
src/process/view/show-toast/meta.json
+22
-2
No files found.
dist/customs/jump-high.json
View file @
564408cc
...
...
@@ -398,5 +398,5 @@
}
},
"id"
:
"jump-high"
,
"code"
:
"(function (global, factory) {
\n\t
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :
\n\t
typeof 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\t
var props = {};
\n\t
function prepareProps() {
\n\t
var metaProps = getProps();
\n\t
engine.injectProp(props, metaProps);
\n\t
}
\n\t
function injectProps(p) {
\n\t
engine.injectProp(props, p);
\n\t
}
\n\n\t
function getTexture
(uuid) {
\n\t
return engine.Texture.from(getAssetByUUID(uuid).uuid);
\n\t
}
\n\t
function getTextureByName(name) {
\n\t
return getTexture(engine.getAssetByName(name).uuid);
\n\t
}
\n\t
function getBlockAsset(type) {
\n\t
return engine.getAssetByName(props.blockAssets[type]);
\n\t
}
\n\t
function 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\t
function playSound(name) {
\n\t
engine.playSound(engine.
getAssetByName(name).uuid, { keep: true });
\n\t
}
\n\n\t
var 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\n\t
var 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\n\t
var 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\t
var 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\n\t
var 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\n\t
var 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\n\t
var 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\n\t
var ObjectPool = engine.ObjectPool;
\n\t
var PoolName = 'gold-bag';
\n\t
ObjectPool.registerPool(PoolName, function () {
\n\t
return new GoldBag();
\n\t
}, function (item, data) {
\n\t
item.reset(data);
\n\t
});
\n\t
var 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\t
var 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\n\t
function index (props) {
\n\t
prepareProps();
\n\t
injectProps(props);
\n\t
var instance = new JumpHigh();
\n\t
return instance;
\n\t
}
\n\n\t
return index;
\n\n
})));
\n
"
"code"
:
"(function (global, factory) {
\n\t
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :
\n\t
typeof 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\t
var props = {};
\n\t
function prepareProps() {
\n\t
var metaProps = getProps();
\n\t
engine.injectProp(props, metaProps);
\n\t
}
\n\t
function injectProps(p) {
\n\t
engine.injectProp(props, p);
\n\t
}
\n\n\t
function getTexture
ByName(name) {
\n\t
return engine.Texture.from(getAssetByName(name).uuid);
\n\t
}
\n\t
function getBlockAsset(type) {
\n\t
return engine.getAssetByName(props.blockAssets[type]);
\n\t
}
\n\t
function 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\t
function playSound(name) {
\n\t
engine.playSound(
getAssetByName(name).uuid, { keep: true });
\n\t
}
\n\n\t
var 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\n\t
var 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\n\t
var 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\t
var 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\n\t
var 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\n\t
var 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\n\t
var 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\n\t
var ObjectPool = engine.ObjectPool;
\n\t
var PoolName = 'gold-bag';
\n\t
ObjectPool.registerPool(PoolName, function () {
\n\t
return new GoldBag();
\n\t
}, function (item, data) {
\n\t
item.reset(data);
\n\t
});
\n\t
var 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\t
var 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\n\t
function index (props) {
\n\t
prepareProps();
\n\t
injectProps(props);
\n\t
var instance = new JumpHigh();
\n\t
return instance;
\n\t
}
\n\n\t
return index;
\n\n
})));
\n
"
}
dist/processes/other/pick-image.json
View file @
564408cc
...
...
@@ -6,7 +6,7 @@
"success"
],
"id"
:
"pick-image"
,
"script"
:
"
var input = document.createElement('input');
\n
input.type = 'file';
\n
input.onchange = function (e) {
\n
processImage(input.files[0], function (imgData) {
\n
next('success', imgData);
\n
});
\n
};
\n
input.click();
\n
function processImage(file, callback) {
\n
var reader = new FileReader();
\n
reader.readAsDataURL(file);
\n
reader.onload = function (e) {
\n
callback(reader.result);
\n
}
;
\n
}
\n
"
,
"script"
:
"
pick(function (imgData) {
\n
next('success', imgData);
\n
});
\n
function getExif(img, callback) {
\n
EXIF.getData(img, function () {
\n
var allMetaData = EXIF.getAllTags(this);
\n
callback(allMetaData);
\n
});
\n
}
\n
function pick(callback) {
\n
var fileInput = document.createElement(
\"
input
\"
);
\n
fileInput.type =
\"
file
\"
;
\n
fileInput.accept =
\"
image/*
\"
;
\n
fileInput.style.display =
\"
none
\"
;
\n
document.body.insertBefore(fileInput, document.body.firstChild);
\n
fileInput.addEventListener(
\"
change
\"
, function (evt) {
\n
var mime = {
\"
png
\"
:
\"
image/png
\"
,
\"
jpg
\"
:
\"
image/jpeg
\"
,
\"
jpeg
\"
:
\"
image/jpeg
\"
,
\"
bmp
\"
:
\"
image/bmp
\"
};
\n
var file = evt.target.files[0];
\n
var type = file.type;
\n
if (!type) {
\n
type = mime[file.name.match(/
\\
.([^
\\
.]+)$/i)[1]];
\n
}
\n
var fileReader = new FileReader();
\n
fileReader.onload = function () {
\n
getExif(file, function (exif) {
\n
var orientation = -1;
\n
if (exif) {
\n
orientation = exif[
\"
Orientation
\"
];
\n
}
\n
var image = new Image();
\n
image.onload = function () {
\n
var canvas = document.createElement(
\"
canvas
\"
);
\n
var ctx = canvas.getContext(
\"
2d
\"
);
\n
canvas.width = image.width;
\n
canvas.height = image.height;
\n
if (orientation > 4) {
\n
canvas.width = image.height;
\n
canvas.height = image.width;
\n
}
\n
ctx.clearRect(0, 0, canvas.width, canvas.height);
\n
switch (orientation) {
\n
case 2:
\n
ctx.translate(canvas.width, 0);
\n
ctx.scale(-1, 1);
\n
break;
\n
case 3:
\n
ctx.translate(canvas.width, canvas.height);
\n
ctx.rotate(Math.PI);
\n
break;
\n
case 4:
\n
ctx.translate(0, canvas.height);
\n
ctx.scale(1, -1);
\n
break;
\n
case 5:
\n
ctx.rotate(0.5 * Math.PI);
\n
ctx.scale(1, -1);
\n
break;
\n
case 6:
\n
ctx.rotate(0.5 * Math.PI);
\n
ctx.translate(0, -image.height);
\n
break;
\n
case 7:
\n
ctx.rotate(0.5 * Math.PI);
\n
ctx.translate(canvas.width, -canvas.height);
\n
ctx.scale(-1, 1);
\n
break;
\n
case 8:
\n
ctx.rotate(-0.5 * Math.PI);
\n
ctx.translate(-canvas.height, 0);
\n
break;
\n
default:
\n
ctx.transform(1, 0, 0, 1, 0, 0);
\n
}
\n
ctx.drawImage(image, 0, 0);
\n
var imagetype =
\"
png
\"
;
\n
if (orientation !== -1) {
\n
imagetype =
\"
jpeg
\"
;
\n
}
\n
var resultURL =
\"\"
;
\n
if (imagetype ===
\"
jpg
\"
|| imagetype ===
\"
jpeg
\"
) {
\n
resultURL = canvas.toDataURL(
\"
image/
\"
+ imagetype);
\n
}
\n
else {
\n
resultURL = canvas.toDataURL(
\"
image/
\"
+ imagetype);
\n
}
\n
callback(resultURL);
\n
image.parentNode.removeChild(image);
\n
fileInput.parentNode.removeChild(fileInput);
\n
};
\n
image.src = fileReader.result;
\n
image.style.display =
\"
none
\"
;
\n
document.body.appendChild(image);
\n
fileInput.value =
\"\"
;
\n
});
\n
};
\n
fileReader.readAsDataURL(file);
\n
}, false);
\n
fileInput.click()
;
\n
}
\n
"
,
"group"
:
"other"
,
"type"
:
"builtin"
}
dist/processes/other/resize-image.json
View file @
564408cc
...
...
@@ -38,7 +38,7 @@
"success"
],
"id"
:
"resize-image"
,
"script"
:
"var width = engine.findVariable('width', args, props);
\n
var height = engine.findVariable('height', args, props);
\n
var cutType = engine.findVariable('cutType', args, props);
\n
var type = engine.findVariable('type', args, props);
\n
var quality = engine.findVariable('quality', args, props);
\n
var img = args;
\n
if (typeof args === 'string') {
\n
img = new Image();
\n
img.onload = function () {
\n
deal();
\n
};
\n
img.onerror = function (e) {
\n
console.log(e);
\n
};
\n
img.src = args;
\n
}
\n
else {
\n
deal();
\n
}
\n
function
getExif(callback) {
\n
EXIF.getData(img, function () {
\n
var allMetaData = EXIF.getAllTags(this);
\n
callback(allMetaData);
\n
});
\n
}
\n
function deal() {
\n
getExif(function (allMetaData) {
\n
var m = cutType === 'inner' ? Math.min : Math.max;
\n
var r = m(width / img.width, height / img.height);
\n
var imgWidth = img.width * r;
\n
var imgHeight = img.height * r;
\n
var x = (width - imgWidth) / 2;
\n
var y = (height - imgHeight) / 2;
\n
var canvas = document.createElement('canvas');
\n
canvas.width = width;
\n
canvas.height = height;
\n
var ctx = canvas.getContext('2d');
\n
ctx.translate(x, y);
\n
ctx.scale(r, r);
\n
allMetaData.Orientation = 1;
\n
if (allMetaData.Orientation) {
\n
var orientation = allMetaData.Orientation;
\n
switch (orientation) {
\n
case 2:
\n
ctx.translate(img.width, 0);
\n
ctx.scale(-1, 1);
\n
break;
\n
case 3:
\n
ctx.translate(img.width, img.height);
\n
ctx.rotate(Math.PI);
\n
break;
\n
case 4:
\n
ctx.translate(0, img.height);
\n
ctx.scale(1, -1);
\n
break;
\n
case 5:
\n
ctx.rotate(-0.5 * Math.PI);
\n
ctx.scale(-1, 1);
\n
ctx.translate(x / r - y / r, y / r - x / r);
\n
break;
\n
case 6:
\n
ctx.rotate(-0.5 * Math.PI);
\n
ctx.translate(-img.width + y / r - x / r, y / r - x / r);
\n
break;
\n
case 7:
\n
ctx.rotate(0.5 * Math.PI);
\n
ctx.scale(-1, 1);
\n
ctx.translate(-img.width + y / r - x / r, -img.height + x / r - y / r);
\n
break;
\n
case 8:
\n
ctx.rotate(-0.5 * Math.PI);
\n
ctx.translate(-img.width + y / r - x / r, -x / r + y / r);
\n
break;
\n
}
\n
}
\n
ctx.drawImage(img, 0, 0);
\n
var dataUrl = canvas.toDataURL('image/' + type, quality);
\n
next('success', dataUrl);
\n
}
);
\n
}
\n
"
,
"script"
:
"var width = engine.findVariable('width', args, props);
\n
var height = engine.findVariable('height', args, props);
\n
var cutType = engine.findVariable('cutType', args, props);
\n
var type = engine.findVariable('type', args, props);
\n
var quality = engine.findVariable('quality', args, props);
\n
var img = args;
\n
if (typeof args === 'string') {
\n
img = new Image();
\n
img.onload = function () {
\n
deal();
\n
};
\n
img.onerror = function (e) {
\n
console.log(e);
\n
};
\n
img.src = args;
\n
}
\n
else {
\n
deal();
\n
}
\n
function
deal() {
\n
var m = cutType === 'inner' ? Math.min : Math.max;
\n
var r = m(width / img.width, height / img.height);
\n
var imgWidth = img.width * r;
\n
var imgHeight = img.height * r;
\n
var x = (width - imgWidth) / 2;
\n
var y = (height - imgHeight) / 2;
\n
var canvas = document.createElement('canvas');
\n
canvas.width = width;
\n
canvas.height = height;
\n
var ctx = canvas.getContext('2d');
\n
ctx.translate(x, y);
\n
ctx.scale(r, r);
\n
ctx.drawImage(img, 0, 0);
\n
var dataUrl = canvas.toDataURL('image/' + type, quality);
\n
next('success', dataUrl
);
\n
}
\n
"
,
"group"
:
"other"
,
"type"
:
"builtin"
}
dist/processes/view/show-toast.json
View file @
564408cc
...
...
@@ -6,13 +6,42 @@
},
"text"
:
{
"type"
:
"string"
,
"alias"
:
"内容"
"alias"
:
"文本内容"
},
"labelAlign"
:
{
"alias"
:
"文本对齐"
,
"type"
:
"enum"
,
"enum"
:
[
{
"label"
:
"左对齐"
,
"value"
:
"left"
},
{
"label"
:
"居中对齐"
,
"value"
:
"center"
},
{
"label"
:
"右对齐"
,
"value"
:
"right"
}
],
"default"
:
"center"
},
"labSize"
:
{
"alias"
:
"文本大小"
,
"type"
:
"number"
,
"default"
:
30
},
"padding"
:
{
"type"
:
"number"
,
"default"
:
10
,
"alias"
:
"边距"
},
"bgAlpha"
:
{
"type"
:
"number"
,
"default"
:
0.7
,
"alias"
:
"背景透明度"
},
"paddingH"
:
{
"type"
:
"number"
,
"alias"
:
"横向边距"
...
...
src/custom/jump-high/debug/main.js
View file @
564408cc
...
...
@@ -13,11 +13,8 @@
engine
.
injectProp
(
props
,
p
);
}
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
uuid
);
}
function
getTextureByName
(
name
)
{
return
getTexture
(
getAssetByName
(
name
).
uuid
);
return
engine
.
Texture
.
from
(
getAssetByName
(
name
).
uuid
);
}
function
getBlockAsset
(
type
)
{
return
engine
.
getAssetByName
(
props
.
blockAssets
[
type
]);
...
...
@@ -853,7 +850,6 @@
};
return
GameView
;
}(
engine
.
Container
));
//# sourceMappingURL=GameView.js.map
var
JumpHigh
=
(
function
(
_super
)
{
tslib
.
__extends
(
JumpHigh
,
_super
);
...
...
src/custom/jump-high/debug/main.js.map
View file @
564408cc
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/custom/jump-high/src/game/utils.ts
View file @
564408cc
...
...
@@ -8,7 +8,7 @@ export function getTexture(uuid) {
}
export
function
getTextureByName
(
name
)
{
return
getTexture
(
getAssetByName
(
name
).
uuid
);
return
engine
.
Texture
.
from
(
getAssetByName
(
name
).
uuid
);
}
export
function
getBlockAsset
(
type
)
{
...
...
src/process/other/pick-image/index.ts
View file @
564408cc
...
...
@@ -2,19 +2,106 @@
* Created by rockyl on 2019-11-16.
*/
let
input
=
document
.
createElement
(
'input'
);
input
.
type
=
'file'
;
input
.
onchange
=
function
(
e
)
{
processImage
(
input
.
files
[
0
],
(
imgData
)
=>
{
next
(
'success'
,
imgData
);
})
};
input
.
click
();
pick
(
function
(
imgData
)
{
next
(
'success'
,
imgData
);
});
function
processImage
(
file
,
callback
)
{
let
reader
=
new
FileReader
();
reader
.
readAsDataURL
(
file
);
reader
.
onload
=
function
(
e
)
{
callback
(
reader
.
result
)
}
function
getExif
(
img
,
callback
)
{
EXIF
.
getData
(
img
,
function
()
{
let
allMetaData
=
EXIF
.
getAllTags
(
this
);
callback
(
allMetaData
)
});
}
function
pick
(
callback
)
{
let
fileInput
=
document
.
createElement
(
"input"
);
fileInput
.
type
=
"file"
;
fileInput
.
accept
=
"image/*"
;
fileInput
.
style
.
display
=
"none"
;
document
.
body
.
insertBefore
(
fileInput
,
document
.
body
.
firstChild
);
fileInput
.
addEventListener
(
"change"
,
function
(
evt
)
{
let
mime
=
{
"png"
:
"image/png"
,
"jpg"
:
"image/jpeg"
,
"jpeg"
:
"image/jpeg"
,
"bmp"
:
"image/bmp"
};
let
file
=
evt
.
target
.
files
[
0
];
let
type
=
file
.
type
;
if
(
!
type
)
{
type
=
mime
[
file
.
name
.
match
(
/
\.([^\.]
+
)
$/i
)[
1
]];
}
let
fileReader
=
new
FileReader
();
fileReader
.
onload
=
function
()
{
getExif
(
file
,
(
exif
)
=>
{
//let exif = EXIF.readFromBinaryFile(arrayBuffer);
let
orientation
=
-
1
;
if
(
exif
)
{
orientation
=
exif
[
"Orientation"
];
}
let
image
=
new
Image
();
image
.
onload
=
function
()
{
let
canvas
=
document
.
createElement
(
"canvas"
);
let
ctx
=
canvas
.
getContext
(
"2d"
);
canvas
.
width
=
image
.
width
;
canvas
.
height
=
image
.
height
;
if
(
orientation
>
4
)
{
canvas
.
width
=
image
.
height
;
canvas
.
height
=
image
.
width
;
}
ctx
.
clearRect
(
0
,
0
,
canvas
.
width
,
canvas
.
height
);
switch
(
orientation
)
{
case
2
:
// horizontal flip
ctx
.
translate
(
canvas
.
width
,
0
);
ctx
.
scale
(
-
1
,
1
);
break
;
case
3
:
// 180° rotate left
ctx
.
translate
(
canvas
.
width
,
canvas
.
height
);
ctx
.
rotate
(
Math
.
PI
);
break
;
case
4
:
ctx
.
translate
(
0
,
canvas
.
height
);
ctx
.
scale
(
1
,
-
1
);
break
;
case
5
:
ctx
.
rotate
(
0.5
*
Math
.
PI
);
ctx
.
scale
(
1
,
-
1
);
break
;
case
6
:
ctx
.
rotate
(
0.5
*
Math
.
PI
);
ctx
.
translate
(
0
,
-
image
.
height
);
break
;
case
7
:
ctx
.
rotate
(
0.5
*
Math
.
PI
);
ctx
.
translate
(
canvas
.
width
,
-
canvas
.
height
);
ctx
.
scale
(
-
1
,
1
);
break
;
case
8
:
ctx
.
rotate
(
-
0.5
*
Math
.
PI
);
ctx
.
translate
(
-
canvas
.
height
,
0
);
break
;
default
:
ctx
.
transform
(
1
,
0
,
0
,
1
,
0
,
0
);
}
ctx
.
drawImage
(
image
,
0
,
0
);
let
imagetype
=
"png"
;
if
(
orientation
!==
-
1
)
{
imagetype
=
"jpeg"
;
}
let
resultURL
=
""
;
if
(
imagetype
===
"jpg"
||
imagetype
===
"jpeg"
)
{
resultURL
=
canvas
.
toDataURL
(
"image/"
+
imagetype
);
}
else
{
resultURL
=
canvas
.
toDataURL
(
"image/"
+
imagetype
);
}
callback
(
resultURL
);
image
.
parentNode
.
removeChild
(
image
);
fileInput
.
parentNode
.
removeChild
(
fileInput
);
};
image
.
src
=
fileReader
.
result
;
image
.
style
.
display
=
"none"
;
document
.
body
.
appendChild
(
image
);
fileInput
.
value
=
""
;
});
};
fileReader
.
readAsDataURL
(
file
);
},
false
);
fileInput
.
click
();
}
src/process/other/resize-image/index.ts
View file @
564408cc
...
...
@@ -7,7 +7,6 @@ const height = engine.findVariable('height', args, props);
const
cutType
=
engine
.
findVariable
(
'cutType'
,
args
,
props
);
const
type
=
engine
.
findVariable
(
'type'
,
args
,
props
);
const
quality
=
engine
.
findVariable
(
'quality'
,
args
,
props
);
let
img
=
args
;
if
(
typeof
args
===
'string'
)
{
img
=
new
Image
();
...
...
@@ -18,79 +17,25 @@ if (typeof args === 'string') {
console
.
log
(
e
);
};
img
.
src
=
args
;
}
else
{
deal
();
}
function
getExif
(
callback
)
{
EXIF
.
getData
(
img
,
function
()
{
var
allMetaData
=
EXIF
.
getAllTags
(
this
);
callback
(
allMetaData
)
});
else
{
deal
();
}
function
deal
()
{
getExif
((
allMetaData
)
=>
{
let
m
=
cutType
===
'inner'
?
Math
.
min
:
Math
.
max
;
let
r
=
m
(
width
/
img
.
width
,
height
/
img
.
height
);
let
imgWidth
=
img
.
width
*
r
;
let
imgHeight
=
img
.
height
*
r
;
let
x
=
(
width
-
imgWidth
)
/
2
;
let
y
=
(
height
-
imgHeight
)
/
2
;
let
canvas
=
document
.
createElement
(
'canvas'
);
canvas
.
width
=
width
;
canvas
.
height
=
height
;
let
ctx
=
canvas
.
getContext
(
'2d'
);
//ctx.strokeStyle = 'blue';
//ctx.strokeRect(0, 0, width, height);
ctx
.
translate
(
x
,
y
);
ctx
.
scale
(
r
,
r
);
allMetaData
.
Orientation
=
1
;
if
(
allMetaData
.
Orientation
)
{
let
orientation
=
allMetaData
.
Orientation
;
switch
(
orientation
)
{
case
2
:
//水平翻转
ctx
.
translate
(
img
.
width
,
0
);
ctx
.
scale
(
-
1
,
1
);
break
;
case
3
:
//180°
ctx
.
translate
(
img
.
width
,
img
.
height
);
ctx
.
rotate
(
Math
.
PI
);
break
;
case
4
:
//垂直翻转
ctx
.
translate
(
0
,
img
.
height
);
ctx
.
scale
(
1
,
-
1
);
break
;
case
5
:
//逆时针90°+水平翻转
ctx
.
rotate
(
-
0.5
*
Math
.
PI
);
ctx
.
scale
(
-
1
,
1
);
ctx
.
translate
(
x
/
r
-
y
/
r
,
y
/
r
-
x
/
r
);
break
;
case
6
:
//逆时针90°
ctx
.
rotate
(
-
0.5
*
Math
.
PI
);
ctx
.
translate
(
-
img
.
width
+
y
/
r
-
x
/
r
,
y
/
r
-
x
/
r
);
break
;
case
7
:
//顺时针90°+垂直翻转
ctx
.
rotate
(
0.5
*
Math
.
PI
);
ctx
.
scale
(
-
1
,
1
);
ctx
.
translate
(
-
img
.
width
+
y
/
r
-
x
/
r
,
-
img
.
height
+
x
/
r
-
y
/
r
);
break
;
case
8
:
//顺时针90°
ctx
.
rotate
(
-
0.5
*
Math
.
PI
);
ctx
.
translate
(
-
img
.
width
+
y
/
r
-
x
/
r
,
-
x
/
r
+
y
/
r
);
break
;
}
}
ctx
.
drawImage
(
img
,
0
,
0
);
let
dataUrl
=
canvas
.
toDataURL
(
'image/'
+
type
,
quality
);
next
(
'success'
,
dataUrl
);
})
let
m
=
cutType
===
'inner'
?
Math
.
min
:
Math
.
max
;
let
r
=
m
(
width
/
img
.
width
,
height
/
img
.
height
);
let
imgWidth
=
img
.
width
*
r
;
let
imgHeight
=
img
.
height
*
r
;
let
x
=
(
width
-
imgWidth
)
/
2
;
let
y
=
(
height
-
imgHeight
)
/
2
;
let
canvas
=
document
.
createElement
(
'canvas'
);
canvas
.
width
=
width
;
canvas
.
height
=
height
;
let
ctx
=
canvas
.
getContext
(
'2d'
);
ctx
.
translate
(
x
,
y
);
ctx
.
scale
(
r
,
r
);
ctx
.
drawImage
(
img
,
0
,
0
);
let
dataUrl
=
canvas
.
toDataURL
(
'image/'
+
type
,
quality
);
next
(
'success'
,
dataUrl
);
}
src/process/view/show-toast/meta.json
View file @
564408cc
...
...
@@ -6,13 +6,33 @@
},
"text"
:
{
"type"
:
"string"
,
"alias"
:
"内容"
"alias"
:
"文本内容"
},
"labelAlign"
:
{
"alias"
:
"文本对齐"
,
"type"
:
"enum"
,
"enum"
:
[
{
"label"
:
"左对齐"
,
"value"
:
"left"
},
{
"label"
:
"居中对齐"
,
"value"
:
"center"
},
{
"label"
:
"右对齐"
,
"value"
:
"right"
}
],
"default"
:
"center"
},
"labSize"
:
{
"alias"
:
"文本大小"
,
"type"
:
"number"
,
"default"
:
30
},
"padding"
:
{
"type"
:
"number"
,
"default"
:
10
,
"alias"
:
"边距"
},
"bgAlpha"
:
{
"type"
:
"number"
,
"default"
:
0.7
,
"alias"
:
"背景透明度"
},
"paddingH"
:
{
"type"
:
"number"
,
"alias"
:
"横向边距"
...
...
@@ -46,4 +66,4 @@
"output"
:
[
"success"
]
}
\ No newline at end of file
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment