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
d1566d32
Commit
d1566d32
authored
May 09, 2020
by
王梦佳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
娃娃机自定义
parent
b9593434
Changes
42
Hide whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
3147 additions
and
482 deletions
+3147
-482
.DS_Store
dist/.DS_Store
+0
-0
doll-machine-common.json
dist/customs/doll-machine-common.json
+256
-0
doll-machine.json
dist/customs/doll-machine.json
+59
-122
doll-machine2.json
dist/customs/doll-machine2.json
+288
-0
open-gift.json
dist/customs/open-gift.json
+73
-0
main.js
src/custom/doll-machine/debug/main.js
+59
-84
main.js.map
src/custom/doll-machine/debug/main.js.map
+1
-1
meta.json
src/custom/doll-machine/meta.json
+123
-187
GameView.ts
src/custom/doll-machine/src/game/GameView.ts
+40
-34
GameWrapper.ts
src/custom/doll-machine/src/game/GameWrapper.ts
+11
-9
Zhuazi.ts
src/custom/doll-machine/src/game/Zhuazi.ts
+29
-34
backBox.ts
src/custom/doll-machine/src/game/backBox.ts
+8
-8
frontBox.ts
src/custom/doll-machine/src/game/frontBox.ts
+3
-3
app.js
src/custom/doll-machine2/debug/app.js
+73
-0
index.html
src/custom/doll-machine2/debug/index.html
+45
-0
load-assets.js
src/custom/doll-machine2/debug/load-assets.js
+52
-0
main.js
src/custom/doll-machine2/debug/main.js
+431
-0
main.js.map
src/custom/doll-machine2/debug/main.js.map
+1
-0
props.js
src/custom/doll-machine2/debug/props.js
+7
-0
meta.json
src/custom/doll-machine2/meta.json
+286
-0
GameView.ts
src/custom/doll-machine2/src/game/GameView.ts
+243
-0
GameWrapper.ts
src/custom/doll-machine2/src/game/GameWrapper.ts
+60
-0
Goods.ts
src/custom/doll-machine2/src/game/Goods.ts
+112
-0
Zhuazi.ts
src/custom/doll-machine2/src/game/Zhuazi.ts
+149
-0
backBox.ts
src/custom/doll-machine2/src/game/backBox.ts
+40
-0
frontBox.ts
src/custom/doll-machine2/src/game/frontBox.ts
+74
-0
object-pool-init.ts
src/custom/doll-machine2/src/game/object-pool-init.ts
+14
-0
utils.ts
src/custom/doll-machine2/src/game/utils.ts
+20
-0
index.ts
src/custom/doll-machine2/src/index.ts
+14
-0
props.ts
src/custom/doll-machine2/src/props.ts
+15
-0
app.js
src/custom/open-gift/debug/app.js
+73
-0
index.html
src/custom/open-gift/debug/index.html
+45
-0
load-assets.js
src/custom/open-gift/debug/load-assets.js
+52
-0
main.js
src/custom/open-gift/debug/main.js
+123
-0
main.js.map
src/custom/open-gift/debug/main.js.map
+1
-0
props.js
src/custom/open-gift/debug/props.js
+7
-0
meta.json
src/custom/open-gift/meta.json
+71
-0
GameView.ts
src/custom/open-gift/src/game/GameView.ts
+96
-0
GameWrapper.ts
src/custom/open-gift/src/game/GameWrapper.ts
+44
-0
utils.ts
src/custom/open-gift/src/game/utils.ts
+20
-0
index.ts
src/custom/open-gift/src/index.ts
+14
-0
props.ts
src/custom/open-gift/src/props.ts
+15
-0
No files found.
dist/.DS_Store
0 → 100644
View file @
d1566d32
File added
dist/customs/doll-machine-common.json
0 → 100644
View file @
d1566d32
{
"name"
:
"娃娃机2"
,
"desc"
:
"娃娃机通用模块"
,
"props"
:
{
"single"
:
{
"alias"
:
"是否是单层娃娃"
,
"type"
:
"boolean"
,
"default"
:
true
},
"dollNum"
:
{
"alias"
:
"一屏展示娃娃个数(最大为4)"
,
"type"
:
"number"
,
"default"
:
4
},
"frontInitX"
:
{
"alias"
:
"前排最右侧娃娃初始X位置"
,
"type"
:
"number"
,
"default"
:
600
},
"frontInitY"
:
{
"alias"
:
"前排最右侧娃娃初始Y位置"
,
"type"
:
"number"
,
"default"
:
614
},
"backInitX"
:
{
"alias"
:
"后排最右侧娃娃初始X位置"
,
"type"
:
"number"
,
"default"
:
188
},
"backInitY"
:
{
"alias"
:
"后排最右侧娃娃初始Y位置"
,
"type"
:
"number"
,
"default"
:
616
},
"ganziShow"
:
{
"alias"
:
"是否显示杆子"
,
"type"
:
"boolean"
,
"default"
:
true
},
"bashouShow"
:
{
"alias"
:
"是否显示把手"
,
"type"
:
"boolean"
,
"default"
:
true
},
"gameStageWidth"
:
{
"alias"
:
"游戏场景宽度"
,
"type"
:
"number"
,
"default"
:
611
},
"gameStageHeight"
:
{
"alias"
:
"游戏场景高度"
,
"type"
:
"number"
,
"default"
:
704
},
"frontmargin"
:
{
"alias"
:
"前排娃娃的间距"
,
"type"
:
"number"
,
"default"
:
13
},
"backmargin"
:
{
"alias"
:
"后排娃娃的间距"
,
"type"
:
"number"
,
"default"
:
50
},
"moveSpeed"
:
{
"alias"
:
"娃娃移动的速度"
,
"type"
:
"number"
,
"default"
:
3
},
"bashouMoveDist"
:
{
"alias"
:
"爪子整体左右移动的范围"
,
"type"
:
"number"
,
"default"
:
200
},
"ganMoveEndY"
:
{
"alias"
:
"杆子最后需要移动到的y值位置"
,
"type"
:
"number"
,
"default"
:
620
},
"leftRotation"
:
{
"alias"
:
"左边爪子旋转角度"
,
"type"
:
"number"
,
"default"
:
20
},
"rightRotation"
:
{
"alias"
:
"右边爪子旋转角度"
,
"type"
:
"number"
,
"default"
:
-20
},
"prizeBoxInitX"
:
{
"alias"
:
"中奖娃娃的x位置"
,
"type"
:
"number"
,
"default"
:
15
},
"prizeBoxInitY"
:
{
"alias"
:
"中奖娃娃的y位置"
,
"type"
:
"number"
,
"default"
:
48
}
},
"assets"
:
[
{
"name"
:
"游戏背景"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/460fd0242aada85de5554391756db6ed2a232a9b.png"
,
"uuid"
:
"05c378c3-bed0-4d5c-bed8-f05ae7920931"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_0"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fde8c60981791e5136c7914274c2a2d0936626cd.png"
,
"uuid"
:
"aa30ee7c-a6ad-4e10-9b6a-13b139664ab5"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/befb2c9ddfd8a5c4acd5126b2d793f7c1bcc40f2.png"
,
"uuid"
:
"4483b626-697a-4aa4-ba57-0c22ddc7c0e6"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_2"
,
"url"
:
"///yun.duiba.com.cn/aurora/assets/50991e640e6bcc2eee02ba945d48a8430ddd2bee.png"
,
"uuid"
:
"b70f2980-a2b3-4ef7-b060-b14dc7a8c9c8"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_3"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fde8c60981791e5136c7914274c2a2d0936626cd.png"
,
"uuid"
:
"aa30ee7c-a6ad-4e10-9b6a-13b139664ab5"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_0"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/94884eafc876346e283efef2aa29bd6d2c36f627.png"
,
"uuid"
:
"3f3feb30-6700-4ac7-a14e-6d7e41e8d4e8"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/7deaaf45e03a626efbced90e4ad3d22373b01bd3.png"
,
"uuid"
:
"b1422629-55d2-4b8b-bdd0-1b043f965248"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_2"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/28a5b5b04c84d6acc86b7efb81dd6d7f717e0cda.png"
,
"uuid"
:
"708da046-26e1-4ff7-abb6-35bf825a5d5b"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_3"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/28a5b5b04c84d6acc86b7efb81dd6d7f717e0cda.png"
,
"uuid"
:
"708da046-26e1-4ff7-abb6-35bf825a5d5b"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_0"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/a47f438d016d1b178cdb5241651a78e4ea365e75.png"
,
"uuid"
:
"c106cd1d-52a0-422a-976c-67151af0b484"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fd60c2da0ce78f7b7bed0e9c45644882a1a40d90.png"
,
"uuid"
:
"3ff6fb20-4a2f-4789-998d-6078e3b603ec"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_2"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/6211ab330a3768ff0a1920cff0ec41f29fa0903b.png"
,
"uuid"
:
"04fa3325-87fc-4009-bfba-26a95d92d80c"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_3"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/6211ab330a3768ff0a1920cff0ec41f29fa0903b.png"
,
"uuid"
:
"04fa3325-87fc-4009-bfba-26a95d92d80c"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_4"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/6211ab330a3768ff0a1920cff0ec41f29fa0903b.png"
,
"uuid"
:
"04fa3325-87fc-4009-bfba-26a95d92d80c"
,
"ext"
:
".png"
},
{
"name"
:
"前传输带"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/7bccbc67b3f896176bed7d21c5f4d4307c3919be.png"
,
"uuid"
:
"06bd03a4-43c3-49bb-94c5-6ef365f70291"
,
"ext"
:
".png"
},
{
"name"
:
"后传输带"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/df9b718f80747a1e21349d2b9ac35d5e19a61dad.png"
,
"uuid"
:
"aa0c6ebc-164f-4767-90ca-a79be4316365"
,
"ext"
:
".png"
},
{
"name"
:
"把手杆子"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/5a9e4ba7ca6701eae85b6d6dcb0612ecb9a3eff9.png"
,
"uuid"
:
"f2f1a937-00f4-442f-af4f-0bcb00656e69"
,
"ext"
:
".png"
},
{
"name"
:
"把手"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/71255a6f3cdf9f66d53589e46d72fcd20fef468d.png"
,
"uuid"
:
"d9b395b5-4e46-43a5-aa2b-bfdd81c07fa7"
,
"ext"
:
".png"
},
{
"name"
:
"伸缩杆"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/a9cf8b147c52b7d4247e80e90e098f787808bfa9.png"
,
"uuid"
:
"fddb4636-9c62-47b2-ba5e-f2cd820dbccc"
,
"ext"
:
".png"
},
{
"name"
:
"左爪"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/1e8634fd94bda455d11956c2847d3823e80701d3.png"
,
"uuid"
:
"739014d2-3193-4853-bf8d-349bd3e8d990"
,
"ext"
:
".png"
},
{
"name"
:
"右爪"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/4bfc510e0d1fa1db77f5effa187294af38b74ff6.png"
,
"uuid"
:
"4fb43b19-67e9-42cc-b461-35c005c714fb"
,
"ext"
:
".png"
},
{
"name"
:
"连接点"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/39f39234631f739e70e9ab8b713284379f4016fb.png"
,
"uuid"
:
"2021124f-ffcb-487f-a24f-a00f3d8aae95"
,
"ext"
:
".png"
}
],
"events"
:
{
"in"
:
{
"doll-machine2-game-init"
:
{
"alias"
:
"重置"
},
"doll-machine2-game-start"
:
{
"alias"
:
"开始"
,
"data"
:
{
"prize"
:
true
}
}
},
"out"
:
{
"doll-machine2-game-end"
:
{
"alias"
:
"重置完毕"
,
"data"
:
null
}
}
},
"id"
:
"doll-machine-common"
,
"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['doll-machine-common'] = 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\t
//# sourceMappingURL=props.js.map
\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
//# sourceMappingURL=utils.js.map
\n\n\t
var FrontBoxs = (function (_super) {
\n\t
tslib.__extends(FrontBoxs, _super);
\n\t
function FrontBoxs() {
\n\t
var _this = _super.call(this) || this;
\n\t
_this.frontBoxs = [];
\n\t
return _this;
\n\t
}
\n\t
FrontBoxs.prototype.setup = function () {
\n\t
var initX, initY = 0;
\n\t
for (var i = 0; i < props.dollNum; i++) {
\n\t
if (!new engine.Sprite(getTextureByName('frontbox_' + i))) {
\n\t
return;
\n\t
}
\n\t
this.frontBoxs[i] = new engine.Sprite(getTextureByName('frontbox_' + i));
\n\t
initX = this.frontBoxs[0].x = props.frontInitX;
\n\t
initY = this.frontBoxs[0].y = props.frontInitY;
\n\t
this.frontBoxs[i]['npcType'] = 'box' + i;
\n\t
}
\n\t
this.frontBoxs[props.dollNum] = new engine.Sprite(getTextureByName('frontbox_0'));
\n\t
this.frontBoxs[props.dollNum]['npcType'] = 'box' + props.dollNum;
\n\t
console.log(this.frontBoxs);
\n\t
for (var i = 0; i < this.frontBoxs.length; i++) {
\n\t
if (i == 0) {
\n\t
this.frontBoxs[i].x = initX;
\n\t
}
\n\t
else {
\n\t
this.frontBoxs[i].x = this.frontBoxs[i - 1].x - this.frontBoxs[0].width - props.frontmargin;
\n\t
}
\n\t
this.frontBoxs[i].y = initY;
\n\t
this.addChild(this.frontBoxs[i]);
\n\t
}
\n\t
this.addEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);
\n\t
};
\n\t
FrontBoxs.prototype.frameMove = function () {
\n\t
var _this = this;
\n\t
this.frontBoxs.forEach(function (item, index) {
\n\t
item.x += props.moveSpeed;
\n\t
if (item.x <= 0 && !item.visible) {
\n\t
item.visible = true;
\n\t
}
\n\t
if (item.x >= 750) {
\n\t
var lastitem = _this.frontBoxs.shift();
\n\t
lastitem.x = _this.frontBoxs[_this.frontBoxs.length - 1].x - _this.frontBoxs[0].width - props.frontmargin;
\n\t
if (!_this.GameView.getMoveX() && item.x <= 0 && _this.GameView.startstatus) {
\n\t
_this.GameView.setMoveX((370 - item.x - 13) / props.moveSpeed, item);
\n\t
_this.hideBox = item;
\n\t
}
\n\t
_this.frontBoxs.push(lastitem);
\n\t
}
\n\t
});
\n\t
};
\n\t
FrontBoxs.prototype.stop = function () {
\n\t
};
\n\t
FrontBoxs.prototype.showHidePrizeBox = function (isshow) {
\n\t
this.hideBox.visible = isshow;
\n\t
};
\n\t
return FrontBoxs;
\n\t
}(engine.Container));
\n\t
//# sourceMappingURL=frontBox.js.map
\n\n\t
var BackBoxs = (function (_super) {
\n\t
tslib.__extends(BackBoxs, _super);
\n\t
function BackBoxs() {
\n\t
var _this = _super.call(this) || this;
\n\t
_this.backBoxs = [];
\n\t
return _this;
\n\t
}
\n\t
BackBoxs.prototype.setup = function () {
\n\t
var initX, initY = 0;
\n\t
for (var i = 0; i < props.dollNum; i++) {
\n\t
this.backBoxs[i] = new engine.Sprite(getTextureByName('backbox_' + i));
\n\t
initX = this.backBoxs[0].x = props.backInitX;
\n\t
initY = this.backBoxs[0].y = props.backInitY;
\n\t
this.backBoxs[i]['npcType'] = 'box' + i;
\n\t
}
\n\t
this.backBoxs[props.dollNum] = new engine.Sprite(getTextureByName('backbox_0'));
\n\t
this.backBoxs[props.dollNum]['npcType'] = 'box' + props.dollNum;
\n\t
for (var i = 0; i < this.backBoxs.length; i++) {
\n\t
if (i == 0) {
\n\t
this.backBoxs[i].x = initX;
\n\t
}
\n\t
else {
\n\t
this.backBoxs[i].x = this.backBoxs[i - 1].x + this.backBoxs[i].width + props.backmargin;
\n\t
}
\n\t
this.backBoxs[i].y = initY;
\n\t
this.addChild(this.backBoxs[i]);
\n\t
}
\n\t
this.addEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);
\n\t
};
\n\t
BackBoxs.prototype.frameMove = function () {
\n\t
var _this = this;
\n\t
this.backBoxs.forEach(function (item) {
\n\t
item.x -= props.moveSpeed;
\n\t
if (item.x <= 0) {
\n\t
var lastitem = _this.backBoxs.shift();
\n\t
lastitem.x = _this.backBoxs[_this.backBoxs.length - 1].x + item.width + props.backmargin;
\n\t
_this.backBoxs.push(lastitem);
\n\t
}
\n\t
});
\n\t
};
\n\t
return BackBoxs;
\n\t
}(engine.Container));
\n\t
//# sourceMappingURL=backBox.js.map
\n\n\t
var Zhuazi = (function (_super) {
\n\t
tslib.__extends(Zhuazi, _super);
\n\t
function Zhuazi() {
\n\t
var _this = _super.call(this) || this;
\n\t
_this.moveArr = [];
\n\t
_this.prizeBoxs = [];
\n\t
return _this;
\n\t
}
\n\t
Zhuazi.prototype.setup = function () {
\n\t
this.ganNode = new engine.Container();
\n\t
this.moveNode = new engine.Container();
\n\t
this.ganNode.x = 280;
\n\t
this.ganNode.y = 350;
\n\t
this.bashouGan = new engine.Sprite(getTextureByName(
\"
把手杆子
\"
));
\n\t
this.bashouGan.x = 60;
\n\t
this.bashouGan.y = 275;
\n\t
this.bashou = new engine.Sprite(getTextureByName(
\"
把手
\"
));
\n\t
this.bashou.x = 0;
\n\t
this.bashou.y = 263;
\n\t
this.ganzi = new engine.Sprite(getTextureByName(
\"
伸缩杆
\"
));
\n\t
this.ganzi.x = 97;
\n\t
this.ganzi.y = 290;
\n\t
this.connect = new engine.Sprite(getTextureByName(
\"
连接点
\"
));
\n\t
this.connect.x = 18;
\n\t
this.connect.y = -5;
\n\t
this.left_zhuazi = new engine.Sprite(getTextureByName(
\"
左爪
\"
));
\n\t
this.left_zhuazi.x = -15;
\n\t
this.left_zhuazi.y = 60;
\n\t
this.left_zhuazi.anchorX = this.left_zhuazi.width;
\n\t
this.left_zhuazi.anchorY = 0;
\n\t
this.right_zhuazi = new engine.Sprite(getTextureByName(
\"
右爪
\"
));
\n\t
this.right_zhuazi.x = 98;
\n\t
this.right_zhuazi.y = 60;
\n\t
this.ganNode.addChild(this.left_zhuazi);
\n\t
this.ganNode.addChild(this.right_zhuazi);
\n\t
this.ganNode.addChild(this.connect);
\n\t
this.ganNode.x = 30;
\n\t
this.zhuaziY = this.ganNode.y;
\n\t
this.moveNode.addChild(this.ganzi);
\n\t
this.moveNode.addChild(this.ganNode);
\n\t
this.moveNode.addChild(this.bashou);
\n\t
this.moveNode.x = 262;
\n\t
this.addChild(this.bashouGan);
\n\t
this.addChild(this.moveNode);
\n\t
if (!props.ganziShow) {
\n\t
this.bashouGan.visible = false;
\n\t
}
\n\t
if (!props.bashouShow) {
\n\t
this.bashou.visible = false;
\n\t
}
\n\t
this.createPrizeBox();
\n\t
};
\n\t
Zhuazi.prototype.createPrizeBox = function () {
\n\t
var _this = this;
\n\t
for (var i = 0; i < props.dollNum; i++) {
\n\t
if (!new engine.Sprite(getTextureByName('prizebox_' + i))) {
\n\t
return;
\n\t
}
\n\t
this.prizeBoxs[i] = new engine.Sprite(getTextureByName('prizebox_' + i));
\n\t
this.prizeBoxs[i]['npcType'] = 'box' + i;
\n\t
}
\n\t
this.prizeBoxs[props.dollNum] = new engine.Sprite(getTextureByName('prizebox_0'));
\n\t
this.prizeBoxs[props.dollNum]['npcType'] = 'box' + props.dollNum;
\n\t
this.prizeBoxs.forEach(function (item) {
\n\t
_this.ganNode.addChild(item);
\n\t
item.visible = false;
\n\t
item.x = props.prizeBoxInitX;
\n\t
item.y = props.prizeBoxInitY;
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.showPrizeBox = function () {
\n\t
var _this = this;
\n\t
this.prizeBoxs.forEach(function (item) {
\n\t
console.log(_this.GameView.getBox()['npcType']);
\n\t
if (item['npcType'] === _this.GameView.getBox()['npcType']) {
\n\t
item.visible = true;
\n\t
_this.itemShow = item;
\n\t
}
\n\t
else {
\n\t
item.visible = false;
\n\t
}
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.move = function () {
\n\t
var _this = this;
\n\t
var rndist = Math.random();
\n\t
var halfWidth = this.bashou.width / 2;
\n\t
var randomX = rndist * (rndist > 0.5 ? 1 : -1) * props.bashouMoveDist;
\n\t
console.log(randomX);
\n\t
engine.Tween.get(this.moveNode).to({ x: 370 + halfWidth - 71 }, 1000).call(function () {
\n\t
_this.zhangkai();
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.zhangkai = function () {
\n\t
var _this = this;
\n\t
this.left_zhuazi.anchorX = this.left_zhuazi.width;
\n\t
this.left_zhuazi.anchorY = 0;
\n\t
engine.Tween.get(this.left_zhuazi, { loop: false }).to({ rotation: props.leftRotation }, 1000);
\n\t
engine.Tween.get(this.right_zhuazi, { loop: false }).to({ rotation: props.rightRotation }, 1000);
\n\t
setTimeout(function () {
\n\t
_this.getLong();
\n\t
}, 500);
\n\t
};
\n\t
Zhuazi.prototype.getLong = function () {
\n\t
var _this = this;
\n\t
var droptime = Number((this.GameView.getMoveX() / 60 - 1).toFixed(2)) * 1000;
\n\t
console.log('dr', droptime);
\n\t
var times = (props.ganMoveEndY - this.ganzi.y) / this.ganzi.height;
\n\t
console.log(Number(times.toFixed(2)));
\n\t
engine.Tween.get(this.ganzi).to({ scaleY: Number(times.toFixed(2)) }, droptime).to({ scaleY: 1 }, droptime);
\n\t
console.log('node', this.zhuaziY);
\n\t
engine.Tween.get(this.ganNode).to({ y: props.ganMoveEndY }, droptime).call(function () {
\n\t
_this.GameView.stopMove();
\n\t
if (_this.GameView.ifPrize) {
\n\t
_this.showPrizeBox();
\n\t
_this.GameView.setVisible(false);
\n\t
}
\n\t
}).to({ y: this.zhuaziY }, droptime).call(function () {
\n\t
if (_this.GameView.ifPrize) {
\n\t
_this.itemShow.visible = false;
\n\t
}
\n\t
engine.globalEvent.dispatchEvent('doll-machine2-game-end');
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.getReset = function () {
\n\t
this.left_zhuazi.anchorX = this.left_zhuazi.width;
\n\t
this.left_zhuazi.anchorY = 0;
\n\t
engine.Tween.get(this.moveNode, { loop: false }).to({ x: 262 }, 1000);
\n\t
engine.Tween.get(this.left_zhuazi, { loop: false }).to({ rotation: 0 }, 1000);
\n\t
engine.Tween.get(this.right_zhuazi, { loop: false }).to({ rotation: 0 }, 1000);
\n\t
this.GameView.resetMoveX();
\n\t
};
\n\t
return Zhuazi;
\n\t
}(engine.Container));
\n\t
//# sourceMappingURL=Zhuazi.js.map
\n\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.startstatus = false;
\n\t
_this.ifPrize = false;
\n\t
_this.goodsItems = [];
\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 frontBoxs = (this._frontBoxs = new FrontBoxs());
\n\t
this._frontBoxs.GameView = this;
\n\t
var backBoxs = (this._backBoxs = new BackBoxs());
\n\t
this._Zhuazi = new Zhuazi();
\n\t
this._Zhuazi.GameView = this;
\n\t
this.frontTransfer = new engine.Container();
\n\t
this.backTransfer = new engine.Container();
\n\t
this.frontTransfer.width = 0;
\n\t
this.frontTransfer.height = 0;
\n\t
this.frontTransfer.alpha = 1;
\n\t
this.backTransfer.width = 0;
\n\t
this.backTransfer.height = 0;
\n\t
this.backTransfer.alpha = 1;
\n\t
this.rect = new engine.Rect();
\n\t
this.rect.width = props.gameStageWidth;
\n\t
this.rect.height = props.gameStageHeight;
\n\t
this.rect.x = 65;
\n\t
this.rect.y = 263;
\n\t
this.NpcBg = new engine.Container();
\n\t
this.addChild(this.NpcBg);
\n\t
this.addChild(this.rect);
\n\t
this.frontDesk = new engine.Sprite(getTextureByName(
\"
前传输带
\"
));
\n\t
this.frontDesk.x = 60;
\n\t
this.frontDesk.y = 781;
\n\t
this.backDesk = new engine.Sprite(getTextureByName(
\"
后传输带
\"
));
\n\t
this.backDesk.x = 60;
\n\t
this.backDesk.y = 712;
\n\t
if (props.single) {
\n\t
this.backDesk.visible = false;
\n\t
}
\n\t
this.NpcBg.addChild(this.backDesk);
\n\t
this.NpcBg.addChild(this.frontDesk);
\n\t
this.NpcBg.addChild(this.backTransfer);
\n\t
this.NpcBg.addChild(this.frontTransfer);
\n\t
this.NpcBg.addChild(this._Zhuazi);
\n\t
this.NpcBg.mask = this.rect;
\n\t
this._Zhuazi.setup();
\n\t
this.backTransfer.addChild(this._backBoxs);
\n\t
this._backBoxs.setup();
\n\t
if (props.single) {
\n\t
this.backTransfer.visible = false;
\n\t
}
\n\t
this.frontTransfer.addChild(this._frontBoxs);
\n\t
this._frontBoxs.setup();
\n\t
};
\n\t
GameView.prototype.stopMove = function () {
\n\t
this._frontBoxs.stop();
\n\t
};
\n\t
GameView.prototype.setMoveX = function (x, item) {
\n\t
this.moveTime = x;
\n\t
this.prizeBox = item;
\n\t
this._Zhuazi.move();
\n\t
};
\n\t
GameView.prototype.setVisible = function (isshow) {
\n\t
this._frontBoxs.showHidePrizeBox(isshow);
\n\t
};
\n\t
GameView.prototype.getMoveX = function () {
\n\t
return this.moveTime;
\n\t
};
\n\t
GameView.prototype.resetMoveX = function () {
\n\t
this.moveTime = null;
\n\t
};
\n\t
GameView.prototype.getBox = function () {
\n\t
return this.prizeBox;
\n\t
};
\n\t
GameView.prototype.reset = function () {
\n\t
this.startstatus = false;
\n\t
this.ifPrize = false;
\n\t
this._Zhuazi.getReset();
\n\t
};
\n\t
GameView.prototype.start = function (type) {
\n\t
if (type === void 0) { type = null; }
\n\t
this.speed = 1;
\n\t
this.gameIng = true;
\n\t
console.log('执行', type);
\n\t
this.startstatus = true;
\n\t
this.ifPrize = type && type.prize || false;
\n\t
};
\n\t
GameView.prototype.beginNpc = function () {
\n\t
var _this = this;
\n\t
this.timer = setTimeout(function () {
\n\t
if (_this.gameIng) ;
\n\t
}, 2000 / this.speed);
\n\t
};
\n\t
GameView.prototype.pause = function () {
\n\t
this.gameIng = false;
\n\t
};
\n\t
GameView.prototype.revive = function () {
\n\t
this.gameIng = true;
\n\t
};
\n\t
GameView.prototype.resume = function () {
\n\t
this.reset();
\n\t
this.start();
\n\t
};
\n\t
return GameView;
\n\t
}(engine.Container));
\n\n\t
var GameWrapper = (function (_super) {
\n\t
tslib.__extends(GameWrapper, _super);
\n\t
function GameWrapper() {
\n\t
var _this = _super.call(this) || this;
\n\t
engine.globalEvent.addEventListener('doll-machine2-game-init', _this.reset, _this);
\n\t
engine.globalEvent.addEventListener('doll-machine2-game-start', _this.start, _this);
\n\t
var gameView = _this._gameView = new GameView();
\n\t
_this.addChild(gameView);
\n\t
return _this;
\n\t
}
\n\t
GameWrapper.prototype.reset = function (event) {
\n\t
injectProps(event.data);
\n\t
this._gameView.visible = true;
\n\t
this._gameView.reset();
\n\t
};
\n\t
GameWrapper.prototype.start = function (event) {
\n\t
console.log('监听开始');
\n\t
injectProps(event.data);
\n\t
this._gameView.start(event.data);
\n\t
};
\n\t
GameWrapper.prototype.pause = function () {
\n\t
this._gameView.pause();
\n\t
};
\n\t
GameWrapper.prototype.resume = function () {
\n\t
this._gameView.resume();
\n\t
};
\n\t
GameWrapper.prototype.revive = function () {
\n\t
this._gameView.revive();
\n\t
};
\n\t
GameWrapper.prototype.clear = function () {
\n\t
this._gameView.visible = false;
\n\t
};
\n\t
GameWrapper.prototype.onTap = function (event) {
\n\t
};
\n\t
return GameWrapper;
\n\t
}(engine.Container));
\n\t
//# sourceMappingURL=GameWrapper.js.map
\n\n\t
function index (props) {
\n\t
prepareProps();
\n\t
injectProps(props);
\n\t
var instance = new GameWrapper();
\n\t
return instance;
\n\t
}
\n\t
//# sourceMappingURL=index.js.map
\n\n\t
return index;
\n\n
})));
\n
"
}
dist/customs/doll-machine.json
View file @
d1566d32
{
"name"
:
"
口红
机"
,
"desc"
:
"
口红
机模块"
,
"name"
:
"
娃娃
机"
,
"desc"
:
"
娃娃
机模块"
,
"props"
:
{
"frontmargin"
:
{
"alias"
:
"前排娃娃的间距"
,
...
...
@@ -25,90 +25,78 @@
"ganMoveEndY"
:
{
"alias"
:
"杆子最后需要移动到的y值位置"
,
"type"
:
"number"
,
"default"
:
70
0
"default"
:
82
0
},
"leftRotation"
:
{
"alias"
:
"左边爪子旋转角度"
,
"type"
:
"number"
,
"default"
:
3
0
"default"
:
2
0
},
"rightRotation"
:
{
"alias"
:
"右边爪子旋转角度"
,
"type"
:
"number"
,
"default"
:
-30
},
"playerPositionY"
:
{
"alias"
:
"玩家Y轴位置"
,
"type"
:
"number"
,
"default"
:
900
},
"rainScore"
:
{
"alias"
:
"接中雨滴获得分数"
,
"type"
:
"number"
,
"default"
:
1
},
"stoneScore"
:
{
"alias"
:
"接中石块获得分数"
,
"type"
:
"number"
,
"default"
:
-1
},
"speed"
:
{
"alias"
:
"道具掉落初始速度"
,
"type"
:
"number"
,
"default"
:
10
},
"maxSpeed"
:
{
"alias"
:
"道具掉落速度上限"
,
"type"
:
"number"
,
"default"
:
3
},
"gameOverCondition"
:
{
"alias"
:
"游戏结束条件(1:接到炸弹死亡,2:分数负数或接到炸弹死亡)"
,
"type"
:
"number"
,
"default"
:
1
"default"
:
-20
}
},
"assets"
:
[
{
"name"
:
"
玩家icon
"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
50a7212a113175fa18c866b005d98f07c558dc77
.png"
,
"uuid"
:
"
66f23d13-82a5-4cec-9496-301ec240d087
"
,
"name"
:
"
游戏背景
"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
460fd0242aada85de5554391756db6ed2a232a9b
.png"
,
"uuid"
:
"
05c378c3-bed0-4d5c-bed8-f05ae7920931
"
,
"ext"
:
".png"
},
{
"name"
:
"
雨滴
"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
8564c8c9be3aead71b05a0bab8d7d07ac3f778a1
.png"
,
"uuid"
:
"
264a6192-d7bf-45e8-8f15-6ba2c439a532
"
,
"name"
:
"
草泥马盒
"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
fde8c60981791e5136c7914274c2a2d0936626cd
.png"
,
"uuid"
:
"
aa30ee7c-a6ad-4e10-9b6a-13b139664ab5
"
,
"ext"
:
".png"
},
{
"name"
:
"
炸弹
"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
171e92283cd13c013ee1b76d28d252ff08815d47
.png"
,
"uuid"
:
"
eb88b42d-e151-4c1b-94b9-7c16f7bfac29
"
,
"name"
:
"
狗盒
"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
befb2c9ddfd8a5c4acd5126b2d793f7c1bcc40f2
.png"
,
"uuid"
:
"
4483b626-697a-4aa4-ba57-0c22ddc7c0e6
"
,
"ext"
:
".png"
},
{
"name"
:
"
游戏背景
"
,
"url"
:
"//
yun.duiba.com.cn/aurora/assets/d1f3f60775abfcbd7fdfb3ce525c18977286cd80
.png"
,
"uuid"
:
"
: fe77919b-d5d2-464e-8cbe-d671c82d110c
"
,
"name"
:
"
猫盒
"
,
"url"
:
"//
/yun.duiba.com.cn/aurora/assets/50991e640e6bcc2eee02ba945d48a8430ddd2bee
.png"
,
"uuid"
:
"
b70f2980-a2b3-4ef7-b060-b14dc7a8c9c8
"
,
"ext"
:
".png"
},
{
"name"
:
"草泥马盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
cddd0a59964e023ed7c8d77a8f1ad6b90c25d3af
.png"
,
"uuid"
:
"3
4b596f3-9a17-410f-a6b6-c39b91c7b123
"
,
"name"
:
"
后
草泥马盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
94884eafc876346e283efef2aa29bd6d2c36f627
.png"
,
"uuid"
:
"3
f3feb30-6700-4ac7-a14e-6d7e41e8d4e8
"
,
"ext"
:
".png"
},
{
"name"
:
"狗盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
fd47ea43eb4884ebb8f0bcd095083062871e4f90
.png"
,
"uuid"
:
"
f78f6bd0-93fd-4965-b18b-32a8e6cd4184
"
,
"name"
:
"
后
狗盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
7deaaf45e03a626efbced90e4ad3d22373b01bd3
.png"
,
"uuid"
:
"
b1422629-55d2-4b8b-bdd0-1b043f965248
"
,
"ext"
:
".png"
},
{
"name"
:
"猫盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/596e89d60f5714e311bdc35171b19097efc54fb5.png"
,
"uuid"
:
"8bb254c4-cf2a-47cb-824e-a62ba153518b"
,
"name"
:
"后猫盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/28a5b5b04c84d6acc86b7efb81dd6d7f717e0cda.png"
,
"uuid"
:
"708da046-26e1-4ff7-abb6-35bf825a5d5b"
,
"ext"
:
".png"
},
{
"name"
:
"中奖草泥马盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/a47f438d016d1b178cdb5241651a78e4ea365e75.png"
,
"uuid"
:
"c106cd1d-52a0-422a-976c-67151af0b484"
,
"ext"
:
".png"
},
{
"name"
:
"中奖狗盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fd60c2da0ce78f7b7bed0e9c45644882a1a40d90.png"
,
"uuid"
:
"3ff6fb20-4a2f-4789-998d-6078e3b603ec"
,
"ext"
:
".png"
},
{
"name"
:
"中奖猫盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/6211ab330a3768ff0a1920cff0ec41f29fa0903b.png"
,
"uuid"
:
"04fa3325-87fc-4009-bfba-26a95d92d80c"
,
"ext"
:
".png"
},
{
...
...
@@ -126,110 +114,59 @@
{
"name"
:
"把手杆子"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/5a9e4ba7ca6701eae85b6d6dcb0612ecb9a3eff9.png"
,
"uuid"
:
"
3ecea516-ca65-4ac2-9b93-08495a52d7d2
"
,
"uuid"
:
"
f2f1a937-00f4-442f-af4f-0bcb00656e69
"
,
"ext"
:
".png"
},
{
"name"
:
"把手"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/71255a6f3cdf9f66d53589e46d72fcd20fef468d.png"
,
"uuid"
:
"d9
18e46f-c7f8-4ad0-8039-08c9c66b4ca6
"
,
"uuid"
:
"d9
b395b5-4e46-43a5-aa2b-bfdd81c07fa7
"
,
"ext"
:
".png"
},
{
"name"
:
"伸缩杆"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/a9cf8b147c52b7d4247e80e90e098f787808bfa9.png"
,
"uuid"
:
"
b0146aee-5741-470c-b0fc-bf00a4aca5f6
"
,
"uuid"
:
"
fddb4636-9c62-47b2-ba5e-f2cd820dbccc
"
,
"ext"
:
".png"
},
{
"name"
:
"左爪"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/1e8634fd94bda455d11956c2847d3823e80701d3.png"
,
"uuid"
:
"
d8e399ff-691f-439a-9ce4-4867514e617d
"
,
"uuid"
:
"
739014d2-3193-4853-bf8d-349bd3e8d990
"
,
"ext"
:
".png"
},
{
"name"
:
"右爪"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/4bfc510e0d1fa1db77f5effa187294af38b74ff6.png"
,
"uuid"
:
"
0df49f61-0281-4647-a55f-437b71b352e6
"
,
"uuid"
:
"
4fb43b19-67e9-42cc-b461-35c005c714fb
"
,
"ext"
:
".png"
},
{
"name"
:
"连接点"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/39f39234631f739e70e9ab8b713284379f4016fb.png"
,
"uuid"
:
"
00ff944e-d038-4974-97fc-1e481af3a949
"
,
"uuid"
:
"
2021124f-ffcb-487f-a24f-a00f3d8aae95
"
,
"ext"
:
".png"
},
{
"name"
:
"水花"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/93d37b4a0e367e80e375308a6b4414d72d7666fc.svga"
,
"uuid"
:
"b521bf94-20e1-44dd-8eca-d24996cbaeae"
,
"ext"
:
".svga"
},
{
"name"
:
"炸弹svga"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/4dd18f0689c663bbcf710a7afc4d929084d97d36.svga"
,
"uuid"
:
"322edf39-805b-4e84-9d07-5573dfeebc0e"
,
"ext"
:
".svga"
},
{
"name"
:
"玩家"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/b66300c5d4f27134b0aac3dc90a3220e8ae572eb.svga"
,
"uuid"
:
"71d8dcbc-3931-471a-b585-b3ae01b25aa6"
,
"ext"
:
".svga"
}
],
"events"
:
{
"in"
:
{
"food-fell-reset"
:
{
"alias"
:
"重置"
,
"doll-machine-reset"
:
{
"alias"
:
"重置"
},
"doll-machine-prize"
:
{
"alias"
:
"开始"
,
"data"
:
{
"goodsProbability"
:
"[0.2,0.5,0.3]道具概率(雨滴、石头、炸弹),所有概率相加为1"
,
"countDown"
:
"倒计时(s)"
,
"acceleratedSpeed"
:
"道具掉落加速度(单位:每秒)"
"prize"
:
true
}
},
"food-fell-start"
:
{
"alias"
:
"开始"
},
"food-fell-revive"
:
{
"alias"
:
"复活"
},
"food-fell-pause"
:
{
"alias"
:
"暂停"
},
"food-fell-resume"
:
{
"alias"
:
"恢复"
},
"food-fell-clear"
:
{
"alias"
:
"清空,通过reset事件恢复"
}
},
"out"
:
{
"food-fell-score-update"
:
{
"alias"
:
"分数更新"
,
"data"
:
{
"score"
:
"分数"
}
},
"food-fell-time-update"
:
{
"alias"
:
"倒计时更新"
,
"data"
:
{
"time"
:
"剩余时间"
}
},
"food-fell-game-over"
:
{
"alias"
:
"游戏结束"
,
"data"
:
{
"score"
:
"分数"
,
"reason"
:
"结束原因(1:时间到了,2:玩家死亡)"
}
},
"doll-mac-getprize"
:
{
"alias"
:
"中奖"
,
"doll-machine-gameover"
:
{
"alias"
:
"重置完毕"
,
"data"
:
null
}
}
},
"id"
:
"doll-machine"
,
"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['doll-machine'] = 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\t
//# sourceMappingURL=props.js.map
\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
//# sourceMappingURL=utils.js.map
\n\n\t
var Goods = (function (_super) {
\n\t
tslib.__extends(Goods, _super);
\n\t
function Goods() {
\n\t
var _this = _super.call(this) || this;
\n\t
var body;
\n\t
body = _this._body = new engine.Rect();
\n\t
var box1 = new engine.Sprite(getTextureByName(
\"
草泥马盒
\"
));
\n\t
box1[
\"
npcType
\"
] =
\"
box1
\"
;
\n\t
var box2 = new engine.Sprite(getTextureByName(
\"
狗盒
\"
));
\n\t
box2[
\"
npcType
\"
] =
\"
box2
\"
;
\n\t
var box3 = new engine.Sprite(getTextureByName(
\"
猫盒
\"
));
\n\t
box3[
\"
npcType
\"
] =
\"
box3
\"
;
\n\t
box1.visible = false;
\n\t
box2.visible = false;
\n\t
box3.visible = false;
\n\t
body.addChild(box1);
\n\t
body.addChild(box2);
\n\t
body.addChild(box3);
\n\t
_this.addChild(body);
\n\t
body.width = 0.0001;
\n\t
body.height = 0.0001;
\n\t
body.mouseEnabled = false;
\n\t
return _this;
\n\t
}
\n\t
Goods.prototype.getRandomNumberByRange = function (start, end) {
\n\t
return Math.floor(Math.random() * (end - start) + start);
\n\t
};
\n\t
Goods.prototype.reset = function () {
\n\t
this.visible = true;
\n\t
this.y = 200;
\n\t
this.x = 0;
\n\t
this.rotation = 0;
\n\t
var random = Math.random();
\n\t
if (random < 0.3) {
\n\t
this.showNpc(
\"
box1
\"
);
\n\t
}
\n\t
else if (random < 0.6) {
\n\t
this.showNpc(
\"
box2
\"
);
\n\t
}
\n\t
else {
\n\t
this.showNpc(
\"
box3
\"
);
\n\t
}
\n\t
};
\n\t
Goods.prototype.showNpc = function (type) {
\n\t
for (var i = 0; i < this._body.children.length; i++) {
\n\t
this._body.children[i].visible = false;
\n\t
this._body.children[i].mouseEnabled = false;
\n\t
}
\n\t
for (var i = 0; i < this._body.children.length; i++) {
\n\t
if (this._body.children[i][
\"
npcType
\"
] == type) {
\n\t
this[
\"
npcType
\"
] = type;
\n\t
console.log(type);
\n\t
this._body.children[i].visible = true;
\n\t
this._body.children[i].mouseEnabled = false;
\n\t
}
\n\t
}
\n\t
};
\n\t
Object.defineProperty(Goods.prototype,
\"
anchorOffsetY
\"
, {
\n\t
set: function (v) {
\n\t
this._body.y = v;
\n\t
},
\n\t
enumerable: true,
\n\t
configurable: true
\n\t
});
\n\t
return Goods;
\n\t
}(engine.Container));
\n\t
//# sourceMappingURL=Goods.js.map
\n\n\t
var ObjectPool = engine.ObjectPool;
\n\t
var PoolName = 'goods';
\n\t
ObjectPool.registerPool(PoolName, function () {
\n\t
return new Goods();
\n\t
}, function (item, data) {
\n\t
item.reset();
\n\t
});
\n\t
//# sourceMappingURL=object-pool-init.js.map
\n\n\t
var FrontBoxs = (function (_super) {
\n\t
tslib.__extends(FrontBoxs, _super);
\n\t
function FrontBoxs() {
\n\t
var _this = _super.call(this) || this;
\n\t
_this.frontBoxs = [];
\n\t
return _this;
\n\t
}
\n\t
FrontBoxs.prototype.setup = function () {
\n\t
var initX, initY = 0;
\n\t
this.box1 = new engine.Sprite(getTextureByName(
\"
狗盒
\"
));
\n\t
this.box1[
\"
npcType
\"
] =
\"
box1
\"
;
\n\t
initX = this.box1.x = 435;
\n\t
initY = this.box1.y = 734;
\n\t
this.box2 = new engine.Sprite(getTextureByName(
\"
猫盒
\"
));
\n\t
this.box2[
\"
npcType
\"
] =
\"
box2
\"
;
\n\t
this.box3 = new engine.Sprite(getTextureByName(
\"
草泥马盒
\"
));
\n\t
this.box3[
\"
npcType
\"
] =
\"
box3
\"
;
\n\t
this.box4 = new engine.Sprite(getTextureByName(
\"
狗盒
\"
));
\n\t
this.box4[
\"
npcType
\"
] =
\"
box4
\"
;
\n\t
this.box5 = new engine.Sprite(getTextureByName(
\"
猫盒
\"
));
\n\t
this.box5[
\"
npcType
\"
] =
\"
box5
\"
;
\n\t
this.frontBoxs = [this.box1, this.box2, this.box3, this.box4];
\n\t
for (var i = 0; i < this.frontBoxs.length; i++) {
\n\t
if (i == 0) {
\n\t
this.frontBoxs[i].x = initX;
\n\t
}
\n\t
else {
\n\t
this.frontBoxs[i].x = this.frontBoxs[i - 1].x - this.box1.width - props.frontmargin;
\n\t
}
\n\t
this.frontBoxs[i].y = initY;
\n\t
this.addChild(this.frontBoxs[i]);
\n\t
}
\n\t
this.addEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);
\n\t
};
\n\t
FrontBoxs.prototype.frameMove = function () {
\n\t
var _this = this;
\n\t
this.frontBoxs.forEach(function (item, index) {
\n\t
item.x += props.moveSpeed;
\n\t
if (item.x <= 0 && !item.visible) {
\n\t
item.visible = true;
\n\t
}
\n\t
if (item.x >= 750) {
\n\t
var lastitem = _this.frontBoxs.shift();
\n\t
lastitem.x = _this.frontBoxs[_this.frontBoxs.length - 1].x - _this.box1.width - props.frontmargin;
\n\t
if (!_this.GameView.getMoveX() && item.x <= 0) {
\n\t
_this.GameView.setMoveX((370 - item.x - 13) / props.moveSpeed, item);
\n\t
_this.hideBox = item;
\n\t
}
\n\t
_this.frontBoxs.push(lastitem);
\n\t
}
\n\t
});
\n\t
};
\n\t
FrontBoxs.prototype.stop = function () {
\n\t
};
\n\t
FrontBoxs.prototype.showHidePrizeBox = function (isshow) {
\n\t
this.hideBox.visible = isshow;
\n\t
};
\n\t
return FrontBoxs;
\n\t
}(engine.Container));
\n\n\t
var BackBoxs = (function (_super) {
\n\t
tslib.__extends(BackBoxs, _super);
\n\t
function BackBoxs() {
\n\t
var _this = _super.call(this) || this;
\n\t
_this.backBoxs = [];
\n\t
return _this;
\n\t
}
\n\t
BackBoxs.prototype.setup = function () {
\n\t
var initX, initY = 0;
\n\t
this.box1 = new engine.Sprite(getTextureByName(
\"
狗盒
\"
));
\n\t
initX = this.box1.x = 188;
\n\t
initY = this.box1.y = 706;
\n\t
this.box2 = new engine.Sprite(getTextureByName(
\"
猫盒
\"
));
\n\t
this.box3 = new engine.Sprite(getTextureByName(
\"
草泥马盒
\"
));
\n\t
this.box4 = new engine.Sprite(getTextureByName(
\"
狗盒
\"
));
\n\t
this.box5 = new engine.Sprite(getTextureByName(
\"
猫盒
\"
));
\n\t
this.backBoxs = [this.box1, this.box2, this.box3, this.box4, this.box5];
\n\t
for (var i = 0; i < this.backBoxs.length; i++) {
\n\t
this.backBoxs[i].scaleX = 0.5;
\n\t
this.backBoxs[i].scaleY = 0.5;
\n\t
if (i == 0) {
\n\t
this.backBoxs[i].x = initX;
\n\t
}
\n\t
else {
\n\t
this.backBoxs[i].x = this.backBoxs[i - 1].x + this.backBoxs[i].width + props.backmargin;
\n\t
}
\n\t
this.backBoxs[i].y = initY;
\n\t
this.addChild(this.backBoxs[i]);
\n\t
}
\n\t
this.addEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);
\n\t
};
\n\t
BackBoxs.prototype.frameMove = function () {
\n\t
var _this = this;
\n\t
this.backBoxs.forEach(function (item) {
\n\t
item.x -= props.moveSpeed;
\n\t
if (item.x <= 0) {
\n\t
var lastitem = _this.backBoxs.shift();
\n\t
lastitem.x = _this.backBoxs[_this.backBoxs.length - 1].x + item.width + props.backmargin;
\n\t
_this.backBoxs.push(lastitem);
\n\t
}
\n\t
});
\n\t
};
\n\t
return BackBoxs;
\n\t
}(engine.Container));
\n\t
//# sourceMappingURL=backBox.js.map
\n\n\t
var Zhuazi = (function (_super) {
\n\t
tslib.__extends(Zhuazi, _super);
\n\t
function Zhuazi() {
\n\t
var _this = _super.call(this) || this;
\n\t
_this.moveArr = [];
\n\t
_this.prizeBoxs = [];
\n\t
return _this;
\n\t
}
\n\t
Zhuazi.prototype.setup = function () {
\n\t
this.ganNode = new engine.Container();
\n\t
this.moveNode = new engine.Container();
\n\t
this.ganNode.x = 280;
\n\t
this.ganNode.y = 425;
\n\t
this.bashouGan = new engine.Sprite(getTextureByName(
\"
把手杆子
\"
));
\n\t
this.bashouGan.x = 60;
\n\t
this.bashouGan.y = 342;
\n\t
this.bashou = new engine.Sprite(getTextureByName(
\"
把手
\"
));
\n\t
this.bashou.x = 0;
\n\t
this.bashou.y = 320;
\n\t
this.ganzi = new engine.Sprite(getTextureByName(
\"
伸缩杆
\"
));
\n\t
this.ganzi.x = 97;
\n\t
this.ganzi.y = 382;
\n\t
this.connect = new engine.Sprite(getTextureByName(
\"
连接点
\"
));
\n\t
this.connect.x = 20;
\n\t
this.connect.y = 0;
\n\t
this.left_zhuazi = new engine.Sprite(getTextureByName(
\"
左爪
\"
));
\n\t
this.left_zhuazi.x = 0;
\n\t
this.left_zhuazi.y = 60;
\n\t
this.left_zhuazi.anchorX = this.left_zhuazi.width;
\n\t
this.left_zhuazi.anchorY = 0;
\n\t
this.left_zhuazi.rotation = 30;
\n\t
this.right_zhuazi = new engine.Sprite(getTextureByName(
\"
右爪
\"
));
\n\t
this.right_zhuazi.x = 83;
\n\t
this.right_zhuazi.y = 60;
\n\t
this.right_zhuazi.rotation = -30;
\n\t
this.ganNode.addChild(this.left_zhuazi);
\n\t
this.ganNode.addChild(this.right_zhuazi);
\n\t
this.ganNode.addChild(this.connect);
\n\t
this.ganNode.x = 30;
\n\t
this.zhuaziY = this.ganNode.y;
\n\t
this.moveNode.addChild(this.ganzi);
\n\t
this.moveNode.addChild(this.ganNode);
\n\t
this.moveNode.addChild(this.bashou);
\n\t
this.moveNode.x = 262;
\n\t
this.addChild(this.bashouGan);
\n\t
this.addChild(this.moveNode);
\n\t
this.createPrizeBox();
\n\t
};
\n\t
Zhuazi.prototype.createPrizeBox = function () {
\n\t
var _this = this;
\n\t
this.box1 = new engine.Sprite(getTextureByName(
\"
狗盒
\"
));
\n\t
this.box1[
\"
npcType
\"
] =
\"
box1
\"
;
\n\t
this.box2 = new engine.Sprite(getTextureByName(
\"
猫盒
\"
));
\n\t
this.box2[
\"
npcType
\"
] =
\"
box2
\"
;
\n\t
this.box3 = new engine.Sprite(getTextureByName(
\"
草泥马盒
\"
));
\n\t
this.box3[
\"
npcType
\"
] =
\"
box3
\"
;
\n\t
this.box4 = new engine.Sprite(getTextureByName(
\"
狗盒
\"
));
\n\t
this.box4[
\"
npcType
\"
] =
\"
box4
\"
;
\n\t
this.box5 = new engine.Sprite(getTextureByName(
\"
猫盒
\"
));
\n\t
this.box5[
\"
npcType
\"
] =
\"
box5
\"
;
\n\t
this.prizeBoxs = [this.box1, this.box2, this.box3, this.box4, this.box5];
\n\t
this.prizeBoxs.forEach(function (item) {
\n\t
_this.ganNode.addChild(item);
\n\t
item.visible = false;
\n\t
item.x = -15;
\n\t
item.y = 48;
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.showPrizeBox = function () {
\n\t
var _this = this;
\n\t
this.prizeBoxs.forEach(function (item) {
\n\t
console.log(_this.GameView.getBox()['npcType']);
\n\t
if (item['npcType'] === _this.GameView.getBox()['npcType']) {
\n\t
item.visible = true;
\n\t
_this.itemShow = item;
\n\t
}
\n\t
else {
\n\t
item.visible = false;
\n\t
}
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.move = function () {
\n\t
var _this = this;
\n\t
var rndist = Math.random();
\n\t
var halfWidth = this.bashou.width / 2;
\n\t
var randomX = rndist * (rndist > 0.5 ? 1 : -1) * props.bashouMoveDist;
\n\t
console.log(randomX);
\n\t
engine.Tween.get(this.moveNode).to({ x: 370 + halfWidth - 71 }, 1000).call(function () {
\n\t
_this.zhangkai();
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.zhangkai = function () {
\n\t
var _this = this;
\n\t
this.left_zhuazi.anchorX = this.left_zhuazi.width;
\n\t
this.left_zhuazi.anchorY = 0;
\n\t
engine.Tween.get(this.left_zhuazi, { loop: false }).to({ rotation: props.leftRotation }, 1000);
\n\t
engine.Tween.get(this.right_zhuazi, { loop: false }).to({ rotation: props.rightRotation }, 1000);
\n\t
setTimeout(function () {
\n\t
_this.getLong();
\n\t
}, 500);
\n\t
};
\n\t
Zhuazi.prototype.getLong = function () {
\n\t
var _this = this;
\n\t
var droptime = Number((this.GameView.getMoveX() / 60 - 1).toFixed(2)) * 1000;
\n\t
console.log('dr', droptime);
\n\t
var times = (props.ganMoveEndY - this.ganzi.y) / this.ganzi.height;
\n\t
console.log(Number(times.toFixed(2)));
\n\t
engine.Tween.get(this.ganzi).to({ scaleY: Number(times.toFixed(2)) }, droptime).to({ scaleY: 1 }, droptime);
\n\t
console.log('node', this.zhuaziY);
\n\t
engine.Tween.get(this.ganNode).to({ y: props.ganMoveEndY }, droptime).call(function () {
\n\t
_this.GameView.stopMove();
\n\t
_this.showPrizeBox();
\n\t
_this.GameView.setVisible(false);
\n\t
}).to({ y: this.zhuaziY }, droptime).call(function () {
\n\t
engine.globalEvent.dispatchEvent('doll-mac-getprize');
\n\t
_this.getReset();
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.getReset = function () {
\n\t
this.itemShow.visible = false;
\n\t
this.left_zhuazi.anchorX = this.left_zhuazi.width;
\n\t
this.left_zhuazi.anchorY = 0;
\n\t
engine.Tween.get(this.moveNode, { loop: false }).to({ x: 262 }, 1000);
\n\t
engine.Tween.get(this.left_zhuazi, { loop: false }).to({ rotation: 0 }, 1000);
\n\t
engine.Tween.get(this.right_zhuazi, { loop: false }).to({ rotation: 0 }, 1000);
\n\t
};
\n\t
return Zhuazi;
\n\t
}(engine.Container));
\n\t
//# sourceMappingURL=Zhuazi.js.map
\n\n\t
var ObjectPool$1 = engine.ObjectPool;
\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.goodsItems = [];
\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 frontBoxs = (this._frontBoxs = new FrontBoxs());
\n\t
this._frontBoxs.GameView = this;
\n\t
var backBoxs = (this._backBoxs = new BackBoxs());
\n\t
this._Zhuazi = new Zhuazi();
\n\t
this._Zhuazi.GameView = this;
\n\t
this.frontTransfer = new engine.Container();
\n\t
this.backTransfer = new engine.Container();
\n\t
this.frontTransfer.width = 0;
\n\t
this.frontTransfer.height = 0;
\n\t
this.frontTransfer.alpha = 1;
\n\t
this.backTransfer.width = 0;
\n\t
this.backTransfer.height = 0;
\n\t
this.backTransfer.alpha = 1;
\n\t
this.rect = new engine.Rect();
\n\t
this.rect.width = 611;
\n\t
this.rect.height = 704;
\n\t
this.rect.x = 65;
\n\t
this.rect.y = 267;
\n\t
this.NpcBg = new engine.Container();
\n\t
this.addChild(this.NpcBg);
\n\t
this.addChild(this.rect);
\n\t
var gameBg = new engine.Sprite(getTextureByName(
\"
游戏背景
\"
));
\n\t
gameBg.x = 65;
\n\t
gameBg.y = 267;
\n\t
this.NpcBg.addChild(gameBg);
\n\t
this.frontDesk = new engine.Sprite(getTextureByName(
\"
前传输带
\"
));
\n\t
this.frontDesk.x = 60;
\n\t
this.frontDesk.y = 904;
\n\t
this.backDesk = new engine.Sprite(getTextureByName(
\"
后传输带
\"
));
\n\t
this.backDesk.x = 60;
\n\t
this.backDesk.y = 810;
\n\t
this.NpcBg.addChild(this.backDesk);
\n\t
this.NpcBg.addChild(this.frontDesk);
\n\t
this.NpcBg.addChild(this.backTransfer);
\n\t
this.NpcBg.addChild(this.frontTransfer);
\n\t
this.NpcBg.addChild(this._Zhuazi);
\n\t
this.NpcBg.mask = this.rect;
\n\t
this._Zhuazi.setup();
\n\t
this.backTransfer.addChild(this._backBoxs);
\n\t
this._backBoxs.setup();
\n\t
this.frontTransfer.addChild(this._frontBoxs);
\n\t
this._frontBoxs.setup();
\n\t
};
\n\t
GameView.prototype.stopMove = function () {
\n\t
this._frontBoxs.stop();
\n\t
};
\n\t
GameView.prototype.setMoveX = function (x, item) {
\n\t
this.moveTime = x;
\n\t
this.prizeBox = item;
\n\t
this._Zhuazi.move();
\n\t
};
\n\t
GameView.prototype.setVisible = function (isshow) {
\n\t
this._frontBoxs.showHidePrizeBox(isshow);
\n\t
};
\n\t
GameView.prototype.getMoveX = function () {
\n\t
console.log(222);
\n\t
return this.moveTime;
\n\t
};
\n\t
GameView.prototype.getBox = function () {
\n\t
return this.prizeBox;
\n\t
};
\n\t
GameView.prototype.reset = function () {
\n\t
this.recycleGoods();
\n\t
this._Zhuazi.getReset();
\n\t
};
\n\t
GameView.prototype.start = function () {
\n\t
var _this = this;
\n\t
this.score = 0;
\n\t
this.speed = 1;
\n\t
this.gameIng = true;
\n\t
this.countdown = props.countDown;
\n\t
this.countdownTimer = setInterval(function () {
\n\t
if (_this.gameIng) {
\n\t
if (_this.countdown > 0) {
\n\t
engine.globalEvent.dispatchEvent(
\"
food-fell-time-update
\"
, {
\n\t
time: _this.countdown
\n\t
});
\n\t
_this.countdown -= 1;
\n\t
}
\n\t
else {
\n\t
engine.globalEvent.dispatchEvent(
\"
food-fell-game-over
\"
, {
\n\t
score: _this.score,
\n\t
reason: 1
\n\t
});
\n\t
_this.died();
\n\t
}
\n\t
}
\n\t
}, 1000);
\n\t
};
\n\t
GameView.prototype.beginNpc = function () {
\n\t
var _this = this;
\n\t
this.timer = setTimeout(function () {
\n\t
if (_this.gameIng) ;
\n\t
}, 2000 / this.speed);
\n\t
};
\n\t
GameView.prototype.pause = function () {
\n\t
this.gameIng = false;
\n\t
};
\n\t
GameView.prototype.revive = function () {
\n\t
this.gameIng = true;
\n\t
};
\n\t
GameView.prototype.resume = function () {
\n\t
this.reset();
\n\t
this.start();
\n\t
};
\n\t
GameView.prototype.initNpc = function () {
\n\t
this.box1 = new engine.Sprite(getTextureByName(
\"
草泥马盒
\"
));
\n\t
this.box2 = new engine.Sprite(getTextureByName(
\"
狗盒
\"
));
\n\t
this.box3 = new engine.Sprite(getTextureByName(
\"
猫盒
\"
));
\n\t
this.box4 = new engine.Sprite(getTextureByName(
\"
草泥马盒
\"
));
\n\t
this.box5 = new engine.Sprite(getTextureByName(
\"
猫盒
\"
));
\n\t
this.box1.x = 120;
\n\t
this.box1.y = 434;
\n\t
this.box2.x = 306;
\n\t
this.box2.y = 434;
\n\t
this.box3.x = 487;
\n\t
this.box3.y = 434;
\n\t
this.box4.x = 240;
\n\t
this.box4.scaleX = 0.5;
\n\t
this.box4.scaleY = 0.5;
\n\t
this.box4.y = 390;
\n\t
this.box5.x = 434;
\n\t
this.box5.y = 390;
\n\t
this.box5.scaleX = 0.5;
\n\t
this.box5.scaleY = 0.5;
\n\t
this.backTransfer.addChild(this.box4);
\n\t
this.backTransfer.addChild(this.box5);
\n\t
this.frontTransfer.addChild(this.box1);
\n\t
this.frontTransfer.addChild(this.box2);
\n\t
this.frontTransfer.addChild(this.box3);
\n\t
};
\n\t
GameView.prototype.died = function () {
\n\t
this.score = 0;
\n\t
this.pause();
\n\t
};
\n\t
GameView.prototype.removeNpc = function (goods) {
\n\t
this.NpcBg.removeChild(goods);
\n\t
ObjectPool$1.recycleObject(PoolName, goods);
\n\t
goods.removeEventListener(engine.Event.ENTER_FRAME, goods[
\"
onGoodsEnter
\"
], this);
\n\t
var index = this.goodsItems.indexOf(goods);
\n\t
if (index > -1) {
\n\t
this.goodsItems.splice(index, 1);
\n\t
}
\n\t
};
\n\t
GameView.prototype.recycleGoods = function () {
\n\t
clearTimeout(this.timer);
\n\t
clearInterval(this.countdownTimer);
\n\t
for (var _i = 0, _a = this.goodsItems; _i < _a.length; _i++) {
\n\t
var goods = _a[_i];
\n\t
if (goods) {
\n\t
this.removeChild(goods);
\n\t
ObjectPool$1.recycleObject(PoolName, goods);
\n\t
goods.removeEventListener(engine.Event.ENTER_FRAME, goods[
\"
onGoodsEnter
\"
], this);
\n\t
}
\n\t
}
\n\t
this.goodsItems = [];
\n\t
};
\n\t
GameView.prototype.hasHit = function (a, b) {
\n\t
if (Math.abs(a.x + a.width / 2 - (b.x + b.width / 2)) <
\n\t
a.width / 2 + b.width / 2 &&
\n\t
Math.abs(a.y + a.height / 2 - (b.y + b.height / 2)) <
\n\t
a.height / 2 + b.height / 2) {
\n\t
return true;
\n\t
}
\n\t
else {
\n\t
return false;
\n\t
}
\n\t
};
\n\t
return GameView;
\n\t
}(engine.Container));
\n\t
//# sourceMappingURL=GameView.js.map
\n\n\t
var GameWrapper = (function (_super) {
\n\t
tslib.__extends(GameWrapper, _super);
\n\t
function GameWrapper() {
\n\t
var _this = _super.call(this) || this;
\n\t
engine.globalEvent.addEventListener('doll-machine-reset', _this.reset, _this);
\n\t
engine.globalEvent.addEventListener('food-fell-start', _this.start, _this);
\n\t
engine.globalEvent.addEventListener('food-fell-pause', _this.pause, _this);
\n\t
engine.globalEvent.addEventListener('food-fell-resume', _this.resume, _this);
\n\t
engine.globalEvent.addEventListener('food-fell-revive', _this.revive, _this);
\n\t
engine.globalEvent.addEventListener('food-fell-clear', _this.clear, _this);
\n\t
_this.addEventListener(engine.MouseEvent.CLICK, _this.onTap, _this);
\n\t
var gameView = _this._gameView = new GameView();
\n\t
_this.addChild(gameView);
\n\t
return _this;
\n\t
}
\n\t
GameWrapper.prototype.reset = function (event) {
\n\t
injectProps(event.data);
\n\t
this._gameView.visible = true;
\n\t
this._gameView.reset();
\n\t
};
\n\t
GameWrapper.prototype.start = function (event) {
\n\t
injectProps(event.data);
\n\t
this._status = 1;
\n\t
this._gameView.start();
\n\t
};
\n\t
GameWrapper.prototype.pause = function () {
\n\t
this._gameView.pause();
\n\t
};
\n\t
GameWrapper.prototype.resume = function () {
\n\t
this._gameView.resume();
\n\t
};
\n\t
GameWrapper.prototype.revive = function () {
\n\t
this._gameView.revive();
\n\t
};
\n\t
GameWrapper.prototype.clear = function () {
\n\t
this._gameView.visible = false;
\n\t
};
\n\t
GameWrapper.prototype.onTap = function (event) {
\n\t
};
\n\t
return GameWrapper;
\n\t
}(engine.Container));
\n\t
//# sourceMappingURL=GameWrapper.js.map
\n\n\t
function index (props) {
\n\t
prepareProps();
\n\t
injectProps(props);
\n\t
var instance = new GameWrapper();
\n\t
return instance;
\n\t
}
\n\t
//# sourceMappingURL=index.js.map
\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['doll-machine'] = factory(global.tslib));
\n
}(this, (function (tslib) { 'use strict';
\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\n\t
var Goods = (function (_super) {
\n\t
tslib.__extends(Goods, _super);
\n\t
function Goods() {
\n\t
var _this = _super.call(this) || this;
\n\t
var body;
\n\t
body = _this._body = new engine.Rect();
\n\t
var box1 = new engine.Sprite(getTextureByName(
\"
草泥马盒
\"
));
\n\t
box1[
\"
npcType
\"
] =
\"
box1
\"
;
\n\t
var box2 = new engine.Sprite(getTextureByName(
\"
狗盒
\"
));
\n\t
box2[
\"
npcType
\"
] =
\"
box2
\"
;
\n\t
var box3 = new engine.Sprite(getTextureByName(
\"
猫盒
\"
));
\n\t
box3[
\"
npcType
\"
] =
\"
box3
\"
;
\n\t
box1.visible = false;
\n\t
box2.visible = false;
\n\t
box3.visible = false;
\n\t
body.addChild(box1);
\n\t
body.addChild(box2);
\n\t
body.addChild(box3);
\n\t
_this.addChild(body);
\n\t
body.width = 0.0001;
\n\t
body.height = 0.0001;
\n\t
body.mouseEnabled = false;
\n\t
return _this;
\n\t
}
\n\t
Goods.prototype.getRandomNumberByRange = function (start, end) {
\n\t
return Math.floor(Math.random() * (end - start) + start);
\n\t
};
\n\t
Goods.prototype.reset = function () {
\n\t
this.visible = true;
\n\t
this.y = 200;
\n\t
this.x = 0;
\n\t
this.rotation = 0;
\n\t
var random = Math.random();
\n\t
if (random < 0.3) {
\n\t
this.showNpc(
\"
box1
\"
);
\n\t
}
\n\t
else if (random < 0.6) {
\n\t
this.showNpc(
\"
box2
\"
);
\n\t
}
\n\t
else {
\n\t
this.showNpc(
\"
box3
\"
);
\n\t
}
\n\t
};
\n\t
Goods.prototype.showNpc = function (type) {
\n\t
for (var i = 0; i < this._body.children.length; i++) {
\n\t
this._body.children[i].visible = false;
\n\t
this._body.children[i].mouseEnabled = false;
\n\t
}
\n\t
for (var i = 0; i < this._body.children.length; i++) {
\n\t
if (this._body.children[i][
\"
npcType
\"
] == type) {
\n\t
this[
\"
npcType
\"
] = type;
\n\t
console.log(type);
\n\t
this._body.children[i].visible = true;
\n\t
this._body.children[i].mouseEnabled = false;
\n\t
}
\n\t
}
\n\t
};
\n\t
Object.defineProperty(Goods.prototype,
\"
anchorOffsetY
\"
, {
\n\t
set: function (v) {
\n\t
this._body.y = v;
\n\t
},
\n\t
enumerable: true,
\n\t
configurable: true
\n\t
});
\n\t
return Goods;
\n\t
}(engine.Container));
\n\n\t
var ObjectPool = engine.ObjectPool;
\n\t
var PoolName = 'goods';
\n\t
ObjectPool.registerPool(PoolName, function () {
\n\t
return new Goods();
\n\t
}, function (item, data) {
\n\t
item.reset();
\n\t
});
\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
var FrontBoxs = (function (_super) {
\n\t
tslib.__extends(FrontBoxs, _super);
\n\t
function FrontBoxs() {
\n\t
var _this = _super.call(this) || this;
\n\t
_this.frontBoxs = [];
\n\t
return _this;
\n\t
}
\n\t
FrontBoxs.prototype.setup = function () {
\n\t
var initX, initY = 0;
\n\t
this.box1 = new engine.Sprite(getTextureByName(
\"
狗盒
\"
));
\n\t
this.box1[
\"
npcType
\"
] =
\"
box1
\"
;
\n\t
initX = this.box1.x = 435;
\n\t
initY = this.box1.y = 614;
\n\t
this.box2 = new engine.Sprite(getTextureByName(
\"
猫盒
\"
));
\n\t
this.box2[
\"
npcType
\"
] =
\"
box2
\"
;
\n\t
this.box3 = new engine.Sprite(getTextureByName(
\"
草泥马盒
\"
));
\n\t
this.box3[
\"
npcType
\"
] =
\"
box3
\"
;
\n\t
this.box4 = new engine.Sprite(getTextureByName(
\"
狗盒
\"
));
\n\t
this.box4[
\"
npcType
\"
] =
\"
box4
\"
;
\n\t
this.box5 = new engine.Sprite(getTextureByName(
\"
猫盒
\"
));
\n\t
this.box5[
\"
npcType
\"
] =
\"
box5
\"
;
\n\t
this.frontBoxs = [this.box1, this.box2, this.box3, this.box4];
\n\t
for (var i = 0; i < this.frontBoxs.length; i++) {
\n\t
if (i == 0) {
\n\t
this.frontBoxs[i].x = initX;
\n\t
}
\n\t
else {
\n\t
this.frontBoxs[i].x = this.frontBoxs[i - 1].x - this.box1.width - props.frontmargin;
\n\t
}
\n\t
this.frontBoxs[i].y = initY;
\n\t
this.addChild(this.frontBoxs[i]);
\n\t
}
\n\t
this.addEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);
\n\t
};
\n\t
FrontBoxs.prototype.frameMove = function () {
\n\t
var _this = this;
\n\t
this.frontBoxs.forEach(function (item, index) {
\n\t
item.x += props.moveSpeed;
\n\t
if (item.x <= 0 && !item.visible) {
\n\t
item.visible = true;
\n\t
}
\n\t
if (item.x >= 750) {
\n\t
var lastitem = _this.frontBoxs.shift();
\n\t
lastitem.x = _this.frontBoxs[_this.frontBoxs.length - 1].x - _this.box1.width - props.frontmargin;
\n\t
if (!_this.GameView.getMoveX() && item.x <= 0 && _this.GameView.startstatus) {
\n\t
_this.GameView.setMoveX((370 - item.x - 13) / props.moveSpeed, item);
\n\t
_this.hideBox = item;
\n\t
}
\n\t
_this.frontBoxs.push(lastitem);
\n\t
}
\n\t
});
\n\t
};
\n\t
FrontBoxs.prototype.stop = function () {
\n\t
};
\n\t
FrontBoxs.prototype.showHidePrizeBox = function (isshow) {
\n\t
this.hideBox.visible = isshow;
\n\t
};
\n\t
return FrontBoxs;
\n\t
}(engine.Container));
\n\n\t
var BackBoxs = (function (_super) {
\n\t
tslib.__extends(BackBoxs, _super);
\n\t
function BackBoxs() {
\n\t
var _this = _super.call(this) || this;
\n\t
_this.backBoxs = [];
\n\t
return _this;
\n\t
}
\n\t
BackBoxs.prototype.setup = function () {
\n\t
var initX, initY = 0;
\n\t
this.box1 = new engine.Sprite(getTextureByName(
\"
后狗盒
\"
));
\n\t
initX = this.box1.x = 188;
\n\t
initY = this.box1.y = 616;
\n\t
this.box2 = new engine.Sprite(getTextureByName(
\"
后猫盒
\"
));
\n\t
this.box3 = new engine.Sprite(getTextureByName(
\"
后草泥马盒
\"
));
\n\t
this.box4 = new engine.Sprite(getTextureByName(
\"
后狗盒
\"
));
\n\t
this.box5 = new engine.Sprite(getTextureByName(
\"
后猫盒
\"
));
\n\t
this.backBoxs = [this.box1, this.box2, this.box3, this.box4, this.box5];
\n\t
for (var i = 0; i < this.backBoxs.length; i++) {
\n\t
if (i == 0) {
\n\t
this.backBoxs[i].x = initX;
\n\t
}
\n\t
else {
\n\t
this.backBoxs[i].x = this.backBoxs[i - 1].x + this.backBoxs[i].width + props.backmargin;
\n\t
}
\n\t
this.backBoxs[i].y = initY;
\n\t
this.addChild(this.backBoxs[i]);
\n\t
}
\n\t
this.addEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);
\n\t
};
\n\t
BackBoxs.prototype.frameMove = function () {
\n\t
var _this = this;
\n\t
this.backBoxs.forEach(function (item) {
\n\t
item.x -= props.moveSpeed;
\n\t
if (item.x <= 0) {
\n\t
var lastitem = _this.backBoxs.shift();
\n\t
lastitem.x = _this.backBoxs[_this.backBoxs.length - 1].x + item.width + props.backmargin;
\n\t
_this.backBoxs.push(lastitem);
\n\t
}
\n\t
});
\n\t
};
\n\t
return BackBoxs;
\n\t
}(engine.Container));
\n\n\t
var Zhuazi = (function (_super) {
\n\t
tslib.__extends(Zhuazi, _super);
\n\t
function Zhuazi() {
\n\t
var _this = _super.call(this) || this;
\n\t
_this.moveArr = [];
\n\t
_this.prizeBoxs = [];
\n\t
return _this;
\n\t
}
\n\t
Zhuazi.prototype.setup = function () {
\n\t
this.ganNode = new engine.Container();
\n\t
this.moveNode = new engine.Container();
\n\t
this.ganNode.x = 280;
\n\t
this.ganNode.y = 350;
\n\t
this.bashouGan = new engine.Sprite(getTextureByName(
\"
把手杆子
\"
));
\n\t
this.bashouGan.x = 60;
\n\t
this.bashouGan.y = 275;
\n\t
this.bashou = new engine.Sprite(getTextureByName(
\"
把手
\"
));
\n\t
this.bashou.x = 0;
\n\t
this.bashou.y = 263;
\n\t
this.ganzi = new engine.Sprite(getTextureByName(
\"
伸缩杆
\"
));
\n\t
this.ganzi.x = 97;
\n\t
this.ganzi.y = 290;
\n\t
this.connect = new engine.Sprite(getTextureByName(
\"
连接点
\"
));
\n\t
this.connect.x = 18;
\n\t
this.connect.y = -5;
\n\t
this.left_zhuazi = new engine.Sprite(getTextureByName(
\"
左爪
\"
));
\n\t
this.left_zhuazi.x = -15;
\n\t
this.left_zhuazi.y = 60;
\n\t
this.left_zhuazi.anchorX = this.left_zhuazi.width;
\n\t
this.left_zhuazi.anchorY = 0;
\n\t
this.right_zhuazi = new engine.Sprite(getTextureByName(
\"
右爪
\"
));
\n\t
this.right_zhuazi.x = 98;
\n\t
this.right_zhuazi.y = 60;
\n\t
this.ganNode.addChild(this.left_zhuazi);
\n\t
this.ganNode.addChild(this.right_zhuazi);
\n\t
this.ganNode.addChild(this.connect);
\n\t
this.ganNode.x = 30;
\n\t
this.zhuaziY = this.ganNode.y;
\n\t
this.moveNode.addChild(this.ganzi);
\n\t
this.moveNode.addChild(this.ganNode);
\n\t
this.moveNode.addChild(this.bashou);
\n\t
this.moveNode.x = 262;
\n\t
this.addChild(this.bashouGan);
\n\t
this.addChild(this.moveNode);
\n\t
this.createPrizeBox();
\n\t
};
\n\t
Zhuazi.prototype.createPrizeBox = function () {
\n\t
var _this = this;
\n\t
this.box1 = new engine.Sprite(getTextureByName(
\"
中奖狗盒
\"
));
\n\t
this.box1[
\"
npcType
\"
] =
\"
box1
\"
;
\n\t
this.box2 = new engine.Sprite(getTextureByName(
\"
中奖猫盒
\"
));
\n\t
this.box2[
\"
npcType
\"
] =
\"
box2
\"
;
\n\t
this.box3 = new engine.Sprite(getTextureByName(
\"
中奖草泥马盒
\"
));
\n\t
this.box3[
\"
npcType
\"
] =
\"
box3
\"
;
\n\t
this.box4 = new engine.Sprite(getTextureByName(
\"
中奖狗盒
\"
));
\n\t
this.box4[
\"
npcType
\"
] =
\"
box4
\"
;
\n\t
this.box5 = new engine.Sprite(getTextureByName(
\"
中奖猫盒
\"
));
\n\t
this.box5[
\"
npcType
\"
] =
\"
box5
\"
;
\n\t
this.prizeBoxs = [this.box1, this.box2, this.box3, this.box4, this.box5];
\n\t
this.prizeBoxs.forEach(function (item) {
\n\t
_this.ganNode.addChild(item);
\n\t
item.visible = false;
\n\t
item.x = 15;
\n\t
item.y = 48;
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.showPrizeBox = function () {
\n\t
var _this = this;
\n\t
this.prizeBoxs.forEach(function (item) {
\n\t
console.log(_this.GameView.getBox()['npcType']);
\n\t
if (item['npcType'] === _this.GameView.getBox()['npcType']) {
\n\t
item.visible = true;
\n\t
_this.itemShow = item;
\n\t
}
\n\t
else {
\n\t
item.visible = false;
\n\t
}
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.move = function () {
\n\t
var _this = this;
\n\t
var rndist = Math.random();
\n\t
var halfWidth = this.bashou.width / 2;
\n\t
var randomX = rndist * (rndist > 0.5 ? 1 : -1) * props.bashouMoveDist;
\n\t
console.log(randomX);
\n\t
engine.Tween.get(this.moveNode).to({ x: 370 + halfWidth - 71 }, 1000).call(function () {
\n\t
_this.zhangkai();
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.zhangkai = function () {
\n\t
var _this = this;
\n\t
this.left_zhuazi.anchorX = this.left_zhuazi.width;
\n\t
this.left_zhuazi.anchorY = 0;
\n\t
engine.Tween.get(this.left_zhuazi, { loop: false }).to({ rotation: props.leftRotation }, 1000);
\n\t
engine.Tween.get(this.right_zhuazi, { loop: false }).to({ rotation: props.rightRotation }, 1000);
\n\t
setTimeout(function () {
\n\t
_this.getLong();
\n\t
}, 500);
\n\t
};
\n\t
Zhuazi.prototype.getLong = function () {
\n\t
var _this = this;
\n\t
var droptime = Number((this.GameView.getMoveX() / 60 - 1).toFixed(2)) * 1000;
\n\t
console.log('dr', droptime);
\n\t
var times = (props.ganMoveEndY - this.ganzi.y) / this.ganzi.height;
\n\t
console.log(Number(times.toFixed(2)));
\n\t
engine.Tween.get(this.ganzi).to({ scaleY: Number(times.toFixed(2)) }, droptime).to({ scaleY: 1 }, droptime);
\n\t
console.log('node', this.zhuaziY);
\n\t
engine.Tween.get(this.ganNode).to({ y: props.ganMoveEndY }, droptime).call(function () {
\n\t
_this.GameView.stopMove();
\n\t
if (_this.GameView.ifPrize) {
\n\t
_this.showPrizeBox();
\n\t
_this.GameView.setVisible(false);
\n\t
}
\n\t
}).to({ y: this.zhuaziY }, droptime).call(function () {
\n\t
if (_this.GameView.ifPrize) {
\n\t
_this.itemShow.visible = false;
\n\t
}
\n\t
engine.globalEvent.dispatchEvent('doll-machine-gameover');
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.getReset = function () {
\n\t
this.left_zhuazi.anchorX = this.left_zhuazi.width;
\n\t
this.left_zhuazi.anchorY = 0;
\n\t
engine.Tween.get(this.moveNode, { loop: false }).to({ x: 262 }, 1000);
\n\t
engine.Tween.get(this.left_zhuazi, { loop: false }).to({ rotation: 0 }, 1000);
\n\t
engine.Tween.get(this.right_zhuazi, { loop: false }).to({ rotation: 0 }, 1000);
\n\t
this.GameView.resetMoveX();
\n\t
};
\n\t
return Zhuazi;
\n\t
}(engine.Container));
\n\n\t
var ObjectPool$1 = engine.ObjectPool;
\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.startstatus = false;
\n\t
_this.ifPrize = false;
\n\t
_this.goodsItems = [];
\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 frontBoxs = (this._frontBoxs = new FrontBoxs());
\n\t
this._frontBoxs.GameView = this;
\n\t
var backBoxs = (this._backBoxs = new BackBoxs());
\n\t
this._Zhuazi = new Zhuazi();
\n\t
this._Zhuazi.GameView = this;
\n\t
this.frontTransfer = new engine.Container();
\n\t
this.backTransfer = new engine.Container();
\n\t
this.frontTransfer.width = 0;
\n\t
this.frontTransfer.height = 0;
\n\t
this.frontTransfer.alpha = 1;
\n\t
this.backTransfer.width = 0;
\n\t
this.backTransfer.height = 0;
\n\t
this.backTransfer.alpha = 1;
\n\t
this.rect = new engine.Rect();
\n\t
this.rect.width = 611;
\n\t
this.rect.height = 704;
\n\t
this.rect.x = 65;
\n\t
this.rect.y = 263;
\n\t
this.NpcBg = new engine.Container();
\n\t
this.addChild(this.NpcBg);
\n\t
this.addChild(this.rect);
\n\t
var gameBg = new engine.Sprite(getTextureByName(
\"
游戏背景
\"
));
\n\t
gameBg.x = 65;
\n\t
gameBg.y = 263;
\n\t
this.NpcBg.addChild(gameBg);
\n\t
this.frontDesk = new engine.Sprite(getTextureByName(
\"
前传输带
\"
));
\n\t
this.frontDesk.x = 60;
\n\t
this.frontDesk.y = 781;
\n\t
this.backDesk = new engine.Sprite(getTextureByName(
\"
后传输带
\"
));
\n\t
this.backDesk.x = 60;
\n\t
this.backDesk.y = 712;
\n\t
this.NpcBg.addChild(this.backDesk);
\n\t
this.NpcBg.addChild(this.frontDesk);
\n\t
this.NpcBg.addChild(this.backTransfer);
\n\t
this.NpcBg.addChild(this.frontTransfer);
\n\t
this.NpcBg.addChild(this._Zhuazi);
\n\t
this.NpcBg.mask = this.rect;
\n\t
this._Zhuazi.setup();
\n\t
this.backTransfer.addChild(this._backBoxs);
\n\t
this._backBoxs.setup();
\n\t
this.frontTransfer.addChild(this._frontBoxs);
\n\t
this._frontBoxs.setup();
\n\t
};
\n\t
GameView.prototype.stopMove = function () {
\n\t
this._frontBoxs.stop();
\n\t
};
\n\t
GameView.prototype.setMoveX = function (x, item) {
\n\t
this.moveTime = x;
\n\t
this.prizeBox = item;
\n\t
this._Zhuazi.move();
\n\t
};
\n\t
GameView.prototype.setVisible = function (isshow) {
\n\t
this._frontBoxs.showHidePrizeBox(isshow);
\n\t
};
\n\t
GameView.prototype.getMoveX = function () {
\n\t
return this.moveTime;
\n\t
};
\n\t
GameView.prototype.resetMoveX = function () {
\n\t
this.moveTime = null;
\n\t
};
\n\t
GameView.prototype.getBox = function () {
\n\t
return this.prizeBox;
\n\t
};
\n\t
GameView.prototype.reset = function () {
\n\t
this.startstatus = false;
\n\t
this.ifPrize = false;
\n\t
this._Zhuazi.getReset();
\n\t
};
\n\t
GameView.prototype.start = function (type) {
\n\t
if (type === void 0) { type = null; }
\n\t
this.speed = 1;
\n\t
this.gameIng = true;
\n\t
console.log('执行', type);
\n\t
this.startstatus = true;
\n\t
this.ifPrize = type && type.prize || false;
\n\t
};
\n\t
GameView.prototype.beginNpc = function () {
\n\t
var _this = this;
\n\t
this.timer = setTimeout(function () {
\n\t
if (_this.gameIng) ;
\n\t
}, 2000 / this.speed);
\n\t
};
\n\t
GameView.prototype.pause = function () {
\n\t
this.gameIng = false;
\n\t
};
\n\t
GameView.prototype.revive = function () {
\n\t
this.gameIng = true;
\n\t
};
\n\t
GameView.prototype.resume = function () {
\n\t
this.reset();
\n\t
this.start();
\n\t
};
\n\t
GameView.prototype.initNpc = function () {
\n\t
this.box1 = new engine.Sprite(getTextureByName(
\"
草泥马盒
\"
));
\n\t
this.box2 = new engine.Sprite(getTextureByName(
\"
狗盒
\"
));
\n\t
this.box3 = new engine.Sprite(getTextureByName(
\"
猫盒
\"
));
\n\t
this.box4 = new engine.Sprite(getTextureByName(
\"
草泥马盒
\"
));
\n\t
this.box5 = new engine.Sprite(getTextureByName(
\"
猫盒
\"
));
\n\t
this.box1.x = 120;
\n\t
this.box1.y = 434;
\n\t
this.box2.x = 306;
\n\t
this.box2.y = 434;
\n\t
this.box3.x = 487;
\n\t
this.box3.y = 434;
\n\t
this.box4.x = 240;
\n\t
this.box4.scaleX = 0.5;
\n\t
this.box4.scaleY = 0.5;
\n\t
this.box4.y = 390;
\n\t
this.box5.x = 434;
\n\t
this.box5.y = 390;
\n\t
this.box5.scaleX = 0.5;
\n\t
this.box5.scaleY = 0.5;
\n\t
this.backTransfer.addChild(this.box4);
\n\t
this.backTransfer.addChild(this.box5);
\n\t
this.frontTransfer.addChild(this.box1);
\n\t
this.frontTransfer.addChild(this.box2);
\n\t
this.frontTransfer.addChild(this.box3);
\n\t
};
\n\t
GameView.prototype.died = function () {
\n\t
this.score = 0;
\n\t
this.pause();
\n\t
};
\n\t
GameView.prototype.removeNpc = function (goods) {
\n\t
this.NpcBg.removeChild(goods);
\n\t
ObjectPool$1.recycleObject(PoolName, goods);
\n\t
goods.removeEventListener(engine.Event.ENTER_FRAME, goods[
\"
onGoodsEnter
\"
], this);
\n\t
var index = this.goodsItems.indexOf(goods);
\n\t
if (index > -1) {
\n\t
this.goodsItems.splice(index, 1);
\n\t
}
\n\t
};
\n\t
GameView.prototype.recycleGoods = function () {
\n\t
clearTimeout(this.timer);
\n\t
clearInterval(this.countdownTimer);
\n\t
for (var _i = 0, _a = this.goodsItems; _i < _a.length; _i++) {
\n\t
var goods = _a[_i];
\n\t
if (goods) {
\n\t
this.removeChild(goods);
\n\t
ObjectPool$1.recycleObject(PoolName, goods);
\n\t
goods.removeEventListener(engine.Event.ENTER_FRAME, goods[
\"
onGoodsEnter
\"
], this);
\n\t
}
\n\t
}
\n\t
this.goodsItems = [];
\n\t
};
\n\t
GameView.prototype.hasHit = function (a, b) {
\n\t
if (Math.abs(a.x + a.width / 2 - (b.x + b.width / 2)) <
\n\t
a.width / 2 + b.width / 2 &&
\n\t
Math.abs(a.y + a.height / 2 - (b.y + b.height / 2)) <
\n\t
a.height / 2 + b.height / 2) {
\n\t
return true;
\n\t
}
\n\t
else {
\n\t
return false;
\n\t
}
\n\t
};
\n\t
return GameView;
\n\t
}(engine.Container));
\n\n\t
var GameWrapper = (function (_super) {
\n\t
tslib.__extends(GameWrapper, _super);
\n\t
function GameWrapper() {
\n\t
var _this = _super.call(this) || this;
\n\t
engine.globalEvent.addEventListener('doll-machine-reset', _this.reset, _this);
\n\t
engine.globalEvent.addEventListener('doll-machine-prize', _this.start, _this);
\n\t
var gameView = _this._gameView = new GameView();
\n\t
_this.addChild(gameView);
\n\t
return _this;
\n\t
}
\n\t
GameWrapper.prototype.reset = function (event) {
\n\t
injectProps(event.data);
\n\t
this._gameView.visible = true;
\n\t
this._gameView.reset();
\n\t
};
\n\t
GameWrapper.prototype.start = function (event) {
\n\t
console.log('监听开始');
\n\t
injectProps(event.data);
\n\t
this._gameView.start(event.data);
\n\t
};
\n\t
GameWrapper.prototype.pause = function () {
\n\t
this._gameView.pause();
\n\t
};
\n\t
GameWrapper.prototype.resume = function () {
\n\t
this._gameView.resume();
\n\t
};
\n\t
GameWrapper.prototype.revive = function () {
\n\t
this._gameView.revive();
\n\t
};
\n\t
GameWrapper.prototype.clear = function () {
\n\t
this._gameView.visible = false;
\n\t
};
\n\t
GameWrapper.prototype.onTap = function (event) {
\n\t
};
\n\t
return GameWrapper;
\n\t
}(engine.Container));
\n\n\t
function index (props) {
\n\t
prepareProps();
\n\t
injectProps(props);
\n\t
var instance = new GameWrapper();
\n\t
return instance;
\n\t
}
\n\n\t
return index;
\n\n
})));
\n
"
}
dist/customs/doll-machine2.json
0 → 100644
View file @
d1566d32
{
"name"
:
"娃娃机2"
,
"desc"
:
"娃娃机通用模块"
,
"props"
:
{
"single"
:
{
"alias"
:
"是否是单层娃娃"
,
"type"
:
"boolean"
,
"default"
:
true
},
"dollNum"
:
{
"alias"
:
"一屏展示娃娃个数(最大为4)"
,
"type"
:
"number"
,
"default"
:
4
},
"initOffsetTop"
:
{
"alias"
:
"整体距离上边距"
,
"type"
:
"number"
,
"default"
:
0
},
"initOffsetLeft"
:
{
"alias"
:
"整体距离左边距"
,
"type"
:
"number"
,
"default"
:
60
},
"frontDeskY"
:
{
"alias"
:
"前排传输带Y位置"
,
"type"
:
"number"
,
"default"
:
518
},
"frontInitX"
:
{
"alias"
:
"前排最右侧娃娃初始X位置"
,
"type"
:
"number"
,
"default"
:
600
},
"frontInitY"
:
{
"alias"
:
"前排最右侧娃娃初始Y位置"
,
"type"
:
"number"
,
"default"
:
351
},
"backDeskY"
:
{
"alias"
:
"后排传输带Y位置"
,
"type"
:
"number"
,
"default"
:
449
},
"backInitX"
:
{
"alias"
:
"后排最右侧娃娃初始X位置"
,
"type"
:
"number"
,
"default"
:
188
},
"backInitY"
:
{
"alias"
:
"后排最右侧娃娃初始Y位置"
,
"type"
:
"number"
,
"default"
:
353
},
"ganziShow"
:
{
"alias"
:
"是否显示杆子"
,
"type"
:
"boolean"
,
"default"
:
true
},
"bashouShow"
:
{
"alias"
:
"是否显示把手"
,
"type"
:
"boolean"
,
"default"
:
true
},
"gameStageWidth"
:
{
"alias"
:
"游戏场景宽度"
,
"type"
:
"number"
,
"default"
:
611
},
"gameStageHeight"
:
{
"alias"
:
"游戏场景高度"
,
"type"
:
"number"
,
"default"
:
704
},
"frontmargin"
:
{
"alias"
:
"前排娃娃的间距"
,
"type"
:
"number"
,
"default"
:
13
},
"backmargin"
:
{
"alias"
:
"后排娃娃的间距"
,
"type"
:
"number"
,
"default"
:
50
},
"moveSpeed"
:
{
"alias"
:
"娃娃移动的速度"
,
"type"
:
"number"
,
"default"
:
3
},
"bashouMoveDist"
:
{
"alias"
:
"爪子整体左右移动的范围"
,
"type"
:
"number"
,
"default"
:
200
},
"ganMoveEndY"
:
{
"alias"
:
"杆子最后需要移动到的y值位置"
,
"type"
:
"number"
,
"default"
:
357
},
"leftRotation"
:
{
"alias"
:
"左边爪子旋转角度"
,
"type"
:
"number"
,
"default"
:
20
},
"rightRotation"
:
{
"alias"
:
"右边爪子旋转角度"
,
"type"
:
"number"
,
"default"
:
-20
},
"prizeBoxInitX"
:
{
"alias"
:
"中奖娃娃的x位置"
,
"type"
:
"number"
,
"default"
:
15
},
"prizeBoxInitY"
:
{
"alias"
:
"中奖娃娃的y位置"
,
"type"
:
"number"
,
"default"
:
48
}
},
"assets"
:
[
{
"name"
:
"游戏背景"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/460fd0242aada85de5554391756db6ed2a232a9b.png"
,
"uuid"
:
"05c378c3-bed0-4d5c-bed8-f05ae7920931"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_0"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fde8c60981791e5136c7914274c2a2d0936626cd.png"
,
"uuid"
:
"aa30ee7c-a6ad-4e10-9b6a-13b139664ab5"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/befb2c9ddfd8a5c4acd5126b2d793f7c1bcc40f2.png"
,
"uuid"
:
"4483b626-697a-4aa4-ba57-0c22ddc7c0e6"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_2"
,
"url"
:
"///yun.duiba.com.cn/aurora/assets/50991e640e6bcc2eee02ba945d48a8430ddd2bee.png"
,
"uuid"
:
"b70f2980-a2b3-4ef7-b060-b14dc7a8c9c8"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_3"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fde8c60981791e5136c7914274c2a2d0936626cd.png"
,
"uuid"
:
"aa30ee7c-a6ad-4e10-9b6a-13b139664ab1"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_4"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fde8c60981791e5136c7914274c2a2d0936626cd.png"
,
"uuid"
:
"aa30ee7c-a6ad-4e10-9b6a-13b139664ab2"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_0"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/94884eafc876346e283efef2aa29bd6d2c36f627.png"
,
"uuid"
:
"3f3feb30-6700-4ac7-a14e-6d7e41e8d4e8"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/7deaaf45e03a626efbced90e4ad3d22373b01bd3.png"
,
"uuid"
:
"b1422629-55d2-4b8b-bdd0-1b043f965248"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_2"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/28a5b5b04c84d6acc86b7efb81dd6d7f717e0cda.png"
,
"uuid"
:
"708da046-26e1-4ff7-abb6-35bf825a5d5b"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_3"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/28a5b5b04c84d6acc86b7efb81dd6d7f717e0cda.png"
,
"uuid"
:
"708da046-26e1-4ff7-abb6-35bf825a5d51"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_4"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/28a5b5b04c84d6acc86b7efb81dd6d7f717e0cda.png"
,
"uuid"
:
"708da046-26e1-4ff7-abb6-35bf825a5d55"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_0"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/a47f438d016d1b178cdb5241651a78e4ea365e75.png"
,
"uuid"
:
"c106cd1d-52a0-422a-976c-67151af0b484"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fd60c2da0ce78f7b7bed0e9c45644882a1a40d90.png"
,
"uuid"
:
"3ff6fb20-4a2f-4789-998d-6078e3b603ec"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_2"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/6211ab330a3768ff0a1920cff0ec41f29fa0903b.png"
,
"uuid"
:
"04fa3325-87fc-4009-bfba-26a95d92d80c"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_3"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/6211ab330a3768ff0a1920cff0ec41f29fa0903b.png"
,
"uuid"
:
"04fa3325-87fc-4009-bfba-26a95d92d800"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_4"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/6211ab330a3768ff0a1920cff0ec41f29fa0903b.png"
,
"uuid"
:
"04fa3325-87fc-4009-bfba-26a95d92d80a"
,
"ext"
:
".png"
},
{
"name"
:
"前传输带"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/7bccbc67b3f896176bed7d21c5f4d4307c3919be.png"
,
"uuid"
:
"06bd03a4-43c3-49bb-94c5-6ef365f70291"
,
"ext"
:
".png"
},
{
"name"
:
"后传输带"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/df9b718f80747a1e21349d2b9ac35d5e19a61dad.png"
,
"uuid"
:
"aa0c6ebc-164f-4767-90ca-a79be4316365"
,
"ext"
:
".png"
},
{
"name"
:
"把手杆子"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/5a9e4ba7ca6701eae85b6d6dcb0612ecb9a3eff9.png"
,
"uuid"
:
"f2f1a937-00f4-442f-af4f-0bcb00656e69"
,
"ext"
:
".png"
},
{
"name"
:
"把手"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/71255a6f3cdf9f66d53589e46d72fcd20fef468d.png"
,
"uuid"
:
"d9b395b5-4e46-43a5-aa2b-bfdd81c07fa7"
,
"ext"
:
".png"
},
{
"name"
:
"伸缩杆"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/a9cf8b147c52b7d4247e80e90e098f787808bfa9.png"
,
"uuid"
:
"fddb4636-9c62-47b2-ba5e-f2cd820dbccc"
,
"ext"
:
".png"
},
{
"name"
:
"左爪"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/1e8634fd94bda455d11956c2847d3823e80701d3.png"
,
"uuid"
:
"739014d2-3193-4853-bf8d-349bd3e8d990"
,
"ext"
:
".png"
},
{
"name"
:
"右爪"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/4bfc510e0d1fa1db77f5effa187294af38b74ff6.png"
,
"uuid"
:
"4fb43b19-67e9-42cc-b461-35c005c714fb"
,
"ext"
:
".png"
},
{
"name"
:
"连接点"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/39f39234631f739e70e9ab8b713284379f4016fb.png"
,
"uuid"
:
"2021124f-ffcb-487f-a24f-a00f3d8aae95"
,
"ext"
:
".png"
}
],
"events"
:
{
"in"
:
{
"doll-machine2-game-init"
:
{
"alias"
:
"重置"
},
"doll-machine2-game-start"
:
{
"alias"
:
"开始"
,
"data"
:
{
"prize"
:
true
}
}
},
"out"
:
{
"doll-machine2-game-end"
:
{
"alias"
:
"重置完毕"
,
"data"
:
null
}
}
},
"id"
:
"doll-machine2"
,
"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['doll-machine2'] = 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\t
//# sourceMappingURL=props.js.map
\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
//# sourceMappingURL=utils.js.map
\n\n\t
var FrontBoxs = (function (_super) {
\n\t
tslib.__extends(FrontBoxs, _super);
\n\t
function FrontBoxs() {
\n\t
var _this = _super.call(this) || this;
\n\t
_this.frontBoxs = [];
\n\t
return _this;
\n\t
}
\n\t
FrontBoxs.prototype.setup = function () {
\n\t
var initX, initY = 0;
\n\t
for (var i = 0; i < +props.dollNum + 1; i++) {
\n\t
if (!new engine.Sprite(getTextureByName('frontbox_' + i))) {
\n\t
return;
\n\t
}
\n\t
this.frontBoxs[i] = new engine.Sprite(getTextureByName('frontbox_' + i));
\n\t
initX = this.frontBoxs[0].x = props.frontInitX;
\n\t
initY = this.frontBoxs[0].y = props.frontInitY;
\n\t
this.frontBoxs[i]['npcType'] = 'box' + i;
\n\t
}
\n\t
for (var i = 0; i < this.frontBoxs.length; i++) {
\n\t
if (i == 0) {
\n\t
this.frontBoxs[i].x = initX;
\n\t
}
\n\t
else {
\n\t
this.frontBoxs[i].x = this.frontBoxs[i - 1].x - this.frontBoxs[0].width - props.frontmargin;
\n\t
}
\n\t
console.log(this.frontBoxs[i].x);
\n\t
this.frontBoxs[i].y = initY;
\n\t
this.addChild(this.frontBoxs[i]);
\n\t
console.log('aaa', this.frontBoxs[i].x);
\n\t
}
\n\t
this.addEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);
\n\t
};
\n\t
FrontBoxs.prototype.frameMove = function () {
\n\t
var _this = this;
\n\t
this.frontBoxs.forEach(function (item, index) {
\n\t
item.x += props.moveSpeed;
\n\t
if (item.x <= 0 && !item.visible) {
\n\t
item.visible = true;
\n\t
}
\n\t
if (item.x >= 750) {
\n\t
var lastitem = _this.frontBoxs.shift();
\n\t
lastitem.x = _this.frontBoxs[_this.frontBoxs.length - 1].x - _this.frontBoxs[0].width - props.frontmargin;
\n\t
if (!_this.GameView.getMoveX() && item.x <= 0 && _this.GameView.startstatus) {
\n\t
_this.GameView.setMoveX((370 - item.x - 13) / props.moveSpeed, item);
\n\t
_this.hideBox = item;
\n\t
}
\n\t
_this.frontBoxs.push(lastitem);
\n\t
}
\n\t
});
\n\t
};
\n\t
FrontBoxs.prototype.stop = function () {
\n\t
};
\n\t
FrontBoxs.prototype.showHidePrizeBox = function (isshow) {
\n\t
this.hideBox.visible = isshow;
\n\t
};
\n\t
return FrontBoxs;
\n\t
}(engine.Container));
\n\n\t
var BackBoxs = (function (_super) {
\n\t
tslib.__extends(BackBoxs, _super);
\n\t
function BackBoxs() {
\n\t
var _this = _super.call(this) || this;
\n\t
_this.backBoxs = [];
\n\t
return _this;
\n\t
}
\n\t
BackBoxs.prototype.setup = function () {
\n\t
var initX, initY = 0;
\n\t
for (var i = 0; i < props.dollNum; i++) {
\n\t
this.backBoxs[i] = new engine.Sprite(getTextureByName('backbox_' + i));
\n\t
initX = this.backBoxs[0].x = props.backInitX;
\n\t
initY = this.backBoxs[0].y = props.backInitY - props.initOffsetTop;
\n\t
this.backBoxs[i]['npcType'] = 'box' + i;
\n\t
}
\n\t
this.backBoxs[props.dollNum] = new engine.Sprite(getTextureByName('backbox_0'));
\n\t
this.backBoxs[props.dollNum]['npcType'] = 'box' + props.dollNum;
\n\t
for (var i = 0; i < this.backBoxs.length; i++) {
\n\t
if (i == 0) {
\n\t
this.backBoxs[i].x = initX;
\n\t
}
\n\t
else {
\n\t
this.backBoxs[i].x = this.backBoxs[i - 1].x + this.backBoxs[i].width + props.backmargin;
\n\t
}
\n\t
this.backBoxs[i].y = initY;
\n\t
this.addChild(this.backBoxs[i]);
\n\t
}
\n\t
this.addEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);
\n\t
};
\n\t
BackBoxs.prototype.frameMove = function () {
\n\t
var _this = this;
\n\t
this.backBoxs.forEach(function (item) {
\n\t
item.x -= props.moveSpeed;
\n\t
if (item.x <= 0) {
\n\t
var lastitem = _this.backBoxs.shift();
\n\t
lastitem.x = _this.backBoxs[_this.backBoxs.length - 1].x + item.width + props.backmargin;
\n\t
_this.backBoxs.push(lastitem);
\n\t
}
\n\t
});
\n\t
};
\n\t
return BackBoxs;
\n\t
}(engine.Container));
\n\t
//# sourceMappingURL=backBox.js.map
\n\n\t
var Zhuazi = (function (_super) {
\n\t
tslib.__extends(Zhuazi, _super);
\n\t
function Zhuazi() {
\n\t
var _this = _super.call(this) || this;
\n\t
_this.moveArr = [];
\n\t
_this.prizeBoxs = [];
\n\t
return _this;
\n\t
}
\n\t
Zhuazi.prototype.setup = function () {
\n\t
this.ganNode = new engine.Container();
\n\t
this.moveNode = new engine.Container();
\n\t
this.ganNode.x = 280;
\n\t
this.ganNode.y = 350;
\n\t
this.bashouGan = new engine.Sprite(getTextureByName(
\"
把手杆子
\"
));
\n\t
this.bashouGan.x = 60;
\n\t
this.bashouGan.y = 12;
\n\t
this.bashou = new engine.Sprite(getTextureByName(
\"
把手
\"
));
\n\t
this.bashou.x = 0;
\n\t
this.bashou.y = 0;
\n\t
this.ganzi = new engine.Sprite(getTextureByName(
\"
伸缩杆
\"
));
\n\t
this.ganzi.x = 97;
\n\t
this.ganzi.y = 27;
\n\t
this.connect = new engine.Sprite(getTextureByName(
\"
连接点
\"
));
\n\t
this.connect.x = 18;
\n\t
this.connect.y = -5;
\n\t
this.left_zhuazi = new engine.Sprite(getTextureByName(
\"
左爪
\"
));
\n\t
this.left_zhuazi.x = -15;
\n\t
this.left_zhuazi.y = 60;
\n\t
this.left_zhuazi.anchorX = this.left_zhuazi.width;
\n\t
this.left_zhuazi.anchorY = 0;
\n\t
this.right_zhuazi = new engine.Sprite(getTextureByName(
\"
右爪
\"
));
\n\t
this.right_zhuazi.x = 98;
\n\t
this.right_zhuazi.y = 60;
\n\t
this.ganNode.addChild(this.left_zhuazi);
\n\t
this.ganNode.addChild(this.right_zhuazi);
\n\t
this.ganNode.addChild(this.connect);
\n\t
this.ganNode.x = 30;
\n\t
this.ganNode.y = this.ganNode.y - 263;
\n\t
this.zhuaziY = this.ganNode.y;
\n\t
this.moveNode.addChild(this.ganzi);
\n\t
this.moveNode.addChild(this.ganNode);
\n\t
this.moveNode.addChild(this.bashou);
\n\t
this.moveNode.x = 262;
\n\t
this.bashouGan.y = this.bashouGan.y;
\n\t
this.moveNode.y = this.moveNode.y;
\n\t
this.addChild(this.bashouGan);
\n\t
this.addChild(this.moveNode);
\n\t
if (!props.ganziShow) {
\n\t
this.bashouGan.visible = false;
\n\t
}
\n\t
if (!props.bashouShow) {
\n\t
this.bashou.visible = false;
\n\t
}
\n\t
this.createPrizeBox();
\n\t
};
\n\t
Zhuazi.prototype.createPrizeBox = function () {
\n\t
var _this = this;
\n\t
for (var i = 0; i < props.dollNum; i++) {
\n\t
if (!new engine.Sprite(getTextureByName('prizebox_' + i))) {
\n\t
return;
\n\t
}
\n\t
this.prizeBoxs[i] = new engine.Sprite(getTextureByName('prizebox_' + i));
\n\t
this.prizeBoxs[i]['npcType'] = 'box' + i;
\n\t
}
\n\t
this.prizeBoxs[props.dollNum] = new engine.Sprite(getTextureByName('prizebox_0'));
\n\t
this.prizeBoxs[props.dollNum]['npcType'] = 'box' + props.dollNum;
\n\t
this.prizeBoxs.forEach(function (item) {
\n\t
_this.ganNode.addChild(item);
\n\t
item.visible = false;
\n\t
item.x = props.prizeBoxInitX;
\n\t
item.y = props.prizeBoxInitY;
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.showPrizeBox = function () {
\n\t
var _this = this;
\n\t
this.prizeBoxs.forEach(function (item) {
\n\t
console.log(_this.GameView.getBox()['npcType']);
\n\t
if (item['npcType'] === _this.GameView.getBox()['npcType']) {
\n\t
item.visible = true;
\n\t
_this.itemShow = item;
\n\t
}
\n\t
else {
\n\t
item.visible = false;
\n\t
}
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.move = function () {
\n\t
var _this = this;
\n\t
var rndist = Math.random();
\n\t
var halfWidth = this.bashou.width / 2;
\n\t
var randomX = rndist * (rndist > 0.5 ? 1 : -1) * props.bashouMoveDist;
\n\t
console.log(randomX);
\n\t
engine.Tween.get(this.moveNode).to({ x: 370 + halfWidth - 71 }, 1000).call(function () {
\n\t
_this.zhangkai();
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.zhangkai = function () {
\n\t
var _this = this;
\n\t
this.left_zhuazi.anchorX = this.left_zhuazi.width;
\n\t
this.left_zhuazi.anchorY = 0;
\n\t
engine.Tween.get(this.left_zhuazi, { loop: false }).to({ rotation: props.leftRotation }, 1000);
\n\t
engine.Tween.get(this.right_zhuazi, { loop: false }).to({ rotation: props.rightRotation }, 1000);
\n\t
setTimeout(function () {
\n\t
_this.getLong();
\n\t
}, 500);
\n\t
};
\n\t
Zhuazi.prototype.getLong = function () {
\n\t
var _this = this;
\n\t
var droptime = Number((this.GameView.getMoveX() / 60 - 1).toFixed(2)) * 1000;
\n\t
console.log('dr', droptime);
\n\t
var times = (props.ganMoveEndY - this.ganzi.y) / this.ganzi.height;
\n\t
console.log(Number(times.toFixed(2)));
\n\t
engine.Tween.get(this.ganzi).to({ scaleY: Number(times.toFixed(2)) }, droptime).to({ scaleY: 1 }, droptime);
\n\t
console.log('node', this.zhuaziY);
\n\t
engine.Tween.get(this.ganNode).to({ y: props.ganMoveEndY }, droptime).call(function () {
\n\t
_this.GameView.stopMove();
\n\t
if (_this.GameView.ifPrize) {
\n\t
_this.showPrizeBox();
\n\t
_this.GameView.setVisible(false);
\n\t
}
\n\t
}).to({ y: this.zhuaziY }, droptime).call(function () {
\n\t
if (_this.GameView.ifPrize) {
\n\t
_this.itemShow.visible = false;
\n\t
}
\n\t
engine.globalEvent.dispatchEvent('doll-machine2-game-end');
\n\t
});
\n\t
};
\n\t
Zhuazi.prototype.getReset = function () {
\n\t
this.left_zhuazi.anchorX = this.left_zhuazi.width;
\n\t
this.left_zhuazi.anchorY = 0;
\n\t
engine.Tween.get(this.moveNode, { loop: false }).to({ x: 262 }, 1000);
\n\t
engine.Tween.get(this.left_zhuazi, { loop: false }).to({ rotation: 0 }, 1000);
\n\t
engine.Tween.get(this.right_zhuazi, { loop: false }).to({ rotation: 0 }, 1000);
\n\t
this.GameView.resetMoveX();
\n\t
};
\n\t
return Zhuazi;
\n\t
}(engine.Container));
\n\t
//# sourceMappingURL=Zhuazi.js.map
\n\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.startstatus = true;
\n\t
_this.ifPrize = true;
\n\t
_this.goodsItems = [];
\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
var _this = this;
\n\t
if (this._hasSetup) {
\n\t
return;
\n\t
}
\n\t
this._hasSetup = true;
\n\t
var frontBoxs = (this._frontBoxs = new FrontBoxs());
\n\t
this._frontBoxs.GameView = this;
\n\t
var backBoxs = (this._backBoxs = new BackBoxs());
\n\t
this._Zhuazi = new Zhuazi();
\n\t
this._Zhuazi.GameView = this;
\n\t
this.frontTransfer = new engine.Container();
\n\t
this.backTransfer = new engine.Container();
\n\t
this.frontTransfer.width = 0;
\n\t
this.frontTransfer.height = 0;
\n\t
this.frontTransfer.alpha = 1;
\n\t
this.backTransfer.width = 0;
\n\t
this.backTransfer.height = 0;
\n\t
this.backTransfer.alpha = 1;
\n\t
this.rect = new engine.Rect();
\n\t
this.rect.width = props.gameStageWidth;
\n\t
this.rect.height = props.gameStageHeight;
\n\t
this.rect.x = 65;
\n\t
this.rect.y = 0;
\n\t
this.NpcBg = new engine.Container();
\n\t
this.NpcBg.x = 0;
\n\t
this.NpcBg.y = 0;
\n\t
this.addChild(this.NpcBg);
\n\t
this.addChild(this.rect);
\n\t
this.frontDesk = new engine.Sprite(getTextureByName(
\"
前传输带
\"
));
\n\t
this.frontDesk.x = props.initOffsetLeft;
\n\t
this.frontDesk.y = props.frontDeskY - props.initOffsetTop;
\n\t
this.backDesk = new engine.Sprite(getTextureByName(
\"
后传输带
\"
));
\n\t
this.backDesk.x = props.initOffsetLeft;
\n\t
this.backDesk.y = props.backDeskY - props.initOffsetTop;
\n\t
if (props.single) {
\n\t
this.backDesk.visible = false;
\n\t
}
\n\t
var pcarr = [this.backDesk, this.frontDesk, this.backTransfer, this.frontTransfer, this._Zhuazi];
\n\t
pcarr.forEach(function (item) {
\n\t
_this.NpcBg.addChild(item);
\n\t
});
\n\t
this.NpcBg.mask = this.rect;
\n\t
this._Zhuazi.setup();
\n\t
this.backTransfer.addChild(this._backBoxs);
\n\t
this._backBoxs.setup();
\n\t
if (props.single) {
\n\t
this.backTransfer.visible = false;
\n\t
}
\n\t
this.frontTransfer.addChild(this._frontBoxs);
\n\t
this._frontBoxs.setup();
\n\t
};
\n\t
GameView.prototype.stopMove = function () {
\n\t
this._frontBoxs.stop();
\n\t
};
\n\t
GameView.prototype.setMoveX = function (x, item) {
\n\t
this.moveTime = x;
\n\t
this.prizeBox = item;
\n\t
this._Zhuazi.move();
\n\t
};
\n\t
GameView.prototype.setVisible = function (isshow) {
\n\t
this._frontBoxs.showHidePrizeBox(isshow);
\n\t
};
\n\t
GameView.prototype.getMoveX = function () {
\n\t
return this.moveTime;
\n\t
};
\n\t
GameView.prototype.resetMoveX = function () {
\n\t
this.moveTime = null;
\n\t
};
\n\t
GameView.prototype.getBox = function () {
\n\t
return this.prizeBox;
\n\t
};
\n\t
GameView.prototype.reset = function () {
\n\t
this.startstatus = false;
\n\t
this.ifPrize = false;
\n\t
this._Zhuazi.getReset();
\n\t
};
\n\t
GameView.prototype.start = function (type) {
\n\t
if (type === void 0) { type = null; }
\n\t
this.speed = 1;
\n\t
this.gameIng = true;
\n\t
console.log('执行', type);
\n\t
this.startstatus = true;
\n\t
this.ifPrize = type && type.prize || false;
\n\t
};
\n\t
GameView.prototype.beginNpc = function () {
\n\t
var _this = this;
\n\t
this.timer = setTimeout(function () {
\n\t
if (_this.gameIng) ;
\n\t
}, 2000 / this.speed);
\n\t
};
\n\t
GameView.prototype.pause = function () {
\n\t
this.gameIng = false;
\n\t
};
\n\t
GameView.prototype.revive = function () {
\n\t
this.gameIng = true;
\n\t
};
\n\t
GameView.prototype.resume = function () {
\n\t
this.reset();
\n\t
this.start();
\n\t
};
\n\t
return GameView;
\n\t
}(engine.Container));
\n\t
//# sourceMappingURL=GameView.js.map
\n\n\t
var GameWrapper = (function (_super) {
\n\t
tslib.__extends(GameWrapper, _super);
\n\t
function GameWrapper() {
\n\t
var _this = _super.call(this) || this;
\n\t
engine.globalEvent.addEventListener('doll-machine2-game-init', _this.reset, _this);
\n\t
engine.globalEvent.addEventListener('doll-machine2-game-start', _this.start, _this);
\n\t
var gameView = _this._gameView = new GameView();
\n\t
_this.addChild(gameView);
\n\t
return _this;
\n\t
}
\n\t
GameWrapper.prototype.reset = function (event) {
\n\t
injectProps(event.data);
\n\t
this._gameView.visible = true;
\n\t
this._gameView.reset();
\n\t
};
\n\t
GameWrapper.prototype.start = function (event) {
\n\t
console.log('监听开始');
\n\t
injectProps(event.data);
\n\t
this._gameView.start(event.data);
\n\t
};
\n\t
GameWrapper.prototype.pause = function () {
\n\t
this._gameView.pause();
\n\t
};
\n\t
GameWrapper.prototype.resume = function () {
\n\t
this._gameView.resume();
\n\t
};
\n\t
GameWrapper.prototype.revive = function () {
\n\t
this._gameView.revive();
\n\t
};
\n\t
GameWrapper.prototype.clear = function () {
\n\t
this._gameView.visible = false;
\n\t
};
\n\t
GameWrapper.prototype.onTap = function (event) {
\n\t
};
\n\t
return GameWrapper;
\n\t
}(engine.Container));
\n\t
//# sourceMappingURL=GameWrapper.js.map
\n\n\t
function index (props) {
\n\t
prepareProps();
\n\t
injectProps(props);
\n\t
var instance = new GameWrapper();
\n\t
return instance;
\n\t
}
\n\t
//# sourceMappingURL=index.js.map
\n\n\t
return index;
\n\n
})));
\n
"
}
dist/customs/open-gift.json
0 → 100644
View file @
d1566d32
{
"name"
:
"拆礼盒"
,
"desc"
:
"拆礼盒模块"
,
"props"
:
{
"initX"
:
{
"alias"
:
"游戏场景初始X位置"
,
"type"
:
"number"
,
"default"
:
0
},
"initY"
:
{
"alias"
:
"游戏场景初始Y位置"
,
"type"
:
"number"
,
"default"
:
0
},
"gameStageWidth"
:
{
"alias"
:
"游戏场景宽度"
,
"type"
:
"number"
,
"default"
:
534
},
"gameStageHeight"
:
{
"alias"
:
"游戏场景高度"
,
"type"
:
"number"
,
"default"
:
408
}
},
"assets"
:
[
{
"name"
:
"底座"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/d6ed718f0d236febaa4d1331950e5a190f225cb5.png"
,
"uuid"
:
"7a0f8b48-449c-46d9-bd80-64455a30e641"
,
"ext"
:
".png"
},
{
"name"
:
"点缀"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/e08f680bbd26c4dcc47fd67ee2e145c46d6fcd1a.png"
,
"uuid"
:
"c7426dc4-d631-4947-accc-015666277208"
,
"ext"
:
".png"
},
{
"name"
:
"初始礼盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/b9bb4e52c3734025fc96a92cb574c92209927b61.svga"
,
"uuid"
:
"947cb448-1992-49f1-a9ed-e359b944953a"
,
"ext"
:
".svga"
},
{
"name"
:
"拆礼盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8e86f8696710de414f0f36dc330db6e4bd0683d6.svga"
,
"uuid"
:
"d9222991-064c-4816-85ee-6964ba78fbd0"
,
"ext"
:
".svga"
}
],
"events"
:
{
"in"
:
{
"open-gift-game-init"
:
{
"alias"
:
"重置"
},
"open-gift-game-start"
:
{
"alias"
:
"开始"
,
"data"
:
{
"prize"
:
true
}
}
},
"out"
:
{
"open-gift-game-end"
:
{
"alias"
:
"动画完毕"
,
"data"
:
null
}
}
},
"id"
:
"open-gift"
,
"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['open-gift'] = 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\t
//# sourceMappingURL=props.js.map
\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 createSvga(name, anchorName) {
\n\t
var inst = new svga.Svga();
\n\t
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
\n\t
return inst;
\n\t
}
\n\t
//# sourceMappingURL=utils.js.map
\n\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.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
this.NpcBg = new engine.Container();
\n\t
this.NpcBg.x = props.initX;
\n\t
this.NpcBg.y = props.initY;
\n\t
this.addChild(this.NpcBg);
\n\t
this.bottomCircle = new engine.Sprite(getTextureByName('底座'));
\n\t
this.bottomCircle.x = 17;
\n\t
this.bottomCircle.y = 305;
\n\t
this.loveDot = new engine.Sprite(getTextureByName('点缀'));
\n\t
this.loveDot.x = 0;
\n\t
this.loveDot.y = 6;
\n\t
this.giftboxSvga = createSvga('初始礼盒');
\n\t
this.giftboxSvga.x = 105;
\n\t
this.giftboxSvga.y = 37;
\n\t
this.giftAfterSvga = createSvga(
\"
拆礼盒
\"
);
\n\t
this.giftAfterSvga.x = 105;
\n\t
this.giftAfterSvga.y = 0;
\n\t
this.giftAfterSvga.visible = false;
\n\t
this.NpcBg.addChild(this.bottomCircle);
\n\t
this.NpcBg.addChild(this.giftboxSvga);
\n\t
this.NpcBg.addChild(this.giftAfterSvga);
\n\t
this.NpcBg.addChild(this.loveDot);
\n\t
this.giftboxSvga.play(false, true);
\n\t
};
\n\t
GameView.prototype.reset = function () {
\n\t
this.giftboxSvga.visible = true;
\n\t
this.giftAfterSvga.visible = false;
\n\t
};
\n\t
GameView.prototype.start = function () {
\n\t
this.giftAfterSvga.visible = true;
\n\t
this.giftboxSvga.visible = false;
\n\t
this.giftAfterSvga.play(false, false);
\n\t
this.giftAfterSvga.once(engine.Event.END_FRAME, function () {
\n\t
engine.globalEvent.dispatchEvent('open-gift-game-end');
\n\t
}, this);
\n\t
};
\n\t
GameView.prototype.resume = function () {
\n\t
this.reset();
\n\t
this.start();
\n\t
};
\n\t
return GameView;
\n\t
}(engine.Container));
\n\n\t
var GameWrapper = (function (_super) {
\n\t
tslib.__extends(GameWrapper, _super);
\n\t
function GameWrapper() {
\n\t
var _this = _super.call(this) || this;
\n\t
engine.globalEvent.addEventListener('open-gift-game-init', _this.reset, _this);
\n\t
engine.globalEvent.addEventListener('open-gift-game-start', _this.start, _this);
\n\t
var gameView = _this._gameView = new GameView();
\n\t
_this.addChild(gameView);
\n\t
return _this;
\n\t
}
\n\t
GameWrapper.prototype.reset = function (event) {
\n\t
injectProps(event.data);
\n\t
this._gameView.visible = true;
\n\t
this._gameView.reset();
\n\t
};
\n\t
GameWrapper.prototype.start = function (event) {
\n\t
console.log('监听开始');
\n\t
injectProps(event.data);
\n\t
this._gameView.start();
\n\t
};
\n\t
GameWrapper.prototype.clear = function () {
\n\t
this._gameView.visible = false;
\n\t
};
\n\t
return GameWrapper;
\n\t
}(engine.Container));
\n\t
//# sourceMappingURL=GameWrapper.js.map
\n\n\t
function index (props) {
\n\t
prepareProps();
\n\t
injectProps(props);
\n\t
var instance = new GameWrapper();
\n\t
return instance;
\n\t
}
\n\t
//# sourceMappingURL=index.js.map
\n\n\t
return index;
\n\n
})));
\n
"
}
src/custom/doll-machine/debug/main.js
View file @
d1566d32
...
...
@@ -4,23 +4,12 @@
(
global
=
global
||
self
,
global
[
'doll-machine'
]
=
factory
(
global
.
tslib
));
}(
this
,
(
function
(
tslib
)
{
'use strict'
;
var
props
=
{};
function
prepareProps
()
{
var
metaProps
=
getProps
();
engine
.
injectProp
(
props
,
metaProps
);
}
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
//# sourceMappingURL=props.js.map
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
//# sourceMappingURL=utils.js.map
var
Goods
=
(
function
(
_super
)
{
tslib
.
__extends
(
Goods
,
_super
);
...
...
@@ -88,7 +77,6 @@
});
return
Goods
;
}(
engine
.
Container
));
//# sourceMappingURL=Goods.js.map
var
ObjectPool
=
engine
.
ObjectPool
;
var
PoolName
=
'goods'
;
...
...
@@ -97,7 +85,15 @@
},
function
(
item
,
data
)
{
item
.
reset
();
});
//# sourceMappingURL=object-pool-init.js.map
var
props
=
{};
function
prepareProps
()
{
var
metaProps
=
getProps
();
engine
.
injectProp
(
props
,
metaProps
);
}
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
var
FrontBoxs
=
(
function
(
_super
)
{
tslib
.
__extends
(
FrontBoxs
,
_super
);
...
...
@@ -111,7 +107,7 @@
this
.
box1
=
new
engine
.
Sprite
(
getTextureByName
(
"狗盒"
));
this
.
box1
[
"npcType"
]
=
"box1"
;
initX
=
this
.
box1
.
x
=
435
;
initY
=
this
.
box1
.
y
=
73
4
;
initY
=
this
.
box1
.
y
=
61
4
;
this
.
box2
=
new
engine
.
Sprite
(
getTextureByName
(
"猫盒"
));
this
.
box2
[
"npcType"
]
=
"box2"
;
this
.
box3
=
new
engine
.
Sprite
(
getTextureByName
(
"草泥马盒"
));
...
...
@@ -143,7 +139,7 @@
if
(
item
.
x
>=
750
)
{
var
lastitem
=
_this
.
frontBoxs
.
shift
();
lastitem
.
x
=
_this
.
frontBoxs
[
_this
.
frontBoxs
.
length
-
1
].
x
-
_this
.
box1
.
width
-
props
.
frontmargin
;
if
(
!
_this
.
GameView
.
getMoveX
()
&&
item
.
x
<=
0
)
{
if
(
!
_this
.
GameView
.
getMoveX
()
&&
item
.
x
<=
0
&&
_this
.
GameView
.
startstatus
)
{
_this
.
GameView
.
setMoveX
((
370
-
item
.
x
-
13
)
/
props
.
moveSpeed
,
item
);
_this
.
hideBox
=
item
;
}
...
...
@@ -168,17 +164,15 @@
}
BackBoxs
.
prototype
.
setup
=
function
()
{
var
initX
,
initY
=
0
;
this
.
box1
=
new
engine
.
Sprite
(
getTextureByName
(
"狗盒"
));
this
.
box1
=
new
engine
.
Sprite
(
getTextureByName
(
"
后
狗盒"
));
initX
=
this
.
box1
.
x
=
188
;
initY
=
this
.
box1
.
y
=
70
6
;
this
.
box2
=
new
engine
.
Sprite
(
getTextureByName
(
"猫盒"
));
this
.
box3
=
new
engine
.
Sprite
(
getTextureByName
(
"草泥马盒"
));
this
.
box4
=
new
engine
.
Sprite
(
getTextureByName
(
"狗盒"
));
this
.
box5
=
new
engine
.
Sprite
(
getTextureByName
(
"猫盒"
));
initY
=
this
.
box1
.
y
=
61
6
;
this
.
box2
=
new
engine
.
Sprite
(
getTextureByName
(
"
后
猫盒"
));
this
.
box3
=
new
engine
.
Sprite
(
getTextureByName
(
"
后
草泥马盒"
));
this
.
box4
=
new
engine
.
Sprite
(
getTextureByName
(
"
后
狗盒"
));
this
.
box5
=
new
engine
.
Sprite
(
getTextureByName
(
"
后
猫盒"
));
this
.
backBoxs
=
[
this
.
box1
,
this
.
box2
,
this
.
box3
,
this
.
box4
,
this
.
box5
];
for
(
var
i
=
0
;
i
<
this
.
backBoxs
.
length
;
i
++
)
{
this
.
backBoxs
[
i
].
scaleX
=
0.5
;
this
.
backBoxs
[
i
].
scaleY
=
0.5
;
if
(
i
==
0
)
{
this
.
backBoxs
[
i
].
x
=
initX
;
}
...
...
@@ -203,7 +197,6 @@
};
return
BackBoxs
;
}(
engine
.
Container
));
//# sourceMappingURL=backBox.js.map
var
Zhuazi
=
(
function
(
_super
)
{
tslib
.
__extends
(
Zhuazi
,
_super
);
...
...
@@ -217,29 +210,27 @@
this
.
ganNode
=
new
engine
.
Container
();
this
.
moveNode
=
new
engine
.
Container
();
this
.
ganNode
.
x
=
280
;
this
.
ganNode
.
y
=
425
;
this
.
ganNode
.
y
=
350
;
this
.
bashouGan
=
new
engine
.
Sprite
(
getTextureByName
(
"把手杆子"
));
this
.
bashouGan
.
x
=
60
;
this
.
bashouGan
.
y
=
342
;
this
.
bashouGan
.
y
=
275
;
this
.
bashou
=
new
engine
.
Sprite
(
getTextureByName
(
"把手"
));
this
.
bashou
.
x
=
0
;
this
.
bashou
.
y
=
320
;
this
.
bashou
.
y
=
263
;
this
.
ganzi
=
new
engine
.
Sprite
(
getTextureByName
(
"伸缩杆"
));
this
.
ganzi
.
x
=
97
;
this
.
ganzi
.
y
=
382
;
this
.
ganzi
.
y
=
290
;
this
.
connect
=
new
engine
.
Sprite
(
getTextureByName
(
"连接点"
));
this
.
connect
.
x
=
20
;
this
.
connect
.
y
=
0
;
this
.
connect
.
x
=
18
;
this
.
connect
.
y
=
-
5
;
this
.
left_zhuazi
=
new
engine
.
Sprite
(
getTextureByName
(
"左爪"
));
this
.
left_zhuazi
.
x
=
0
;
this
.
left_zhuazi
.
x
=
-
15
;
this
.
left_zhuazi
.
y
=
60
;
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
this
.
left_zhuazi
.
rotation
=
30
;
this
.
right_zhuazi
=
new
engine
.
Sprite
(
getTextureByName
(
"右爪"
));
this
.
right_zhuazi
.
x
=
83
;
this
.
right_zhuazi
.
x
=
98
;
this
.
right_zhuazi
.
y
=
60
;
this
.
right_zhuazi
.
rotation
=
-
30
;
this
.
ganNode
.
addChild
(
this
.
left_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
right_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
connect
);
...
...
@@ -255,21 +246,21 @@
};
Zhuazi
.
prototype
.
createPrizeBox
=
function
()
{
var
_this
=
this
;
this
.
box1
=
new
engine
.
Sprite
(
getTextureByName
(
"狗盒"
));
this
.
box1
=
new
engine
.
Sprite
(
getTextureByName
(
"
中奖
狗盒"
));
this
.
box1
[
"npcType"
]
=
"box1"
;
this
.
box2
=
new
engine
.
Sprite
(
getTextureByName
(
"猫盒"
));
this
.
box2
=
new
engine
.
Sprite
(
getTextureByName
(
"
中奖
猫盒"
));
this
.
box2
[
"npcType"
]
=
"box2"
;
this
.
box3
=
new
engine
.
Sprite
(
getTextureByName
(
"草泥马盒"
));
this
.
box3
=
new
engine
.
Sprite
(
getTextureByName
(
"
中奖
草泥马盒"
));
this
.
box3
[
"npcType"
]
=
"box3"
;
this
.
box4
=
new
engine
.
Sprite
(
getTextureByName
(
"狗盒"
));
this
.
box4
=
new
engine
.
Sprite
(
getTextureByName
(
"
中奖
狗盒"
));
this
.
box4
[
"npcType"
]
=
"box4"
;
this
.
box5
=
new
engine
.
Sprite
(
getTextureByName
(
"猫盒"
));
this
.
box5
=
new
engine
.
Sprite
(
getTextureByName
(
"
中奖
猫盒"
));
this
.
box5
[
"npcType"
]
=
"box5"
;
this
.
prizeBoxs
=
[
this
.
box1
,
this
.
box2
,
this
.
box3
,
this
.
box4
,
this
.
box5
];
this
.
prizeBoxs
.
forEach
(
function
(
item
)
{
_this
.
ganNode
.
addChild
(
item
);
item
.
visible
=
false
;
item
.
x
=
-
15
;
item
.
x
=
15
;
item
.
y
=
48
;
});
};
...
...
@@ -316,30 +307,35 @@
console
.
log
(
'node'
,
this
.
zhuaziY
);
engine
.
Tween
.
get
(
this
.
ganNode
).
to
({
y
:
props
.
ganMoveEndY
},
droptime
).
call
(
function
()
{
_this
.
GameView
.
stopMove
();
_this
.
showPrizeBox
();
_this
.
GameView
.
setVisible
(
false
);
if
(
_this
.
GameView
.
ifPrize
)
{
_this
.
showPrizeBox
();
_this
.
GameView
.
setVisible
(
false
);
}
}).
to
({
y
:
this
.
zhuaziY
},
droptime
).
call
(
function
()
{
engine
.
globalEvent
.
dispatchEvent
(
'doll-mac-getprize'
);
_this
.
getReset
();
if
(
_this
.
GameView
.
ifPrize
)
{
_this
.
itemShow
.
visible
=
false
;
}
engine
.
globalEvent
.
dispatchEvent
(
'doll-machine-gameover'
);
});
};
Zhuazi
.
prototype
.
getReset
=
function
()
{
this
.
itemShow
.
visible
=
false
;
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
engine
.
Tween
.
get
(
this
.
moveNode
,
{
loop
:
false
}).
to
({
x
:
262
},
1000
);
engine
.
Tween
.
get
(
this
.
left_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
0
},
1000
);
engine
.
Tween
.
get
(
this
.
right_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
0
},
1000
);
this
.
GameView
.
resetMoveX
();
};
return
Zhuazi
;
}(
engine
.
Container
));
//# sourceMappingURL=Zhuazi.js.map
var
ObjectPool$1
=
engine
.
ObjectPool
;
var
GameView
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameView
,
_super
);
function
GameView
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
startstatus
=
false
;
_this
.
ifPrize
=
false
;
_this
.
goodsItems
=
[];
_this
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
_this
.
setup
,
_this
);
return
_this
;
...
...
@@ -366,20 +362,20 @@
this
.
rect
.
width
=
611
;
this
.
rect
.
height
=
704
;
this
.
rect
.
x
=
65
;
this
.
rect
.
y
=
26
7
;
this
.
rect
.
y
=
26
3
;
this
.
NpcBg
=
new
engine
.
Container
();
this
.
addChild
(
this
.
NpcBg
);
this
.
addChild
(
this
.
rect
);
var
gameBg
=
new
engine
.
Sprite
(
getTextureByName
(
"游戏背景"
));
gameBg
.
x
=
65
;
gameBg
.
y
=
26
7
;
gameBg
.
y
=
26
3
;
this
.
NpcBg
.
addChild
(
gameBg
);
this
.
frontDesk
=
new
engine
.
Sprite
(
getTextureByName
(
"前传输带"
));
this
.
frontDesk
.
x
=
60
;
this
.
frontDesk
.
y
=
904
;
this
.
frontDesk
.
y
=
781
;
this
.
backDesk
=
new
engine
.
Sprite
(
getTextureByName
(
"后传输带"
));
this
.
backDesk
.
x
=
60
;
this
.
backDesk
.
y
=
810
;
this
.
backDesk
.
y
=
712
;
this
.
NpcBg
.
addChild
(
this
.
backDesk
);
this
.
NpcBg
.
addChild
(
this
.
frontDesk
);
this
.
NpcBg
.
addChild
(
this
.
backTransfer
);
...
...
@@ -404,39 +400,26 @@
this
.
_frontBoxs
.
showHidePrizeBox
(
isshow
);
};
GameView
.
prototype
.
getMoveX
=
function
()
{
console
.
log
(
222
);
return
this
.
moveTime
;
};
GameView
.
prototype
.
resetMoveX
=
function
()
{
this
.
moveTime
=
null
;
};
GameView
.
prototype
.
getBox
=
function
()
{
return
this
.
prizeBox
;
};
GameView
.
prototype
.
reset
=
function
()
{
this
.
recycleGoods
();
this
.
startstatus
=
false
;
this
.
ifPrize
=
false
;
this
.
_Zhuazi
.
getReset
();
};
GameView
.
prototype
.
start
=
function
()
{
var
_this
=
this
;
this
.
score
=
0
;
GameView
.
prototype
.
start
=
function
(
type
)
{
if
(
type
===
void
0
)
{
type
=
null
;
}
this
.
speed
=
1
;
this
.
gameIng
=
true
;
this
.
countdown
=
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
);
console
.
log
(
'执行'
,
type
);
this
.
startstatus
=
true
;
this
.
ifPrize
=
type
&&
type
.
prize
||
false
;
};
GameView
.
prototype
.
beginNpc
=
function
()
{
var
_this
=
this
;
...
...
@@ -519,19 +502,13 @@
};
return
GameView
;
}(
engine
.
Container
));
//# sourceMappingURL=GameView.js.map
var
GameWrapper
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameWrapper
,
_super
);
function
GameWrapper
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
'doll-machine-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
);
engine
.
globalEvent
.
addEventListener
(
'doll-machine-prize'
,
_this
.
start
,
_this
);
var
gameView
=
_this
.
_gameView
=
new
GameView
();
_this
.
addChild
(
gameView
);
return
_this
;
...
...
@@ -542,9 +519,9 @@
this
.
_gameView
.
reset
();
};
GameWrapper
.
prototype
.
start
=
function
(
event
)
{
console
.
log
(
'监听开始'
);
injectProps
(
event
.
data
);
this
.
_status
=
1
;
this
.
_gameView
.
start
();
this
.
_gameView
.
start
(
event
.
data
);
};
GameWrapper
.
prototype
.
pause
=
function
()
{
this
.
_gameView
.
pause
();
...
...
@@ -562,7 +539,6 @@
};
return
GameWrapper
;
}(
engine
.
Container
));
//# sourceMappingURL=GameWrapper.js.map
function
index
(
props
)
{
prepareProps
();
...
...
@@ -570,7 +546,6 @@
var
instance
=
new
GameWrapper
();
return
instance
;
}
//# sourceMappingURL=index.js.map
return
index
;
...
...
src/custom/doll-machine/debug/main.js.map
View file @
d1566d32
{"version":3,"file":"index.js","sources":["src/custom/doll-machine/src/props.ts","src/custom/doll-machine/src/game/utils.ts","src/custom/doll-machine/src/game/Goods.ts","src/custom/doll-machine/src/game/object-pool-init.ts","src/custom/doll-machine/src/game/frontBox.ts","src/custom/doll-machine/src/game/backBox.ts","src/custom/doll-machine/src/game/Zhuazi.ts","src/custom/doll-machine/src/game/GameView.ts","src/custom/doll-machine/src/game/GameWrapper.ts","src/custom/doll-machine/src/index.ts"],"sourcesContent":["/**\n * Created by rockyl on 2020-01-21.\n */\n\nexport let props: any = {};\n\nexport function prepareProps() {\n\tlet metaProps = getProps();\n\n\tengine.injectProp(props, metaProps);\n}\n\nexport function injectProps(p) {\n\tengine.injectProp(props, p);\n}\n","/**\n * Created by rockyl on 2020-01-21.\n */\n\nexport function getTexture(uuid) {\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\n}\n\nexport function getTextureByName(name) {\n\treturn getTexture(engine.getAssetByName(name).uuid);\n}\n\nexport function playSound(name) {\n\tengine.playSound(engine.getAssetByName(name).uuid, {keep: true});\n}\nexport function createSvga(name, anchorName?) {\n\tlet inst = new svga.Svga();\n\tinst.source = 'asset://' + engine.getAssetByName(name).uuid;\n\treturn inst;\n}","/**\n * Created by rockyl on 2020-02-02.\n *\n * 掉落物品\n */\nimport { getTextureByName } from \"./utils\";\nimport { props } from \"../props\";\n\nexport class Goods extends engine.Container {\n private _body: engine.Rect;\n private _toY;\n\n constructor() {\n super();\n\n let body;\n body = this._body = new engine.Rect();\n\n // let rain = new engine.Sprite(getTextureByName('雨滴'));\n // rain[\"npcType\"]=\"rain\"\n // let stone = new engine.Sprite(getTextureByName('石块'));\n // stone[\"npcType\"]=\"stone\"\n // let boom = new engine.Sprite(getTextureByName('炸弹'));\n // boom[\"npcType\"]=\"boom\"\n\n let box1 = new engine.Sprite(getTextureByName(\"草泥马盒\"));\n box1[\"npcType\"] = \"box1\";\n let box2 = new engine.Sprite(getTextureByName(\"狗盒\"));\n box2[\"npcType\"] = \"box2\";\n let box3 = new engine.Sprite(getTextureByName(\"猫盒\"));\n box3[\"npcType\"] = \"box3\";\n\n // rain.visible=false;\n // stone.visible=false;\n // boom.visible=false;\n // body.addChild(rain)\n // body.addChild(stone)\n // body.addChild(boom)\n\n box1.visible = false;\n box2.visible = false;\n box3.visible = false;\n body.addChild(box1);\n body.addChild(box2);\n body.addChild(box3);\n\n this.addChild(body);\n body.width = 0.0001;\n body.height = 0.0001;\n body.mouseEnabled = false;\n }\n\n getRandomNumberByRange(start, end) {\n return Math.floor(Math.random() * (end - start) + start);\n }\n\n // reset() {\n // \tthis.visible = true;\n // \tthis.rotation = 0;\n // \tthis.anchorOffsetY = 0;\n // \tthis.y = 0;\n // \tthis.x = (750-120)*Math.random()+30;\n // \tthis.rotation = 0;\n // \tlet random=Math.random()\n\n // \tif(random<props.goodsProbability[0]){\n // \t\tthis.showNpc(\"box1\")\n // \t}else if(random>=props.goodsProbability[0]&&random<=(props.goodsProbability[0]+props.goodsProbability[1])){\n // \t\tthis.showNpc(\"box2\")\n // \t}else if(random>(props.goodsProbability[0]+props.goodsProbability[1])){\n // \t\tthis.showNpc(\"box3\")\n // \t}\n // }\n\n reset() {\n this.visible = true;\n this.y = 200;\n this.x = 0;\n this.rotation = 0;\n let random = Math.random();\n if (random < 0.3) {\n this.showNpc(\"box1\");\n } else if (random < 0.6) {\n this.showNpc(\"box2\");\n } else {\n this.showNpc(\"box3\");\n }\n // this.showNpc(\"box1\");\n // this.showNpc(\"box2\");\n // this.showNpc(\"box3\");\n }\n\n showNpc(type) {\n for (let i = 0; i < this._body.children.length; i++) {\n this._body.children[i].visible = false;\n this._body.children[i].mouseEnabled = false;\n }\n for (let i = 0; i < this._body.children.length; i++) {\n if (this._body.children[i][\"npcType\"] == type) {\n this[\"npcType\"] = type;\n console.log(type);\n\n this._body.children[i].visible = true;\n this._body.children[i].mouseEnabled = false;\n }\n }\n }\n\n set anchorOffsetY(v) {\n this._body.y = v;\n }\n}\n","/**\n * Created by rockyl on 2020-02-03.\n */\n\nimport {Goods} from \"./Goods\";\nimport ObjectPool = engine.ObjectPool;\n\nexport const PoolName: string = 'goods';\n\nObjectPool.registerPool(PoolName, function () {\n\treturn new Goods();\n}, function (item: Goods, data) {\n\titem.reset();\n});\n","import { getTextureByName } from \"./utils\";\nimport GameView from './GameView';\nimport { props } from \"../props\";\nexport class FrontBoxs extends engine.Container {\n //盒子1\n private box1: engine.Container;\n //盒子2\n private box2: engine.Container;\n //盒子3\n private box3: engine.Container;\n //盒子4\n private box4: engine.Container;\n //盒子5\n private box5: engine.Container;\n // 需隐藏的盒子\n private hideBox: engine.Container;\n private frontBoxs=[];\n public GameView: GameView;\n constructor() {\n super();\n }\n setup() {\n let initX , initY = 0;\n this.box1 = new engine.Sprite(getTextureByName(\"狗盒\"));\n this.box1[\"npcType\"] = \"box1\";\n initX = this.box1.x = 435;\n initY = this.box1.y = 734;\n\n this.box2 = new engine.Sprite(getTextureByName(\"猫盒\"));\n this.box2[\"npcType\"] = \"box2\";\n this.box3 = new engine.Sprite(getTextureByName(\"草泥马盒\"));\n this.box3[\"npcType\"] = \"box3\";\n this.box4 = new engine.Sprite(getTextureByName(\"狗盒\"));\n this.box4[\"npcType\"] = \"box4\";\n this.box5 = new engine.Sprite(getTextureByName(\"猫盒\"));\n this.box5[\"npcType\"] = \"box5\";\n this.frontBoxs = [this.box1, this.box2, this.box3, this.box4];\n for(let i = 0; i < this.frontBoxs.length; i++) {\n if(i == 0) {\n this.frontBoxs[i].x = initX ;\n } else {\n this.frontBoxs[i].x = this.frontBoxs[i - 1].x - this.box1.width - props.frontmargin;\n }\n \n this.frontBoxs[i].y = initY;\n this.addChild(this.frontBoxs[i]);\n }\n this.addEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);\n }\n frameMove() {\n this.frontBoxs.forEach((item, index) => {\n item.x += props.moveSpeed;\n if(item.x <=0 && !item.visible) {\n item.visible = true;\n }\n if(item.x >= 750) {\n let lastitem = this.frontBoxs.shift();\n lastitem.x = this.frontBoxs[this.frontBoxs.length - 1].x - this.box1.width - props.frontmargin;\n \n if(!this.GameView.getMoveX() && item.x <= 0) {\n this.GameView.setMoveX((370 - item.x - 13) / props.moveSpeed, item);\n this.hideBox = item;\n }\n this.frontBoxs.push(lastitem);\n }\n })\n }\n stop() {\n // this.removeEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);\n }\n showHidePrizeBox(isshow) {\n this.hideBox.visible = isshow\n }\n}","import { getTextureByName } from \"./utils\";\nimport { props } from \"../props\";\nexport class BackBoxs extends engine.Container {\n //盒子1\n private box1: engine.Container;\n //盒子2\n private box2: engine.Container;\n //盒子3\n private box3: engine.Container;\n //盒子4\n private box4: engine.Container;\n //盒子5\n private box5: engine.Container;\n private backBoxs=[];\n constructor() {\n super();\n }\n setup() {\n let initX , initY = 0;\n this.box1 = new engine.Sprite(getTextureByName(\"狗盒\"));\n initX = this.box1.x = 188;\n initY = this.box1.y = 706;\n\n this.box2 = new engine.Sprite(getTextureByName(\"猫盒\"));\n this.box3 = new engine.Sprite(getTextureByName(\"草泥马盒\"));\n this.box4 = new engine.Sprite(getTextureByName(\"狗盒\"));\n this.box5 = new engine.Sprite(getTextureByName(\"猫盒\"));\n this.backBoxs = [this.box1, this.box2, this.box3, this.box4, this.box5];\n for (let i = 0; i < this.backBoxs.length; i++) {\n this.backBoxs[i].scaleX = 0.5;\n this.backBoxs[i].scaleY = 0.5;\n if(i == 0) {\n this.backBoxs[i].x = initX;\n } else {\n this.backBoxs[i].x = this.backBoxs[i - 1].x + this.backBoxs[i].width + props.backmargin;\n }\n this.backBoxs[i].y = initY;\n \n this.addChild(this.backBoxs[i]);\n }\n this.addEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);\n }\n frameMove() {\n this.backBoxs.forEach((item) => {\n item.x -= props.moveSpeed;\n if (item.x <= 0) {\n let lastitem = this.backBoxs.shift();\n lastitem.x = this.backBoxs[this.backBoxs.length - 1].x + item.width + props.backmargin;\n this.backBoxs.push(lastitem);\n }\n })\n }\n}","import { getTextureByName } from \"./utils\";\nimport { props } from \"../props\";\nimport GameView from './GameView';\nexport class Zhuazi extends engine.Container {\n private bashouGan: engine.Sprite;\n private bashou: engine.Sprite;\n private ganzi: engine.Sprite;\n private left_zhuazi: engine.Sprite;\n private right_zhuazi: engine.Sprite;\n private connect: engine.Sprite;\n private ganNode: engine.Container;\n private moveNode: engine.Container;\n private moveArr = [];\n private zhuaziY;\n //盒子1\n private box1: engine.Container;\n //盒子2\n private box2: engine.Container;\n //盒子3\n private box3: engine.Container;\n //盒子4\n private box4: engine.Container;\n //盒子5\n private box5: engine.Container;\n private itemShow: engine.Container;\n private prizeBoxs = [];\n public GameView: GameView;\n constructor() {\n super();\n }\n setup() {\n this.ganNode = new engine.Container();\n this.moveNode = new engine.Container();\n this.ganNode.x = 280;\n this.ganNode.y = 425;\n this.bashouGan = new engine.Sprite(getTextureByName(\"把手杆子\"));\n this.bashouGan.x = 60;\n this.bashouGan.y = 342;\n this.bashou = new engine.Sprite(getTextureByName(\"把手\"));\n this.bashou.x = 0;\n this.bashou.y = 320;\n this.ganzi = new engine.Sprite(getTextureByName(\"伸缩杆\"));\n this.ganzi.x = 97;\n this.ganzi.y = 382;\n this.connect = new engine.Sprite(getTextureByName(\"连接点\"));\n this.connect.x = 20;\n this.connect.y = 0;\n this.left_zhuazi = new engine.Sprite(getTextureByName(\"左爪\"));\n this.left_zhuazi.x = 0;\n this.left_zhuazi.y = 60;\n this.left_zhuazi.anchorX = this.left_zhuazi.width;\n this.left_zhuazi.anchorY = 0;\n this.left_zhuazi.rotation = 30;\n this.right_zhuazi = new engine.Sprite(getTextureByName(\"右爪\"));\n this.right_zhuazi.x = 83;\n this.right_zhuazi.y = 60;\n this.right_zhuazi.rotation = -30;\n this.ganNode.addChild(this.left_zhuazi);\n this.ganNode.addChild(this.right_zhuazi);\n this.ganNode.addChild(this.connect);\n this.ganNode.x = 30;\n this.zhuaziY = this.ganNode.y;\n this.moveNode.addChild(this.ganzi);\n this.moveNode.addChild(this.ganNode);\n this.moveNode.addChild(this.bashou);\n this.moveNode.x = 262;\n // this.moveNode.\n // this.moveArr = [this.bashou, this.ganzi, this.ganNode];\n this.addChild(this.bashouGan);\n // this.addChild(this.ganzi);\n // this.addChild(this.bashou);\n // this.addChild(this.ganNode);\n this.addChild(this.moveNode);\n this.createPrizeBox();\n // setTimeout(() => {\n // this.move();\n // }, 2000)\n \n }\n createPrizeBox() {\n this.box1 = new engine.Sprite(getTextureByName(\"狗盒\"));\n this.box1[\"npcType\"] = \"box1\";\n this.box2 = new engine.Sprite(getTextureByName(\"猫盒\"));\n this.box2[\"npcType\"] = \"box2\";\n this.box3 = new engine.Sprite(getTextureByName(\"草泥马盒\"));\n this.box3[\"npcType\"] = \"box3\";\n this.box4 = new engine.Sprite(getTextureByName(\"狗盒\"));\n this.box4[\"npcType\"] = \"box4\";\n this.box5 = new engine.Sprite(getTextureByName(\"猫盒\"));\n this.box5[\"npcType\"] = \"box5\";\n this.prizeBoxs = [this.box1, this.box2, this.box3, this.box4, this.box5];\n this.prizeBoxs.forEach(item => {\n this.ganNode.addChild(item);\n item.visible = false;\n item.x = -15;\n item.y = 48;\n })\n }\n showPrizeBox() {\n\n this.prizeBoxs.forEach(item => {\n console.log(this.GameView.getBox()['npcType']);\n if (item['npcType'] === this.GameView.getBox()['npcType']) {\n item.visible = true;\n this.itemShow = item;\n } else {\n item.visible = false;\n }\n })\n \n }\n move() {\n let rndist = Math.random();\n let halfWidth = this.bashou.width / 2;\n let randomX = rndist * (rndist > 0.5 ? 1 : -1) * props.bashouMoveDist;\n console.log(randomX);\n engine.Tween.get(this.moveNode).to({ x: 370 + halfWidth - 71}, 1000).call(() => {\n this.zhangkai();\n });\n // this.moveArr.forEach((item,index) => {\n // engine.Tween.get(item).to({ x: item.x +randomX}, 500).to({x: 370}, 500).call(() => {\n // if (index == this.moveArr.length-1) {\n // this.zhangkai();\n // }\n // });\n // })\n }\n zhangkai() {\n this.left_zhuazi.anchorX = this.left_zhuazi.width;\n this.left_zhuazi.anchorY = 0;\n engine.Tween.get(this.left_zhuazi, { loop: false }).to({ rotation: props.leftRotation}, 1000);\n engine.Tween.get(this.right_zhuazi, { loop: false }).to({ rotation: props.rightRotation }, 1000);\n setTimeout(() => {\n this.getLong();\n }, 500);\n }\n getLong() {\n let droptime = Number((this.GameView.getMoveX() / 60 - 1).toFixed(2)) * 1000;\n console.log('dr', droptime);\n let times = (props.ganMoveEndY - this.ganzi.y ) / this.ganzi.height;\n console.log(Number(times.toFixed(2)) );\n engine.Tween.get(this.ganzi).to({ scaleY: Number(times.toFixed(2)) }, droptime).to({ scaleY: 1 }, droptime)\n console.log('node', this.zhuaziY);\n engine.Tween.get(this.ganNode).to({ y: props.ganMoveEndY }, droptime).call(() => {\n this.GameView.stopMove();\n this.showPrizeBox();\n this.GameView.setVisible(false);\n }).to({ y: this.zhuaziY }, droptime).call(() => {\n engine.globalEvent.dispatchEvent('doll-mac-getprize');\n this.getReset();\n })\n\n // .to({ scaleY: 1 }, droptime)\n // to({ y: this.zhuaziY }, droptime)\n }\n getReset() {\n this.itemShow.visible = false;\n this.left_zhuazi.anchorX = this.left_zhuazi.width;\n this.left_zhuazi.anchorY = 0;\n engine.Tween.get(this.moveNode, {loop: false}).to({x: 262}, 1000);\n engine.Tween.get(this.left_zhuazi, { loop: false }).to({ rotation: 0 }, 1000);\n engine.Tween.get(this.right_zhuazi, { loop: false }).to({ rotation: 0 }, 1000);\n }\n}","/**\n * Created by rockyl on 2018/8/16.\n */\n\nimport { props } from \"../props\";\nimport { playSound, createSvga } from \"./utils\";\nimport ObjectPool = engine.ObjectPool;\nimport { getTextureByName } from \"./utils\";\nimport { Goods } from \"./Goods\";\nimport { PoolName } from \"./object-pool-init\";\nimport { FrontBoxs } from \"./frontBox\";\nimport { BackBoxs } from \"./backBox\";\nimport { Zhuazi } from './Zhuazi';\n\nexport default class GameView extends engine.Container {\n private _hasSetup;\n\n //触摸层\n private rectBg: engine.Rect;\n //npc层\n private NpcBg: engine.Container;\n //盒子1\n private box1: engine.Container;\n //盒子2\n private box2: engine.Container;\n //盒子3\n private box3: engine.Container;\n //盒子4\n private box4: engine.Container;\n //盒子5\n private box5: engine.Container;\n //前传输区域\n private frontTransfer: engine.Container;\n //后传输区域\n private backTransfer: engine.Container;\n //前台板\n private frontDesk: engine.Sprite;\n //后台板\n private backDesk: engine.Sprite;\n private _frontBoxs: FrontBoxs;\n\tprivate _backBoxs: BackBoxs;\n\tprivate _Zhuazi: Zhuazi;\n\tprivate prizeBox: engine.Container;\n\tprivate rect;\n //当前分数\n\tprivate score;\n\t\n\t//中奖盒子移动距离\n\tprivate moveTime;\n\n //游戏状态\n private gameIng;\n\n //npc出身计时器\n private timer;\n //倒计时计时器\n private countdownTimer: any;\n //倒计时\n private countdown: number;\n\n //当前速度\n private speed: number;\n\n // 当前场景上面的物品\n private goodsItems = [];\n\n private _goods: Goods;\n\n constructor() {\n super();\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\n }\n\n // private waterSvga;\n // private boomSvga;\n // private playerSvga;\n\n setup() {\n if (this._hasSetup) {\n return;\n }\n\n this._hasSetup = true;\n\t\tconst frontBoxs = (this._frontBoxs = new FrontBoxs());\n\t\tthis._frontBoxs.GameView = this;\n\t\tconst backBoxs = (this._backBoxs = new BackBoxs());\n\t\tthis._Zhuazi = new Zhuazi();\n\t\tthis._Zhuazi.GameView = this;\n this.frontTransfer = new engine.Container();\n this.backTransfer = new engine.Container();\n this.frontTransfer.width = 0;\n this.frontTransfer.height = 0;\n this.frontTransfer.alpha = 1;\n // this.frontTransfer.x = 0;\n // this.frontTransfer.y = 434;\n\n this.backTransfer.width = 0;\n this.backTransfer.height = 0;\n this.backTransfer.alpha = 1;\n // this.backTransfer.x = 0;\n // this.backTransfer.y = 390;\n\t\tthis.rect = new engine.Rect();\n\t\t// this.rect.width = 608;\n\t\tthis.rect.width = 611;\n\t\tthis.rect.height = 704;\n\t\t// this.rect.x = 71;\n\t\t// this.rect.y = 263;\n\t\tthis.rect.x = 65;\n\t\tthis.rect.y = 267;\n this.NpcBg = new engine.Container();\n // this.NpcBg.alpha = 1;\n // this.NpcBg.width = 0;\n\t\t// this.NpcBg.height = 0;\n\t\tthis.addChild(this.NpcBg);\n\t\tthis.addChild(this.rect);\n\t\t\n\t\t\n\t\t\n\t\tlet gameBg = new engine.Sprite(getTextureByName(\"游戏背景\"));\n\t\tgameBg.x = 65;\n\t\tgameBg.y = 267;\n\t\tthis.NpcBg.addChild(gameBg);\n\t\t\n this.frontDesk = new engine.Sprite(getTextureByName(\"前传输带\"));\n this.frontDesk.x = 60;\n this.frontDesk.y = 904;\n\n this.backDesk = new engine.Sprite(getTextureByName(\"后传输带\"));\n this.backDesk.x = 60;\n this.backDesk.y = 810;\n\n this.NpcBg.addChild(this.backDesk);\n this.NpcBg.addChild(this.frontDesk);\n this.NpcBg.addChild(this.backTransfer);\n\t\tthis.NpcBg.addChild(this.frontTransfer);\n\t\tthis.NpcBg.addChild(this._Zhuazi);\n\n\t\tthis.NpcBg.mask = this.rect;\n\t\tthis._Zhuazi.setup();\n\t\t\n\t\t// this._Zhuazi.move();\n\t\tthis.backTransfer.addChild(this._backBoxs);\n\t\tthis._backBoxs.setup();\n\t\tthis.frontTransfer.addChild(this._frontBoxs);\n\t\tthis._frontBoxs.setup();\n\n //\tthis.player.fillColor=\"rgba(0, 0, 0,1)\"\n //console.log(this.player.fillColor)\n\n // this.rectBg = new engine.Rect();\n // this.rectBg.alpha = 0;\n // this.rectBg.width = 750;\n // this.rectBg.height = 1624;\n // this.addChild(this.rectBg);\n\t}\n\t/**\n\t * \n\t * @param 暂停move\n\t */\n\tstopMove() {\n\t\tthis._frontBoxs.stop();\n\t}\n\t/**\n\t * 赋值x距离值\n\t */\n\tsetMoveX(x, item) {\n\t\tthis.moveTime = x;\n\t\tthis.prizeBox = item;\n\t\tthis._Zhuazi.move();\n\t}\n\t/**\n\t * 显示隐藏盒子\n\t */\n\tsetVisible(isshow) {\n\t\tthis._frontBoxs.showHidePrizeBox(isshow);\n\t}\n\t/**\n\t * 获取中奖盒子移动的距离\n\t */\n\tgetMoveX() {\n\t\tconsole.log(222);\n\t\treturn this.moveTime;\n\t}\n\t/**\n\t * 获取中奖盒子\n\t */\n\tgetBox() {\n\t\treturn this.prizeBox;\n\t}\n /**\n * 重置场景\n */\n reset() {\n\t\tthis.recycleGoods();\n\t\tthis._Zhuazi.getReset();\n }\n\n /**\n * 开始\n */\n start() {\n this.score = 0;\n this.speed = 1;\n this.gameIng = true;\n // this.creatNpc()\n // this.beginNpc();\n this.countdown = props.countDown;\n\n this.countdownTimer = setInterval(() => {\n if (this.gameIng) {\n if (this.countdown > 0) {\n engine.globalEvent.dispatchEvent(\"food-fell-time-update\", {\n time: this.countdown\n });\n this.countdown -= 1;\n } else {\n engine.globalEvent.dispatchEvent(\"food-fell-game-over\", {\n score: this.score,\n reason: 1\n });\n this.died();\n }\n }\n }, 1000);\n }\n\n /**\n * npc开始掉落\n */\n beginNpc() {\n this.timer = setTimeout(() => {\n if (this.gameIng) {\n // this.speed += props.acceleratedSpeed;\n // this.creatNpc()\n }\n //递归执行\n // this.beginNpc();\n }, 2000 / this.speed);\n }\n\n /**\n * 暂停\n */\n pause() {\n this.gameIng = false;\n }\n\n /**\n * 恢复\n */\n revive() {\n this.gameIng = true;\n }\n\n /**\n * 重新开始\n */\n resume() {\n this.reset();\n this.start();\n }\n\n /**\n * 初始化盒子位置\n */\n initNpc() {\n this.box1 = new engine.Sprite(getTextureByName(\"草泥马盒\"));\n this.box2 = new engine.Sprite(getTextureByName(\"狗盒\"));\n this.box3 = new engine.Sprite(getTextureByName(\"猫盒\"));\n this.box4 = new engine.Sprite(getTextureByName(\"草泥马盒\"));\n this.box5 = new engine.Sprite(getTextureByName(\"猫盒\"));\n this.box1.x = 120;\n this.box1.y = 434;\n this.box2.x = 306;\n this.box2.y = 434;\n this.box3.x = 487;\n this.box3.y = 434;\n this.box4.x = 240;\n this.box4.scaleX = 0.5;\n this.box4.scaleY = 0.5;\n this.box4.y = 390;\n this.box5.x = 434;\n this.box5.y = 390;\n this.box5.scaleX = 0.5;\n this.box5.scaleY = 0.5;\n this.backTransfer.addChild(this.box4);\n this.backTransfer.addChild(this.box5);\n this.frontTransfer.addChild(this.box1);\n this.frontTransfer.addChild(this.box2);\n this.frontTransfer.addChild(this.box3);\n }\n\n /**\n * 创建NPC\n */\n // private creatNpc() {\n // // this.initNpc();\n // let goods = (this._goods = <Goods>ObjectPool.getObject(PoolName));\n // console.log(goods);\n // this.goodsItems.push(goods);\n // this.NpcBg.addChild(goods);\n // goods.addEventListener(\n // engine.Event.ENTER_FRAME,\n // (goods[\"onGoodsEnter\"] = () => {\n // if (goods.y > 1624) {\n // this.removeNpc(goods);\n // } else {\n // if (this.gameIng) {\n // //速度叠加\n // // goods.y += (4 * this.speed)\n // goods.x += 2 * this.speed;\n // //如果玩家和物品发生碰撞\n // if (this.hasHit(this.player, goods)) {\n // if (goods[\"npcType\"] == \"rain\") {\n // console.log(\"碰到雨滴\");\n // this.score += props.rainScore;\n // this.waterSvga.visible = true;\n // this.waterSvga.play(false, false);\n // this.waterSvga.once(\n // engine.Event.END_FRAME,\n // () => {\n // this.waterSvga.visible = false;\n // },\n // this\n // );\n // } else if (goods[\"npcType\"] == \"stone\") {\n // console.log(\"碰到石头\");\n // this.score += props.stoneScore;\n // } else if (goods[\"npcType\"] == \"boom\") {\n // console.log(\"碰到炸弹\");\n // this.boomSvga.visible = true;\n // this.boomSvga.play(false, false);\n // this.boomSvga.once(\n // engine.Event.END_FRAME,\n // () => {\n // this.boomSvga.visible = false;\n // },\n // this\n // );\n // engine.globalEvent.dispatchEvent(\"food-fell-game-over\", {\n // score: this.score,\n // reason: 2\n // });\n // this.died();\n // }\n // engine.globalEvent.dispatchEvent(\"food-fell-score-update\", {\n // score: this.score\n // });\n // this.removeNpc(goods);\n // }\n // }\n // }\n // }),\n // this\n // );\n // }\n\n /**\n * 玩家死亡\n */\n private died() {\n this.score = 0;\n this.pause();\n }\n\n /**\n * 回收指定物品\n * @param goods 物品\n */\n private removeNpc(goods) {\n this.NpcBg.removeChild(goods);\n ObjectPool.recycleObject(PoolName, goods);\n goods.removeEventListener(\n engine.Event.ENTER_FRAME,\n goods[\"onGoodsEnter\"],\n this\n );\n let index = this.goodsItems.indexOf(goods);\n if (index > -1) {\n this.goodsItems.splice(index, 1);\n }\n }\n\n /**\n * 回收对象\n */\n private recycleGoods() {\n clearTimeout(this.timer);\n clearInterval(this.countdownTimer);\n for (let goods of this.goodsItems) {\n if (goods) {\n this.removeChild(goods);\n ObjectPool.recycleObject(PoolName, goods);\n goods.removeEventListener(\n engine.Event.ENTER_FRAME,\n goods[\"onGoodsEnter\"],\n this\n );\n }\n }\n this.goodsItems = [];\n }\n\n\n /**\n * 碰撞检测\n * @param a a盒子\n * @param b b盒子\n */\n private hasHit(a, b) {\n if (\n Math.abs(a.x + a.width / 2 - (b.x + b.width / 2)) <\n a.width / 2 + b.width / 2 &&\n Math.abs(a.y + a.height / 2 - (b.y + b.height / 2)) <\n a.height / 2 + b.height / 2\n ) {\n return true;\n } else {\n return false;\n }\n }\n}\n","/**\n * Created by rockyl on 2020-01-09.\n */\n\nimport GameView from \"./GameView\";\nimport {injectProps} from \"../props\";\n\n\nexport class GameWrapper extends engine.Container {\n\tprivate _status;\n\tprivate _gameView: GameView;\n\n\n\n\n\n\tconstructor() {\n\t\tsuper();\n\t\tengine.globalEvent.addEventListener('doll-machine-reset', this.reset, this);\n\t\tengine.globalEvent.addEventListener('food-fell-start', this.start, this);\n\t\tengine.globalEvent.addEventListener('food-fell-pause', this.pause, this);\n\t\tengine.globalEvent.addEventListener('food-fell-resume', this.resume, this);\n\t\tengine.globalEvent.addEventListener('food-fell-revive', this.revive, this);\n\t\tengine.globalEvent.addEventListener('food-fell-clear', this.clear, this);\n\n\t\tthis.addEventListener(engine.MouseEvent.CLICK, this.onTap, this);\n\n\t\tlet gameView = this._gameView = new GameView();\n\t\tthis.addChild(gameView);\n\t\t// gameView.reset()\n\t\t// gameView.start()\n\t}\n\n\treset(event: engine.Event) {\t\t\n\t\tinjectProps(event.data);\n\t\tthis._gameView.visible = true;\n\t\tthis._gameView.reset();\n\t}\n\n\tstart(event: engine.Event) {\n\t\tinjectProps(event.data);\n\t\tthis._status = 1;\n\t\tthis._gameView.start();\n\t}\n\n\tpause() {\n\t\tthis._gameView.pause();\n\t}\n\n\tresume() {\n\t\tthis._gameView.resume();\n\t}\n\n\trevive() {\n\t\tthis._gameView.revive();\n\t}\n\n\tclear() {\n\t\tthis._gameView.visible = false;\n\t}\n\n\tprivate onTap(event) {\n\t//\tthis._gameView.tap(event);\n\t}\n}\n","/**\n * Created by rockyl on 2019-11-20.\n */\n\nimport {GameWrapper} from \"./game/GameWrapper\";\nimport {injectProps, prepareProps} from \"./props\";\n\nexport default function (props) {\n\tprepareProps();\n\tinjectProps(props);\n\n\tlet instance = new GameWrapper();\n\treturn instance;\n}\n"],"names":["__extends","ObjectPool"],"mappings":";;;;;;CAIO,IAAI,KAAK,GAAQ,EAAE,CAAC;UAEX,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;UAEe,WAAW,CAAC,CAAC;KAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC7B,CAAC;;;UCVe,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;AAED,UAAgB,gBAAgB,CAAC,I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4BAAM,GAAN;SACC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;MACxB;KAED,4BAAM,GAAN;SACC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;MACxB;KAED,2BAAK,GAAL;SACC,IAAI,CAAC,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;MAC/B;KAEO,2BAAK,GAAb,UAAc,KAAK;MAElB;KACF,kBAAC;CAAD,CAAC,CAxDgC,MAAM,CAAC,SAAS,GAwDhD;;;iBCzDwB,KAAK;KAC7B,YAAY,EAAE,CAAC;KACf,WAAW,CAAC,KAAK,CAAC,CAAC;KAEnB,IAAI,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;KACjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;;"}
\ No newline at end of file
{"version":3,"file":"index.js","sources":["src/custom/doll-machine/src/game/utils.ts","src/custom/doll-machine/src/game/Goods.ts","src/custom/doll-machine/src/game/object-pool-init.ts","src/custom/doll-machine/src/props.ts","src/custom/doll-machine/src/game/frontBox.ts","src/custom/doll-machine/src/game/backBox.ts","src/custom/doll-machine/src/game/Zhuazi.ts","src/custom/doll-machine/src/game/GameView.ts","src/custom/doll-machine/src/game/GameWrapper.ts","src/custom/doll-machine/src/index.ts"],"sourcesContent":["/**\n * Created by rockyl on 2020-01-21.\n */\n\nexport function getTexture(uuid) {\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\n}\n\nexport function getTextureByName(name) {\n\treturn getTexture(engine.getAssetByName(name).uuid);\n}\n\nexport function playSound(name) {\n\tengine.playSound(engine.getAssetByName(name).uuid, {keep: true});\n}\nexport function createSvga(name, anchorName?) {\n\tlet inst = new svga.Svga();\n\tinst.source = 'asset://' + engine.getAssetByName(name).uuid;\n\treturn inst;\n}","/**\n * Created by rockyl on 2020-02-02.\n *\n * 掉落物品\n */\nimport { getTextureByName } from \"./utils\";\nimport { props } from \"../props\";\n\nexport class Goods extends engine.Container {\n private _body: engine.Rect;\n private _toY;\n\n constructor() {\n super();\n\n let body;\n body = this._body = new engine.Rect();\n\n // let rain = new engine.Sprite(getTextureByName('雨滴'));\n // rain[\"npcType\"]=\"rain\"\n // let stone = new engine.Sprite(getTextureByName('石块'));\n // stone[\"npcType\"]=\"stone\"\n // let boom = new engine.Sprite(getTextureByName('炸弹'));\n // boom[\"npcType\"]=\"boom\"\n\n let box1 = new engine.Sprite(getTextureByName(\"草泥马盒\"));\n box1[\"npcType\"] = \"box1\";\n let box2 = new engine.Sprite(getTextureByName(\"狗盒\"));\n box2[\"npcType\"] = \"box2\";\n let box3 = new engine.Sprite(getTextureByName(\"猫盒\"));\n box3[\"npcType\"] = \"box3\";\n\n // rain.visible=false;\n // stone.visible=false;\n // boom.visible=false;\n // body.addChild(rain)\n // body.addChild(stone)\n // body.addChild(boom)\n\n box1.visible = false;\n box2.visible = false;\n box3.visible = false;\n body.addChild(box1);\n body.addChild(box2);\n body.addChild(box3);\n\n this.addChild(body);\n body.width = 0.0001;\n body.height = 0.0001;\n body.mouseEnabled = false;\n }\n\n getRandomNumberByRange(start, end) {\n return Math.floor(Math.random() * (end - start) + start);\n }\n\n // reset() {\n // \tthis.visible = true;\n // \tthis.rotation = 0;\n // \tthis.anchorOffsetY = 0;\n // \tthis.y = 0;\n // \tthis.x = (750-120)*Math.random()+30;\n // \tthis.rotation = 0;\n // \tlet random=Math.random()\n\n // \tif(random<props.goodsProbability[0]){\n // \t\tthis.showNpc(\"box1\")\n // \t}else if(random>=props.goodsProbability[0]&&random<=(props.goodsProbability[0]+props.goodsProbability[1])){\n // \t\tthis.showNpc(\"box2\")\n // \t}else if(random>(props.goodsProbability[0]+props.goodsProbability[1])){\n // \t\tthis.showNpc(\"box3\")\n // \t}\n // }\n\n reset() {\n this.visible = true;\n this.y = 200;\n this.x = 0;\n this.rotation = 0;\n let random = Math.random();\n if (random < 0.3) {\n this.showNpc(\"box1\");\n } else if (random < 0.6) {\n this.showNpc(\"box2\");\n } else {\n this.showNpc(\"box3\");\n }\n // this.showNpc(\"box1\");\n // this.showNpc(\"box2\");\n // this.showNpc(\"box3\");\n }\n\n showNpc(type) {\n for (let i = 0; i < this._body.children.length; i++) {\n this._body.children[i].visible = false;\n this._body.children[i].mouseEnabled = false;\n }\n for (let i = 0; i < this._body.children.length; i++) {\n if (this._body.children[i][\"npcType\"] == type) {\n this[\"npcType\"] = type;\n console.log(type);\n\n this._body.children[i].visible = true;\n this._body.children[i].mouseEnabled = false;\n }\n }\n }\n\n set anchorOffsetY(v) {\n this._body.y = v;\n }\n}\n","/**\n * Created by rockyl on 2020-02-03.\n */\n\nimport {Goods} from \"./Goods\";\nimport ObjectPool = engine.ObjectPool;\n\nexport const PoolName: string = 'goods';\n\nObjectPool.registerPool(PoolName, function () {\n\treturn new Goods();\n}, function (item: Goods, data) {\n\titem.reset();\n});\n","/**\n * Created by rockyl on 2020-01-21.\n */\n\nexport let props: any = {};\n\nexport function prepareProps() {\n\tlet metaProps = getProps();\n\n\tengine.injectProp(props, metaProps);\n}\n\nexport function injectProps(p) {\n\tengine.injectProp(props, p);\n}\n","import { getTextureByName } from \"./utils\";\nimport GameView from './GameView';\nimport { props } from \"../props\";\nexport class FrontBoxs extends engine.Container {\n //盒子1\n private box1: engine.Container;\n //盒子2\n private box2: engine.Container;\n //盒子3 \n private box3: engine.Container;\n //盒子4\n private box4: engine.Container;\n //盒子5\n private box5: engine.Container;\n // 需隐藏的盒子\n private hideBox: engine.Container;\n private frontBoxs=[];\n public GameView: GameView;\n constructor() {\n super();\n }\n setup() {\n let initX , initY = 0;\n this.box1 = new engine.Sprite(getTextureByName(\"狗盒\"));\n this.box1[\"npcType\"] = \"box1\";\n initX = this.box1.x = 435;\n initY = this.box1.y = 614;\n\n this.box2 = new engine.Sprite(getTextureByName(\"猫盒\"));\n this.box2[\"npcType\"] = \"box2\";\n this.box3 = new engine.Sprite(getTextureByName(\"草泥马盒\"));\n this.box3[\"npcType\"] = \"box3\";\n this.box4 = new engine.Sprite(getTextureByName(\"狗盒\"));\n this.box4[\"npcType\"] = \"box4\";\n this.box5 = new engine.Sprite(getTextureByName(\"猫盒\"));\n this.box5[\"npcType\"] = \"box5\";\n this.frontBoxs = [this.box1, this.box2, this.box3, this.box4];\n for(let i = 0; i < this.frontBoxs.length; i++) {\n if(i == 0) {\n this.frontBoxs[i].x = initX ;\n } else {\n this.frontBoxs[i].x = this.frontBoxs[i - 1].x - this.box1.width - props.frontmargin;\n }\n \n this.frontBoxs[i].y = initY;\n this.addChild(this.frontBoxs[i]);\n }\n this.addEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);\n }\n frameMove() {\n this.frontBoxs.forEach((item, index) => {\n item.x += props.moveSpeed;\n if(item.x <=0 && !item.visible) {\n item.visible = true;\n }\n if(item.x >= 750) {\n let lastitem = this.frontBoxs.shift();\n lastitem.x = this.frontBoxs[this.frontBoxs.length - 1].x - this.box1.width - props.frontmargin;\n \n if (!this.GameView.getMoveX() && item.x <= 0 && this.GameView.startstatus) {\n this.GameView.setMoveX((370 - item.x - 13) / props.moveSpeed, item);\n this.hideBox = item;\n }\n this.frontBoxs.push(lastitem);\n }\n })\n }\n stop() {\n // this.removeEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);\n }\n showHidePrizeBox(isshow) {\n this.hideBox.visible = isshow\n }\n}","import { getTextureByName } from \"./utils\";\nimport { props } from \"../props\";\nexport class BackBoxs extends engine.Container {\n //盒子1\n private box1: engine.Container;\n //盒子2\n private box2: engine.Container;\n //盒子3\n private box3: engine.Container;\n //盒子4\n private box4: engine.Container;\n //盒子5\n private box5: engine.Container;\n private backBoxs=[];\n constructor() {\n super();\n }\n setup() {\n let initX , initY = 0;\n this.box1 = new engine.Sprite(getTextureByName(\"后狗盒\"));\n initX = this.box1.x = 188;\n initY = this.box1.y = 616;\n\n this.box2 = new engine.Sprite(getTextureByName(\"后猫盒\"));\n this.box3 = new engine.Sprite(getTextureByName(\"后草泥马盒\"));\n this.box4 = new engine.Sprite(getTextureByName(\"后狗盒\"));\n this.box5 = new engine.Sprite(getTextureByName(\"后猫盒\"));\n this.backBoxs = [this.box1, this.box2, this.box3, this.box4, this.box5];\n for (let i = 0; i < this.backBoxs.length; i++) {\n // this.backBoxs[i].scaleX = 0.5;\n // this.backBoxs[i].scaleY = 0.5;\n if(i == 0) {\n this.backBoxs[i].x = initX;\n } else {\n this.backBoxs[i].x = this.backBoxs[i - 1].x + this.backBoxs[i].width + props.backmargin;\n }\n this.backBoxs[i].y = initY;\n \n this.addChild(this.backBoxs[i]);\n }\n this.addEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);\n }\n frameMove() {\n this.backBoxs.forEach((item) => {\n item.x -= props.moveSpeed;\n if (item.x <= 0) {\n let lastitem = this.backBoxs.shift();\n lastitem.x = this.backBoxs[this.backBoxs.length - 1].x + item.width + props.backmargin;\n this.backBoxs.push(lastitem);\n }\n })\n }\n}","import { getTextureByName } from \"./utils\";\nimport { props } from \"../props\";\nimport GameView from './GameView';\nexport class Zhuazi extends engine.Container {\n private bashouGan: engine.Sprite;\n private bashou: engine.Sprite;\n private ganzi: engine.Sprite;\n private left_zhuazi: engine.Sprite;\n private right_zhuazi: engine.Sprite;\n private connect: engine.Sprite;\n private ganNode: engine.Container;\n private moveNode: engine.Container;\n private moveArr = [];\n private zhuaziY;\n //盒子1\n private box1: engine.Container;\n //盒子2\n private box2: engine.Container;\n //盒子3\n private box3: engine.Container;\n //盒子4\n private box4: engine.Container;\n //盒子5\n private box5: engine.Container;\n private itemShow: engine.Container;\n private prizeBoxs = [];\n public GameView: GameView;\n constructor() {\n super();\n }\n setup() {\n this.ganNode = new engine.Container();\n this.moveNode = new engine.Container();\n this.ganNode.x = 280;\n this.ganNode.y = 350;\n this.bashouGan = new engine.Sprite(getTextureByName(\"把手杆子\"));\n this.bashouGan.x = 60;\n this.bashouGan.y = 275;\n this.bashou = new engine.Sprite(getTextureByName(\"把手\"));\n this.bashou.x = 0;\n this.bashou.y = 263;\n this.ganzi = new engine.Sprite(getTextureByName(\"伸缩杆\"));\n this.ganzi.x = 97;\n this.ganzi.y = 290;\n this.connect = new engine.Sprite(getTextureByName(\"连接点\"));\n this.connect.x = 18;\n this.connect.y = -5;\n this.left_zhuazi = new engine.Sprite(getTextureByName(\"左爪\"));\n this.left_zhuazi.x = -15;\n this.left_zhuazi.y = 60;\n this.left_zhuazi.anchorX = this.left_zhuazi.width;\n this.left_zhuazi.anchorY = 0;\n this.right_zhuazi = new engine.Sprite(getTextureByName(\"右爪\"));\n this.right_zhuazi.x = 98;\n this.right_zhuazi.y = 60;\n this.ganNode.addChild(this.left_zhuazi);\n this.ganNode.addChild(this.right_zhuazi);\n this.ganNode.addChild(this.connect);\n this.ganNode.x = 30;\n this.zhuaziY = this.ganNode.y;\n this.moveNode.addChild(this.ganzi);\n this.moveNode.addChild(this.ganNode);\n this.moveNode.addChild(this.bashou);\n this.moveNode.x = 262;\n // this.moveNode.\n // this.moveArr = [this.bashou, this.ganzi, this.ganNode];\n this.addChild(this.bashouGan);\n // this.addChild(this.ganzi);\n // this.addChild(this.bashou);\n // this.addChild(this.ganNode);\n this.addChild(this.moveNode);\n this.createPrizeBox();\n // setTimeout(() => {\n // this.move();\n // }, 2000)\n \n }\n createPrizeBox() {\n this.box1 = new engine.Sprite(getTextureByName(\"中奖狗盒\"));\n this.box1[\"npcType\"] = \"box1\";\n this.box2 = new engine.Sprite(getTextureByName(\"中奖猫盒\"));\n this.box2[\"npcType\"] = \"box2\";\n this.box3 = new engine.Sprite(getTextureByName(\"中奖草泥马盒\"));\n this.box3[\"npcType\"] = \"box3\";\n this.box4 = new engine.Sprite(getTextureByName(\"中奖狗盒\"));\n this.box4[\"npcType\"] = \"box4\";\n this.box5 = new engine.Sprite(getTextureByName(\"中奖猫盒\"));\n this.box5[\"npcType\"] = \"box5\";\n this.prizeBoxs = [this.box1, this.box2, this.box3, this.box4, this.box5];\n this.prizeBoxs.forEach(item => {\n this.ganNode.addChild(item);\n item.visible = false;\n item.x = 15;\n item.y = 48;\n })\n }\n showPrizeBox() {\n this.prizeBoxs.forEach(item => {\n console.log(this.GameView.getBox()['npcType']);\n if (item['npcType'] === this.GameView.getBox()['npcType']) {\n item.visible = true;\n this.itemShow = item;\n } else {\n item.visible = false;\n }\n })\n \n }\n move() {\n let rndist = Math.random();\n let halfWidth = this.bashou.width / 2;\n let randomX = rndist * (rndist > 0.5 ? 1 : -1) * props.bashouMoveDist;\n console.log(randomX);\n engine.Tween.get(this.moveNode).to({ x: 370 + halfWidth - 71}, 1000).call(() => {\n this.zhangkai();\n });\n }\n zhangkai() {\n this.left_zhuazi.anchorX = this.left_zhuazi.width;\n this.left_zhuazi.anchorY = 0;\n engine.Tween.get(this.left_zhuazi, { loop: false }).to({ rotation: props.leftRotation}, 1000);\n engine.Tween.get(this.right_zhuazi, { loop: false }).to({ rotation: props.rightRotation }, 1000);\n setTimeout(() => {\n this.getLong();\n }, 500);\n }\n getLong() {\n let droptime = Number((this.GameView.getMoveX() / 60 - 1).toFixed(2)) * 1000;\n console.log('dr', droptime);\n let times = (props.ganMoveEndY - this.ganzi.y ) / this.ganzi.height;\n console.log(Number(times.toFixed(2)) );\n engine.Tween.get(this.ganzi).to({ scaleY: Number(times.toFixed(2)) }, droptime).to({ scaleY: 1 }, droptime)\n console.log('node', this.zhuaziY);\n engine.Tween.get(this.ganNode).to({ y: props.ganMoveEndY }, droptime).call(() => {\n this.GameView.stopMove();\n if (this.GameView.ifPrize) {\n this.showPrizeBox();\n this.GameView.setVisible(false);\n }\n }).to({ y: this.zhuaziY }, droptime).call(() => {\n // this.getReset();\n if (this.GameView.ifPrize) {\n this.itemShow.visible = false;\n }\n engine.globalEvent.dispatchEvent('doll-machine-gameover');\n })\n }\n getReset() {\n // if (this.GameView.ifPrize) {\n // this.itemShow.visible = false;\n // }\n this.left_zhuazi.anchorX = this.left_zhuazi.width;\n this.left_zhuazi.anchorY = 0;\n engine.Tween.get(this.moveNode, {loop: false}).to({x: 262}, 1000);\n engine.Tween.get(this.left_zhuazi, { loop: false }).to({ rotation: 0 }, 1000);\n engine.Tween.get(this.right_zhuazi, { loop: false }).to({ rotation: 0 }, 1000);\n this.GameView.resetMoveX();\n }\n}","/**\n * Created by rockyl on 2018/8/16.\n */\n\nimport { props } from \"../props\";\nimport { playSound, createSvga } from \"./utils\";\nimport ObjectPool = engine.ObjectPool;\nimport { getTextureByName } from \"./utils\";\nimport { Goods } from \"./Goods\";\nimport { PoolName } from \"./object-pool-init\";\nimport { FrontBoxs } from \"./frontBox\";\nimport { BackBoxs } from \"./backBox\";\nimport { Zhuazi } from './Zhuazi';\n\nexport default class GameView extends engine.Container {\n private _hasSetup;\n\n //触摸层\n private rectBg: engine.Rect;\n //npc层\n private NpcBg: engine.Container;\n //盒子1\n private box1: engine.Container;\n //盒子2\n private box2: engine.Container;\n //盒子3\n private box3: engine.Container;\n //盒子4\n private box4: engine.Container;\n //盒子5\n private box5: engine.Container;\n //前传输区域\n private frontTransfer: engine.Container;\n //后传输区域\n private backTransfer: engine.Container;\n //前台板\n private frontDesk: engine.Sprite;\n //后台板\n private backDesk: engine.Sprite;\n private _frontBoxs: FrontBoxs;\n\tprivate _backBoxs: BackBoxs;\n\tprivate _Zhuazi: Zhuazi;\n\tprivate prizeBox: engine.Container;\n\tprivate rect;\n //当前分数\n\tprivate score;\n\t\n\t//中奖盒子移动距离\n\tprivate moveTime;\n\n //游戏状态\n private gameIng;\n //是否已获取位移值\n public startstatus=false;\n //是否中奖\n public ifPrize=false;\n //npc出身计时器\n private timer;\n //倒计时计时器\n private countdownTimer: any;\n //倒计时\n private countdown: number;\n\n //当前速度\n private speed: number;\n\n // 当前场景上面的物品\n private goodsItems = [];\n\n private _goods: Goods;\n\n constructor() {\n super();\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\n }\n\n // private waterSvga;\n // private boomSvga;\n // private playerSvga;\n\n setup() {\n if (this._hasSetup) {\n return;\n }\n\n this._hasSetup = true;\n\t\tconst frontBoxs = (this._frontBoxs = new FrontBoxs());\n\t\tthis._frontBoxs.GameView = this;\n\t\tconst backBoxs = (this._backBoxs = new BackBoxs());\n\t\tthis._Zhuazi = new Zhuazi();\n\t\tthis._Zhuazi.GameView = this;\n this.frontTransfer = new engine.Container();\n this.backTransfer = new engine.Container();\n this.frontTransfer.width = 0;\n this.frontTransfer.height = 0;\n this.frontTransfer.alpha = 1;\n // this.frontTransfer.x = 0;\n // this.frontTransfer.y = 434;\n\n this.backTransfer.width = 0;\n this.backTransfer.height = 0;\n this.backTransfer.alpha = 1;\n // this.backTransfer.x = 0;\n // this.backTransfer.y = 390;\n\t\tthis.rect = new engine.Rect();\n\t\t// this.rect.width = 608;\n\t\tthis.rect.width = 611;\n\t\tthis.rect.height = 704;\n\t\tthis.rect.x = 65;\n\t\tthis.rect.y = 263;\n this.NpcBg = new engine.Container();\n\t\tthis.addChild(this.NpcBg);\n\t\tthis.addChild(this.rect);\n\t\t\n\t\t\n\t\t\n\t\tlet gameBg = new engine.Sprite(getTextureByName(\"游戏背景\"));\n\t\tgameBg.x = 65;\n\t\tgameBg.y = 263;\n\t\tthis.NpcBg.addChild(gameBg);\n\t\t\n this.frontDesk = new engine.Sprite(getTextureByName(\"前传输带\"));\n this.frontDesk.x = 60;\n this.frontDesk.y = 781;\n\n this.backDesk = new engine.Sprite(getTextureByName(\"后传输带\"));\n this.backDesk.x = 60;\n this.backDesk.y = 712;\n\n this.NpcBg.addChild(this.backDesk);\n this.NpcBg.addChild(this.frontDesk);\n this.NpcBg.addChild(this.backTransfer);\n\t\tthis.NpcBg.addChild(this.frontTransfer);\n\t\tthis.NpcBg.addChild(this._Zhuazi);\n\n\t\tthis.NpcBg.mask = this.rect;\n\t\tthis._Zhuazi.setup();\n\t\t\n\t\t// this._Zhuazi.move();\n\t\tthis.backTransfer.addChild(this._backBoxs);\n\t\tthis._backBoxs.setup();\n\t\tthis.frontTransfer.addChild(this._frontBoxs);\n\t\tthis._frontBoxs.setup();\n\n //\tthis.player.fillColor=\"rgba(0, 0, 0,1)\"\n //console.log(this.player.fillColor)\n\n // this.rectBg = new engine.Rect();\n // this.rectBg.alpha = 0;\n // this.rectBg.width = 750;\n // this.rectBg.height = 1624;\n // this.addChild(this.rectBg);\n\t}\n\t/**\n\t * \n\t * @param 暂停move\n\t */\n\tstopMove() {\n\t\tthis._frontBoxs.stop();\n\t}\n\t/**\n\t * 赋值x距离值\n\t */\n\tsetMoveX(x, item) {\n\t\tthis.moveTime = x;\n this.prizeBox = item;\n\t\tthis._Zhuazi.move();\n }\n\t/**\n\t * 显示隐藏盒子\n\t */\n\tsetVisible(isshow) {\n\t\tthis._frontBoxs.showHidePrizeBox(isshow);\n\t}\n\t/**\n\t * 获取中奖盒子移动的距离\n\t */\n\tgetMoveX() {\n\t\treturn this.moveTime;\n }\n /**\n * 重置moveTime\n */\n resetMoveX() {\n this.moveTime = null;\n }\n\t/**\n\t * 获取中奖盒子\n\t */\n\tgetBox() {\n\t\treturn this.prizeBox;\n\t}\n /**\n * 重置场景\n */\n reset() {\n this.startstatus = false;\n this.ifPrize = false;\n\t\tthis._Zhuazi.getReset();\n }\n\n /**\n * 开始\n */\n start(type=null) {\n this.speed = 1;\n this.gameIng = true;\n console.log('执行', type);\n this.startstatus = true;\n this.ifPrize = type && type.prize || false;\n // this.creatNpc()\n // this.beginNpc();\n // this.countdown = props.countDown;\n\n // this.countdownTimer = setInterval(() => {\n // if (this.gameIng) {\n // if (this.countdown > 0) {\n // engine.globalEvent.dispatchEvent(\"food-fell-time-update\", {\n // time: this.countdown\n // });\n // this.countdown -= 1;\n // } else {\n // engine.globalEvent.dispatchEvent(\"food-fell-game-over\", {\n // score: this.score,\n // reason: 1\n // });\n // this.died();\n // }\n // }\n // }, 1000);\n }\n\n /**\n * npc开始掉落\n */\n beginNpc() {\n this.timer = setTimeout(() => {\n if (this.gameIng) {\n // this.speed += props.acceleratedSpeed;\n // this.creatNpc()\n }\n //递归执行\n // this.beginNpc();\n }, 2000 / this.speed);\n }\n\n /**\n * 暂停\n */\n pause() {\n this.gameIng = false;\n }\n\n /**\n * 恢复\n */\n revive() {\n this.gameIng = true;\n }\n\n /**\n * 重新开始\n */\n resume() {\n this.reset();\n this.start();\n }\n\n /**\n * 初始化盒子位置\n */\n initNpc() {\n this.box1 = new engine.Sprite(getTextureByName(\"草泥马盒\"));\n this.box2 = new engine.Sprite(getTextureByName(\"狗盒\"));\n this.box3 = new engine.Sprite(getTextureByName(\"猫盒\"));\n this.box4 = new engine.Sprite(getTextureByName(\"草泥马盒\"));\n this.box5 = new engine.Sprite(getTextureByName(\"猫盒\"));\n this.box1.x = 120;\n this.box1.y = 434;\n this.box2.x = 306;\n this.box2.y = 434;\n this.box3.x = 487;\n this.box3.y = 434;\n this.box4.x = 240;\n this.box4.scaleX = 0.5;\n this.box4.scaleY = 0.5;\n this.box4.y = 390;\n this.box5.x = 434;\n this.box5.y = 390;\n this.box5.scaleX = 0.5;\n this.box5.scaleY = 0.5;\n this.backTransfer.addChild(this.box4);\n this.backTransfer.addChild(this.box5);\n this.frontTransfer.addChild(this.box1);\n this.frontTransfer.addChild(this.box2);\n this.frontTransfer.addChild(this.box3);\n }\n\n /**\n * 创建NPC\n */\n // private creatNpc() {\n // // this.initNpc();\n // let goods = (this._goods = <Goods>ObjectPool.getObject(PoolName));\n // console.log(goods);\n // this.goodsItems.push(goods);\n // this.NpcBg.addChild(goods);\n // goods.addEventListener(\n // engine.Event.ENTER_FRAME,\n // (goods[\"onGoodsEnter\"] = () => {\n // if (goods.y > 1624) {\n // this.removeNpc(goods);\n // } else {\n // if (this.gameIng) {\n // //速度叠加\n // // goods.y += (4 * this.speed)\n // goods.x += 2 * this.speed;\n // //如果玩家和物品发生碰撞\n // if (this.hasHit(this.player, goods)) {\n // if (goods[\"npcType\"] == \"rain\") {\n // console.log(\"碰到雨滴\");\n // this.score += props.rainScore;\n // this.waterSvga.visible = true;\n // this.waterSvga.play(false, false);\n // this.waterSvga.once(\n // engine.Event.END_FRAME,\n // () => {\n // this.waterSvga.visible = false;\n // },\n // this\n // );\n // } else if (goods[\"npcType\"] == \"stone\") {\n // console.log(\"碰到石头\");\n // this.score += props.stoneScore;\n // } else if (goods[\"npcType\"] == \"boom\") {\n // console.log(\"碰到炸弹\");\n // this.boomSvga.visible = true;\n // this.boomSvga.play(false, false);\n // this.boomSvga.once(\n // engine.Event.END_FRAME,\n // () => {\n // this.boomSvga.visible = false;\n // },\n // this\n // );\n // engine.globalEvent.dispatchEvent(\"food-fell-game-over\", {\n // score: this.score,\n // reason: 2\n // });\n // this.died();\n // }\n // engine.globalEvent.dispatchEvent(\"food-fell-score-update\", {\n // score: this.score\n // });\n // this.removeNpc(goods);\n // }\n // }\n // }\n // }),\n // this\n // );\n // }\n\n /**\n * 玩家死亡\n */\n private died() {\n this.score = 0;\n this.pause();\n }\n\n /**\n * 回收指定物品\n * @param goods 物品\n */\n private removeNpc(goods) {\n this.NpcBg.removeChild(goods);\n ObjectPool.recycleObject(PoolName, goods);\n goods.removeEventListener(\n engine.Event.ENTER_FRAME,\n goods[\"onGoodsEnter\"],\n this\n );\n let index = this.goodsItems.indexOf(goods);\n if (index > -1) {\n this.goodsItems.splice(index, 1);\n }\n }\n\n /**\n * 回收对象\n */\n private recycleGoods() {\n clearTimeout(this.timer);\n clearInterval(this.countdownTimer);\n for (let goods of this.goodsItems) {\n if (goods) {\n this.removeChild(goods);\n ObjectPool.recycleObject(PoolName, goods);\n goods.removeEventListener(\n engine.Event.ENTER_FRAME,\n goods[\"onGoodsEnter\"],\n this\n );\n }\n }\n this.goodsItems = [];\n }\n\n\n /**\n * 碰撞检测\n * @param a a盒子\n * @param b b盒子\n */\n private hasHit(a, b) {\n if (\n Math.abs(a.x + a.width / 2 - (b.x + b.width / 2)) <\n a.width / 2 + b.width / 2 &&\n Math.abs(a.y + a.height / 2 - (b.y + b.height / 2)) <\n a.height / 2 + b.height / 2\n ) {\n return true;\n } else {\n return false;\n }\n }\n}\n","/**\n * Created by rockyl on 2020-01-09.\n */\n\nimport GameView from \"./GameView\";\nimport {injectProps} from \"../props\";\n\n\nexport class GameWrapper extends engine.Container {\n\tprivate _status;\n\tprivate _gameView: GameView;\n\n\n\n\n\n\tconstructor() {\n\t\tsuper();\n\t\tengine.globalEvent.addEventListener('doll-machine-reset', this.reset, this);\n\t\tengine.globalEvent.addEventListener('doll-machine-prize', this.start, this);\n\t\t// engine.globalEvent.addEventListener('food-fell-start', this.start, this);\n\t\t// engine.globalEvent.addEventListener('food-fell-pause', this.pause, this);\n\t\t// engine.globalEvent.addEventListener('food-fell-resume', this.resume, this);\n\t\t// engine.globalEvent.addEventListener('food-fell-revive', this.revive, this);\n\t\t// engine.globalEvent.addEventListener('food-fell-clear', this.clear, this);\n\n\t\t// this.addEventListener(engine.MouseEvent.CLICK, this.onTap, this);\n\n\t\tlet gameView = this._gameView = new GameView();\n\t\tthis.addChild(gameView);\n\t\t// gameView.reset();\n\t\t// gameView.start()\n\t}\n\n\treset(event: engine.Event) {\t\t\n\t\tinjectProps(event.data);\n\t\tthis._gameView.visible = true;\n\t\tthis._gameView.reset();\n\t}\n\n\tstart(event: engine.Event) {\n\t\tconsole.log('监听开始');\n\t\tinjectProps(event.data);\n\t\t// this._status = 1;\n\t\tthis._gameView.start(event.data);\n\t}\n\n\tpause() {\n\t\tthis._gameView.pause();\n\t}\n\n\tresume() {\n\t\tthis._gameView.resume();\n\t}\n\n\trevive() {\n\t\tthis._gameView.revive();\n\t}\n\n\tclear() {\n\t\tthis._gameView.visible = false;\n\t}\n\n\tprivate onTap(event) {\n\t//\tthis._gameView.tap(event);\n\t}\n}\n","/**\n * Created by rockyl on 2019-11-20.\n */\n\nimport {GameWrapper} from \"./game/GameWrapper\";\nimport {injectProps, prepareProps} from \"./props\";\n\nexport default function (props) {\n\tprepareProps();\n\tinjectProps(props);\n\n\tlet instance = new GameWrapper();\n\treturn instance;\n}\n"],"names":["__extends","ObjectPool"],"mappings":";;;;;;UAIgB,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IA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/custom/doll-machine/meta.json
View file @
d1566d32
{
"name"
:
"口红机"
,
"desc"
:
"口红机模块"
,
"props"
:
{
"frontmargin"
:
{
"alias"
:
"前排娃娃的间距"
,
"type"
:
"number"
,
"default"
:
50
},
"backmargin"
:
{
"alias"
:
"后排娃娃的间距"
,
"type"
:
"number"
,
"default"
:
50
},
"moveSpeed"
:
{
"alias"
:
"娃娃移动的速度"
,
"type"
:
"number"
,
"default"
:
3
},
"bashouMoveDist"
:
{
"alias"
:
"爪子整体左右移动的范围"
,
"type"
:
"number"
,
"default"
:
200
},
"ganMoveEndY"
:
{
"alias"
:
"杆子最后需要移动到的y值位置"
,
"type"
:
"number"
,
"default"
:
700
},
"leftRotation"
:
{
"alias"
:
"左边爪子旋转角度"
,
"type"
:
"number"
,
"default"
:
30
},
"rightRotation"
:
{
"alias"
:
"右边爪子旋转角度"
,
"type"
:
"number"
,
"default"
:
-30
},
"playerPositionY"
:
{
"alias"
:
"玩家Y轴位置"
,
"type"
:
"number"
,
"default"
:
900
},
"rainScore"
:
{
"alias"
:
"接中雨滴获得分数"
,
"type"
:
"number"
,
"default"
:
1
},
"stoneScore"
:
{
"alias"
:
"接中石块获得分数"
,
"type"
:
"number"
,
"default"
:
-1
},
"speed"
:
{
"alias"
:
"道具掉落初始速度"
,
"type"
:
"number"
,
"default"
:
10
},
"maxSpeed"
:
{
"alias"
:
"道具掉落速度上限"
,
"type"
:
"number"
,
"default"
:
3
},
"gameOverCondition"
:
{
"alias"
:
"游戏结束条件(1:接到炸弹死亡,2:分数负数或接到炸弹死亡)"
,
"type"
:
"number"
,
"default"
:
1
}
},
"assets"
:
[
{
"name"
:
"玩家icon"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/50a7212a113175fa18c866b005d98f07c558dc77.png"
,
"uuid"
:
"66f23d13-82a5-4cec-9496-301ec240d087"
,
"ext"
:
".png"
},
{
"name"
:
"雨滴"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8564c8c9be3aead71b05a0bab8d7d07ac3f778a1.png"
,
"uuid"
:
"264a6192-d7bf-45e8-8f15-6ba2c439a532"
,
"ext"
:
".png"
},
{
"name"
:
"炸弹"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/171e92283cd13c013ee1b76d28d252ff08815d47.png"
,
"uuid"
:
"eb88b42d-e151-4c1b-94b9-7c16f7bfac29"
,
"name"
:
"娃娃机"
,
"desc"
:
"娃娃机模块"
,
"props"
:
{
"frontmargin"
:
{
"alias"
:
"前排娃娃的间距"
,
"type"
:
"number"
,
"default"
:
50
},
"backmargin"
:
{
"alias"
:
"后排娃娃的间距"
,
"type"
:
"number"
,
"default"
:
50
},
"moveSpeed"
:
{
"alias"
:
"娃娃移动的速度"
,
"type"
:
"number"
,
"default"
:
3
},
"bashouMoveDist"
:
{
"alias"
:
"爪子整体左右移动的范围"
,
"type"
:
"number"
,
"default"
:
200
},
"ganMoveEndY"
:
{
"alias"
:
"杆子最后需要移动到的y值位置"
,
"type"
:
"number"
,
"default"
:
820
},
"leftRotation"
:
{
"alias"
:
"左边爪子旋转角度"
,
"type"
:
"number"
,
"default"
:
20
},
"rightRotation"
:
{
"alias"
:
"右边爪子旋转角度"
,
"type"
:
"number"
,
"default"
:
-20
}
},
"assets"
:
[
{
"name"
:
"游戏背景"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/460fd0242aada85de5554391756db6ed2a232a9b.png"
,
"uuid"
:
"05c378c3-bed0-4d5c-bed8-f05ae7920931"
,
"ext"
:
".png"
},
{
"name"
:
"草泥马盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fde8c60981791e5136c7914274c2a2d0936626cd.png"
,
"uuid"
:
"aa30ee7c-a6ad-4e10-9b6a-13b139664ab5"
,
"ext"
:
".png"
},
{
"name"
:
"狗盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/befb2c9ddfd8a5c4acd5126b2d793f7c1bcc40f2.png"
,
"uuid"
:
"4483b626-697a-4aa4-ba57-0c22ddc7c0e6"
,
"ext"
:
".png"
},
{
"name"
:
"猫盒"
,
"url"
:
"///yun.duiba.com.cn/aurora/assets/50991e640e6bcc2eee02ba945d48a8430ddd2bee.png"
,
"uuid"
:
"b70f2980-a2b3-4ef7-b060-b14dc7a8c9c8"
,
"ext"
:
".png"
},
{
"name"
:
"后草泥马盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/94884eafc876346e283efef2aa29bd6d2c36f627.png"
,
"uuid"
:
"3f3feb30-6700-4ac7-a14e-6d7e41e8d4e8"
,
"ext"
:
".png"
},
{
"name"
:
"
游戏背景
"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
d1f3f60775abfcbd7fdfb3ce525c18977286cd80
.png"
,
"uuid"
:
"
: fe77919b-d5d2-464e-8cbe-d671c82d110c
"
,
"name"
:
"
后狗盒
"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
7deaaf45e03a626efbced90e4ad3d22373b01bd3
.png"
,
"uuid"
:
"
b1422629-55d2-4b8b-bdd0-1b043f965248
"
,
"ext"
:
".png"
},
{
"name"
:
"
草泥马
盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
cddd0a59964e023ed7c8d77a8f1ad6b90c25d3af
.png"
,
"uuid"
:
"
34b596f3-9a17-410f-a6b6-c39b91c7b123
"
,
"name"
:
"
后猫
盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
28a5b5b04c84d6acc86b7efb81dd6d7f717e0cda
.png"
,
"uuid"
:
"
708da046-26e1-4ff7-abb6-35bf825a5d5b
"
,
"ext"
:
".png"
},
{
"name"
:
"
狗
盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
fd47ea43eb4884ebb8f0bcd095083062871e4f90
.png"
,
"uuid"
:
"
f78f6bd0-93fd-4965-b18b-32a8e6cd41
84"
,
"name"
:
"
中奖草泥马
盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
a47f438d016d1b178cdb5241651a78e4ea365e75
.png"
,
"uuid"
:
"
c106cd1d-52a0-422a-976c-67151af0b4
84"
,
"ext"
:
".png"
},
{
"name"
:
"
猫
盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
596e89d60f5714e311bdc35171b19097efc54fb5
.png"
,
"uuid"
:
"
8bb254c4-cf2a-47cb-824e-a62ba153518b
"
,
"name"
:
"
中奖狗
盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
fd60c2da0ce78f7b7bed0e9c45644882a1a40d90
.png"
,
"uuid"
:
"
3ff6fb20-4a2f-4789-998d-6078e3b603ec
"
,
"ext"
:
".png"
},
{
"name"
:
"
前传输带
"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
7bccbc67b3f896176bed7d21c5f4d4307c3919be
.png"
,
"uuid"
:
"0
6bd03a4-43c3-49bb-94c5-6ef365f70291
"
,
"name"
:
"
中奖猫盒
"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
6211ab330a3768ff0a1920cff0ec41f29fa0903b
.png"
,
"uuid"
:
"0
4fa3325-87fc-4009-bfba-26a95d92d80c
"
,
"ext"
:
".png"
},
{
"name"
:
"后传输带"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/df9b718f80747a1e21349d2b9ac35d5e19a61dad.png"
,
"uuid"
:
"aa0c6ebc-164f-4767-90ca-a79be4316365"
,
"ext"
:
".png"
},
{
{
"name"
:
"前传输带"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/7bccbc67b3f896176bed7d21c5f4d4307c3919be.png"
,
"uuid"
:
"06bd03a4-43c3-49bb-94c5-6ef365f70291"
,
"ext"
:
".png"
},
{
"name"
:
"后传输带"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/df9b718f80747a1e21349d2b9ac35d5e19a61dad.png"
,
"uuid"
:
"aa0c6ebc-164f-4767-90ca-a79be4316365"
,
"ext"
:
".png"
},
{
"name"
:
"把手杆子"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/5a9e4ba7ca6701eae85b6d6dcb0612ecb9a3eff9.png"
,
"uuid"
:
"
3ecea516-ca65-4ac2-9b93-08495a52d7d2
"
,
"uuid"
:
"
f2f1a937-00f4-442f-af4f-0bcb00656e69
"
,
"ext"
:
".png"
},
{
"name"
:
"把手"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/71255a6f3cdf9f66d53589e46d72fcd20fef468d.png"
,
"uuid"
:
"d9
18e46f-c7f8-4ad0-8039-08c9c66b4ca6
"
,
"uuid"
:
"d9
b395b5-4e46-43a5-aa2b-bfdd81c07fa7
"
,
"ext"
:
".png"
},
{
"name"
:
"伸缩杆"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/a9cf8b147c52b7d4247e80e90e098f787808bfa9.png"
,
"uuid"
:
"
b0146aee-5741-470c-b0fc-bf00a4aca5f6
"
,
"uuid"
:
"
fddb4636-9c62-47b2-ba5e-f2cd820dbccc
"
,
"ext"
:
".png"
},
{
"name"
:
"左爪"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/1e8634fd94bda455d11956c2847d3823e80701d3.png"
,
"uuid"
:
"
d8e399ff-691f-439a-9ce4-4867514e617d
"
,
"uuid"
:
"
739014d2-3193-4853-bf8d-349bd3e8d990
"
,
"ext"
:
".png"
},
{
"name"
:
"右爪"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/4bfc510e0d1fa1db77f5effa187294af38b74ff6.png"
,
"uuid"
:
"
0df49f61-0281-4647-a55f-437b71b352e6
"
,
"uuid"
:
"
4fb43b19-67e9-42cc-b461-35c005c714fb
"
,
"ext"
:
".png"
},
{
"name"
:
"连接点"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/39f39234631f739e70e9ab8b713284379f4016fb.png"
,
"uuid"
:
"
00ff944e-d038-4974-97fc-1e481af3a949
"
,
"uuid"
:
"
2021124f-ffcb-487f-a24f-a00f3d8aae95
"
,
"ext"
:
".png"
},
{
"name"
:
"水花"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/93d37b4a0e367e80e375308a6b4414d72d7666fc.svga"
,
"uuid"
:
"b521bf94-20e1-44dd-8eca-d24996cbaeae"
,
"ext"
:
".svga"
},
{
"name"
:
"炸弹svga"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/4dd18f0689c663bbcf710a7afc4d929084d97d36.svga"
,
"uuid"
:
"322edf39-805b-4e84-9d07-5573dfeebc0e"
,
"ext"
:
".svga"
},
{
"name"
:
"玩家"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/b66300c5d4f27134b0aac3dc90a3220e8ae572eb.svga"
,
"uuid"
:
"71d8dcbc-3931-471a-b585-b3ae01b25aa6"
,
"ext"
:
".svga"
}
],
"events"
:
{
"in"
:
{
"food-fell-reset"
:
{
"alias"
:
"重置"
,
"data"
:
{
"goodsProbability"
:
"[0.2,0.5,0.3]道具概率(雨滴、石头、炸弹),所有概率相加为1"
,
"countDown"
:
"倒计时(s)"
,
"acceleratedSpeed"
:
"道具掉落加速度(单位:每秒)"
}
},
"food-fell-start"
:
{
"alias"
:
"开始"
},
"food-fell-revive"
:
{
"alias"
:
"复活"
},
"food-fell-pause"
:
{
"alias"
:
"暂停"
},
"food-fell-resume"
:
{
"alias"
:
"恢复"
},
"food-fell-clear"
:
{
"alias"
:
"清空,通过reset事件恢复"
}
},
"out"
:
{
"food-fell-score-update"
:
{
"alias"
:
"分数更新"
,
"data"
:
{
"score"
:
"分数"
}
},
"food-fell-time-update"
:
{
"alias"
:
"倒计时更新"
,
"data"
:
{
"time"
:
"剩余时间"
}
},
"food-fell-game-over"
:
{
"alias"
:
"游戏结束"
,
"data"
:
{
"score"
:
"分数"
,
"reason"
:
"结束原因(1:时间到了,2:玩家死亡)"
}
},
"doll-mac-getprize"
:
{
"alias"
:
"中奖"
,
"data"
:
null
}
}
}
}
\ No newline at end of file
],
"events"
:
{
"in"
:
{
"doll-machine-reset"
:
{
"alias"
:
"重置"
},
"doll-machine-prize"
:
{
"alias"
:
"开始"
,
"data"
:
{
"prize"
:
true
}
}
},
"out"
:
{
"doll-machine-gameover"
:
{
"alias"
:
"重置完毕"
,
"data"
:
null
}
}
}
}
src/custom/doll-machine/src/game/GameView.ts
View file @
d1566d32
...
...
@@ -50,7 +50,10 @@ export default class GameView extends engine.Container {
//游戏状态
private
gameIng
;
//是否已获取位移值
public
startstatus
=
false
;
//是否中奖
public
ifPrize
=
false
;
//npc出身计时器
private
timer
;
//倒计时计时器
...
...
@@ -103,14 +106,9 @@ export default class GameView extends engine.Container {
// this.rect.width = 608;
this
.
rect
.
width
=
611
;
this
.
rect
.
height
=
704
;
// this.rect.x = 71;
// this.rect.y = 263;
this
.
rect
.
x
=
65
;
this
.
rect
.
y
=
26
7
;
this
.
rect
.
y
=
26
3
;
this
.
NpcBg
=
new
engine
.
Container
();
// this.NpcBg.alpha = 1;
// this.NpcBg.width = 0;
// this.NpcBg.height = 0;
this
.
addChild
(
this
.
NpcBg
);
this
.
addChild
(
this
.
rect
);
...
...
@@ -118,16 +116,16 @@ export default class GameView extends engine.Container {
let
gameBg
=
new
engine
.
Sprite
(
getTextureByName
(
"游戏背景"
));
gameBg
.
x
=
65
;
gameBg
.
y
=
26
7
;
gameBg
.
y
=
26
3
;
this
.
NpcBg
.
addChild
(
gameBg
);
this
.
frontDesk
=
new
engine
.
Sprite
(
getTextureByName
(
"前传输带"
));
this
.
frontDesk
.
x
=
60
;
this
.
frontDesk
.
y
=
904
;
this
.
frontDesk
.
y
=
781
;
this
.
backDesk
=
new
engine
.
Sprite
(
getTextureByName
(
"后传输带"
));
this
.
backDesk
.
x
=
60
;
this
.
backDesk
.
y
=
810
;
this
.
backDesk
.
y
=
712
;
this
.
NpcBg
.
addChild
(
this
.
backDesk
);
this
.
NpcBg
.
addChild
(
this
.
frontDesk
);
...
...
@@ -165,9 +163,9 @@ export default class GameView extends engine.Container {
*/
setMoveX
(
x
,
item
)
{
this
.
moveTime
=
x
;
this
.
prizeBox
=
item
;
this
.
prizeBox
=
item
;
this
.
_Zhuazi
.
move
();
}
}
/**
* 显示隐藏盒子
*/
...
...
@@ -178,9 +176,14 @@ export default class GameView extends engine.Container {
* 获取中奖盒子移动的距离
*/
getMoveX
()
{
console
.
log
(
222
);
return
this
.
moveTime
;
}
}
/**
* 重置moveTime
*/
resetMoveX
()
{
this
.
moveTime
=
null
;
}
/**
* 获取中奖盒子
*/
...
...
@@ -191,37 +194,40 @@ export default class GameView extends engine.Container {
* 重置场景
*/
reset
()
{
this
.
recycleGoods
();
this
.
startstatus
=
false
;
this
.
ifPrize
=
false
;
this
.
_Zhuazi
.
getReset
();
}
/**
* 开始
*/
start
()
{
this
.
score
=
0
;
start
(
type
=
null
)
{
this
.
speed
=
1
;
this
.
gameIng
=
true
;
console
.
log
(
'执行'
,
type
);
this
.
startstatus
=
true
;
this
.
ifPrize
=
type
&&
type
.
prize
||
false
;
// this.creatNpc()
// this.beginNpc();
this
.
countdown
=
props
.
countDown
;
//
this.countdown = props.countDown;
this
.
countdownTimer
=
setInterval
(()
=>
{
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
);
//
this.countdownTimer = setInterval(() => {
//
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);
}
/**
...
...
src/custom/doll-machine/src/game/GameWrapper.ts
View file @
d1566d32
...
...
@@ -17,17 +17,18 @@ export class GameWrapper extends engine.Container {
constructor
()
{
super
();
engine
.
globalEvent
.
addEventListener
(
'doll-machine-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
);
engine
.
globalEvent
.
addEventListener
(
'doll-machine-prize'
,
this
.
start
,
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
);
//
this.addEventListener(engine.MouseEvent.CLICK, this.onTap, this);
let
gameView
=
this
.
_gameView
=
new
GameView
();
this
.
addChild
(
gameView
);
// gameView.reset()
// gameView.reset()
;
// gameView.start()
}
...
...
@@ -38,9 +39,10 @@ export class GameWrapper extends engine.Container {
}
start
(
event
:
engine
.
Event
)
{
console
.
log
(
'监听开始'
);
injectProps
(
event
.
data
);
this
.
_status
=
1
;
this
.
_gameView
.
start
();
//
this._status = 1;
this
.
_gameView
.
start
(
event
.
data
);
}
pause
()
{
...
...
src/custom/doll-machine/src/game/Zhuazi.ts
View file @
d1566d32
...
...
@@ -32,29 +32,27 @@ export class Zhuazi extends engine.Container {
this
.
ganNode
=
new
engine
.
Container
();
this
.
moveNode
=
new
engine
.
Container
();
this
.
ganNode
.
x
=
280
;
this
.
ganNode
.
y
=
425
;
this
.
ganNode
.
y
=
350
;
this
.
bashouGan
=
new
engine
.
Sprite
(
getTextureByName
(
"把手杆子"
));
this
.
bashouGan
.
x
=
60
;
this
.
bashouGan
.
y
=
342
;
this
.
bashouGan
.
y
=
275
;
this
.
bashou
=
new
engine
.
Sprite
(
getTextureByName
(
"把手"
));
this
.
bashou
.
x
=
0
;
this
.
bashou
.
y
=
320
;
this
.
bashou
.
y
=
263
;
this
.
ganzi
=
new
engine
.
Sprite
(
getTextureByName
(
"伸缩杆"
));
this
.
ganzi
.
x
=
97
;
this
.
ganzi
.
y
=
382
;
this
.
ganzi
.
y
=
290
;
this
.
connect
=
new
engine
.
Sprite
(
getTextureByName
(
"连接点"
));
this
.
connect
.
x
=
20
;
this
.
connect
.
y
=
0
;
this
.
connect
.
x
=
18
;
this
.
connect
.
y
=
-
5
;
this
.
left_zhuazi
=
new
engine
.
Sprite
(
getTextureByName
(
"左爪"
));
this
.
left_zhuazi
.
x
=
0
;
this
.
left_zhuazi
.
x
=
-
15
;
this
.
left_zhuazi
.
y
=
60
;
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
this
.
left_zhuazi
.
rotation
=
30
;
this
.
right_zhuazi
=
new
engine
.
Sprite
(
getTextureByName
(
"右爪"
));
this
.
right_zhuazi
.
x
=
83
;
this
.
right_zhuazi
.
x
=
98
;
this
.
right_zhuazi
.
y
=
60
;
this
.
right_zhuazi
.
rotation
=
-
30
;
this
.
ganNode
.
addChild
(
this
.
left_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
right_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
connect
);
...
...
@@ -78,31 +76,30 @@ export class Zhuazi extends engine.Container {
}
createPrizeBox
()
{
this
.
box1
=
new
engine
.
Sprite
(
getTextureByName
(
"狗盒"
));
this
.
box1
=
new
engine
.
Sprite
(
getTextureByName
(
"
中奖
狗盒"
));
this
.
box1
[
"npcType"
]
=
"box1"
;
this
.
box2
=
new
engine
.
Sprite
(
getTextureByName
(
"猫盒"
));
this
.
box2
=
new
engine
.
Sprite
(
getTextureByName
(
"
中奖
猫盒"
));
this
.
box2
[
"npcType"
]
=
"box2"
;
this
.
box3
=
new
engine
.
Sprite
(
getTextureByName
(
"草泥马盒"
));
this
.
box3
=
new
engine
.
Sprite
(
getTextureByName
(
"
中奖
草泥马盒"
));
this
.
box3
[
"npcType"
]
=
"box3"
;
this
.
box4
=
new
engine
.
Sprite
(
getTextureByName
(
"狗盒"
));
this
.
box4
=
new
engine
.
Sprite
(
getTextureByName
(
"
中奖
狗盒"
));
this
.
box4
[
"npcType"
]
=
"box4"
;
this
.
box5
=
new
engine
.
Sprite
(
getTextureByName
(
"猫盒"
));
this
.
box5
=
new
engine
.
Sprite
(
getTextureByName
(
"
中奖
猫盒"
));
this
.
box5
[
"npcType"
]
=
"box5"
;
this
.
prizeBoxs
=
[
this
.
box1
,
this
.
box2
,
this
.
box3
,
this
.
box4
,
this
.
box5
];
this
.
prizeBoxs
.
forEach
(
item
=>
{
this
.
ganNode
.
addChild
(
item
);
item
.
visible
=
false
;
item
.
x
=
-
15
;
item
.
x
=
15
;
item
.
y
=
48
;
})
}
showPrizeBox
()
{
this
.
prizeBoxs
.
forEach
(
item
=>
{
console
.
log
(
this
.
GameView
.
getBox
()[
'npcType'
]);
if
(
item
[
'npcType'
]
===
this
.
GameView
.
getBox
()[
'npcType'
])
{
item
.
visible
=
true
;
this
.
itemShow
=
item
;
item
.
visible
=
true
;
this
.
itemShow
=
item
;
}
else
{
item
.
visible
=
false
;
}
...
...
@@ -117,13 +114,6 @@ export class Zhuazi extends engine.Container {
engine
.
Tween
.
get
(
this
.
moveNode
).
to
({
x
:
370
+
halfWidth
-
71
},
1000
).
call
(()
=>
{
this
.
zhangkai
();
});
// this.moveArr.forEach((item,index) => {
// engine.Tween.get(item).to({ x: item.x +randomX}, 500).to({x: 370}, 500).call(() => {
// if (index == this.moveArr.length-1) {
// this.zhangkai();
// }
// });
// })
}
zhangkai
()
{
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
...
...
@@ -143,22 +133,27 @@ export class Zhuazi extends engine.Container {
console
.
log
(
'node'
,
this
.
zhuaziY
);
engine
.
Tween
.
get
(
this
.
ganNode
).
to
({
y
:
props
.
ganMoveEndY
},
droptime
).
call
(()
=>
{
this
.
GameView
.
stopMove
();
this
.
showPrizeBox
();
this
.
GameView
.
setVisible
(
false
);
if
(
this
.
GameView
.
ifPrize
)
{
this
.
showPrizeBox
();
this
.
GameView
.
setVisible
(
false
);
}
}).
to
({
y
:
this
.
zhuaziY
},
droptime
).
call
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'doll-mac-getprize'
);
this
.
getReset
();
// this.getReset();
if
(
this
.
GameView
.
ifPrize
)
{
this
.
itemShow
.
visible
=
false
;
}
engine
.
globalEvent
.
dispatchEvent
(
'doll-machine-gameover'
);
})
// .to({ scaleY: 1 }, droptime)
// to({ y: this.zhuaziY }, droptime)
}
getReset
()
{
this
.
itemShow
.
visible
=
false
;
// if (this.GameView.ifPrize) {
// this.itemShow.visible = false;
// }
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
engine
.
Tween
.
get
(
this
.
moveNode
,
{
loop
:
false
}).
to
({
x
:
262
},
1000
);
engine
.
Tween
.
get
(
this
.
left_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
0
},
1000
);
engine
.
Tween
.
get
(
this
.
right_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
0
},
1000
);
this
.
GameView
.
resetMoveX
();
}
}
\ No newline at end of file
src/custom/doll-machine/src/game/backBox.ts
View file @
d1566d32
...
...
@@ -17,18 +17,18 @@ export class BackBoxs extends engine.Container {
}
setup
()
{
let
initX
,
initY
=
0
;
this
.
box1
=
new
engine
.
Sprite
(
getTextureByName
(
"狗盒"
));
this
.
box1
=
new
engine
.
Sprite
(
getTextureByName
(
"
后
狗盒"
));
initX
=
this
.
box1
.
x
=
188
;
initY
=
this
.
box1
.
y
=
70
6
;
initY
=
this
.
box1
.
y
=
61
6
;
this
.
box2
=
new
engine
.
Sprite
(
getTextureByName
(
"猫盒"
));
this
.
box3
=
new
engine
.
Sprite
(
getTextureByName
(
"草泥马盒"
));
this
.
box4
=
new
engine
.
Sprite
(
getTextureByName
(
"狗盒"
));
this
.
box5
=
new
engine
.
Sprite
(
getTextureByName
(
"猫盒"
));
this
.
box2
=
new
engine
.
Sprite
(
getTextureByName
(
"
后
猫盒"
));
this
.
box3
=
new
engine
.
Sprite
(
getTextureByName
(
"
后
草泥马盒"
));
this
.
box4
=
new
engine
.
Sprite
(
getTextureByName
(
"
后
狗盒"
));
this
.
box5
=
new
engine
.
Sprite
(
getTextureByName
(
"
后
猫盒"
));
this
.
backBoxs
=
[
this
.
box1
,
this
.
box2
,
this
.
box3
,
this
.
box4
,
this
.
box5
];
for
(
let
i
=
0
;
i
<
this
.
backBoxs
.
length
;
i
++
)
{
this
.
backBoxs
[
i
].
scaleX
=
0.5
;
this
.
backBoxs
[
i
].
scaleY
=
0.5
;
//
this.backBoxs[i].scaleX = 0.5;
//
this.backBoxs[i].scaleY = 0.5;
if
(
i
==
0
)
{
this
.
backBoxs
[
i
].
x
=
initX
;
}
else
{
...
...
src/custom/doll-machine/src/game/frontBox.ts
View file @
d1566d32
...
...
@@ -6,7 +6,7 @@ export class FrontBoxs extends engine.Container {
private
box1
:
engine
.
Container
;
//盒子2
private
box2
:
engine
.
Container
;
//盒子3
//盒子3
private
box3
:
engine
.
Container
;
//盒子4
private
box4
:
engine
.
Container
;
...
...
@@ -24,7 +24,7 @@ export class FrontBoxs extends engine.Container {
this
.
box1
=
new
engine
.
Sprite
(
getTextureByName
(
"狗盒"
));
this
.
box1
[
"npcType"
]
=
"box1"
;
initX
=
this
.
box1
.
x
=
435
;
initY
=
this
.
box1
.
y
=
73
4
;
initY
=
this
.
box1
.
y
=
61
4
;
this
.
box2
=
new
engine
.
Sprite
(
getTextureByName
(
"猫盒"
));
this
.
box2
[
"npcType"
]
=
"box2"
;
...
...
@@ -57,7 +57,7 @@ export class FrontBoxs extends engine.Container {
let
lastitem
=
this
.
frontBoxs
.
shift
();
lastitem
.
x
=
this
.
frontBoxs
[
this
.
frontBoxs
.
length
-
1
].
x
-
this
.
box1
.
width
-
props
.
frontmargin
;
if
(
!
this
.
GameView
.
getMoveX
()
&&
item
.
x
<=
0
)
{
if
(
!
this
.
GameView
.
getMoveX
()
&&
item
.
x
<=
0
&&
this
.
GameView
.
startstatus
)
{
this
.
GameView
.
setMoveX
((
370
-
item
.
x
-
13
)
/
props
.
moveSpeed
,
item
);
this
.
hideBox
=
item
;
}
...
...
src/custom/doll-machine2/debug/app.js
0 → 100644
View file @
d1566d32
/**
* Created by renjianfeng on 2020-03-13.
*/
const
customId
=
"doll-machine2"
;
(
async
function
()
{
let
customModule
=
await
fetch
(
`../meta.json`
);
customModule
=
await
customModule
.
json
();
console
.
log
(
customModule
);
await
loadAssets
(
customModule
.
assets
);
launchWithCustomModule
(
customModule
);
})();
function
launchWithCustomModule
(
customModule
)
{
//engine.registerCustomCodeModule(customModule);
engine
.
registerCustomModule
(
customId
,
window
[
customId
]);
const
{
props
:
propsOption
,
assets
}
=
customModule
;
let
props
=
engine
.
computeProps
(
customModuleProps
,
propsOption
);
const
customModuleIns
=
{
id
:
customId
,
props
,
assets
,
};
engine
.
registerCustomModules
([
customModuleIns
]);
engine
.
launchWithConfig
({
options
:
{
entrySceneView
:
'entry'
,
},
assets
:
[],
views
:
[{
name
:
'entry'
,
type
:
'node'
,
properties
:
{
x
:
0
,
y
:
0
,
}
}],
},
null
,
function
()
{
setTimeout
(()
=>
{
engine
.
addCustomModule
(
customId
,
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
));
},
100
);
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'food-fell-reset'
,
{
"goodsProbability"
:
[
0.8
,
0.1
,
0.1
],
"countDown"
:
30
,
"acceleratedSpeed"
:
0.1
});
engine
.
globalEvent
.
dispatchEvent
(
'food-fell-start'
);
},
500
);
});
engine
.
globalEvent
.
addEventListener
(
'food-fell-time-update'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
engine
.
globalEvent
.
addEventListener
(
'food-fell-score-update'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
engine
.
globalEvent
.
addEventListener
(
'food-fell-game-over'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
}
function
getAssetByUUID
(
uuid
)
{
return
engine
.
resolveCustomAsset
(
customId
,
uuid
);
}
function
getProps
()
{
return
engine
.
getProps
(
customId
);
}
src/custom/doll-machine2/debug/index.html
0 → 100644
View file @
d1566d32
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
美食从天而降
</title>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
/>
<meta
name=
"apple-mobile-web-app-capable"
content=
"yes"
/>
<meta
name=
"full-screen"
content=
"true"
/>
<meta
name=
"screen-orientation"
content=
"portrait"
/>
<meta
name=
"x5-fullscreen"
content=
"true"
/>
<meta
name=
"360-fullscreen"
content=
"true"
/>
<style>
html
,
body
{
padding
:
0
;
margin
:
0
;
border
:
0
;
width
:
100%
;
height
:
100%
;
overflow
:
hidden
;
position
:
absolute
;
background-color
:
red
;
}
</style>
</head>
<body>
<div
id=
"game-container"
style=
"line-height:0;font-size:0"
></div>
<script
crossorigin=
"anonymous"
src=
"//yun.duiba.com.cn/editor/zeroing/libs/engine.50cdcef6ebe4e8c0fbc624f9d4fbf225102c5750.js"
></script>
<script
crossorigin=
"anonymous"
src=
"//yun.duiba.com.cn/editor/zeroing/libs/svga.fd3923ae6e664251ca7981801a65809cc5f36bc3.js"
></script>
<!-- <script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.ebc906f6b50b8da0a669f77027981d5f3cb560ce.js"></script> -->
<!-- <script src="http://localhost:4002/debug/engine.js"></script>
<script src="http://localhost:4003/debug/engine-svga.js"></script> -->
<!--<script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.9a9dbfda4cb2dd5508ecddfe3d95dfd88063f7b5.js"></script>-->
<script
src=
"app.js"
></script>
<script
src=
"props.js"
></script>
<script
src=
"load-assets.js"
></script>
<script
src=
"main.js"
></script>
<script>
</script>
</body>
\ No newline at end of file
src/custom/doll-machine2/debug/load-assets.js
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2020-01-21.
*/
const
assets
=
[
{
"name"
:
"玩家icon"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/50a7212a113175fa18c866b005d98f07c558dc77.png"
,
"uuid"
:
"66f23d13-82a5-4cec-9496-301ec240d087"
,
"ext"
:
".png"
},
{
"name"
:
"雨滴"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8564c8c9be3aead71b05a0bab8d7d07ac3f778a1.png"
,
"uuid"
:
"264a6192-d7bf-45e8-8f15-6ba2c439a532"
,
"ext"
:
".png"
},
{
"name"
:
"炸弹"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/171e92283cd13c013ee1b76d28d252ff08815d47.png"
,
"uuid"
:
"eb88b42d-e151-4c1b-94b9-7c16f7bfac29"
,
"ext"
:
".png"
},
{
"name"
:
"石块"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/99b0af0c59fe79a415a3f032149cfacc27e3ac2c.png"
,
"uuid"
:
"ab1bdabc-21ba-46bf-9299-6c638f766c88"
,
"ext"
:
".png"
},
{
"name"
:
"水花"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/93d37b4a0e367e80e375308a6b4414d72d7666fc.svga"
,
"uuid"
:
"b521bf94-20e1-44dd-8eca-d24996cbaeae"
,
"ext"
:
".svga"
},
{
"name"
:
"炸弹"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/4dd18f0689c663bbcf710a7afc4d929084d97d36.svga"
,
"uuid"
:
"322edf39-805b-4e84-9d07-5573dfeebc0e"
,
"ext"
:
".svga"
},
{
"name"
:
"玩家"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/b66300c5d4f27134b0aac3dc90a3220e8ae572eb.svga"
,
"uuid"
:
"71d8dcbc-3931-471a-b585-b3ae01b25aa6"
,
"ext"
:
".svga"
}
];
function
loadAssets
(
customModuleAssets
,
onProgress
,
onComplete
){
return
engine
.
loadAssets
(
assets
.
concat
(...
customModuleAssets
),
onProgress
,
onComplete
);
}
src/custom/doll-machine2/debug/main.js
0 → 100644
View file @
d1566d32
(
function
(
global
,
factory
)
{
typeof
exports
===
'object'
&&
typeof
module
!==
'undefined'
?
module
.
exports
=
factory
(
require
(
'tslib'
))
:
typeof
define
===
'function'
&&
define
.
amd
?
define
([
'tslib'
],
factory
)
:
(
global
=
global
||
self
,
global
[
'doll-machine2'
]
=
factory
(
global
.
tslib
));
}(
this
,
(
function
(
tslib
)
{
'use strict'
;
var
props
=
{};
function
prepareProps
()
{
var
metaProps
=
getProps
();
engine
.
injectProp
(
props
,
metaProps
);
}
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
//# sourceMappingURL=props.js.map
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
//# sourceMappingURL=utils.js.map
var
FrontBoxs
=
(
function
(
_super
)
{
tslib
.
__extends
(
FrontBoxs
,
_super
);
function
FrontBoxs
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
frontBoxs
=
[];
return
_this
;
}
FrontBoxs
.
prototype
.
setup
=
function
()
{
var
initX
,
initY
=
0
;
for
(
var
i
=
0
;
i
<
+
props
.
dollNum
+
1
;
i
++
)
{
if
(
!
new
engine
.
Sprite
(
getTextureByName
(
'frontbox_'
+
i
)))
{
return
;
}
this
.
frontBoxs
[
i
]
=
new
engine
.
Sprite
(
getTextureByName
(
'frontbox_'
+
i
));
initX
=
this
.
frontBoxs
[
0
].
x
=
props
.
frontInitX
;
initY
=
this
.
frontBoxs
[
0
].
y
=
props
.
frontInitY
;
this
.
frontBoxs
[
i
][
'npcType'
]
=
'box'
+
i
;
}
for
(
var
i
=
0
;
i
<
this
.
frontBoxs
.
length
;
i
++
)
{
if
(
i
==
0
)
{
this
.
frontBoxs
[
i
].
x
=
initX
;
}
else
{
this
.
frontBoxs
[
i
].
x
=
this
.
frontBoxs
[
i
-
1
].
x
-
this
.
frontBoxs
[
0
].
width
-
props
.
frontmargin
;
}
console
.
log
(
this
.
frontBoxs
[
i
].
x
);
this
.
frontBoxs
[
i
].
y
=
initY
;
this
.
addChild
(
this
.
frontBoxs
[
i
]);
console
.
log
(
'aaa'
,
this
.
frontBoxs
[
i
].
x
);
}
this
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
frameMove
,
this
);
};
FrontBoxs
.
prototype
.
frameMove
=
function
()
{
var
_this
=
this
;
this
.
frontBoxs
.
forEach
(
function
(
item
,
index
)
{
item
.
x
+=
props
.
moveSpeed
;
if
(
item
.
x
<=
0
&&
!
item
.
visible
)
{
item
.
visible
=
true
;
}
if
(
item
.
x
>=
750
)
{
var
lastitem
=
_this
.
frontBoxs
.
shift
();
lastitem
.
x
=
_this
.
frontBoxs
[
_this
.
frontBoxs
.
length
-
1
].
x
-
_this
.
frontBoxs
[
0
].
width
-
props
.
frontmargin
;
if
(
!
_this
.
GameView
.
getMoveX
()
&&
item
.
x
<=
0
&&
_this
.
GameView
.
startstatus
)
{
_this
.
GameView
.
setMoveX
((
370
-
item
.
x
-
13
)
/
props
.
moveSpeed
,
item
);
_this
.
hideBox
=
item
;
}
_this
.
frontBoxs
.
push
(
lastitem
);
}
});
};
FrontBoxs
.
prototype
.
stop
=
function
()
{
};
FrontBoxs
.
prototype
.
showHidePrizeBox
=
function
(
isshow
)
{
this
.
hideBox
.
visible
=
isshow
;
};
return
FrontBoxs
;
}(
engine
.
Container
));
var
BackBoxs
=
(
function
(
_super
)
{
tslib
.
__extends
(
BackBoxs
,
_super
);
function
BackBoxs
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
backBoxs
=
[];
return
_this
;
}
BackBoxs
.
prototype
.
setup
=
function
()
{
var
initX
,
initY
=
0
;
for
(
var
i
=
0
;
i
<
props
.
dollNum
;
i
++
)
{
this
.
backBoxs
[
i
]
=
new
engine
.
Sprite
(
getTextureByName
(
'backbox_'
+
i
));
initX
=
this
.
backBoxs
[
0
].
x
=
props
.
backInitX
;
initY
=
this
.
backBoxs
[
0
].
y
=
props
.
backInitY
-
props
.
initOffsetTop
;
this
.
backBoxs
[
i
][
'npcType'
]
=
'box'
+
i
;
}
this
.
backBoxs
[
props
.
dollNum
]
=
new
engine
.
Sprite
(
getTextureByName
(
'backbox_0'
));
this
.
backBoxs
[
props
.
dollNum
][
'npcType'
]
=
'box'
+
props
.
dollNum
;
for
(
var
i
=
0
;
i
<
this
.
backBoxs
.
length
;
i
++
)
{
if
(
i
==
0
)
{
this
.
backBoxs
[
i
].
x
=
initX
;
}
else
{
this
.
backBoxs
[
i
].
x
=
this
.
backBoxs
[
i
-
1
].
x
+
this
.
backBoxs
[
i
].
width
+
props
.
backmargin
;
}
this
.
backBoxs
[
i
].
y
=
initY
;
this
.
addChild
(
this
.
backBoxs
[
i
]);
}
this
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
frameMove
,
this
);
};
BackBoxs
.
prototype
.
frameMove
=
function
()
{
var
_this
=
this
;
this
.
backBoxs
.
forEach
(
function
(
item
)
{
item
.
x
-=
props
.
moveSpeed
;
if
(
item
.
x
<=
0
)
{
var
lastitem
=
_this
.
backBoxs
.
shift
();
lastitem
.
x
=
_this
.
backBoxs
[
_this
.
backBoxs
.
length
-
1
].
x
+
item
.
width
+
props
.
backmargin
;
_this
.
backBoxs
.
push
(
lastitem
);
}
});
};
return
BackBoxs
;
}(
engine
.
Container
));
//# sourceMappingURL=backBox.js.map
var
Zhuazi
=
(
function
(
_super
)
{
tslib
.
__extends
(
Zhuazi
,
_super
);
function
Zhuazi
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
moveArr
=
[];
_this
.
prizeBoxs
=
[];
return
_this
;
}
Zhuazi
.
prototype
.
setup
=
function
()
{
this
.
ganNode
=
new
engine
.
Container
();
this
.
moveNode
=
new
engine
.
Container
();
this
.
ganNode
.
x
=
280
;
this
.
ganNode
.
y
=
350
;
this
.
bashouGan
=
new
engine
.
Sprite
(
getTextureByName
(
"把手杆子"
));
this
.
bashouGan
.
x
=
60
;
this
.
bashouGan
.
y
=
12
;
this
.
bashou
=
new
engine
.
Sprite
(
getTextureByName
(
"把手"
));
this
.
bashou
.
x
=
0
;
this
.
bashou
.
y
=
0
;
this
.
ganzi
=
new
engine
.
Sprite
(
getTextureByName
(
"伸缩杆"
));
this
.
ganzi
.
x
=
97
;
this
.
ganzi
.
y
=
27
;
this
.
connect
=
new
engine
.
Sprite
(
getTextureByName
(
"连接点"
));
this
.
connect
.
x
=
18
;
this
.
connect
.
y
=
-
5
;
this
.
left_zhuazi
=
new
engine
.
Sprite
(
getTextureByName
(
"左爪"
));
this
.
left_zhuazi
.
x
=
-
15
;
this
.
left_zhuazi
.
y
=
60
;
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
this
.
right_zhuazi
=
new
engine
.
Sprite
(
getTextureByName
(
"右爪"
));
this
.
right_zhuazi
.
x
=
98
;
this
.
right_zhuazi
.
y
=
60
;
this
.
ganNode
.
addChild
(
this
.
left_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
right_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
connect
);
this
.
ganNode
.
x
=
30
;
this
.
ganNode
.
y
=
this
.
ganNode
.
y
-
263
;
this
.
zhuaziY
=
this
.
ganNode
.
y
;
this
.
moveNode
.
addChild
(
this
.
ganzi
);
this
.
moveNode
.
addChild
(
this
.
ganNode
);
this
.
moveNode
.
addChild
(
this
.
bashou
);
this
.
moveNode
.
x
=
262
;
this
.
bashouGan
.
y
=
this
.
bashouGan
.
y
;
this
.
moveNode
.
y
=
this
.
moveNode
.
y
;
this
.
addChild
(
this
.
bashouGan
);
this
.
addChild
(
this
.
moveNode
);
if
(
!
props
.
ganziShow
)
{
this
.
bashouGan
.
visible
=
false
;
}
if
(
!
props
.
bashouShow
)
{
this
.
bashou
.
visible
=
false
;
}
this
.
createPrizeBox
();
};
Zhuazi
.
prototype
.
createPrizeBox
=
function
()
{
var
_this
=
this
;
for
(
var
i
=
0
;
i
<
props
.
dollNum
;
i
++
)
{
if
(
!
new
engine
.
Sprite
(
getTextureByName
(
'prizebox_'
+
i
)))
{
return
;
}
this
.
prizeBoxs
[
i
]
=
new
engine
.
Sprite
(
getTextureByName
(
'prizebox_'
+
i
));
this
.
prizeBoxs
[
i
][
'npcType'
]
=
'box'
+
i
;
}
this
.
prizeBoxs
[
props
.
dollNum
]
=
new
engine
.
Sprite
(
getTextureByName
(
'prizebox_0'
));
this
.
prizeBoxs
[
props
.
dollNum
][
'npcType'
]
=
'box'
+
props
.
dollNum
;
this
.
prizeBoxs
.
forEach
(
function
(
item
)
{
_this
.
ganNode
.
addChild
(
item
);
item
.
visible
=
false
;
item
.
x
=
props
.
prizeBoxInitX
;
item
.
y
=
props
.
prizeBoxInitY
;
});
};
Zhuazi
.
prototype
.
showPrizeBox
=
function
()
{
var
_this
=
this
;
this
.
prizeBoxs
.
forEach
(
function
(
item
)
{
console
.
log
(
_this
.
GameView
.
getBox
()[
'npcType'
]);
if
(
item
[
'npcType'
]
===
_this
.
GameView
.
getBox
()[
'npcType'
])
{
item
.
visible
=
true
;
_this
.
itemShow
=
item
;
}
else
{
item
.
visible
=
false
;
}
});
};
Zhuazi
.
prototype
.
move
=
function
()
{
var
_this
=
this
;
var
rndist
=
Math
.
random
();
var
halfWidth
=
this
.
bashou
.
width
/
2
;
var
randomX
=
rndist
*
(
rndist
>
0.5
?
1
:
-
1
)
*
props
.
bashouMoveDist
;
console
.
log
(
randomX
);
engine
.
Tween
.
get
(
this
.
moveNode
).
to
({
x
:
370
+
halfWidth
-
71
},
1000
).
call
(
function
()
{
_this
.
zhangkai
();
});
};
Zhuazi
.
prototype
.
zhangkai
=
function
()
{
var
_this
=
this
;
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
engine
.
Tween
.
get
(
this
.
left_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
props
.
leftRotation
},
1000
);
engine
.
Tween
.
get
(
this
.
right_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
props
.
rightRotation
},
1000
);
setTimeout
(
function
()
{
_this
.
getLong
();
},
500
);
};
Zhuazi
.
prototype
.
getLong
=
function
()
{
var
_this
=
this
;
var
droptime
=
Number
((
this
.
GameView
.
getMoveX
()
/
60
-
1
).
toFixed
(
2
))
*
1000
;
console
.
log
(
'dr'
,
droptime
);
var
times
=
(
props
.
ganMoveEndY
-
this
.
ganzi
.
y
)
/
this
.
ganzi
.
height
;
console
.
log
(
Number
(
times
.
toFixed
(
2
)));
engine
.
Tween
.
get
(
this
.
ganzi
).
to
({
scaleY
:
Number
(
times
.
toFixed
(
2
))
},
droptime
).
to
({
scaleY
:
1
},
droptime
);
console
.
log
(
'node'
,
this
.
zhuaziY
);
engine
.
Tween
.
get
(
this
.
ganNode
).
to
({
y
:
props
.
ganMoveEndY
},
droptime
).
call
(
function
()
{
_this
.
GameView
.
stopMove
();
if
(
_this
.
GameView
.
ifPrize
)
{
_this
.
showPrizeBox
();
_this
.
GameView
.
setVisible
(
false
);
}
}).
to
({
y
:
this
.
zhuaziY
},
droptime
).
call
(
function
()
{
if
(
_this
.
GameView
.
ifPrize
)
{
_this
.
itemShow
.
visible
=
false
;
}
engine
.
globalEvent
.
dispatchEvent
(
'doll-machine2-game-end'
);
});
};
Zhuazi
.
prototype
.
getReset
=
function
()
{
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
engine
.
Tween
.
get
(
this
.
moveNode
,
{
loop
:
false
}).
to
({
x
:
262
},
1000
);
engine
.
Tween
.
get
(
this
.
left_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
0
},
1000
);
engine
.
Tween
.
get
(
this
.
right_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
0
},
1000
);
this
.
GameView
.
resetMoveX
();
};
return
Zhuazi
;
}(
engine
.
Container
));
//# sourceMappingURL=Zhuazi.js.map
var
GameView
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameView
,
_super
);
function
GameView
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
startstatus
=
true
;
_this
.
ifPrize
=
true
;
_this
.
goodsItems
=
[];
_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
;
var
frontBoxs
=
(
this
.
_frontBoxs
=
new
FrontBoxs
());
this
.
_frontBoxs
.
GameView
=
this
;
var
backBoxs
=
(
this
.
_backBoxs
=
new
BackBoxs
());
this
.
_Zhuazi
=
new
Zhuazi
();
this
.
_Zhuazi
.
GameView
=
this
;
this
.
frontTransfer
=
new
engine
.
Container
();
this
.
backTransfer
=
new
engine
.
Container
();
this
.
frontTransfer
.
width
=
0
;
this
.
frontTransfer
.
height
=
0
;
this
.
frontTransfer
.
alpha
=
1
;
this
.
backTransfer
.
width
=
0
;
this
.
backTransfer
.
height
=
0
;
this
.
backTransfer
.
alpha
=
1
;
this
.
rect
=
new
engine
.
Rect
();
this
.
rect
.
width
=
props
.
gameStageWidth
;
this
.
rect
.
height
=
props
.
gameStageHeight
;
this
.
rect
.
x
=
65
;
this
.
rect
.
y
=
0
;
this
.
NpcBg
=
new
engine
.
Container
();
this
.
NpcBg
.
x
=
0
;
this
.
NpcBg
.
y
=
0
;
this
.
addChild
(
this
.
NpcBg
);
this
.
addChild
(
this
.
rect
);
this
.
frontDesk
=
new
engine
.
Sprite
(
getTextureByName
(
"前传输带"
));
this
.
frontDesk
.
x
=
props
.
initOffsetLeft
;
this
.
frontDesk
.
y
=
props
.
frontDeskY
-
props
.
initOffsetTop
;
this
.
backDesk
=
new
engine
.
Sprite
(
getTextureByName
(
"后传输带"
));
this
.
backDesk
.
x
=
props
.
initOffsetLeft
;
this
.
backDesk
.
y
=
props
.
backDeskY
-
props
.
initOffsetTop
;
if
(
props
.
single
)
{
this
.
backDesk
.
visible
=
false
;
}
var
pcarr
=
[
this
.
backDesk
,
this
.
frontDesk
,
this
.
backTransfer
,
this
.
frontTransfer
,
this
.
_Zhuazi
];
pcarr
.
forEach
(
function
(
item
)
{
_this
.
NpcBg
.
addChild
(
item
);
});
this
.
NpcBg
.
mask
=
this
.
rect
;
this
.
_Zhuazi
.
setup
();
this
.
backTransfer
.
addChild
(
this
.
_backBoxs
);
this
.
_backBoxs
.
setup
();
if
(
props
.
single
)
{
this
.
backTransfer
.
visible
=
false
;
}
this
.
frontTransfer
.
addChild
(
this
.
_frontBoxs
);
this
.
_frontBoxs
.
setup
();
};
GameView
.
prototype
.
stopMove
=
function
()
{
this
.
_frontBoxs
.
stop
();
};
GameView
.
prototype
.
setMoveX
=
function
(
x
,
item
)
{
this
.
moveTime
=
x
;
this
.
prizeBox
=
item
;
this
.
_Zhuazi
.
move
();
};
GameView
.
prototype
.
setVisible
=
function
(
isshow
)
{
this
.
_frontBoxs
.
showHidePrizeBox
(
isshow
);
};
GameView
.
prototype
.
getMoveX
=
function
()
{
return
this
.
moveTime
;
};
GameView
.
prototype
.
resetMoveX
=
function
()
{
this
.
moveTime
=
null
;
};
GameView
.
prototype
.
getBox
=
function
()
{
return
this
.
prizeBox
;
};
GameView
.
prototype
.
reset
=
function
()
{
this
.
startstatus
=
false
;
this
.
ifPrize
=
false
;
this
.
_Zhuazi
.
getReset
();
};
GameView
.
prototype
.
start
=
function
(
type
)
{
if
(
type
===
void
0
)
{
type
=
null
;
}
this
.
speed
=
1
;
this
.
gameIng
=
true
;
console
.
log
(
'执行'
,
type
);
this
.
startstatus
=
true
;
this
.
ifPrize
=
type
&&
type
.
prize
||
false
;
};
GameView
.
prototype
.
beginNpc
=
function
()
{
var
_this
=
this
;
this
.
timer
=
setTimeout
(
function
()
{
if
(
_this
.
gameIng
)
;
},
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
();
};
return
GameView
;
}(
engine
.
Container
));
//# sourceMappingURL=GameView.js.map
var
GameWrapper
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameWrapper
,
_super
);
function
GameWrapper
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
'doll-machine2-game-init'
,
_this
.
reset
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'doll-machine2-game-start'
,
_this
.
start
,
_this
);
var
gameView
=
_this
.
_gameView
=
new
GameView
();
_this
.
addChild
(
gameView
);
return
_this
;
}
GameWrapper
.
prototype
.
reset
=
function
(
event
)
{
injectProps
(
event
.
data
);
this
.
_gameView
.
visible
=
true
;
this
.
_gameView
.
reset
();
};
GameWrapper
.
prototype
.
start
=
function
(
event
)
{
console
.
log
(
'监听开始'
);
injectProps
(
event
.
data
);
this
.
_gameView
.
start
(
event
.
data
);
};
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
));
//# sourceMappingURL=GameWrapper.js.map
function
index
(
props
)
{
prepareProps
();
injectProps
(
props
);
var
instance
=
new
GameWrapper
();
return
instance
;
}
//# sourceMappingURL=index.js.map
return
index
;
})));
//# sourceMappingURL=main.js.map
\ No newline at end of file
src/custom/doll-machine2/debug/main.js.map
0 → 100644
View file @
d1566d32
{"version":3,"file":"index.js","sources":["src/custom/doll-machine2/src/props.ts","src/custom/doll-machine2/src/game/utils.ts","src/custom/doll-machine2/src/game/frontBox.ts","src/custom/doll-machine2/src/game/backBox.ts","src/custom/doll-machine2/src/game/Zhuazi.ts","src/custom/doll-machine2/src/game/GameView.ts","src/custom/doll-machine2/src/game/GameWrapper.ts","src/custom/doll-machine2/src/index.ts"],"sourcesContent":["/**\n * Created by rockyl on 2020-01-21.\n */\n\nexport let props: any = {};\n\nexport function prepareProps() {\n\tlet metaProps = getProps();\n\n\tengine.injectProp(props, metaProps);\n}\n\nexport function injectProps(p) {\n\tengine.injectProp(props, p);\n}\n","/**\n * Created by rockyl on 2020-01-21.\n */\n\nexport function getTexture(uuid) {\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\n}\n\nexport function getTextureByName(name) {\n\treturn getTexture(engine.getAssetByName(name).uuid);\n}\n\nexport function playSound(name) {\n\tengine.playSound(engine.getAssetByName(name).uuid, {keep: true});\n}\nexport function createSvga(name, anchorName?) {\n\tlet inst = new svga.Svga();\n\tinst.source = 'asset://' + engine.getAssetByName(name).uuid;\n\treturn inst;\n}","import { getTextureByName } from \"./utils\";\nimport GameView from './GameView';\nimport { props } from \"../props\";\nexport class FrontBoxs extends engine.Container {\n //盒子1\n private box1: engine.Container;\n //盒子2\n private box2: engine.Container;\n //盒子3 \n private box3: engine.Container;\n //盒子4\n private box4: engine.Container;\n //盒子5\n private box5: engine.Container;\n // 需隐藏的盒子\n private hideBox: engine.Container;\n private frontBoxs=[];\n public GameView: GameView;\n constructor() {\n super();\n }\n setup() {\n let initX , initY = 0;\n for(let i = 0; i < +props.dollNum+1; i++) {\n if (!new engine.Sprite(getTextureByName('frontbox_' + i))) {\n return;\n }\n this.frontBoxs[i] = new engine.Sprite(getTextureByName('frontbox_'+i));\n initX = this.frontBoxs[0].x = props.frontInitX;\n initY = this.frontBoxs[0].y = props.frontInitY;\n this.frontBoxs[i]['npcType'] = 'box'+i;\n }\n // this.frontBoxs[props.dollNum] = new engine.Sprite(getTextureByName('frontbox_0'));\n // this.frontBoxs[props.dollNum]['npcType'] = 'box' + props.dollNum;\n \n for(let i = 0; i < this.frontBoxs.length; i++) {\n if(i == 0) {\n this.frontBoxs[i].x = initX ;\n } else {\n this.frontBoxs[i].x = this.frontBoxs[i - 1].x - this.frontBoxs[0].width - props.frontmargin;\n }\n console.log(this.frontBoxs[i].x);\n this.frontBoxs[i].y = initY;\n this.addChild(this.frontBoxs[i]);\n console.log('aaa', this.frontBoxs[i].x);\n }\n // console.log(this.frontBoxs);\n this.addEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);\n }\n frameMove() {\n this.frontBoxs.forEach((item, index) => {\n item.x += props.moveSpeed;\n if(item.x <=0 && !item.visible) {\n item.visible = true;\n }\n if(item.x >= 750) {\n let lastitem = this.frontBoxs.shift();\n lastitem.x = this.frontBoxs[this.frontBoxs.length - 1].x - this.frontBoxs[0].width - props.frontmargin;\n \n if (!this.GameView.getMoveX() && item.x <= 0 && this.GameView.startstatus) {\n this.GameView.setMoveX((370 - item.x - 13) / props.moveSpeed, item);\n this.hideBox = item;\n }\n this.frontBoxs.push(lastitem);\n }\n })\n }\n stop() {\n // this.removeEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);\n }\n showHidePrizeBox(isshow) {\n this.hideBox.visible = isshow\n }\n}","import { getTextureByName } from \"./utils\";\nimport { props } from \"../props\";\nexport class BackBoxs extends engine.Container {\n private backBoxs=[];\n constructor() {\n super();\n }\n setup() {\n let initX , initY = 0;\n for (let i = 0; i < props.dollNum; i++) {\n this.backBoxs[i] = new engine.Sprite(getTextureByName('backbox_' + i));\n initX = this.backBoxs[0].x = props.backInitX;\n initY = this.backBoxs[0].y = props.backInitY - props.initOffsetTop;\n this.backBoxs[i]['npcType'] = 'box' + i;\n }\n this.backBoxs[props.dollNum] = new engine.Sprite(getTextureByName('backbox_0'));\n this.backBoxs[props.dollNum]['npcType'] = 'box' + props.dollNum;\n for (let i = 0; i < this.backBoxs.length; i++) {\n if(i == 0) {\n this.backBoxs[i].x = initX;\n } else {\n this.backBoxs[i].x = this.backBoxs[i - 1].x + this.backBoxs[i].width + props.backmargin;\n }\n this.backBoxs[i].y = initY;\n \n this.addChild(this.backBoxs[i]);\n }\n this.addEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);\n }\n frameMove() {\n this.backBoxs.forEach((item) => {\n item.x -= props.moveSpeed;\n if (item.x <= 0) {\n let lastitem = this.backBoxs.shift();\n lastitem.x = this.backBoxs[this.backBoxs.length - 1].x + item.width + props.backmargin;\n this.backBoxs.push(lastitem);\n }\n })\n }\n}","import { getTextureByName } from \"./utils\";\nimport { props } from \"../props\";\nimport GameView from './GameView';\nexport class Zhuazi extends engine.Container {\n private bashouGan: engine.Sprite;\n private bashou: engine.Sprite;\n private ganzi: engine.Sprite;\n private left_zhuazi: engine.Sprite;\n private right_zhuazi: engine.Sprite;\n private connect: engine.Sprite;\n private ganNode: engine.Container;\n private moveNode: engine.Container;\n private moveArr = [];\n private zhuaziY;\n private itemShow: engine.Container;\n private prizeBoxs = [];\n public GameView: GameView;\n constructor() {\n super();\n }\n setup() {\n this.ganNode = new engine.Container();\n this.moveNode = new engine.Container();\n this.ganNode.x = 280;\n this.ganNode.y = 350;\n this.bashouGan = new engine.Sprite(getTextureByName(\"把手杆子\"));\n this.bashouGan.x = 60;\n this.bashouGan.y = 12;\n this.bashou = new engine.Sprite(getTextureByName(\"把手\"));\n this.bashou.x = 0;\n this.bashou.y = 0;\n this.ganzi = new engine.Sprite(getTextureByName(\"伸缩杆\"));\n this.ganzi.x = 97;\n this.ganzi.y = 27;\n this.connect = new engine.Sprite(getTextureByName(\"连接点\"));\n this.connect.x = 18;\n this.connect.y = -5;\n this.left_zhuazi = new engine.Sprite(getTextureByName(\"左爪\"));\n this.left_zhuazi.x = -15;\n this.left_zhuazi.y = 60;\n this.left_zhuazi.anchorX = this.left_zhuazi.width;\n this.left_zhuazi.anchorY = 0;\n this.right_zhuazi = new engine.Sprite(getTextureByName(\"右爪\"));\n this.right_zhuazi.x = 98;\n this.right_zhuazi.y = 60;\n this.ganNode.addChild(this.left_zhuazi);\n this.ganNode.addChild(this.right_zhuazi);\n this.ganNode.addChild(this.connect);\n this.ganNode.x = 30;\n this.ganNode.y = this.ganNode.y - 263;\n this.zhuaziY = this.ganNode.y;\n this.moveNode.addChild(this.ganzi);\n this.moveNode.addChild(this.ganNode);\n this.moveNode.addChild(this.bashou);\n this.moveNode.x = 262;\n this.bashouGan.y = this.bashouGan.y;\n this.moveNode.y = this.moveNode.y;\n this.addChild(this.bashouGan);\n this.addChild(this.moveNode);\n if (!props.ganziShow) {\n this.bashouGan.visible = false;\n }\n if (!props.bashouShow) {\n this.bashou.visible = false;\n }\n this.createPrizeBox();\n \n }\n createPrizeBox() {\n for (let i = 0; i < props.dollNum; i++) {\n if (!new engine.Sprite(getTextureByName('prizebox_' + i))) {\n return;\n }\n this.prizeBoxs[i] = new engine.Sprite(getTextureByName('prizebox_' + i));\n this.prizeBoxs[i]['npcType'] = 'box' + i;\n }\n this.prizeBoxs[props.dollNum] = new engine.Sprite(getTextureByName('prizebox_0'));\n this.prizeBoxs[props.dollNum]['npcType'] = 'box' + props.dollNum;\n\n this.prizeBoxs.forEach(item => {\n this.ganNode.addChild(item);\n item.visible = false;\n item.x = props.prizeBoxInitX;\n item.y = props.prizeBoxInitY;\n })\n }\n showPrizeBox() {\n this.prizeBoxs.forEach(item => {\n console.log(this.GameView.getBox()['npcType']);\n if (item['npcType'] === this.GameView.getBox()['npcType']) {\n item.visible = true;\n this.itemShow = item;\n } else {\n item.visible = false;\n }\n })\n \n }\n move() {\n let rndist = Math.random();\n let halfWidth = this.bashou.width / 2;\n let randomX = rndist * (rndist > 0.5 ? 1 : -1) * props.bashouMoveDist;\n console.log(randomX);\n engine.Tween.get(this.moveNode).to({ x: 370 + halfWidth - 71}, 1000).call(() => {\n this.zhangkai();\n });\n }\n zhangkai() {\n this.left_zhuazi.anchorX = this.left_zhuazi.width;\n this.left_zhuazi.anchorY = 0;\n engine.Tween.get(this.left_zhuazi, { loop: false }).to({ rotation: props.leftRotation}, 1000);\n engine.Tween.get(this.right_zhuazi, { loop: false }).to({ rotation: props.rightRotation }, 1000);\n setTimeout(() => {\n this.getLong();\n }, 500);\n }\n getLong() {\n let droptime = Number((this.GameView.getMoveX() / 60 - 1).toFixed(2)) * 1000;\n console.log('dr', droptime);\n let times = (props.ganMoveEndY - this.ganzi.y ) / this.ganzi.height;\n console.log(Number(times.toFixed(2)) );\n engine.Tween.get(this.ganzi).to({ scaleY: Number(times.toFixed(2)) }, droptime).to({ scaleY: 1 }, droptime)\n console.log('node', this.zhuaziY);\n engine.Tween.get(this.ganNode).to({ y: props.ganMoveEndY }, droptime).call(() => {\n this.GameView.stopMove();\n if (this.GameView.ifPrize) {\n this.showPrizeBox();\n this.GameView.setVisible(false);\n }\n }).to({ y: this.zhuaziY }, droptime).call(() => {\n // this.getReset();\n if (this.GameView.ifPrize) {\n this.itemShow.visible = false;\n }\n engine.globalEvent.dispatchEvent('doll-machine2-game-end');\n })\n }\n getReset() {\n // if (this.GameView.ifPrize) {\n // this.itemShow.visible = false;\n // }\n this.left_zhuazi.anchorX = this.left_zhuazi.width;\n this.left_zhuazi.anchorY = 0;\n engine.Tween.get(this.moveNode, {loop: false}).to({x: 262}, 1000);\n engine.Tween.get(this.left_zhuazi, { loop: false }).to({ rotation: 0 }, 1000);\n engine.Tween.get(this.right_zhuazi, { loop: false }).to({ rotation: 0 }, 1000);\n this.GameView.resetMoveX();\n }\n}","/**\n * Created by rockyl on 2018/8/16.\n */\n\nimport { props } from \"../props\";\nimport { playSound, createSvga } from \"./utils\";\nimport ObjectPool = engine.ObjectPool;\nimport { getTextureByName } from \"./utils\";\nimport { Goods } from \"./Goods\";\nimport { PoolName } from \"./object-pool-init\";\nimport { FrontBoxs } from \"./frontBox\";\nimport { BackBoxs } from \"./backBox\";\nimport { Zhuazi } from './Zhuazi';\n\nexport default class GameView extends engine.Container {\n private _hasSetup;\n\n //触摸层\n private rectBg: engine.Rect;\n //npc层\n private NpcBg: engine.Container;\n //盒子1\n private box1: engine.Container;\n //盒子2\n private box2: engine.Container;\n //盒子3\n private box3: engine.Container;\n //盒子4\n private box4: engine.Container;\n //盒子5\n private box5: engine.Container;\n //前传输区域\n private frontTransfer: engine.Container;\n //后传输区域\n private backTransfer: engine.Container;\n //前台板\n private frontDesk: engine.Sprite;\n //后台板\n private backDesk: engine.Sprite;\n private _frontBoxs: FrontBoxs;\n\tprivate _backBoxs: BackBoxs;\n\tprivate _Zhuazi: Zhuazi;\n\tprivate prizeBox: engine.Container;\n\tprivate rect;\n //当前分数\n\tprivate score;\n\t\n\t//中奖盒子移动距离\n\tprivate moveTime;\n\n //游戏状态\n private gameIng;\n //是否已获取位移值\n public startstatus=true;\n //是否中奖\n public ifPrize=true;\n //npc出身计时器\n private timer;\n //倒计时计时器\n private countdownTimer: any;\n //倒计时\n private countdown: number;\n\n //当前速度\n private speed: number;\n\n // 当前场景上面的物品\n private goodsItems = [];\n\n private _goods: Goods;\n\n constructor() {\n super();\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\n }\n\n // private waterSvga;\n // private boomSvga;\n // private playerSvga;\n\n setup() {\n if (this._hasSetup) {\n return;\n }\n\n this._hasSetup = true;\n\t\tconst frontBoxs = (this._frontBoxs = new FrontBoxs());\n\t\tthis._frontBoxs.GameView = this;\n\t\tconst backBoxs = (this._backBoxs = new BackBoxs());\n\t\tthis._Zhuazi = new Zhuazi();\n\t\tthis._Zhuazi.GameView = this;\n this.frontTransfer = new engine.Container();\n this.backTransfer = new engine.Container();\n this.frontTransfer.width = 0;\n this.frontTransfer.height = 0;\n this.frontTransfer.alpha = 1;\n // this.frontTransfer.x = 0;\n // this.frontTransfer.y = 434;\n\n this.backTransfer.width = 0;\n this.backTransfer.height = 0;\n this.backTransfer.alpha = 1;\n // this.backTransfer.x = 0;\n // this.backTransfer.y = 390;\n\t\tthis.rect = new engine.Rect();\n this.rect.width = props.gameStageWidth;\n this.rect.height = props.gameStageHeight;\n\t\tthis.rect.x = 65;\n this.rect.y = 0;\n this.NpcBg = new engine.Container();\n this.NpcBg.x = 0;\n this.NpcBg.y = 0;\n\t\tthis.addChild(this.NpcBg);\n\t\tthis.addChild(this.rect);\n\t\t\n\t\t\n\t\t\n\t\t// let gameBg = new engine.Sprite(getTextureByName(\"游戏背景\"));\n\t\t// gameBg.x = 65;\n\t\t// gameBg.y = 263;\n\t\t// this.NpcBg.addChild(gameBg);\n\t\t\n this.frontDesk = new engine.Sprite(getTextureByName(\"前传输带\"));\n this.frontDesk.x = props.initOffsetLeft;\n this.frontDesk.y = props.frontDeskY - props.initOffsetTop;\n\n this.backDesk = new engine.Sprite(getTextureByName(\"后传输带\"));\n this.backDesk.x = props.initOffsetLeft;\n this.backDesk.y = props.backDeskY - props.initOffsetTop;\n if(props.single) {\n this.backDesk.visible = false;\n }\n let pcarr = [this.backDesk, this.frontDesk, this.backTransfer, this.frontTransfer, this._Zhuazi];\n pcarr.forEach(item => {\n this.NpcBg.addChild(item);\n })\n\t\tthis.NpcBg.mask = this.rect;\n\t\tthis._Zhuazi.setup();\n\t\t\n\t\t// this._Zhuazi.move();\n\t\tthis.backTransfer.addChild(this._backBoxs);\n this._backBoxs.setup();\n if (props.single) {\n this.backTransfer.visible = false;\n }\n\t\tthis.frontTransfer.addChild(this._frontBoxs);\n\t\tthis._frontBoxs.setup();\n\t}\n\t/**\n\t * \n\t * @param 暂停move\n\t */\n\tstopMove() {\n\t\tthis._frontBoxs.stop();\n\t}\n\t/**\n\t * 赋值x距离值\n\t */\n\tsetMoveX(x, item) {\n\t\tthis.moveTime = x;\n this.prizeBox = item;\n\t\tthis._Zhuazi.move();\n }\n\t/**\n\t * 显示隐藏盒子\n\t */\n\tsetVisible(isshow) {\n\t\tthis._frontBoxs.showHidePrizeBox(isshow);\n\t}\n\t/**\n\t * 获取中奖盒子移动的距离\n\t */\n\tgetMoveX() {\n\t\treturn this.moveTime;\n }\n /**\n * 重置moveTime\n */\n resetMoveX() {\n this.moveTime = null;\n }\n\t/**\n\t * 获取中奖盒子\n\t */\n\tgetBox() {\n\t\treturn this.prizeBox;\n\t}\n /**\n * 重置场景\n */\n reset() {\n this.startstatus = false;\n this.ifPrize = false;\n\t\tthis._Zhuazi.getReset();\n }\n\n /**\n * 开始\n */\n start(type=null) {\n this.speed = 1;\n this.gameIng = true;\n console.log('执行', type);\n this.startstatus = true;\n this.ifPrize = type && type.prize || false;\n }\n\n /**\n * npc开始掉落\n */\n beginNpc() {\n this.timer = setTimeout(() => {\n if (this.gameIng) {\n // this.speed += props.acceleratedSpeed;\n // this.creatNpc()\n }\n //递归执行\n // this.beginNpc();\n }, 2000 / this.speed);\n }\n\n /**\n * 暂停\n */\n pause() {\n this.gameIng = false;\n }\n\n /**\n * 恢复\n */\n revive() {\n this.gameIng = true;\n }\n\n /**\n * 重新开始\n */\n resume() {\n this.reset();\n this.start();\n }\n}\n","/**\n * Created by rockyl on 2020-01-09.\n */\n\nimport GameView from \"./GameView\";\nimport {injectProps} from \"../props\";\n\n\nexport class GameWrapper extends engine.Container {\n\tprivate _status;\n\tprivate _gameView: GameView;\n\n\n\n\n\n\tconstructor() {\n\t\tsuper();\n\t\tengine.globalEvent.addEventListener('doll-machine2-game-init', this.reset, this);\n\t\tengine.globalEvent.addEventListener('doll-machine2-game-start', this.start, this);\n\n\t\tlet gameView = this._gameView = new GameView();\n\t\tthis.addChild(gameView);\n\t\t// gameView.reset();\n\t\t// gameView.start()\n\t}\n\n\treset(event: engine.Event) {\t\t\n\t\tinjectProps(event.data);\n\t\tthis._gameView.visible = true;\n\t\tthis._gameView.reset();\n\t}\n\n\tstart(event: engine.Event) {\n\t\tconsole.log('监听开始');\n\t\tinjectProps(event.data);\n\t\t// this._status = 1;\n\t\tthis._gameView.start(event.data);\n\t}\n\n\tpause() {\n\t\tthis._gameView.pause();\n\t}\n\n\tresume() {\n\t\tthis._gameView.resume();\n\t}\n\n\trevive() {\n\t\tthis._gameView.revive();\n\t}\n\n\tclear() {\n\t\tthis._gameView.visible = false;\n\t}\n\n\tprivate onTap(event) {\n\t//\tthis._gameView.tap(event);\n\t}\n}\n","/**\n * Created by rockyl on 2019-11-20.\n */\n\nimport {GameWrapper} from \"./game/GameWrapper\";\nimport {injectProps, prepareProps} from \"./props\";\n\nexport default function (props) {\n\tprepareProps();\n\tinjectProps(props);\n\n\tlet instance = new GameWrapper();\n\treturn instance;\n}\n"],"names":["__extends"],"mappings":";;;;;;CAIO,IAAI,KAAK,GAAQ,EAAE,CAAC;UAEX,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;UAEe,WAAW,CAAC,CAAC;KAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC7B,CAAC;;;UCVe,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;AAED,UAAgB,gBAAgB,CAAC,IAAI;KACpC,OAAO,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACrD,CAAC;AAED;;CCTA;KAA+BA,mCAAgB;KAe7C;SAAA,YACE,iBAAO,SACR;SAJO,eAAS,GAAC,EAAE,CAAC;;MAIpB;KACD,yBAAK,GAAL;SACE,IAAI,KAAK,EAAG,KAAK,GAAG,CAAC,CAAC;SACtB,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,OA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AM,GAAN;SACC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;MACxB;KAED,2BAAK,GAAL;SACC,IAAI,CAAC,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;MAC/B;KAEO,2BAAK,GAAb,UAAc,KAAK;MAElB;KACF,kBAAC;CAAD,CAAC,CAnDgC,MAAM,CAAC,SAAS,GAmDhD;;;iBCpDwB,KAAK;KAC7B,YAAY,EAAE,CAAC;KACf,WAAW,CAAC,KAAK,CAAC,CAAC;KAEnB,IAAI,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;KACjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;;"}
\ No newline at end of file
src/custom/doll-machine2/debug/props.js
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2020-01-21.
*/
let
customModuleProps
=
{
};
src/custom/doll-machine2/meta.json
0 → 100644
View file @
d1566d32
{
"name"
:
"娃娃机2"
,
"desc"
:
"娃娃机通用模块"
,
"props"
:
{
"single"
:
{
"alias"
:
"是否是单层娃娃"
,
"type"
:
"boolean"
,
"default"
:
true
},
"dollNum"
:
{
"alias"
:
"一屏展示娃娃个数(最大为4)"
,
"type"
:
"number"
,
"default"
:
4
},
"initOffsetTop"
:
{
"alias"
:
"整体距离上边距"
,
"type"
:
"number"
,
"default"
:
0
},
"initOffsetLeft"
:
{
"alias"
:
"整体距离左边距"
,
"type"
:
"number"
,
"default"
:
60
},
"frontDeskY"
:
{
"alias"
:
"前排传输带Y位置"
,
"type"
:
"number"
,
"default"
:
518
},
"frontInitX"
:
{
"alias"
:
"前排最右侧娃娃初始X位置"
,
"type"
:
"number"
,
"default"
:
600
},
"frontInitY"
:
{
"alias"
:
"前排最右侧娃娃初始Y位置"
,
"type"
:
"number"
,
"default"
:
351
},
"backDeskY"
:
{
"alias"
:
"后排传输带Y位置"
,
"type"
:
"number"
,
"default"
:
449
},
"backInitX"
:
{
"alias"
:
"后排最右侧娃娃初始X位置"
,
"type"
:
"number"
,
"default"
:
188
},
"backInitY"
:
{
"alias"
:
"后排最右侧娃娃初始Y位置"
,
"type"
:
"number"
,
"default"
:
353
},
"ganziShow"
:
{
"alias"
:
"是否显示杆子"
,
"type"
:
"boolean"
,
"default"
:
true
},
"bashouShow"
:
{
"alias"
:
"是否显示把手"
,
"type"
:
"boolean"
,
"default"
:
true
},
"gameStageWidth"
:
{
"alias"
:
"游戏场景宽度"
,
"type"
:
"number"
,
"default"
:
611
},
"gameStageHeight"
:
{
"alias"
:
"游戏场景高度"
,
"type"
:
"number"
,
"default"
:
704
},
"frontmargin"
:
{
"alias"
:
"前排娃娃的间距"
,
"type"
:
"number"
,
"default"
:
13
},
"backmargin"
:
{
"alias"
:
"后排娃娃的间距"
,
"type"
:
"number"
,
"default"
:
50
},
"moveSpeed"
:
{
"alias"
:
"娃娃移动的速度"
,
"type"
:
"number"
,
"default"
:
3
},
"bashouMoveDist"
:
{
"alias"
:
"爪子整体左右移动的范围"
,
"type"
:
"number"
,
"default"
:
200
},
"ganMoveEndY"
:
{
"alias"
:
"杆子最后需要移动到的y值位置"
,
"type"
:
"number"
,
"default"
:
357
},
"leftRotation"
:
{
"alias"
:
"左边爪子旋转角度"
,
"type"
:
"number"
,
"default"
:
20
},
"rightRotation"
:
{
"alias"
:
"右边爪子旋转角度"
,
"type"
:
"number"
,
"default"
:
-20
},
"prizeBoxInitX"
:
{
"alias"
:
"中奖娃娃的x位置"
,
"type"
:
"number"
,
"default"
:
15
},
"prizeBoxInitY"
:
{
"alias"
:
"中奖娃娃的y位置"
,
"type"
:
"number"
,
"default"
:
48
}
},
"assets"
:
[
{
"name"
:
"游戏背景"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/460fd0242aada85de5554391756db6ed2a232a9b.png"
,
"uuid"
:
"05c378c3-bed0-4d5c-bed8-f05ae7920931"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_0"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fde8c60981791e5136c7914274c2a2d0936626cd.png"
,
"uuid"
:
"aa30ee7c-a6ad-4e10-9b6a-13b139664ab5"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/befb2c9ddfd8a5c4acd5126b2d793f7c1bcc40f2.png"
,
"uuid"
:
"4483b626-697a-4aa4-ba57-0c22ddc7c0e6"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_2"
,
"url"
:
"///yun.duiba.com.cn/aurora/assets/50991e640e6bcc2eee02ba945d48a8430ddd2bee.png"
,
"uuid"
:
"b70f2980-a2b3-4ef7-b060-b14dc7a8c9c8"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_3"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fde8c60981791e5136c7914274c2a2d0936626cd.png"
,
"uuid"
:
"aa30ee7c-a6ad-4e10-9b6a-13b139664ab1"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_4"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fde8c60981791e5136c7914274c2a2d0936626cd.png"
,
"uuid"
:
"aa30ee7c-a6ad-4e10-9b6a-13b139664ab2"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_0"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/94884eafc876346e283efef2aa29bd6d2c36f627.png"
,
"uuid"
:
"3f3feb30-6700-4ac7-a14e-6d7e41e8d4e8"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/7deaaf45e03a626efbced90e4ad3d22373b01bd3.png"
,
"uuid"
:
"b1422629-55d2-4b8b-bdd0-1b043f965248"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_2"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/28a5b5b04c84d6acc86b7efb81dd6d7f717e0cda.png"
,
"uuid"
:
"708da046-26e1-4ff7-abb6-35bf825a5d5b"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_3"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/28a5b5b04c84d6acc86b7efb81dd6d7f717e0cda.png"
,
"uuid"
:
"708da046-26e1-4ff7-abb6-35bf825a5d51"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_4"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/28a5b5b04c84d6acc86b7efb81dd6d7f717e0cda.png"
,
"uuid"
:
"708da046-26e1-4ff7-abb6-35bf825a5d55"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_0"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/a47f438d016d1b178cdb5241651a78e4ea365e75.png"
,
"uuid"
:
"c106cd1d-52a0-422a-976c-67151af0b484"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_1"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fd60c2da0ce78f7b7bed0e9c45644882a1a40d90.png"
,
"uuid"
:
"3ff6fb20-4a2f-4789-998d-6078e3b603ec"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_2"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/6211ab330a3768ff0a1920cff0ec41f29fa0903b.png"
,
"uuid"
:
"04fa3325-87fc-4009-bfba-26a95d92d80c"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_3"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/6211ab330a3768ff0a1920cff0ec41f29fa0903b.png"
,
"uuid"
:
"04fa3325-87fc-4009-bfba-26a95d92d800"
,
"ext"
:
".png"
},
{
"name"
:
"prizebox_4"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/6211ab330a3768ff0a1920cff0ec41f29fa0903b.png"
,
"uuid"
:
"04fa3325-87fc-4009-bfba-26a95d92d80a"
,
"ext"
:
".png"
},
{
"name"
:
"前传输带"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/7bccbc67b3f896176bed7d21c5f4d4307c3919be.png"
,
"uuid"
:
"06bd03a4-43c3-49bb-94c5-6ef365f70291"
,
"ext"
:
".png"
},
{
"name"
:
"后传输带"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/df9b718f80747a1e21349d2b9ac35d5e19a61dad.png"
,
"uuid"
:
"aa0c6ebc-164f-4767-90ca-a79be4316365"
,
"ext"
:
".png"
},
{
"name"
:
"把手杆子"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/5a9e4ba7ca6701eae85b6d6dcb0612ecb9a3eff9.png"
,
"uuid"
:
"f2f1a937-00f4-442f-af4f-0bcb00656e69"
,
"ext"
:
".png"
},
{
"name"
:
"把手"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/71255a6f3cdf9f66d53589e46d72fcd20fef468d.png"
,
"uuid"
:
"d9b395b5-4e46-43a5-aa2b-bfdd81c07fa7"
,
"ext"
:
".png"
},
{
"name"
:
"伸缩杆"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/a9cf8b147c52b7d4247e80e90e098f787808bfa9.png"
,
"uuid"
:
"fddb4636-9c62-47b2-ba5e-f2cd820dbccc"
,
"ext"
:
".png"
},
{
"name"
:
"左爪"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/1e8634fd94bda455d11956c2847d3823e80701d3.png"
,
"uuid"
:
"739014d2-3193-4853-bf8d-349bd3e8d990"
,
"ext"
:
".png"
},
{
"name"
:
"右爪"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/4bfc510e0d1fa1db77f5effa187294af38b74ff6.png"
,
"uuid"
:
"4fb43b19-67e9-42cc-b461-35c005c714fb"
,
"ext"
:
".png"
},
{
"name"
:
"连接点"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/39f39234631f739e70e9ab8b713284379f4016fb.png"
,
"uuid"
:
"2021124f-ffcb-487f-a24f-a00f3d8aae95"
,
"ext"
:
".png"
}
],
"events"
:
{
"in"
:
{
"doll-machine2-game-init"
:
{
"alias"
:
"重置"
},
"doll-machine2-game-start"
:
{
"alias"
:
"开始"
,
"data"
:
{
"prize"
:
true
}
}
},
"out"
:
{
"doll-machine2-game-end"
:
{
"alias"
:
"重置完毕"
,
"data"
:
null
}
}
}
}
src/custom/doll-machine2/src/game/GameView.ts
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2018/8/16.
*/
import
{
props
}
from
"../props"
;
import
{
playSound
,
createSvga
}
from
"./utils"
;
import
ObjectPool
=
engine
.
ObjectPool
;
import
{
getTextureByName
}
from
"./utils"
;
import
{
Goods
}
from
"./Goods"
;
import
{
PoolName
}
from
"./object-pool-init"
;
import
{
FrontBoxs
}
from
"./frontBox"
;
import
{
BackBoxs
}
from
"./backBox"
;
import
{
Zhuazi
}
from
'./Zhuazi'
;
export
default
class
GameView
extends
engine
.
Container
{
private
_hasSetup
;
//触摸层
private
rectBg
:
engine
.
Rect
;
//npc层
private
NpcBg
:
engine
.
Container
;
//盒子1
private
box1
:
engine
.
Container
;
//盒子2
private
box2
:
engine
.
Container
;
//盒子3
private
box3
:
engine
.
Container
;
//盒子4
private
box4
:
engine
.
Container
;
//盒子5
private
box5
:
engine
.
Container
;
//前传输区域
private
frontTransfer
:
engine
.
Container
;
//后传输区域
private
backTransfer
:
engine
.
Container
;
//前台板
private
frontDesk
:
engine
.
Sprite
;
//后台板
private
backDesk
:
engine
.
Sprite
;
private
_frontBoxs
:
FrontBoxs
;
private
_backBoxs
:
BackBoxs
;
private
_Zhuazi
:
Zhuazi
;
private
prizeBox
:
engine
.
Container
;
private
rect
;
//当前分数
private
score
;
//中奖盒子移动距离
private
moveTime
;
//游戏状态
private
gameIng
;
//是否已获取位移值
public
startstatus
=
true
;
//是否中奖
public
ifPrize
=
true
;
//npc出身计时器
private
timer
;
//倒计时计时器
private
countdownTimer
:
any
;
//倒计时
private
countdown
:
number
;
//当前速度
private
speed
:
number
;
// 当前场景上面的物品
private
goodsItems
=
[];
private
_goods
:
Goods
;
constructor
()
{
super
();
this
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
this
.
setup
,
this
);
}
// private waterSvga;
// private boomSvga;
// private playerSvga;
setup
()
{
if
(
this
.
_hasSetup
)
{
return
;
}
this
.
_hasSetup
=
true
;
const
frontBoxs
=
(
this
.
_frontBoxs
=
new
FrontBoxs
());
this
.
_frontBoxs
.
GameView
=
this
;
const
backBoxs
=
(
this
.
_backBoxs
=
new
BackBoxs
());
this
.
_Zhuazi
=
new
Zhuazi
();
this
.
_Zhuazi
.
GameView
=
this
;
this
.
frontTransfer
=
new
engine
.
Container
();
this
.
backTransfer
=
new
engine
.
Container
();
this
.
frontTransfer
.
width
=
0
;
this
.
frontTransfer
.
height
=
0
;
this
.
frontTransfer
.
alpha
=
1
;
// this.frontTransfer.x = 0;
// this.frontTransfer.y = 434;
this
.
backTransfer
.
width
=
0
;
this
.
backTransfer
.
height
=
0
;
this
.
backTransfer
.
alpha
=
1
;
// this.backTransfer.x = 0;
// this.backTransfer.y = 390;
this
.
rect
=
new
engine
.
Rect
();
this
.
rect
.
width
=
props
.
gameStageWidth
;
this
.
rect
.
height
=
props
.
gameStageHeight
;
this
.
rect
.
x
=
65
;
this
.
rect
.
y
=
0
;
this
.
NpcBg
=
new
engine
.
Container
();
this
.
NpcBg
.
x
=
0
;
this
.
NpcBg
.
y
=
0
;
this
.
addChild
(
this
.
NpcBg
);
this
.
addChild
(
this
.
rect
);
// let gameBg = new engine.Sprite(getTextureByName("游戏背景"));
// gameBg.x = 65;
// gameBg.y = 263;
// this.NpcBg.addChild(gameBg);
this
.
frontDesk
=
new
engine
.
Sprite
(
getTextureByName
(
"前传输带"
));
this
.
frontDesk
.
x
=
props
.
initOffsetLeft
;
this
.
frontDesk
.
y
=
props
.
frontDeskY
-
props
.
initOffsetTop
;
this
.
backDesk
=
new
engine
.
Sprite
(
getTextureByName
(
"后传输带"
));
this
.
backDesk
.
x
=
props
.
initOffsetLeft
;
this
.
backDesk
.
y
=
props
.
backDeskY
-
props
.
initOffsetTop
;
if
(
props
.
single
)
{
this
.
backDesk
.
visible
=
false
;
}
let
pcarr
=
[
this
.
backDesk
,
this
.
frontDesk
,
this
.
backTransfer
,
this
.
frontTransfer
,
this
.
_Zhuazi
];
pcarr
.
forEach
(
item
=>
{
this
.
NpcBg
.
addChild
(
item
);
})
this
.
NpcBg
.
mask
=
this
.
rect
;
this
.
_Zhuazi
.
setup
();
// this._Zhuazi.move();
this
.
backTransfer
.
addChild
(
this
.
_backBoxs
);
this
.
_backBoxs
.
setup
();
if
(
props
.
single
)
{
this
.
backTransfer
.
visible
=
false
;
}
this
.
frontTransfer
.
addChild
(
this
.
_frontBoxs
);
this
.
_frontBoxs
.
setup
();
}
/**
*
* @param 暂停move
*/
stopMove
()
{
this
.
_frontBoxs
.
stop
();
}
/**
* 赋值x距离值
*/
setMoveX
(
x
,
item
)
{
this
.
moveTime
=
x
;
this
.
prizeBox
=
item
;
this
.
_Zhuazi
.
move
();
}
/**
* 显示隐藏盒子
*/
setVisible
(
isshow
)
{
this
.
_frontBoxs
.
showHidePrizeBox
(
isshow
);
}
/**
* 获取中奖盒子移动的距离
*/
getMoveX
()
{
return
this
.
moveTime
;
}
/**
* 重置moveTime
*/
resetMoveX
()
{
this
.
moveTime
=
null
;
}
/**
* 获取中奖盒子
*/
getBox
()
{
return
this
.
prizeBox
;
}
/**
* 重置场景
*/
reset
()
{
this
.
startstatus
=
false
;
this
.
ifPrize
=
false
;
this
.
_Zhuazi
.
getReset
();
}
/**
* 开始
*/
start
(
type
=
null
)
{
this
.
speed
=
1
;
this
.
gameIng
=
true
;
console
.
log
(
'执行'
,
type
);
this
.
startstatus
=
true
;
this
.
ifPrize
=
type
&&
type
.
prize
||
false
;
}
/**
* npc开始掉落
*/
beginNpc
()
{
this
.
timer
=
setTimeout
(()
=>
{
if
(
this
.
gameIng
)
{
// this.speed += props.acceleratedSpeed;
// this.creatNpc()
}
//递归执行
// this.beginNpc();
},
2000
/
this
.
speed
);
}
/**
* 暂停
*/
pause
()
{
this
.
gameIng
=
false
;
}
/**
* 恢复
*/
revive
()
{
this
.
gameIng
=
true
;
}
/**
* 重新开始
*/
resume
()
{
this
.
reset
();
this
.
start
();
}
}
src/custom/doll-machine2/src/game/GameWrapper.ts
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2020-01-09.
*/
import
GameView
from
"./GameView"
;
import
{
injectProps
}
from
"../props"
;
export
class
GameWrapper
extends
engine
.
Container
{
private
_status
;
private
_gameView
:
GameView
;
constructor
()
{
super
();
engine
.
globalEvent
.
addEventListener
(
'doll-machine2-game-init'
,
this
.
reset
,
this
);
engine
.
globalEvent
.
addEventListener
(
'doll-machine2-game-start'
,
this
.
start
,
this
);
let
gameView
=
this
.
_gameView
=
new
GameView
();
this
.
addChild
(
gameView
);
// gameView.reset();
// gameView.start()
}
reset
(
event
:
engine
.
Event
)
{
injectProps
(
event
.
data
);
this
.
_gameView
.
visible
=
true
;
this
.
_gameView
.
reset
();
}
start
(
event
:
engine
.
Event
)
{
console
.
log
(
'监听开始'
);
injectProps
(
event
.
data
);
// this._status = 1;
this
.
_gameView
.
start
(
event
.
data
);
}
pause
()
{
this
.
_gameView
.
pause
();
}
resume
()
{
this
.
_gameView
.
resume
();
}
revive
()
{
this
.
_gameView
.
revive
();
}
clear
()
{
this
.
_gameView
.
visible
=
false
;
}
private
onTap
(
event
)
{
// this._gameView.tap(event);
}
}
src/custom/doll-machine2/src/game/Goods.ts
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2020-02-02.
*
* 掉落物品
*/
import
{
getTextureByName
}
from
"./utils"
;
import
{
props
}
from
"../props"
;
export
class
Goods
extends
engine
.
Container
{
private
_body
:
engine
.
Rect
;
private
_toY
;
constructor
()
{
super
();
let
body
;
body
=
this
.
_body
=
new
engine
.
Rect
();
// let rain = new engine.Sprite(getTextureByName('雨滴'));
// rain["npcType"]="rain"
// let stone = new engine.Sprite(getTextureByName('石块'));
// stone["npcType"]="stone"
// let boom = new engine.Sprite(getTextureByName('炸弹'));
// boom["npcType"]="boom"
let
box1
=
new
engine
.
Sprite
(
getTextureByName
(
"草泥马盒"
));
box1
[
"npcType"
]
=
"box1"
;
let
box2
=
new
engine
.
Sprite
(
getTextureByName
(
"狗盒"
));
box2
[
"npcType"
]
=
"box2"
;
let
box3
=
new
engine
.
Sprite
(
getTextureByName
(
"猫盒"
));
box3
[
"npcType"
]
=
"box3"
;
// rain.visible=false;
// stone.visible=false;
// boom.visible=false;
// body.addChild(rain)
// body.addChild(stone)
// body.addChild(boom)
box1
.
visible
=
false
;
box2
.
visible
=
false
;
box3
.
visible
=
false
;
body
.
addChild
(
box1
);
body
.
addChild
(
box2
);
body
.
addChild
(
box3
);
this
.
addChild
(
body
);
body
.
width
=
0.0001
;
body
.
height
=
0.0001
;
body
.
mouseEnabled
=
false
;
}
getRandomNumberByRange
(
start
,
end
)
{
return
Math
.
floor
(
Math
.
random
()
*
(
end
-
start
)
+
start
);
}
// reset() {
// this.visible = true;
// this.rotation = 0;
// this.anchorOffsetY = 0;
// this.y = 0;
// this.x = (750-120)*Math.random()+30;
// this.rotation = 0;
// let random=Math.random()
// if(random<props.goodsProbability[0]){
// this.showNpc("box1")
// }else if(random>=props.goodsProbability[0]&&random<=(props.goodsProbability[0]+props.goodsProbability[1])){
// this.showNpc("box2")
// }else if(random>(props.goodsProbability[0]+props.goodsProbability[1])){
// this.showNpc("box3")
// }
// }
reset
()
{
this
.
visible
=
true
;
this
.
y
=
200
;
this
.
x
=
0
;
this
.
rotation
=
0
;
let
random
=
Math
.
random
();
if
(
random
<
0.3
)
{
this
.
showNpc
(
"box1"
);
}
else
if
(
random
<
0.6
)
{
this
.
showNpc
(
"box2"
);
}
else
{
this
.
showNpc
(
"box3"
);
}
// this.showNpc("box1");
// this.showNpc("box2");
// this.showNpc("box3");
}
showNpc
(
type
)
{
for
(
let
i
=
0
;
i
<
this
.
_body
.
children
.
length
;
i
++
)
{
this
.
_body
.
children
[
i
].
visible
=
false
;
this
.
_body
.
children
[
i
].
mouseEnabled
=
false
;
}
for
(
let
i
=
0
;
i
<
this
.
_body
.
children
.
length
;
i
++
)
{
if
(
this
.
_body
.
children
[
i
][
"npcType"
]
==
type
)
{
this
[
"npcType"
]
=
type
;
console
.
log
(
type
);
this
.
_body
.
children
[
i
].
visible
=
true
;
this
.
_body
.
children
[
i
].
mouseEnabled
=
false
;
}
}
}
set
anchorOffsetY
(
v
)
{
this
.
_body
.
y
=
v
;
}
}
src/custom/doll-machine2/src/game/Zhuazi.ts
0 → 100644
View file @
d1566d32
import
{
getTextureByName
}
from
"./utils"
;
import
{
props
}
from
"../props"
;
import
GameView
from
'./GameView'
;
export
class
Zhuazi
extends
engine
.
Container
{
private
bashouGan
:
engine
.
Sprite
;
private
bashou
:
engine
.
Sprite
;
private
ganzi
:
engine
.
Sprite
;
private
left_zhuazi
:
engine
.
Sprite
;
private
right_zhuazi
:
engine
.
Sprite
;
private
connect
:
engine
.
Sprite
;
private
ganNode
:
engine
.
Container
;
private
moveNode
:
engine
.
Container
;
private
moveArr
=
[];
private
zhuaziY
;
private
itemShow
:
engine
.
Container
;
private
prizeBoxs
=
[];
public
GameView
:
GameView
;
constructor
()
{
super
();
}
setup
()
{
this
.
ganNode
=
new
engine
.
Container
();
this
.
moveNode
=
new
engine
.
Container
();
this
.
ganNode
.
x
=
280
;
this
.
ganNode
.
y
=
350
;
this
.
bashouGan
=
new
engine
.
Sprite
(
getTextureByName
(
"把手杆子"
));
this
.
bashouGan
.
x
=
60
;
this
.
bashouGan
.
y
=
12
;
this
.
bashou
=
new
engine
.
Sprite
(
getTextureByName
(
"把手"
));
this
.
bashou
.
x
=
0
;
this
.
bashou
.
y
=
0
;
this
.
ganzi
=
new
engine
.
Sprite
(
getTextureByName
(
"伸缩杆"
));
this
.
ganzi
.
x
=
97
;
this
.
ganzi
.
y
=
27
;
this
.
connect
=
new
engine
.
Sprite
(
getTextureByName
(
"连接点"
));
this
.
connect
.
x
=
18
;
this
.
connect
.
y
=
-
5
;
this
.
left_zhuazi
=
new
engine
.
Sprite
(
getTextureByName
(
"左爪"
));
this
.
left_zhuazi
.
x
=
-
15
;
this
.
left_zhuazi
.
y
=
60
;
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
this
.
right_zhuazi
=
new
engine
.
Sprite
(
getTextureByName
(
"右爪"
));
this
.
right_zhuazi
.
x
=
98
;
this
.
right_zhuazi
.
y
=
60
;
this
.
ganNode
.
addChild
(
this
.
left_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
right_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
connect
);
this
.
ganNode
.
x
=
30
;
this
.
ganNode
.
y
=
this
.
ganNode
.
y
-
263
;
this
.
zhuaziY
=
this
.
ganNode
.
y
;
this
.
moveNode
.
addChild
(
this
.
ganzi
);
this
.
moveNode
.
addChild
(
this
.
ganNode
);
this
.
moveNode
.
addChild
(
this
.
bashou
);
this
.
moveNode
.
x
=
262
;
this
.
bashouGan
.
y
=
this
.
bashouGan
.
y
;
this
.
moveNode
.
y
=
this
.
moveNode
.
y
;
this
.
addChild
(
this
.
bashouGan
);
this
.
addChild
(
this
.
moveNode
);
if
(
!
props
.
ganziShow
)
{
this
.
bashouGan
.
visible
=
false
;
}
if
(
!
props
.
bashouShow
)
{
this
.
bashou
.
visible
=
false
;
}
this
.
createPrizeBox
();
}
createPrizeBox
()
{
for
(
let
i
=
0
;
i
<
props
.
dollNum
;
i
++
)
{
if
(
!
new
engine
.
Sprite
(
getTextureByName
(
'prizebox_'
+
i
)))
{
return
;
}
this
.
prizeBoxs
[
i
]
=
new
engine
.
Sprite
(
getTextureByName
(
'prizebox_'
+
i
));
this
.
prizeBoxs
[
i
][
'npcType'
]
=
'box'
+
i
;
}
this
.
prizeBoxs
[
props
.
dollNum
]
=
new
engine
.
Sprite
(
getTextureByName
(
'prizebox_0'
));
this
.
prizeBoxs
[
props
.
dollNum
][
'npcType'
]
=
'box'
+
props
.
dollNum
;
this
.
prizeBoxs
.
forEach
(
item
=>
{
this
.
ganNode
.
addChild
(
item
);
item
.
visible
=
false
;
item
.
x
=
props
.
prizeBoxInitX
;
item
.
y
=
props
.
prizeBoxInitY
;
})
}
showPrizeBox
()
{
this
.
prizeBoxs
.
forEach
(
item
=>
{
console
.
log
(
this
.
GameView
.
getBox
()[
'npcType'
]);
if
(
item
[
'npcType'
]
===
this
.
GameView
.
getBox
()[
'npcType'
])
{
item
.
visible
=
true
;
this
.
itemShow
=
item
;
}
else
{
item
.
visible
=
false
;
}
})
}
move
()
{
let
rndist
=
Math
.
random
();
let
halfWidth
=
this
.
bashou
.
width
/
2
;
let
randomX
=
rndist
*
(
rndist
>
0.5
?
1
:
-
1
)
*
props
.
bashouMoveDist
;
console
.
log
(
randomX
);
engine
.
Tween
.
get
(
this
.
moveNode
).
to
({
x
:
370
+
halfWidth
-
71
},
1000
).
call
(()
=>
{
this
.
zhangkai
();
});
}
zhangkai
()
{
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
engine
.
Tween
.
get
(
this
.
left_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
props
.
leftRotation
},
1000
);
engine
.
Tween
.
get
(
this
.
right_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
props
.
rightRotation
},
1000
);
setTimeout
(()
=>
{
this
.
getLong
();
},
500
);
}
getLong
()
{
let
droptime
=
Number
((
this
.
GameView
.
getMoveX
()
/
60
-
1
).
toFixed
(
2
))
*
1000
;
console
.
log
(
'dr'
,
droptime
);
let
times
=
(
props
.
ganMoveEndY
-
this
.
ganzi
.
y
)
/
this
.
ganzi
.
height
;
console
.
log
(
Number
(
times
.
toFixed
(
2
))
);
engine
.
Tween
.
get
(
this
.
ganzi
).
to
({
scaleY
:
Number
(
times
.
toFixed
(
2
))
},
droptime
).
to
({
scaleY
:
1
},
droptime
)
console
.
log
(
'node'
,
this
.
zhuaziY
);
engine
.
Tween
.
get
(
this
.
ganNode
).
to
({
y
:
props
.
ganMoveEndY
},
droptime
).
call
(()
=>
{
this
.
GameView
.
stopMove
();
if
(
this
.
GameView
.
ifPrize
)
{
this
.
showPrizeBox
();
this
.
GameView
.
setVisible
(
false
);
}
}).
to
({
y
:
this
.
zhuaziY
},
droptime
).
call
(()
=>
{
// this.getReset();
if
(
this
.
GameView
.
ifPrize
)
{
this
.
itemShow
.
visible
=
false
;
}
engine
.
globalEvent
.
dispatchEvent
(
'doll-machine2-game-end'
);
})
}
getReset
()
{
// if (this.GameView.ifPrize) {
// this.itemShow.visible = false;
// }
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
engine
.
Tween
.
get
(
this
.
moveNode
,
{
loop
:
false
}).
to
({
x
:
262
},
1000
);
engine
.
Tween
.
get
(
this
.
left_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
0
},
1000
);
engine
.
Tween
.
get
(
this
.
right_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
0
},
1000
);
this
.
GameView
.
resetMoveX
();
}
}
\ No newline at end of file
src/custom/doll-machine2/src/game/backBox.ts
0 → 100644
View file @
d1566d32
import
{
getTextureByName
}
from
"./utils"
;
import
{
props
}
from
"../props"
;
export
class
BackBoxs
extends
engine
.
Container
{
private
backBoxs
=
[];
constructor
()
{
super
();
}
setup
()
{
let
initX
,
initY
=
0
;
for
(
let
i
=
0
;
i
<
props
.
dollNum
;
i
++
)
{
this
.
backBoxs
[
i
]
=
new
engine
.
Sprite
(
getTextureByName
(
'backbox_'
+
i
));
initX
=
this
.
backBoxs
[
0
].
x
=
props
.
backInitX
;
initY
=
this
.
backBoxs
[
0
].
y
=
props
.
backInitY
-
props
.
initOffsetTop
;
this
.
backBoxs
[
i
][
'npcType'
]
=
'box'
+
i
;
}
this
.
backBoxs
[
props
.
dollNum
]
=
new
engine
.
Sprite
(
getTextureByName
(
'backbox_0'
));
this
.
backBoxs
[
props
.
dollNum
][
'npcType'
]
=
'box'
+
props
.
dollNum
;
for
(
let
i
=
0
;
i
<
this
.
backBoxs
.
length
;
i
++
)
{
if
(
i
==
0
)
{
this
.
backBoxs
[
i
].
x
=
initX
;
}
else
{
this
.
backBoxs
[
i
].
x
=
this
.
backBoxs
[
i
-
1
].
x
+
this
.
backBoxs
[
i
].
width
+
props
.
backmargin
;
}
this
.
backBoxs
[
i
].
y
=
initY
;
this
.
addChild
(
this
.
backBoxs
[
i
]);
}
this
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
frameMove
,
this
);
}
frameMove
()
{
this
.
backBoxs
.
forEach
((
item
)
=>
{
item
.
x
-=
props
.
moveSpeed
;
if
(
item
.
x
<=
0
)
{
let
lastitem
=
this
.
backBoxs
.
shift
();
lastitem
.
x
=
this
.
backBoxs
[
this
.
backBoxs
.
length
-
1
].
x
+
item
.
width
+
props
.
backmargin
;
this
.
backBoxs
.
push
(
lastitem
);
}
})
}
}
\ No newline at end of file
src/custom/doll-machine2/src/game/frontBox.ts
0 → 100644
View file @
d1566d32
import
{
getTextureByName
}
from
"./utils"
;
import
GameView
from
'./GameView'
;
import
{
props
}
from
"../props"
;
export
class
FrontBoxs
extends
engine
.
Container
{
//盒子1
private
box1
:
engine
.
Container
;
//盒子2
private
box2
:
engine
.
Container
;
//盒子3
private
box3
:
engine
.
Container
;
//盒子4
private
box4
:
engine
.
Container
;
//盒子5
private
box5
:
engine
.
Container
;
// 需隐藏的盒子
private
hideBox
:
engine
.
Container
;
private
frontBoxs
=
[];
public
GameView
:
GameView
;
constructor
()
{
super
();
}
setup
()
{
let
initX
,
initY
=
0
;
for
(
let
i
=
0
;
i
<
+
props
.
dollNum
+
1
;
i
++
)
{
if
(
!
new
engine
.
Sprite
(
getTextureByName
(
'frontbox_'
+
i
)))
{
return
;
}
this
.
frontBoxs
[
i
]
=
new
engine
.
Sprite
(
getTextureByName
(
'frontbox_'
+
i
));
initX
=
this
.
frontBoxs
[
0
].
x
=
props
.
frontInitX
;
initY
=
this
.
frontBoxs
[
0
].
y
=
props
.
frontInitY
;
this
.
frontBoxs
[
i
][
'npcType'
]
=
'box'
+
i
;
}
// this.frontBoxs[props.dollNum] = new engine.Sprite(getTextureByName('frontbox_0'));
// this.frontBoxs[props.dollNum]['npcType'] = 'box' + props.dollNum;
for
(
let
i
=
0
;
i
<
this
.
frontBoxs
.
length
;
i
++
)
{
if
(
i
==
0
)
{
this
.
frontBoxs
[
i
].
x
=
initX
;
}
else
{
this
.
frontBoxs
[
i
].
x
=
this
.
frontBoxs
[
i
-
1
].
x
-
this
.
frontBoxs
[
0
].
width
-
props
.
frontmargin
;
}
console
.
log
(
this
.
frontBoxs
[
i
].
x
);
this
.
frontBoxs
[
i
].
y
=
initY
;
this
.
addChild
(
this
.
frontBoxs
[
i
]);
console
.
log
(
'aaa'
,
this
.
frontBoxs
[
i
].
x
);
}
// console.log(this.frontBoxs);
this
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
frameMove
,
this
);
}
frameMove
()
{
this
.
frontBoxs
.
forEach
((
item
,
index
)
=>
{
item
.
x
+=
props
.
moveSpeed
;
if
(
item
.
x
<=
0
&&
!
item
.
visible
)
{
item
.
visible
=
true
;
}
if
(
item
.
x
>=
750
)
{
let
lastitem
=
this
.
frontBoxs
.
shift
();
lastitem
.
x
=
this
.
frontBoxs
[
this
.
frontBoxs
.
length
-
1
].
x
-
this
.
frontBoxs
[
0
].
width
-
props
.
frontmargin
;
if
(
!
this
.
GameView
.
getMoveX
()
&&
item
.
x
<=
0
&&
this
.
GameView
.
startstatus
)
{
this
.
GameView
.
setMoveX
((
370
-
item
.
x
-
13
)
/
props
.
moveSpeed
,
item
);
this
.
hideBox
=
item
;
}
this
.
frontBoxs
.
push
(
lastitem
);
}
})
}
stop
()
{
// this.removeEventListener(engine.Event.ENTER_FRAME, this.frameMove, this);
}
showHidePrizeBox
(
isshow
)
{
this
.
hideBox
.
visible
=
isshow
}
}
\ No newline at end of file
src/custom/doll-machine2/src/game/object-pool-init.ts
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2020-02-03.
*/
import
{
Goods
}
from
"./Goods"
;
import
ObjectPool
=
engine
.
ObjectPool
;
export
const
PoolName
:
string
=
'goods'
;
ObjectPool
.
registerPool
(
PoolName
,
function
()
{
return
new
Goods
();
},
function
(
item
:
Goods
,
data
)
{
item
.
reset
();
});
src/custom/doll-machine2/src/game/utils.ts
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2020-01-21.
*/
export
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
export
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
export
function
playSound
(
name
)
{
engine
.
playSound
(
engine
.
getAssetByName
(
name
).
uuid
,
{
keep
:
true
});
}
export
function
createSvga
(
name
,
anchorName
?)
{
let
inst
=
new
svga
.
Svga
();
inst
.
source
=
'asset://'
+
engine
.
getAssetByName
(
name
).
uuid
;
return
inst
;
}
\ No newline at end of file
src/custom/doll-machine2/src/index.ts
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2019-11-20.
*/
import
{
GameWrapper
}
from
"./game/GameWrapper"
;
import
{
injectProps
,
prepareProps
}
from
"./props"
;
export
default
function
(
props
)
{
prepareProps
();
injectProps
(
props
);
let
instance
=
new
GameWrapper
();
return
instance
;
}
src/custom/doll-machine2/src/props.ts
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2020-01-21.
*/
export
let
props
:
any
=
{};
export
function
prepareProps
()
{
let
metaProps
=
getProps
();
engine
.
injectProp
(
props
,
metaProps
);
}
export
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
src/custom/open-gift/debug/app.js
0 → 100644
View file @
d1566d32
/**
* Created by renjianfeng on 2020-03-13.
*/
const
customId
=
"open-gift"
;
(
async
function
()
{
let
customModule
=
await
fetch
(
`../meta.json`
);
customModule
=
await
customModule
.
json
();
console
.
log
(
customModule
);
await
loadAssets
(
customModule
.
assets
);
launchWithCustomModule
(
customModule
);
})();
function
launchWithCustomModule
(
customModule
)
{
//engine.registerCustomCodeModule(customModule);
engine
.
registerCustomModule
(
customId
,
window
[
customId
]);
const
{
props
:
propsOption
,
assets
}
=
customModule
;
let
props
=
engine
.
computeProps
(
customModuleProps
,
propsOption
);
const
customModuleIns
=
{
id
:
customId
,
props
,
assets
,
};
engine
.
registerCustomModules
([
customModuleIns
]);
engine
.
launchWithConfig
({
options
:
{
entrySceneView
:
'entry'
,
},
assets
:
[],
views
:
[{
name
:
'entry'
,
type
:
'node'
,
properties
:
{
x
:
0
,
y
:
0
,
}
}],
},
null
,
function
()
{
setTimeout
(()
=>
{
engine
.
addCustomModule
(
customId
,
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
));
},
100
);
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'food-fell-reset'
,
{
"goodsProbability"
:
[
0.8
,
0.1
,
0.1
],
"countDown"
:
30
,
"acceleratedSpeed"
:
0.1
});
engine
.
globalEvent
.
dispatchEvent
(
'food-fell-start'
);
},
500
);
});
engine
.
globalEvent
.
addEventListener
(
'food-fell-time-update'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
engine
.
globalEvent
.
addEventListener
(
'food-fell-score-update'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
engine
.
globalEvent
.
addEventListener
(
'food-fell-game-over'
,
(
e
)
=>
{
console
.
log
(
e
.
type
,
e
.
data
);
});
}
function
getAssetByUUID
(
uuid
)
{
return
engine
.
resolveCustomAsset
(
customId
,
uuid
);
}
function
getProps
()
{
return
engine
.
getProps
(
customId
);
}
src/custom/open-gift/debug/index.html
0 → 100644
View file @
d1566d32
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
拆礼盒
</title>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
/>
<meta
name=
"apple-mobile-web-app-capable"
content=
"yes"
/>
<meta
name=
"full-screen"
content=
"true"
/>
<meta
name=
"screen-orientation"
content=
"portrait"
/>
<meta
name=
"x5-fullscreen"
content=
"true"
/>
<meta
name=
"360-fullscreen"
content=
"true"
/>
<style>
html
,
body
{
padding
:
0
;
margin
:
0
;
border
:
0
;
width
:
100%
;
height
:
100%
;
overflow
:
hidden
;
position
:
absolute
;
background-color
:
red
;
}
</style>
</head>
<body>
<div
id=
"game-container"
style=
"line-height:0;font-size:0"
></div>
<script
crossorigin=
"anonymous"
src=
"//yun.duiba.com.cn/editor/zeroing/libs/engine.50cdcef6ebe4e8c0fbc624f9d4fbf225102c5750.js"
></script>
<script
crossorigin=
"anonymous"
src=
"//yun.duiba.com.cn/editor/zeroing/libs/svga.fd3923ae6e664251ca7981801a65809cc5f36bc3.js"
></script>
<!-- <script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.ebc906f6b50b8da0a669f77027981d5f3cb560ce.js"></script> -->
<!-- <script src="http://localhost:4002/debug/engine.js"></script>
<script src="http://localhost:4003/debug/engine-svga.js"></script> -->
<!--<script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.9a9dbfda4cb2dd5508ecddfe3d95dfd88063f7b5.js"></script>-->
<script
src=
"app.js"
></script>
<script
src=
"props.js"
></script>
<script
src=
"load-assets.js"
></script>
<script
src=
"main.js"
></script>
<script>
</script>
</body>
\ No newline at end of file
src/custom/open-gift/debug/load-assets.js
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2020-01-21.
*/
const
assets
=
[
{
"name"
:
"玩家icon"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/50a7212a113175fa18c866b005d98f07c558dc77.png"
,
"uuid"
:
"66f23d13-82a5-4cec-9496-301ec240d087"
,
"ext"
:
".png"
},
{
"name"
:
"雨滴"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8564c8c9be3aead71b05a0bab8d7d07ac3f778a1.png"
,
"uuid"
:
"264a6192-d7bf-45e8-8f15-6ba2c439a532"
,
"ext"
:
".png"
},
{
"name"
:
"炸弹"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/171e92283cd13c013ee1b76d28d252ff08815d47.png"
,
"uuid"
:
"eb88b42d-e151-4c1b-94b9-7c16f7bfac29"
,
"ext"
:
".png"
},
{
"name"
:
"石块"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/99b0af0c59fe79a415a3f032149cfacc27e3ac2c.png"
,
"uuid"
:
"ab1bdabc-21ba-46bf-9299-6c638f766c88"
,
"ext"
:
".png"
},
{
"name"
:
"水花"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/93d37b4a0e367e80e375308a6b4414d72d7666fc.svga"
,
"uuid"
:
"b521bf94-20e1-44dd-8eca-d24996cbaeae"
,
"ext"
:
".svga"
},
{
"name"
:
"炸弹"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/4dd18f0689c663bbcf710a7afc4d929084d97d36.svga"
,
"uuid"
:
"322edf39-805b-4e84-9d07-5573dfeebc0e"
,
"ext"
:
".svga"
},
{
"name"
:
"玩家"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/b66300c5d4f27134b0aac3dc90a3220e8ae572eb.svga"
,
"uuid"
:
"71d8dcbc-3931-471a-b585-b3ae01b25aa6"
,
"ext"
:
".svga"
}
];
function
loadAssets
(
customModuleAssets
,
onProgress
,
onComplete
){
return
engine
.
loadAssets
(
assets
.
concat
(...
customModuleAssets
),
onProgress
,
onComplete
);
}
src/custom/open-gift/debug/main.js
0 → 100644
View file @
d1566d32
(
function
(
global
,
factory
)
{
typeof
exports
===
'object'
&&
typeof
module
!==
'undefined'
?
module
.
exports
=
factory
(
require
(
'tslib'
))
:
typeof
define
===
'function'
&&
define
.
amd
?
define
([
'tslib'
],
factory
)
:
(
global
=
global
||
self
,
global
[
'open-gift'
]
=
factory
(
global
.
tslib
));
}(
this
,
(
function
(
tslib
)
{
'use strict'
;
var
props
=
{};
function
prepareProps
()
{
var
metaProps
=
getProps
();
engine
.
injectProp
(
props
,
metaProps
);
}
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
//# sourceMappingURL=props.js.map
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
function
createSvga
(
name
,
anchorName
)
{
var
inst
=
new
svga
.
Svga
();
inst
.
source
=
'asset://'
+
engine
.
getAssetByName
(
name
).
uuid
;
return
inst
;
}
//# sourceMappingURL=utils.js.map
var
GameView
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameView
,
_super
);
function
GameView
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
_this
.
setup
,
_this
);
return
_this
;
}
GameView
.
prototype
.
setup
=
function
()
{
if
(
this
.
_hasSetup
)
{
return
;
}
this
.
_hasSetup
=
true
;
this
.
NpcBg
=
new
engine
.
Container
();
this
.
NpcBg
.
x
=
props
.
initX
;
this
.
NpcBg
.
y
=
props
.
initY
;
this
.
addChild
(
this
.
NpcBg
);
this
.
bottomCircle
=
new
engine
.
Sprite
(
getTextureByName
(
'底座'
));
this
.
bottomCircle
.
x
=
17
;
this
.
bottomCircle
.
y
=
305
;
this
.
loveDot
=
new
engine
.
Sprite
(
getTextureByName
(
'点缀'
));
this
.
loveDot
.
x
=
0
;
this
.
loveDot
.
y
=
6
;
this
.
giftboxSvga
=
createSvga
(
'初始礼盒'
);
this
.
giftboxSvga
.
x
=
105
;
this
.
giftboxSvga
.
y
=
37
;
this
.
giftAfterSvga
=
createSvga
(
"拆礼盒"
);
this
.
giftAfterSvga
.
x
=
105
;
this
.
giftAfterSvga
.
y
=
0
;
this
.
giftAfterSvga
.
visible
=
false
;
this
.
NpcBg
.
addChild
(
this
.
bottomCircle
);
this
.
NpcBg
.
addChild
(
this
.
giftboxSvga
);
this
.
NpcBg
.
addChild
(
this
.
giftAfterSvga
);
this
.
NpcBg
.
addChild
(
this
.
loveDot
);
this
.
giftboxSvga
.
play
(
false
,
true
);
};
GameView
.
prototype
.
reset
=
function
()
{
this
.
giftboxSvga
.
visible
=
true
;
this
.
giftAfterSvga
.
visible
=
false
;
};
GameView
.
prototype
.
start
=
function
()
{
this
.
giftAfterSvga
.
visible
=
true
;
this
.
giftboxSvga
.
visible
=
false
;
this
.
giftAfterSvga
.
play
(
false
,
false
);
this
.
giftAfterSvga
.
once
(
engine
.
Event
.
END_FRAME
,
function
()
{
engine
.
globalEvent
.
dispatchEvent
(
'open-gift-game-end'
);
},
this
);
};
GameView
.
prototype
.
resume
=
function
()
{
this
.
reset
();
this
.
start
();
};
return
GameView
;
}(
engine
.
Container
));
var
GameWrapper
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameWrapper
,
_super
);
function
GameWrapper
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
'open-gift-game-init'
,
_this
.
reset
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'open-gift-game-start'
,
_this
.
start
,
_this
);
var
gameView
=
_this
.
_gameView
=
new
GameView
();
_this
.
addChild
(
gameView
);
return
_this
;
}
GameWrapper
.
prototype
.
reset
=
function
(
event
)
{
injectProps
(
event
.
data
);
this
.
_gameView
.
visible
=
true
;
this
.
_gameView
.
reset
();
};
GameWrapper
.
prototype
.
start
=
function
(
event
)
{
console
.
log
(
'监听开始'
);
injectProps
(
event
.
data
);
this
.
_gameView
.
start
();
};
GameWrapper
.
prototype
.
clear
=
function
()
{
this
.
_gameView
.
visible
=
false
;
};
return
GameWrapper
;
}(
engine
.
Container
));
//# sourceMappingURL=GameWrapper.js.map
function
index
(
props
)
{
prepareProps
();
injectProps
(
props
);
var
instance
=
new
GameWrapper
();
return
instance
;
}
//# sourceMappingURL=index.js.map
return
index
;
})));
//# sourceMappingURL=main.js.map
\ No newline at end of file
src/custom/open-gift/debug/main.js.map
0 → 100644
View file @
d1566d32
{"version":3,"file":"index.js","sources":["src/custom/open-gift/src/props.ts","src/custom/open-gift/src/game/utils.ts","src/custom/open-gift/src/game/GameView.ts","src/custom/open-gift/src/game/GameWrapper.ts","src/custom/open-gift/src/index.ts"],"sourcesContent":["/**\n * Created by rockyl on 2020-01-21.\n */\n\nexport let props: any = {};\n\nexport function prepareProps() {\n\tlet metaProps = getProps();\n\n\tengine.injectProp(props, metaProps);\n}\n\nexport function injectProps(p) {\n\tengine.injectProp(props, p);\n}\n","/**\n * Created by rockyl on 2020-01-21.\n */\n\nexport function getTexture(uuid) {\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\n}\n\nexport function getTextureByName(name) {\n\treturn getTexture(engine.getAssetByName(name).uuid);\n}\n\nexport function playSound(name) {\n\tengine.playSound(engine.getAssetByName(name).uuid, {keep: true});\n}\nexport function createSvga(name, anchorName?) {\n\tlet inst = new svga.Svga();\n\tinst.source = 'asset://' + engine.getAssetByName(name).uuid;\n\treturn inst;\n}","/**\n * Created by rockyl on 2018/8/16.\n */\n\nimport { props } from \"../props\";\nimport ObjectPool = engine.ObjectPool;\nimport { getTextureByName, createSvga } from \"./utils\";\n\nexport default class GameView extends engine.Container {\n private _hasSetup;\n \n //npc层\n private NpcBg: engine.Container;\n //底座\n private bottomCircle: engine.Container;\n //爱心点缀\n private loveDot: engine.Container;\n //礼盒\n private giftboxSvga;\n //礼盒前动画\n private giftAfterSvga\n \n\tprivate rect;\n\n constructor() {\n super();\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\n }\n\n setup() {\n if (this._hasSetup) {\n return;\n }\n\n this._hasSetup = true;\n\n this.NpcBg = new engine.Container();\n this.NpcBg.x = props.initX;\n this.NpcBg.y = props.initY;\n this.addChild(this.NpcBg);\n this.bottomCircle = new engine.Sprite(getTextureByName('底座'));\n this.bottomCircle.x = 17;\n this.bottomCircle.y = 305;\n this.loveDot = new engine.Sprite(getTextureByName('点缀'));\n this.loveDot.x = 0;\n this.loveDot.y = 6;\n\n this.giftboxSvga = createSvga('初始礼盒');\n this.giftboxSvga.x = 105;\n this.giftboxSvga.y = 37;\n this.giftAfterSvga = createSvga(\"拆礼盒\");\n this.giftAfterSvga.x = 105;\n this.giftAfterSvga.y = 0;\n this.giftAfterSvga.visible = false;\n this.NpcBg.addChild(this.bottomCircle);\n this.NpcBg.addChild(this.giftboxSvga);\n this.NpcBg.addChild(this.giftAfterSvga);\n this.NpcBg.addChild(this.loveDot);\n this.giftboxSvga.play(false, true)\n\t\t// this.rect = new engine.Rect();\n // this.rect.width = props.gameStageWidth;\n // this.rect.height = props.gameStageHeight;\n\t\t// this.rect.x = 0;\n\t\t// this.rect.y = 0;\n\t\t// this.addChild(this.rect);\n\n // this.NpcBg.mask = this.rect;\n\t}\n /**\n * 重置场景\n */\n reset() {\n this.giftboxSvga.visible = true;\n this.giftAfterSvga.visible = false;\n }\n\n /**\n * 开始\n */\n start() {\n this.giftAfterSvga.visible = true;\n this.giftboxSvga.visible = false;\n this.giftAfterSvga.play(false, false)\n this.giftAfterSvga.once(engine.Event.END_FRAME, () => {\n engine.globalEvent.dispatchEvent('open-gift-game-end');\n }, this);\n }\n\n /**\n * 重新开始\n */\n resume() {\n this.reset();\n this.start();\n }\n}\n","/**\n * Created by rockyl on 2020-01-09.\n */\n\nimport GameView from \"./GameView\";\nimport {injectProps} from \"../props\";\n\n\nexport class GameWrapper extends engine.Container {\n\tprivate _status;\n\tprivate _gameView: GameView;\n\n\n\n\n\n\tconstructor() {\n\t\tsuper();\n\t\tengine.globalEvent.addEventListener('open-gift-game-init', this.reset, this);\n\t\tengine.globalEvent.addEventListener('open-gift-game-start', this.start, this);\n\n\t\tlet gameView = this._gameView = new GameView();\n\t\tthis.addChild(gameView);\n\t\t// gameView.reset();\n\t\t// gameView.start()\n\t}\n\n\treset(event: engine.Event) {\t\t\n\t\tinjectProps(event.data);\n\t\tthis._gameView.visible = true;\n\t\tthis._gameView.reset();\n\t}\n\n\tstart(event: engine.Event) {\n\t\tconsole.log('监听开始');\n\t\tinjectProps(event.data);\n\t\t// this._status = 1;\n\t\tthis._gameView.start();\n\t}\n\n\tclear() {\n\t\tthis._gameView.visible = false;\n\t}\n}\n","/**\n * Created by rockyl on 2019-11-20.\n */\n\nimport {GameWrapper} from \"./game/GameWrapper\";\nimport {injectProps, prepareProps} from \"./props\";\n\nexport default function (props) {\n\tprepareProps();\n\tinjectProps(props);\n\n\tlet instance = new GameWrapper();\n\treturn instance;\n}\n"],"names":["__extends"],"mappings":";;;;;;CAIO,IAAI,KAAK,GAAQ,EAAE,CAAC;UAEX,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;UAEe,WAAW,CAAC,CAAC;KAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC7B,CAAC;;;UCVe,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;AAED,UAAgB,gBAAgB,CAAC,IAAI;KACpC,OAAO,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACrD,CAAC;AAED,UAGgB,UAAU,CAAC,IAAI,EAAE,UAAW;KAC3C,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;KAC3B,IAAI,CAAC,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;KAC5D,OAAO,IAAI,CAAC;CACb,CAAC;;;CCXD;KAAsCA,kCAAgB;KAgBpD;SAAA,YACE,iBAAO,SAER;SADC,KAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,KAAI,CAAC,KAAK,EAAE,KAAI,CAAC,CAAC;;MAC1D;KAED,wBAAK,GAAL;SACE,IAAI,IAAI,CAAC,SAAS,EAAE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AAS,GAAG,IAAI,QAAQ,EAAE,CAAC;SAC/C,KAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;;MAGxB;KAED,2BAAK,GAAL,UAAM,KAAmB;SACxB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACxB,IAAI,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;SAC9B,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KAED,2BAAK,GAAL,UAAM,KAAmB;SACxB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;SACpB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAExB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KAED,2BAAK,GAAL;SACC,IAAI,CAAC,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;MAC/B;KACF,kBAAC;CAAD,CAAC,CAnCgC,MAAM,CAAC,SAAS,GAmChD;;;iBCpCwB,KAAK;KAC7B,YAAY,EAAE,CAAC;KACf,WAAW,CAAC,KAAK,CAAC,CAAC;KAEnB,IAAI,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;KACjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;;"}
\ No newline at end of file
src/custom/open-gift/debug/props.js
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2020-01-21.
*/
let
customModuleProps
=
{
};
src/custom/open-gift/meta.json
0 → 100644
View file @
d1566d32
{
"name"
:
"拆礼盒"
,
"desc"
:
"拆礼盒模块"
,
"props"
:
{
"initX"
:
{
"alias"
:
"游戏场景初始X位置"
,
"type"
:
"number"
,
"default"
:
0
},
"initY"
:
{
"alias"
:
"游戏场景初始Y位置"
,
"type"
:
"number"
,
"default"
:
0
},
"gameStageWidth"
:
{
"alias"
:
"游戏场景宽度"
,
"type"
:
"number"
,
"default"
:
534
},
"gameStageHeight"
:
{
"alias"
:
"游戏场景高度"
,
"type"
:
"number"
,
"default"
:
408
}
},
"assets"
:
[
{
"name"
:
"底座"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/d6ed718f0d236febaa4d1331950e5a190f225cb5.png"
,
"uuid"
:
"7a0f8b48-449c-46d9-bd80-64455a30e641"
,
"ext"
:
".png"
},
{
"name"
:
"点缀"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/e08f680bbd26c4dcc47fd67ee2e145c46d6fcd1a.png"
,
"uuid"
:
"c7426dc4-d631-4947-accc-015666277208"
,
"ext"
:
".png"
},
{
"name"
:
"初始礼盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/b9bb4e52c3734025fc96a92cb574c92209927b61.svga"
,
"uuid"
:
"947cb448-1992-49f1-a9ed-e359b944953a"
,
"ext"
:
".svga"
},
{
"name"
:
"拆礼盒"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/8e86f8696710de414f0f36dc330db6e4bd0683d6.svga"
,
"uuid"
:
"d9222991-064c-4816-85ee-6964ba78fbd0"
,
"ext"
:
".svga"
}
],
"events"
:
{
"in"
:
{
"open-gift-game-init"
:
{
"alias"
:
"重置"
},
"open-gift-game-start"
:
{
"alias"
:
"开始"
,
"data"
:
{
"prize"
:
true
}
}
},
"out"
:
{
"open-gift-game-end"
:
{
"alias"
:
"动画完毕"
,
"data"
:
null
}
}
}
}
src/custom/open-gift/src/game/GameView.ts
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2018/8/16.
*/
import
{
props
}
from
"../props"
;
import
ObjectPool
=
engine
.
ObjectPool
;
import
{
getTextureByName
,
createSvga
}
from
"./utils"
;
export
default
class
GameView
extends
engine
.
Container
{
private
_hasSetup
;
//npc层
private
NpcBg
:
engine
.
Container
;
//底座
private
bottomCircle
:
engine
.
Container
;
//爱心点缀
private
loveDot
:
engine
.
Container
;
//礼盒
private
giftboxSvga
;
//礼盒前动画
private
giftAfterSvga
private
rect
;
constructor
()
{
super
();
this
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
this
.
setup
,
this
);
}
setup
()
{
if
(
this
.
_hasSetup
)
{
return
;
}
this
.
_hasSetup
=
true
;
this
.
NpcBg
=
new
engine
.
Container
();
this
.
NpcBg
.
x
=
props
.
initX
;
this
.
NpcBg
.
y
=
props
.
initY
;
this
.
addChild
(
this
.
NpcBg
);
this
.
bottomCircle
=
new
engine
.
Sprite
(
getTextureByName
(
'底座'
));
this
.
bottomCircle
.
x
=
17
;
this
.
bottomCircle
.
y
=
305
;
this
.
loveDot
=
new
engine
.
Sprite
(
getTextureByName
(
'点缀'
));
this
.
loveDot
.
x
=
0
;
this
.
loveDot
.
y
=
6
;
this
.
giftboxSvga
=
createSvga
(
'初始礼盒'
);
this
.
giftboxSvga
.
x
=
105
;
this
.
giftboxSvga
.
y
=
37
;
this
.
giftAfterSvga
=
createSvga
(
"拆礼盒"
);
this
.
giftAfterSvga
.
x
=
105
;
this
.
giftAfterSvga
.
y
=
0
;
this
.
giftAfterSvga
.
visible
=
false
;
this
.
NpcBg
.
addChild
(
this
.
bottomCircle
);
this
.
NpcBg
.
addChild
(
this
.
giftboxSvga
);
this
.
NpcBg
.
addChild
(
this
.
giftAfterSvga
);
this
.
NpcBg
.
addChild
(
this
.
loveDot
);
this
.
giftboxSvga
.
play
(
false
,
true
)
// this.rect = new engine.Rect();
// this.rect.width = props.gameStageWidth;
// this.rect.height = props.gameStageHeight;
// this.rect.x = 0;
// this.rect.y = 0;
// this.addChild(this.rect);
// this.NpcBg.mask = this.rect;
}
/**
* 重置场景
*/
reset
()
{
this
.
giftboxSvga
.
visible
=
true
;
this
.
giftAfterSvga
.
visible
=
false
;
}
/**
* 开始
*/
start
()
{
this
.
giftAfterSvga
.
visible
=
true
;
this
.
giftboxSvga
.
visible
=
false
;
this
.
giftAfterSvga
.
play
(
false
,
false
)
this
.
giftAfterSvga
.
once
(
engine
.
Event
.
END_FRAME
,
()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'open-gift-game-end'
);
},
this
);
}
/**
* 重新开始
*/
resume
()
{
this
.
reset
();
this
.
start
();
}
}
src/custom/open-gift/src/game/GameWrapper.ts
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2020-01-09.
*/
import
GameView
from
"./GameView"
;
import
{
injectProps
}
from
"../props"
;
export
class
GameWrapper
extends
engine
.
Container
{
private
_status
;
private
_gameView
:
GameView
;
constructor
()
{
super
();
engine
.
globalEvent
.
addEventListener
(
'open-gift-game-init'
,
this
.
reset
,
this
);
engine
.
globalEvent
.
addEventListener
(
'open-gift-game-start'
,
this
.
start
,
this
);
let
gameView
=
this
.
_gameView
=
new
GameView
();
this
.
addChild
(
gameView
);
// gameView.reset();
// gameView.start()
}
reset
(
event
:
engine
.
Event
)
{
injectProps
(
event
.
data
);
this
.
_gameView
.
visible
=
true
;
this
.
_gameView
.
reset
();
}
start
(
event
:
engine
.
Event
)
{
console
.
log
(
'监听开始'
);
injectProps
(
event
.
data
);
// this._status = 1;
this
.
_gameView
.
start
();
}
clear
()
{
this
.
_gameView
.
visible
=
false
;
}
}
src/custom/open-gift/src/game/utils.ts
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2020-01-21.
*/
export
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
export
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
export
function
playSound
(
name
)
{
engine
.
playSound
(
engine
.
getAssetByName
(
name
).
uuid
,
{
keep
:
true
});
}
export
function
createSvga
(
name
,
anchorName
?)
{
let
inst
=
new
svga
.
Svga
();
inst
.
source
=
'asset://'
+
engine
.
getAssetByName
(
name
).
uuid
;
return
inst
;
}
\ No newline at end of file
src/custom/open-gift/src/index.ts
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2019-11-20.
*/
import
{
GameWrapper
}
from
"./game/GameWrapper"
;
import
{
injectProps
,
prepareProps
}
from
"./props"
;
export
default
function
(
props
)
{
prepareProps
();
injectProps
(
props
);
let
instance
=
new
GameWrapper
();
return
instance
;
}
src/custom/open-gift/src/props.ts
0 → 100644
View file @
d1566d32
/**
* Created by rockyl on 2020-01-21.
*/
export
let
props
:
any
=
{};
export
function
prepareProps
()
{
let
metaProps
=
getProps
();
engine
.
injectProp
(
props
,
metaProps
);
}
export
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
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