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
57aa8bf6
Commit
57aa8bf6
authored
Mar 27, 2020
by
13732208043
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
茶叶更新
parent
7393d156
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
262 additions
and
221 deletions
+262
-221
pick-tea.json
dist/customs/pick-tea.json
+32
-13
main.js
src/custom/pick-tea/debug/main.js
+69
-89
main.js.map
src/custom/pick-tea/debug/main.js.map
+1
-1
meta.json
src/custom/pick-tea/meta.json
+31
-12
GameView.ts
src/custom/pick-tea/src/game/GameView.ts
+108
-99
GameWrapper.ts
src/custom/pick-tea/src/game/GameWrapper.ts
+9
-5
utils.ts
src/custom/pick-tea/src/game/utils.ts
+12
-2
No files found.
dist/customs/pick-tea.json
View file @
57aa8bf6
{
"name"
:
"采茶叶"
,
"desc"
:
"采茶叶模
块
"
,
"desc"
:
"采茶叶模
左上角0,0点
"
,
"props"
:
{
"versePos"
:
{
"alias"
:
"诗句的起始位置"
,
...
...
@@ -10,7 +10,7 @@
"verses"
:
{
"alias"
:
"诗句"
,
"type"
:
"array<string>"
,
"default"
:
"今
朝有酒今朝醉,今宵更有湘江月,找出霏霏满碗花,雨过林霏清石气,秋将山翠入诗心,生怕芳丛鹰嘴芽,老郎封寄谪仙家
"
"default"
:
"今
宵更有湘江月,照出霏霏满碗花,雨过林霏清石气,秋将山翠入诗心
"
},
"verseLabel"
:
{
"alias"
:
"提示语框xys"
,
...
...
@@ -22,6 +22,16 @@
"type"
:
"array<string>"
,
"default"
:
"#33628b,#99b1c5"
},
"showFrontImg"
:
{
"alias"
:
"茶叶前景图1显示2隐藏"
,
"type"
:
"number"
,
"default"
:
"1"
},
"FrontImgPos"
:
{
"alias"
:
"茶叶前景图位置"
,
"type"
:
"array<number>"
,
"default"
:
"0,584"
},
"pickTeaSpeed"
:
{
"alias"
:
"采集茶叶的速度ms"
,
"type"
:
"number"
,
...
...
@@ -30,12 +40,12 @@
"basketSvgaPos"
:
{
"alias"
:
"人物的位置"
,
"type"
:
"array<number>"
,
"default"
:
"110,4
2
0"
"default"
:
"110,4
1
0"
},
"addOneSvgaPos"
:
{
"alias"
:
"+1SVGA的位置"
,
"type"
:
"array<number>"
,
"default"
:
"
70,72
0"
"default"
:
"
0,-10
0"
},
"pickTeaSvgaPos"
:
{
"alias"
:
"采茶叶SVGA的位置"
,
...
...
@@ -50,12 +60,12 @@
"handGraspSvgaPos"
:
{
"alias"
:
"手点击SVGA的位置"
,
"type"
:
"array<number>"
,
"default"
:
"
543,791
"
"default"
:
"
477,-29
"
},
"handGraspMovePos"
:
{
"alias"
:
"手点击移动的位置"
,
"type"
:
"array<number>"
,
"default"
:
"
460,700
"
"default"
:
"
372,-145
"
},
"progressbarBgImgPos"
:
{
"alias"
:
"进度条底图的位置"
,
...
...
@@ -65,7 +75,7 @@
"progressbarImgPos"
:
{
"alias"
:
"进度条的位置"
,
"type"
:
"array<number>"
,
"default"
:
"-
443
,4"
"default"
:
"-
335
,4"
},
"teaStarImgPos"
:
{
"alias"
:
"小茶叶的位置"
,
...
...
@@ -84,6 +94,12 @@
}
},
"assets"
:
[
{
"name"
:
"前景"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/1da0ea14267ff35f90f49c22deb1b34181571e90.png"
,
"uuid"
:
"9f5db57e-47f9-43e5-af80-adf41299280d"
,
"ext"
:
".png"
},
{
"name"
:
"气泡框"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/585743f25262b6992ac97015e22d91054d506821.png"
,
...
...
@@ -98,7 +114,7 @@
},
{
"name"
:
"进度"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
047218962662ed238192f211719c109fa107e8e1
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
afb6b2655838ea955d250663fc535cc166b466e7
.png"
,
"uuid"
:
"23e7861c-75a9-46bd-93f8-2825d4810d31"
,
"ext"
:
".png"
},
...
...
@@ -190,26 +206,29 @@
"events"
:
{
"in"
:
{
"event-getchange-TeaNum"
:
{
"alias"
:
"茶叶数量{初始值
totalNum,总量nowNum
} "
"alias"
:
"茶叶数量{初始值
nowNum,总量totalNum,后端时间serverData
} "
},
"event-getBasket-Type"
:
{
"alias"
:
"获得篮子类型"
"alias"
:
"获得篮子类型
(纸 布 竹 木)0 1 2 3
"
},
"event-hand-grasp"
:
{
"alias"
:
"手抓去"
},
"event-getClick-person"
:
{
"alias"
:
"点击人物"
}
},
"out"
:
{
"event-setchange-TeaNum"
:
{
"alias"
:
""
,
"alias"
:
"
获取茶叶数量{初始值nowNum,总量totalNum,后端时间serverData}
"
,
"data"
:
{}
},
"event-setBasket-Typ"
:
{
"alias"
:
""
,
"alias"
:
"
获得篮子类型(纸 布 竹 木)0 1 2 3
"
,
"data"
:
{}
}
}
},
"id"
:
"pick-tea"
,
"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['pick-tea'] = factory(global.tslib));
\n
}(this, (function (tslib) { 'use strict';
\n\n\t
var props = {};
\r\n\t
function prepareProps() {
\r\n\t
var metaProps = getProps();
\r\n\t
engine.injectProp(props, metaProps);
\r\n\t
}
\r\n\t
function injectProps(p) {
\r\n\t
engine.injectProp(props, p);
\r\n\t
}
\r\n\t
//# sourceMappingURL=props.js.map
\n\n\t
function getTexture(uuid) {
\r\n\t
return engine.Texture.from(getAssetByUUID(uuid).uuid);
\r\n\t
}
\r\n\t
function getTextureByName(name) {
\r\n\t
return getTexture(engine.getAssetByName(name).uuid);
\r\n\t
}
\r\n\t
function createSvga(name, anchorName) {
\r\n\t
var inst = new svga.Svga();
\r\n\t
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
\r\n\t
return inst;
\r\n\t
}
\r\n\t
//# sourceMappingURL=utils.js.map
\n\n\t
var GameView = (function (_super) {
\r\n\t
tslib.__extends(GameView, _super);
\r\n\t
function GameView() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.nowPercentage = 0;
\r\n\t
_this.goodsItems = [];
\r\n\t
_this._touchEnabled = true;
\r\n\t
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GameView.prototype.setup = function () {
\r\n\t
var _this = this;
\r\n\t
if (this._hasSetup) {
\r\n\t
return;
\r\n\t
}
\r\n\t
this._hasSetup = true;
\r\n\t
this.pickTeaBg = new engine.Container();
\r\n\t
var bgGroud = new engine.Image();
\r\n\t
bgGroud.source = '//yun.duiba.com.cn/aurora/assets/a988c47db8d3131faad175c7c2944773392be643.png';
\r\n\t
this.addChild(bgGroud);
\r\n\t
this.addChild(this.pickTeaBg);
\r\n\t
this.teaHalfImg = new engine.Image();
\r\n\t
this.paperBasketSvga = createSvga(
\"
采茶童-纸篮子
\"
);
\r\n\t
this.clothBasketSvga = createSvga(
\"
采茶童-布篮子
\"
);
\r\n\t
this.bambooBasketSvga = createSvga(
\"
采茶童-竹编篮
\"
);
\r\n\t
this.woodBasketSvga = createSvga(
\"
采茶童-木篮子
\"
);
\r\n\t
this.addOneSvga = createSvga(
\"
+1
\"
);
\r\n\t
this.pickTeaSvga = createSvga(
\"
采茶叶
\"
);
\r\n\t
this.teaSkyUpSvga = createSvga(
\"
茶叶向上飞
\"
);
\r\n\t
this.handGraspSvga = createSvga(
\"
手抓去
\"
);
\r\n\t
this.pickTeaBg.addChild(this.paperBasketSvga);
\r\n\t
this.pickTeaBg.addChild(this.clothBasketSvga);
\r\n\t
this.pickTeaBg.addChild(this.bambooBasketSvga);
\r\n\t
this.pickTeaBg.addChild(this.woodBasketSvga);
\r\n\t
this.pickTeaBg.addChild(this.addOneSvga);
\r\n\t
this.pickTeaBg.addChild(this.pickTeaSvga);
\r\n\t
this.pickTeaBg.addChild(this.teaSkyUpSvga);
\r\n\t
this.pickTeaBg.addChild(this.handGraspSvga);
\r\n\t
this.basketSvgaGroup = [this.paperBasketSvga, this.clothBasketSvga, this.bambooBasketSvga, this.woodBasketSvga];
\r\n\t
this.progressbarBgImg = new engine.Image(getTextureByName('进度条底框'));
\r\n\t
this.progressbarImg = new engine.Image(getTextureByName('进度'));
\r\n\t
this.teaHalfFlagImg = new engine.Image(getTextureByName('茶叶进度缺'));
\r\n\t
this.teaFullFlagImg = new engine.Image(getTextureByName('茶叶进度满'));
\r\n\t
this.teaStarImg = new engine.Image(getTextureByName('小茶叶'));
\r\n\t
this.verseImg = new engine.Image(getTextureByName('气泡框'));
\r\n\t
this.pickTeaBg.addChild(this.verseImg);
\r\n\t
var mask = new engine.Rect();
\r\n\t
mask.width = 600;
\r\n\t
mask.height = 50;
\r\n\t
mask.x = 10;
\r\n\t
mask.y = 0;
\r\n\t
mask.alpha = 1;
\r\n\t
this.progressbarImg.mask = mask;
\r\n\t
console.log(this.progressbarImg.mask);
\r\n\t
this.progressbarBgImg.addChild(this.progressbarImg);
\r\n\t
this.progressbarBgImg.addChild(mask);
\r\n\t
console.log('遮罩坐标');
\r\n\t
console.log(mask.x, mask.y);
\r\n\t
this.progressbarBgImg.addChild(this.teaHalfFlagImg);
\r\n\t
this.progressbarBgImg.addChild(this.teaFullFlagImg);
\r\n\t
this.progressbarBgImg.addChild(this.teaStarImg);
\r\n\t
this.pickTeaCount = new engine.Label();
\r\n\t
this.progressbarBgImg.addChild(this.pickTeaCount);
\r\n\t
this.addChild(this.progressbarBgImg);
\r\n\t
var myDate = new Date();
\r\n\t
var nowData = myDate.getTime();
\r\n\t
this.setTeaNum({ totalNum: 430, nowNum: 0, serverData: nowData });
\r\n\t
this.initChildrenPos();
\r\n\t
setInterval(function () {
\r\n\t
_this.handGrasp();
\r\n\t
}, 5000);
\r\n\t
};
\r\n\t
GameView.prototype.reset = function () {
\r\n\t
var _this = this;
\r\n\t
console.log('111111111reset1');
\r\n\t
this.initView();
\r\n\t
setTimeout(function () {
\r\n\t
return _this.setPickTeaLevel(1);
\r\n\t
}, 500);
\r\n\t
};
\r\n\t
GameView.prototype.start = function () {
\r\n\t
};
\r\n\t
GameView.prototype.pause = function () {
\r\n\t
this.gameIng = false;
\r\n\t
};
\r\n\t
GameView.prototype.revive = function () {
\r\n\t
this.gameIng = true;
\r\n\t
};
\r\n\t
GameView.prototype.resume = function () {
\r\n\t
this.reset();
\r\n\t
this.start();
\r\n\t
};
\r\n\t
GameView.prototype.initView = function () {
\r\n\t
this.pickTeaBg.mouseEnabled = false;
\r\n\t
this.teaHalfImg.visible = false;
\r\n\t
this.pickTeaSvga.visible = false;
\r\n\t
this.teaSkyUpSvga.visible = false;
\r\n\t
this.verseImg.visible = false;
\r\n\t
this.initChildrenPos();
\r\n\t
};
\r\n\t
GameView.prototype.initChildrenPos = function () {
\r\n\t
for (var i = 0; i < this.basketSvgaGroup.length; i++) {
\r\n\t
this.basketSvgaGroup[i].visible = false;
\r\n\t
this.basketSvgaGroup[i].x = props.basketSvgaPos[0];
\r\n\t
this.basketSvgaGroup[i].y = props.basketSvgaPos[1];
\r\n\t
this.basketSvgaGroup[i].addEventListener(engine.MouseEvent.CLICK, this.showVerse, this);
\r\n\t
}
\r\n\t
this.verseImg.x = props.versePos[0];
\r\n\t
this.verseImg.y = props.versePos[1];
\r\n\t
this.addOneSvga.x = props.addOneSvgaPos[0];
\r\n\t
this.addOneSvga.y = props.addOneSvgaPos[1];
\r\n\t
this.pickTeaSvga.x = props.pickTeaSvgaPos[0];
\r\n\t
this.pickTeaSvga.y = props.pickTeaSvgaPos[1];
\r\n\t
this.teaSkyUpSvga.x = props.teaSkyUpSvgaPos[0];
\r\n\t
this.teaSkyUpSvga.y = props.teaSkyUpSvgaPos[1];
\r\n\t
this.handGraspSvga.x = props.handGraspSvgaPos[0];
\r\n\t
this.handGraspSvga.y = props.handGraspSvgaPos[1];
\r\n\t
this.progressbarBgImg.x = props.progressbarBgImgPos[0];
\r\n\t
this.progressbarBgImg.y = props.progressbarBgImgPos[1];
\r\n\t
this.progressbarImg.x = props.progressbarImgPos[0];
\r\n\t
this.progressbarImg.y = props.progressbarImgPos[1];
\r\n\t
this.teaHalfFlagImg.x = props.teaHalfFlagImgPos[0];
\r\n\t
this.teaHalfFlagImg.y = props.teaHalfFlagImgPos[1];
\r\n\t
this.teaHalfFlagImg.anchorX = this.teaHalfFlagImg.width / 2;
\r\n\t
this.teaHalfFlagImg.anchorY = this.teaHalfFlagImg.height / 2;
\r\n\t
this.teaFullFlagImg.x = props.teaHalfFlagImgPos[0];
\r\n\t
this.teaFullFlagImg.y = props.teaHalfFlagImgPos[1];
\r\n\t
this.teaFullFlagImg.visible = false;
\r\n\t
this.teaStarImg.x = props.teaStarImgPos[0];
\r\n\t
this.teaStarImg.y = props.teaStarImgPos[1];
\r\n\t
this.pickTeaCount.fillColor = 'white';
\r\n\t
this.pickTeaCount.size = 30;
\r\n\t
this.pickTeaCount.text = '';
\r\n\t
this.pickTeaCount.x = props.pickTeaCountPos[0];
\r\n\t
this.pickTeaCount.y = props.pickTeaCountPos[1];
\r\n\t
this.pickTeaCount.height = 50;
\r\n\t
this.pickTeaCount.width = 200;
\r\n\t
this.verseLabel = new engine.TextField();
\r\n\t
this.verseLabel.size = props.verseLabel[2];
\r\n\t
this.verseLabel.text = '11';
\r\n\t
this.verseLabel.fillColor = props.verseColor[0];
\r\n\t
this.verseLabel.height = props.verseLabel[1];
\r\n\t
this.verseLabel.width = props.verseLabel[0];
\r\n\t
this.verseLabel.strokeColor = props.verseColor[1];
\r\n\t
this.verseLabel.stroke = 0.5;
\r\n\t
this.verseLabel.y = 15;
\r\n\t
this.verseLabel['textHeight'] = 14;
\r\n\t
this.verseLabel.textAlign = engine.TEXT_ALIGN.CENTER;
\r\n\t
this.verseImg.visible = false;
\r\n\t
this.verseImg.addChild(this.verseLabel);
\r\n\t
};
\r\n\t
GameView.prototype.showVerse = function () {
\r\n\t
return tslib.__awaiter(this, void 0, void 0, function () {
\r\n\t
var random, verse, y;
\r\n\t
var _this = this;
\r\n\t
return tslib.__generator(this, function (_a) {
\r\n\t
console.log('显示诗句');
\r\n\t
if (!this._touchEnabled) {
\r\n\t
return [2];
\r\n\t
}
\r\n\t
this._touchEnabled = false;
\r\n\t
this.verseImg.visible = true;
\r\n\t
random = Math.floor(Math.random() * 3);
\r\n\t
console.log('random', random);
\r\n\t
console.log('props.verses');
\r\n\t
console.log(props.verses);
\r\n\t
verse = props.verses[random];
\r\n\t
console.log('verse', verse);
\r\n\t
this.verseLabel.text = verse;
\r\n\t
y = this.verseImg.y;
\r\n\t
engine.Tween.get(this.verseImg)
\r\n\t
.to({ alpha: 0 }, 3000).call(function () {
\r\n\t
_this.verseImg.visible = false;
\r\n\t
_this.verseImg.alpha = 1;
\r\n\t
_this._touchEnabled = true;
\r\n\t
});
\r\n\t
return [2];
\r\n\t
});
\r\n\t
});
\r\n\t
};
\r\n\t
GameView.prototype.setTeaNum = function (TeaNums) {
\r\n\t
var _this = this;
\r\n\t
if (this.schedule) {
\r\n\t
console.log('清理定时器,重新设置同步');
\r\n\t
clearInterval(this.schedule);
\r\n\t
}
\r\n\t
var totalNum = TeaNums.totalNum;
\r\n\t
var nowNum = TeaNums.nowNum;
\r\n\t
this.pickTeaCount.text = nowNum + '/' + totalNum;
\r\n\t
this.getTeaPercentage(nowNum, totalNum);
\r\n\t
var surplus = nowNum - totalNum;
\r\n\t
console.log('surplus', surplus);
\r\n\t
var width = this.progressbarImg.width;
\r\n\t
var myDate = new Date();
\r\n\t
var nowData = myDate.getTime();
\r\n\t
var serverData = TeaNums.serverData;
\r\n\t
var fbdvalue = Math.abs((nowData - serverData / 1000));
\r\n\t
console.log('fbdvalue', fbdvalue);
\r\n\t
var dataDiff = 0;
\r\n\t
var x = -width * (1 - nowNum / totalNum);
\r\n\t
console.log('x', x);
\r\n\t
this.progressbarImg.x = parseFloat(x.toFixed(3));
\r\n\t
console.log('this.progressbarImg.x', this.progressbarImg.x);
\r\n\t
var step = (width - (width - Math.abs(this.progressbarImg.x))) / surplus;
\r\n\t
console.log('进图条每秒比例原始step', step);
\r\n\t
step = parseFloat(step.toFixed(3));
\r\n\t
console.log('进图条每秒比例step', step);
\r\n\t
this.addOneSvga.play(1, true);
\r\n\t
var speed = props.pickTeaSpeed;
\r\n\t
var teaFullRotation = engine.Tween.get(this.teaHalfFlagImg, { loop: true })
\r\n\t
.to({ rotation: 360 }, speed).call(function () {
\r\n\t
_this.teaHalfFlagImg.rotation = 0;
\r\n\t
});
\r\n\t
this.schedule = setInterval(function () {
\r\n\t
if (nowNum == totalNum) {
\r\n\t
console.log('达到最大长度');
\r\n\t
clearInterval(_this.schedule);
\r\n\t
engine.Tween.pauseTweens(teaFullRotation);
\r\n\t
_this.progressbarImg.x = 0;
\r\n\t
_this.teaHalfFlagImg.visible = false;
\r\n\t
_this.teaFullFlagImg.visible = !_this.teaHalfFlagImg.visible;
\r\n\t
_this.addOneSvga.visible = !_this.teaHalfFlagImg.visible;
\r\n\t
_this.addOneSvga.stop();
\r\n\t
}
\r\n\t
if (_this.progressbarImg.x <= -2) {
\r\n\t
_this.progressbarImg.x -= step;
\r\n\t
}
\r\n\t
_this.getTeaPercentage(nowNum, totalNum);
\r\n\t
nowNum++;
\r\n\t
dataDiff++;
\r\n\t
myDate = new Date();
\r\n\t
nowData = myDate.getTime();
\r\n\t
console.log('nowData');
\r\n\t
console.log(nowData);
\r\n\t
console.log('nowData - serverData) / 1000 - dataDiff', (nowData - serverData) / 1000 - (fbdvalue + dataDiff));
\r\n\t
if (Math.abs((nowData - serverData) / 1000) - dataDiff > (fbdvalue + 3)) {
\r\n\t
clearInterval(_this.schedule);
\r\n\t
engine.Tween.pauseTweens(teaFullRotation);
\r\n\t
engine.globalEvent.dispatchEvent('event-setchange-TeaNum');
\r\n\t
return;
\r\n\t
}
\r\n\t
console.log('this.progressbarImg.x', _this.progressbarImg.x);
\r\n\t
}, speed);
\r\n\t
};
\r\n\t
GameView.prototype.getTeaPercentage = function (nowNum, totalNum) {
\r\n\t
this.pickTeaCount.text = nowNum + '/' + totalNum;
\r\n\t
var teaPercentage = 2;
\r\n\t
var portion = totalNum / 3;
\r\n\t
if (nowNum < portion) {
\r\n\t
return;
\r\n\t
}
\r\n\t
if (nowNum < (portion * 2)) {
\r\n\t
teaPercentage = 1;
\r\n\t
}
\r\n\t
console.log('teaPercentage', teaPercentage);
\r\n\t
if (this.nowPercentage != teaPercentage) {
\r\n\t
console.log('状态改变');
\r\n\t
this.nowPercentage = teaPercentage;
\r\n\t
this.updateTeaPercentage(teaPercentage);
\r\n\t
}
\r\n\t
};
\r\n\t
GameView.prototype.updateTeaPercentage = function (teaPercentage) {
\r\n\t
if (teaPercentage === void 0) { teaPercentage = 0; }
\r\n\t
console.log('需要更换茶叶数量皮肤');
\r\n\t
console.log('延迟500ms');
\r\n\t
var pickTeaSVGA = this.basketSvgaGroup[1];
\r\n\t
console.log('pickTeaSVGA');
\r\n\t
console.log(pickTeaSVGA);
\r\n\t
pickTeaSVGA.removeChildAt(10);
\r\n\t
var originframes = pickTeaSVGA.children[7];
\r\n\t
if (!originframes) {
\r\n\t
return;
\r\n\t
}
\r\n\t
var teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));
\r\n\t
if (teaPercentage == 1) {
\r\n\t
this.teaHalfImg = new engine.Image(getTextureByName('茶叶-少'));
\r\n\t
}
\r\n\t
else if (teaPercentage == 2) {
\r\n\t
this.teaHalfImg = new engine.Image(getTextureByName('茶叶-满'));
\r\n\t
}
\r\n\t
this.teaHalfImg.visible = false;
\r\n\t
this.teaHalfImg['frames'] = teaBucketframes;
\r\n\t
console.log('this.teaHalfImg');
\r\n\t
console.log(this.teaHalfImg);
\r\n\t
pickTeaSVGA.addChildAt(this.teaHalfImg, 10);
\r\n\t
};
\r\n\t
GameView.prototype.setPickTeaLevel = function (level) {
\r\n\t
var _this = this;
\r\n\t
console.log('setPickTeaLevel', level);
\r\n\t
var pickTeaSVGA = this.basketSvgaGroup[level];
\r\n\t
pickTeaSVGA.visible = true;
\r\n\t
setTimeout(function () {
\r\n\t
console.log('延迟500ms');
\r\n\t
var originframes = pickTeaSVGA.children[7];
\r\n\t
var teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));
\r\n\t
if (_this.teaHalfImg) {
\r\n\t
_this.teaHalfImg['frames'] = teaBucketframes;
\r\n\t
}
\r\n\t
console.log('this.teaHalfImg');
\r\n\t
console.log(_this.teaHalfImg);
\r\n\t
pickTeaSVGA.addChildAt(_this.teaHalfImg, 10);
\r\n\t
pickTeaSVGA.gotoAndPlay(1, true);
\r\n\t
}, 300);
\r\n\t
};
\r\n\t
GameView.prototype.handGrasp = function () {
\r\n\t
console.log('handGrasp');
\r\n\t
var that = this;
\r\n\t
setTimeout(function () {
\r\n\t
that.handGraspSvga.play(1, true);
\r\n\t
engine.Tween.get(that.handGraspSvga)
\r\n\t
.to({ x: props.handGraspMovePos[0], y: props.handGraspMovePos[1] }, 600).call(function () {
\r\n\t
that.handGraspSvga.x = props.handGraspSvgaPos[0];
\r\n\t
that.handGraspSvga.y = props.handGraspSvgaPos[1];
\r\n\t
that.pickTeaSvga.visible = true;
\r\n\t
that.pickTeaSvga.play(1, false);
\r\n\t
});
\r\n\t
that.pickTeaSvga.addEventListener(engine.Event.END_FRAME, function () {
\r\n\t
that.teaSkyUpSvga.visible = true;
\r\n\t
that.teaSkyUpSvga.play(1, false);
\r\n\t
});
\r\n\t
that.teaSkyUpSvga.addEventListener(engine.Event.END_FRAME, function () {
\r\n\t
that.teaSkyUpSvga.visible = false;
\r\n\t
});
\r\n\t
}, 500);
\r\n\t
};
\r\n\t
return GameView;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=GameView.js.map
\n\n\t
var GameWrapper = (function (_super) {
\r\n\t
tslib.__extends(GameWrapper, _super);
\r\n\t
function GameWrapper() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
engine.globalEvent.addEventListener('event-pickTeaGame-init', _this.reset, _this);
\r\n\t
engine.globalEvent.addEventListener('event-hand-grasp', _this.handGrasp, _this);
\r\n\t
engine.globalEvent.addEventListener('event-getchange-TeaNum', _this.setTeaNum, _this);
\r\n\t
engine.globalEvent.addEventListener('event-getBasket-Type', _this.setPickTeaLevel, _this);
\r\n\t
var gameView = _this._gameView = new GameView();
\r\n\t
_this.addChild(gameView);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GameWrapper.prototype.setTeaNum = function (event) {
\r\n\t
injectProps(event.data);
\r\n\t
this._gameView.setTeaNum(event.data);
\r\n\t
};
\r\n\t
GameWrapper.prototype.setPickTeaLevel = function (event) {
\r\n\t
injectProps(event.data);
\r\n\t
this._gameView.setPickTeaLevel(event.data);
\r\n\t
};
\r\n\t
GameWrapper.prototype.reset = function (event) {
\r\n\t
injectProps(event.data);
\r\n\t
this._gameView.visible = true;
\r\n\t
this._gameView.reset();
\r\n\t
};
\r\n\t
GameWrapper.prototype.start = function (event) {
\r\n\t
injectProps(event.data);
\r\n\t
this._status = 1;
\r\n\t
this._gameView.start();
\r\n\t
};
\r\n\t
GameWrapper.prototype.pause = function () {
\r\n\t
this._gameView.pause();
\r\n\t
};
\r\n\t
GameWrapper.prototype.resume = function () {
\r\n\t
this._gameView.resume();
\r\n\t
};
\r\n\t
GameWrapper.prototype.revive = function () {
\r\n\t
this._gameView.revive();
\r\n\t
};
\r\n\t
GameWrapper.prototype.clear = function () {
\r\n\t
this._gameView.visible = false;
\r\n\t
};
\r\n\t
GameWrapper.prototype.handGrasp = function () {
\r\n\t
this._gameView.handGrasp()
;
\r\n\t
};
\r\n\t
GameWrapper.prototype.onTap = function (event) {
\r\n\t
};
\r\n\t
return GameWrapper;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=GameWrapper.js.map
\n\n\t
function index (props) {
\r\n\t
prepareProps();
\r\n\t
injectProps(props);
\r\n\t
var instance = new GameWrapper();
\r\n\t
return instance;
\r\n\t
}
\r\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['pick-tea'] = factory(global.tslib));
\n
}(this, (function (tslib) { 'use strict';
\n\n\t
var props = {};
\r\n\t
function prepareProps() {
\r\n\t
var metaProps = getProps();
\r\n\t
engine.injectProp(props, metaProps);
\r\n\t
}
\r\n\t
function injectProps(p) {
\r\n\t
engine.injectProp(props, p);
\r\n\t
}
\r\n\t
//# sourceMappingURL=props.js.map
\n\n\t
function getTexture(uuid) {
\r\n\t
return engine.Texture.from(getAssetByUUID(uuid).uuid);
\r\n\t
}
\r\n\t
function getTextureByName(name) {
\r\n\t
return getTexture(engine.getAssetByName(name).uuid);
\r\n\t
}
\r\n\t
function createSvga(name, anchorName) {
\r\n\t
var inst = new svga.Svga();
\r\n\t
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
\r\n\t
return inst;
\r\n\t
}
\r\n\t
function showLog(abjname, obj) {
\r\n\t
}
\r\n\t
//# sourceMappingURL=utils.js.map
\n\n\t
var GameView = (function (_super) {
\r\n\t
tslib.__extends(GameView, _super);
\r\n\t
function GameView() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
_this.nowPercentage = 0;
\r\n\t
_this.goodsItems = [];
\r\n\t
_this._touchEnabled = true;
\r\n\t
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GameView.prototype.setup = function () {
\r\n\t
var _this = this;
\r\n\t
if (this._hasSetup) {
\r\n\t
return;
\r\n\t
}
\r\n\t
this._hasSetup = true;
\r\n\t
this.pickTeaBg = new engine.Container();
\r\n\t
this.addChild(this.pickTeaBg);
\r\n\t
this.teaHalfImg = new engine.Image();
\r\n\t
this.paperBasketSvga = createSvga(
\"
采茶童-纸篮子
\"
);
\r\n\t
this.clothBasketSvga = createSvga(
\"
采茶童-布篮子
\"
);
\r\n\t
this.bambooBasketSvga = createSvga(
\"
采茶童-竹编篮
\"
);
\r\n\t
this.woodBasketSvga = createSvga(
\"
采茶童-木篮子
\"
);
\r\n\t
this.addOneSvga = createSvga(
\"
+1
\"
);
\r\n\t
this.pickTeaSvga = createSvga(
\"
采茶叶
\"
);
\r\n\t
this.teaSkyUpSvga = createSvga(
\"
茶叶向上飞
\"
);
\r\n\t
this.handGraspSvga = createSvga(
\"
手抓去
\"
);
\r\n\t
this.frontImg = new engine.Image(getTextureByName('前景'));
\r\n\t
this.pickTeaBg.addChild(this.paperBasketSvga);
\r\n\t
this.pickTeaBg.addChild(this.clothBasketSvga);
\r\n\t
this.pickTeaBg.addChild(this.bambooBasketSvga);
\r\n\t
this.pickTeaBg.addChild(this.woodBasketSvga);
\r\n\t
this.pickTeaBg.addChild(this.pickTeaSvga);
\r\n\t
this.pickTeaBg.addChild(this.teaSkyUpSvga);
\r\n\t
this.basketSvgaGroup = [this.paperBasketSvga, this.clothBasketSvga, this.bambooBasketSvga, this.woodBasketSvga];
\r\n\t
this.progressbarBgImg = new engine.Image(getTextureByName('进度条底框'));
\r\n\t
this.progressbarImg = new engine.Image(getTextureByName('进度'));
\r\n\t
this.teaHalfFlagImg = new engine.Image(getTextureByName('茶叶进度缺'));
\r\n\t
this.teaFullFlagImg = new engine.Image(getTextureByName('茶叶进度满'));
\r\n\t
this.teaStarImg = new engine.Image(getTextureByName('小茶叶'));
\r\n\t
this.verseImg = new engine.Image(getTextureByName('气泡框'));
\r\n\t
this.pickTeaBg.addChild(this.verseImg);
\r\n\t
var mask = new engine.Rect();
\r\n\t
mask.width = 600;
\r\n\t
mask.height = 50;
\r\n\t
mask.x = 10;
\r\n\t
mask.y = 0;
\r\n\t
mask.alpha = 1;
\r\n\t
this.progressbarImg.mask = mask;
\r\n\t
showLog(this.progressbarImg.mask);
\r\n\t
this.addChild(this.frontImg);
\r\n\t
this.progressbarBgImg.addChild(this.progressbarImg);
\r\n\t
this.progressbarBgImg.addChild(mask);
\r\n\t
this.progressbarBgImg.addChild(this.addOneSvga);
\r\n\t
this.progressbarBgImg.addChild(this.handGraspSvga);
\r\n\t
this.progressbarBgImg.addChild(this.teaHalfFlagImg);
\r\n\t
this.progressbarBgImg.addChild(this.teaFullFlagImg);
\r\n\t
this.progressbarBgImg.addChild(this.teaStarImg);
\r\n\t
this.pickTeaCount = new engine.Label();
\r\n\t
this.progressbarBgImg.addChild(this.pickTeaCount);
\r\n\t
this.addChild(this.progressbarBgImg);
\r\n\t
this.initView();
\r\n\t
setTimeout(function () {
\r\n\t
_this.setTeaNum({ totalNum: 10, nowNum: 0, serverData: 1585290768011 });
\r\n\t
}, 500);
\r\n\t
};
\r\n\t
GameView.prototype.reset = function () {
\r\n\t
this.initView();
\r\n\t
};
\r\n\t
GameView.prototype.start = function () {
\r\n\t
};
\r\n\t
GameView.prototype.pause = function () {
\r\n\t
this.gameIng = false;
\r\n\t
};
\r\n\t
GameView.prototype.revive = function () {
\r\n\t
this.gameIng = true;
\r\n\t
};
\r\n\t
GameView.prototype.resume = function () {
\r\n\t
this.reset();
\r\n\t
this.start();
\r\n\t
};
\r\n\t
GameView.prototype.initView = function () {
\r\n\t
this.pickTeaBg.mouseEnabled = false;
\r\n\t
this.teaHalfImg.visible = false;
\r\n\t
this.pickTeaSvga.visible = false;
\r\n\t
this.teaSkyUpSvga.visible = false;
\r\n\t
this.verseImg.visible = false;
\r\n\t
this.frontImg.visible = props.showFrontImg == 1;
\r\n\t
this.initChildrenPos();
\r\n\t
};
\r\n\t
GameView.prototype.initChildrenPos = function () {
\r\n\t
for (var i = 0; i < this.basketSvgaGroup.length; i++) {
\r\n\t
this.basketSvgaGroup[i].visible = false;
\r\n\t
this.basketSvgaGroup[i].x = props.basketSvgaPos[0];
\r\n\t
this.basketSvgaGroup[i].y = props.basketSvgaPos[1];
\r\n\t
}
\r\n\t
this.verseImg.x = props.versePos[0];
\r\n\t
this.verseImg.y = props.versePos[1];
\r\n\t
this.addOneSvga.x = props.addOneSvgaPos[0];
\r\n\t
this.addOneSvga.y = props.addOneSvgaPos[1];
\r\n\t
this.pickTeaSvga.x = props.pickTeaSvgaPos[0];
\r\n\t
this.pickTeaSvga.y = props.pickTeaSvgaPos[1];
\r\n\t
this.teaSkyUpSvga.x = props.teaSkyUpSvgaPos[0];
\r\n\t
this.teaSkyUpSvga.y = props.teaSkyUpSvgaPos[1];
\r\n\t
this.handGraspSvga.x = props.handGraspSvgaPos[0];
\r\n\t
this.handGraspSvga.y = props.handGraspSvgaPos[1];
\r\n\t
this.progressbarBgImg.x = props.progressbarBgImgPos[0];
\r\n\t
this.progressbarBgImg.y = props.progressbarBgImgPos[1];
\r\n\t
this.progressbarImg.x = props.progressbarImgPos[0];
\r\n\t
this.progressbarImg.y = props.progressbarImgPos[1];
\r\n\t
this.teaHalfFlagImg.x = props.teaHalfFlagImgPos[0];
\r\n\t
this.teaHalfFlagImg.y = props.teaHalfFlagImgPos[1];
\r\n\t
this.teaHalfFlagImg.anchorX = this.teaHalfFlagImg.width / 2;
\r\n\t
this.teaHalfFlagImg.anchorY = this.teaHalfFlagImg.height / 2;
\r\n\t
this.teaFullFlagImg.x = props.teaHalfFlagImgPos[0];
\r\n\t
this.teaFullFlagImg.y = props.teaHalfFlagImgPos[1];
\r\n\t
this.frontImg.x = props.FrontImgPos[0];
\r\n\t
this.frontImg.y = props.FrontImgPos[1];
\r\n\t
this.teaFullFlagImg.visible = false;
\r\n\t
this.teaStarImg.x = props.teaStarImgPos[0];
\r\n\t
this.teaStarImg.y = props.teaStarImgPos[1];
\r\n\t
this.pickTeaCount.fillColor = 'white';
\r\n\t
this.pickTeaCount.size = 30;
\r\n\t
this.pickTeaCount.text = '';
\r\n\t
this.pickTeaCount.x = props.pickTeaCountPos[0];
\r\n\t
this.pickTeaCount.y = props.pickTeaCountPos[1];
\r\n\t
this.pickTeaCount.height = 50;
\r\n\t
this.pickTeaCount.width = 200;
\r\n\t
this.verseLabel = new engine.TextField();
\r\n\t
this.verseLabel.size = props.verseLabel[2];
\r\n\t
this.verseLabel.text = '';
\r\n\t
this.verseLabel.fillColor = props.verseColor[0];
\r\n\t
this.verseLabel.height = props.verseLabel[1];
\r\n\t
this.verseLabel.width = props.verseLabel[0];
\r\n\t
this.verseLabel.strokeColor = props.verseColor[1];
\r\n\t
this.verseLabel.stroke = 0.5;
\r\n\t
this.verseLabel.y = 15;
\r\n\t
this.verseLabel['textHeight'] = 14;
\r\n\t
this.verseLabel.textAlign = engine.TEXT_ALIGN.CENTER;
\r\n\t
this.verseImg.visible = false;
\r\n\t
this.verseImg.addChild(this.verseLabel);
\r\n\t
};
\r\n\t
GameView.prototype.showVerse = function () {
\r\n\t
var _this = this;
\r\n\t
this.verseImg.visible = true;
\r\n\t
var len = props.verses.length;
\r\n\t
var random = Math.floor(Math.random() * len);
\r\n\t
var verse = props.verses[random];
\r\n\t
this.verseLabel.text = verse;
\r\n\t
var y = this.verseImg.y;
\r\n\t
engine.Tween.get(this.verseImg)
\r\n\t
.to({ alpha: 0 }, 3000).call(function () {
\r\n\t
_this.verseImg.visible = false;
\r\n\t
_this.verseImg.alpha = 1;
\r\n\t
});
\r\n\t
};
\r\n\t
GameView.prototype.setTeaNum = function (TeaNums) {
\r\n\t
var _this = this;
\r\n\t
if (this.schedule) {
\r\n\t
clearInterval(this.schedule);
\r\n\t
}
\r\n\t
var totalNum = TeaNums.totalNum;
\r\n\t
var nowNum = TeaNums.nowNum + 1;
\r\n\t
var surplus = nowNum - totalNum;
\r\n\t
if (surplus == 0) {
\r\n\t
console.log('达到最大长度');
\r\n\t
this.progressbarImg.x = this.teaFullFlagImg.width / 2;
\r\n\t
this.teaHalfFlagImg.visible = false;
\r\n\t
this.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible;
\r\n\t
this.addOneSvga.visible = !this.teaHalfFlagImg.visible;
\r\n\t
this.addOneSvga.stop();
\r\n\t
return;
\r\n\t
}
\r\n\t
console.log('surplus', surplus);
\r\n\t
var width = this.progressbarImg.width;
\r\n\t
var myDate = new Date();
\r\n\t
var nowData = myDate.getTime();
\r\n\t
var serverData = TeaNums.serverData;
\r\n\t
var fbdvalue = Math.abs((nowData - serverData));
\r\n\t
console.log('fbdvalue', fbdvalue);
\r\n\t
var dataDiff = 0;
\r\n\t
var x = -width * (1 - nowNum / totalNum);
\r\n\t
console.log('x', x);
\r\n\t
console.log('parseFloat(x.toFixed(3))', parseFloat(x.toFixed(3)));
\r\n\t
this.progressbarImg.x = parseFloat(x.toFixed(3)) + this.teaFullFlagImg.width / 2 - Math.abs(this.teaFullFlagImg.x);
\r\n\t
console.log('this.progressbarImg.x', this.progressbarImg.x);
\r\n\t
var step = (this.teaFullFlagImg.width / 2 - this.progressbarImg.x) / surplus;
\r\n\t
console.log('step', step);
\r\n\t
this.addOneSvga.play(1, true);
\r\n\t
var speed = props.pickTeaSpeed;
\r\n\t
var teaFullRotation = engine.Tween.get(this.teaHalfFlagImg, { loop: true })
\r\n\t
.to({ rotation: 360 }, speed).call(function () {
\r\n\t
_this.teaHalfFlagImg.rotation = 0;
\r\n\t
});
\r\n\t
this.schedule = setInterval(function () {
\r\n\t
if (nowNum == totalNum) {
\r\n\t
console.log('达到最大长度');
\r\n\t
clearInterval(_this.schedule);
\r\n\t
engine.Tween.removeTweens(teaFullRotation);
\r\n\t
_this.progressbarImg.x = _this.teaFullFlagImg.width / 2;
\r\n\t
_this.teaHalfFlagImg.visible = false;
\r\n\t
_this.teaFullFlagImg.visible = !_this.teaHalfFlagImg.visible;
\r\n\t
_this.addOneSvga.visible = !_this.teaHalfFlagImg.visible;
\r\n\t
_this.addOneSvga.stop();
\r\n\t
}
\r\n\t
console.log('nowNum', nowNum, 'totalNum', totalNum);
\r\n\t
_this.getTeaPercentage(nowNum, totalNum);
\r\n\t
if (_this.progressbarImg.x < _this.teaFullFlagImg.width / 2 + step) {
\r\n\t
_this.progressbarImg.x -= step;
\r\n\t
}
\r\n\t
nowNum++;
\r\n\t
dataDiff += speed;
\r\n\t
myDate = new Date();
\r\n\t
nowData = myDate.getTime();
\r\n\t
if (Math.abs((nowData - serverData)) - dataDiff > (fbdvalue + 3000)) {
\r\n\t
console.log('校准数据前后数据偏差过大');
\r\n\t
console.log(Math.abs((nowData - serverData)) - dataDiff - (fbdvalue + 3000));
\r\n\t
clearInterval(_this.schedule);
\r\n\t
engine.Tween.removeTweens(teaFullRotation);
\r\n\t
engine.globalEvent.dispatchEvent('event-setchange-TeaNum');
\r\n\t
_this.addOneSvga.visible = false;
\r\n\t
_this.addOneSvga.stop();
\r\n\t
return;
\r\n\t
}
\r\n\t
}, speed);
\r\n\t
};
\r\n\t
GameView.prototype.getTeaPercentage = function (nowNum, totalNum) {
\r\n\t
this.pickTeaCount.text = nowNum + '/' + totalNum;
\r\n\t
var teaPercentage = 2;
\r\n\t
var portion = totalNum / 3;
\r\n\t
if (nowNum < portion) {
\r\n\t
return;
\r\n\t
}
\r\n\t
if (nowNum < (portion * 2)) {
\r\n\t
teaPercentage = 1;
\r\n\t
}
\r\n\t
console.log('teaPercentage', teaPercentage);
\r\n\t
if (this.nowPercentage != teaPercentage) {
\r\n\t
this.nowPercentage = teaPercentage;
\r\n\t
this.updateTeaPercentage(teaPercentage);
\r\n\t
}
\r\n\t
};
\r\n\t
GameView.prototype.updateTeaPercentage = function (teaPercentage) {
\r\n\t
if (teaPercentage === void 0) { teaPercentage = 0; }
\r\n\t
var pickTeaSVGA = this.basketSvgaGroup[1];
\r\n\t
pickTeaSVGA.removeChildAt(10);
\r\n\t
var originframes = pickTeaSVGA.children[7];
\r\n\t
if (!originframes) {
\r\n\t
return;
\r\n\t
}
\r\n\t
var teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));
\r\n\t
if (teaPercentage == 1) {
\r\n\t
this.teaHalfImg = new engine.Image(getTextureByName('茶叶-少'));
\r\n\t
}
\r\n\t
else if (teaPercentage == 2) {
\r\n\t
this.teaHalfImg = new engine.Image(getTextureByName('茶叶-满'));
\r\n\t
}
\r\n\t
this.teaHalfImg.visible = false;
\r\n\t
this.teaHalfImg['frames'] = teaBucketframes;
\r\n\t
pickTeaSVGA.addChildAt(this.teaHalfImg, 10);
\r\n\t
};
\r\n\t
GameView.prototype.setPickTeaLevel = function (level) {
\r\n\t
var _this = this;
\r\n\t
var pickTeaSVGA = this.basketSvgaGroup[level];
\r\n\t
pickTeaSVGA.visible = true;
\r\n\t
setTimeout(function () {
\r\n\t
var originframes = pickTeaSVGA.children[7];
\r\n\t
var teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));
\r\n\t
if (_this.teaHalfImg) {
\r\n\t
_this.teaHalfImg['frames'] = teaBucketframes;
\r\n\t
}
\r\n\t
showLog(_this.teaHalfImg);
\r\n\t
pickTeaSVGA.addChildAt(_this.teaHalfImg, 10);
\r\n\t
pickTeaSVGA.gotoAndPlay(1, true);
\r\n\t
}, 300);
\r\n\t
};
\r\n\t
GameView.prototype.handGrasp = function () {
\r\n\t
var that = this;
\r\n\t
setTimeout(function () {
\r\n\t
engine.Tween.get(that.handGraspSvga)
\r\n\t
.to({ x: props.handGraspMovePos[0], y: props.handGraspMovePos[1] }, 400).call(function () {
\r\n\t
that.handGraspSvga.play(1, true);
\r\n\t
setTimeout(function () {
\r\n\t
that.handGraspSvga.stop();
\r\n\t
that.handGraspSvga.x = props.handGraspSvgaPos[0];
\r\n\t
that.handGraspSvga.y = props.handGraspSvgaPos[1];
\r\n\t
}, 600);
\r\n\t
that.pickTeaSvga.visible = true;
\r\n\t
that.pickTeaSvga.play(1, false);
\r\n\t
});
\r\n\t
that.pickTeaSvga.addEventListener(engine.Event.END_FRAME, function () {
\r\n\t
that.teaSkyUpSvga.visible = true;
\r\n\t
that.teaSkyUpSvga.play(1, false);
\r\n\t
});
\r\n\t
that.teaSkyUpSvga.addEventListener(engine.Event.END_FRAME, function () {
\r\n\t
that.teaSkyUpSvga.visible = false;
\r\n\t
that.updateTeaPercentage(0);
\r\n\t
});
\r\n\t
}, 500);
\r\n\t
};
\r\n\t
return GameView;
\r\n\t
}(engine.Container));
\n\n\t
var GameWrapper = (function (_super) {
\r\n\t
tslib.__extends(GameWrapper, _super);
\r\n\t
function GameWrapper() {
\r\n\t
var _this = _super.call(this) || this;
\r\n\t
engine.globalEvent.addEventListener('event-pickTeaGame-init', _this.reset, _this);
\r\n\t
engine.globalEvent.addEventListener('event-hand-grasp', _this.handGrasp, _this);
\r\n\t
engine.globalEvent.addEventListener('event-getClick-person', _this.clickPerson, _this);
\r\n\t
engine.globalEvent.addEventListener('event-getchange-TeaNum', _this.setTeaNum, _this);
\r\n\t
engine.globalEvent.addEventListener('event-getBasket-Type', _this.setPickTeaLevel, _this);
\r\n\t
var gameView = _this._gameView = new GameView();
\r\n\t
_this.addChild(gameView);
\r\n\t
return _this;
\r\n\t
}
\r\n\t
GameWrapper.prototype.setTeaNum = function (event) {
\r\n\t
injectProps(event.data);
\r\n\t
this._gameView.setTeaNum(event.data);
\r\n\t
};
\r\n\t
GameWrapper.prototype.setPickTeaLevel = function (event) {
\r\n\t
injectProps(event.data);
\r\n\t
this._gameView.setPickTeaLevel(event.data);
\r\n\t
};
\r\n\t
GameWrapper.prototype.handGrasp = function () {
\r\n\t
this._gameView.handGrasp();
\r\n\t
};
\r\n\t
GameWrapper.prototype.clickPerson = function () {
\r\n\t
this._gameView.showVerse();
\r\n\t
};
\r\n\t
GameWrapper.prototype.reset = function (event) {
\r\n\t
injectProps(event.data);
\r\n\t
this._gameView.visible = true;
\r\n\t
this._gameView.reset();
\r\n\t
};
\r\n\t
GameWrapper.prototype.start = function (event) {
\r\n\t
injectProps(event.data);
\r\n\t
this._status = 1;
\r\n\t
this._gameView.start();
\r\n\t
};
\r\n\t
GameWrapper.prototype.pause = function () {
\r\n\t
this._gameView.pause();
\r\n\t
};
\r\n\t
GameWrapper.prototype.resume = function () {
\r\n\t
this._gameView.resume();
\r\n\t
};
\r\n\t
GameWrapper.prototype.revive = function () {
\r\n\t
this._gameView.revive();
\r\n\t
};
\r\n\t
GameWrapper.prototype.clear = function () {
\r\n\t
this._gameView.visible = false
;
\r\n\t
};
\r\n\t
GameWrapper.prototype.onTap = function (event) {
\r\n\t
};
\r\n\t
return GameWrapper;
\r\n\t
}(engine.Container));
\r\n\t
//# sourceMappingURL=GameWrapper.js.map
\n\n\t
function index (props) {
\r\n\t
prepareProps();
\r\n\t
injectProps(props);
\r\n\t
var instance = new GameWrapper();
\r\n\t
return instance;
\r\n\t
}
\r\n\t
//# sourceMappingURL=index.js.map
\n\n\t
return index;
\n\n
})));
\n
"
}
src/custom/pick-tea/debug/main.js
View file @
57aa8bf6
...
...
@@ -25,6 +25,8 @@
inst
.
source
=
'asset://'
+
engine
.
getAssetByName
(
name
).
uuid
;
return
inst
;
}
function
showLog
(
abjname
,
obj
)
{
}
//# sourceMappingURL=utils.js.map
var
GameView
=
(
function
(
_super
)
{
...
...
@@ -44,9 +46,6 @@
}
this
.
_hasSetup
=
true
;
this
.
pickTeaBg
=
new
engine
.
Container
();
var
bgGroud
=
new
engine
.
Image
();
bgGroud
.
source
=
'//yun.duiba.com.cn/aurora/assets/a988c47db8d3131faad175c7c2944773392be643.png'
;
this
.
addChild
(
bgGroud
);
this
.
addChild
(
this
.
pickTeaBg
);
this
.
teaHalfImg
=
new
engine
.
Image
();
this
.
paperBasketSvga
=
createSvga
(
"采茶童-纸篮子"
);
...
...
@@ -57,14 +56,13 @@
this
.
pickTeaSvga
=
createSvga
(
"采茶叶"
);
this
.
teaSkyUpSvga
=
createSvga
(
"茶叶向上飞"
);
this
.
handGraspSvga
=
createSvga
(
"手抓去"
);
this
.
frontImg
=
new
engine
.
Image
(
getTextureByName
(
'前景'
));
this
.
pickTeaBg
.
addChild
(
this
.
paperBasketSvga
);
this
.
pickTeaBg
.
addChild
(
this
.
clothBasketSvga
);
this
.
pickTeaBg
.
addChild
(
this
.
bambooBasketSvga
);
this
.
pickTeaBg
.
addChild
(
this
.
woodBasketSvga
);
this
.
pickTeaBg
.
addChild
(
this
.
addOneSvga
);
this
.
pickTeaBg
.
addChild
(
this
.
pickTeaSvga
);
this
.
pickTeaBg
.
addChild
(
this
.
teaSkyUpSvga
);
this
.
pickTeaBg
.
addChild
(
this
.
handGraspSvga
);
this
.
basketSvgaGroup
=
[
this
.
paperBasketSvga
,
this
.
clothBasketSvga
,
this
.
bambooBasketSvga
,
this
.
woodBasketSvga
];
this
.
progressbarBgImg
=
new
engine
.
Image
(
getTextureByName
(
'进度条底框'
));
this
.
progressbarImg
=
new
engine
.
Image
(
getTextureByName
(
'进度'
));
...
...
@@ -80,33 +78,26 @@
mask
.
y
=
0
;
mask
.
alpha
=
1
;
this
.
progressbarImg
.
mask
=
mask
;
console
.
log
(
this
.
progressbarImg
.
mask
);
showLog
(
this
.
progressbarImg
.
mask
);
this
.
addChild
(
this
.
frontImg
);
this
.
progressbarBgImg
.
addChild
(
this
.
progressbarImg
);
this
.
progressbarBgImg
.
addChild
(
mask
);
console
.
log
(
'遮罩坐标'
);
console
.
log
(
mask
.
x
,
mask
.
y
);
this
.
progressbarBgImg
.
addChild
(
this
.
addOneSvga
);
this
.
progressbarBgImg
.
addChild
(
this
.
handGraspSvga
);
this
.
progressbarBgImg
.
addChild
(
this
.
teaHalfFlagImg
);
this
.
progressbarBgImg
.
addChild
(
this
.
teaFullFlagImg
);
this
.
progressbarBgImg
.
addChild
(
this
.
teaStarImg
);
this
.
pickTeaCount
=
new
engine
.
Label
();
this
.
progressbarBgImg
.
addChild
(
this
.
pickTeaCount
);
this
.
addChild
(
this
.
progressbarBgImg
);
var
myDate
=
new
Date
();
var
nowData
=
myDate
.
getTime
();
this
.
setTeaNum
({
totalNum
:
430
,
nowNum
:
0
,
serverData
:
nowData
});
this
.
initChildrenPos
();
setInterval
(
function
()
{
_this
.
handGrasp
();
},
5000
);
};
GameView
.
prototype
.
reset
=
function
()
{
var
_this
=
this
;
console
.
log
(
'111111111reset1'
);
this
.
initView
();
setTimeout
(
function
()
{
return
_this
.
setPickTeaLevel
(
1
);
_this
.
setTeaNum
({
totalNum
:
10
,
nowNum
:
0
,
serverData
:
1585290768011
}
);
},
500
);
};
GameView
.
prototype
.
reset
=
function
()
{
this
.
initView
();
};
GameView
.
prototype
.
start
=
function
()
{
};
GameView
.
prototype
.
pause
=
function
()
{
...
...
@@ -125,6 +116,7 @@
this
.
pickTeaSvga
.
visible
=
false
;
this
.
teaSkyUpSvga
.
visible
=
false
;
this
.
verseImg
.
visible
=
false
;
this
.
frontImg
.
visible
=
props
.
showFrontImg
==
1
;
this
.
initChildrenPos
();
};
GameView
.
prototype
.
initChildrenPos
=
function
()
{
...
...
@@ -132,7 +124,6 @@
this
.
basketSvgaGroup
[
i
].
visible
=
false
;
this
.
basketSvgaGroup
[
i
].
x
=
props
.
basketSvgaPos
[
0
];
this
.
basketSvgaGroup
[
i
].
y
=
props
.
basketSvgaPos
[
1
];
this
.
basketSvgaGroup
[
i
].
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
showVerse
,
this
);
}
this
.
verseImg
.
x
=
props
.
versePos
[
0
];
this
.
verseImg
.
y
=
props
.
versePos
[
1
];
...
...
@@ -154,6 +145,8 @@
this
.
teaHalfFlagImg
.
anchorY
=
this
.
teaHalfFlagImg
.
height
/
2
;
this
.
teaFullFlagImg
.
x
=
props
.
teaHalfFlagImgPos
[
0
];
this
.
teaFullFlagImg
.
y
=
props
.
teaHalfFlagImgPos
[
1
];
this
.
frontImg
.
x
=
props
.
FrontImgPos
[
0
];
this
.
frontImg
.
y
=
props
.
FrontImgPos
[
1
];
this
.
teaFullFlagImg
.
visible
=
false
;
this
.
teaStarImg
.
x
=
props
.
teaStarImgPos
[
0
];
this
.
teaStarImg
.
y
=
props
.
teaStarImgPos
[
1
];
...
...
@@ -166,7 +159,7 @@
this
.
pickTeaCount
.
width
=
200
;
this
.
verseLabel
=
new
engine
.
TextField
();
this
.
verseLabel
.
size
=
props
.
verseLabel
[
2
];
this
.
verseLabel
.
text
=
'
11
'
;
this
.
verseLabel
.
text
=
''
;
this
.
verseLabel
.
fillColor
=
props
.
verseColor
[
0
];
this
.
verseLabel
.
height
=
props
.
verseLabel
[
1
];
this
.
verseLabel
.
width
=
props
.
verseLabel
[
0
];
...
...
@@ -179,61 +172,51 @@
this
.
verseImg
.
addChild
(
this
.
verseLabel
);
};
GameView
.
prototype
.
showVerse
=
function
()
{
return
tslib
.
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
var
random
,
verse
,
y
;
var
_this
=
this
;
return
tslib
.
__generator
(
this
,
function
(
_a
)
{
console
.
log
(
'显示诗句'
);
if
(
!
this
.
_touchEnabled
)
{
return
[
2
];
}
this
.
_touchEnabled
=
false
;
this
.
verseImg
.
visible
=
true
;
random
=
Math
.
floor
(
Math
.
random
()
*
3
);
console
.
log
(
'random'
,
random
);
console
.
log
(
'props.verses'
);
console
.
log
(
props
.
verses
);
verse
=
props
.
verses
[
random
];
console
.
log
(
'verse'
,
verse
);
this
.
verseLabel
.
text
=
verse
;
y
=
this
.
verseImg
.
y
;
engine
.
Tween
.
get
(
this
.
verseImg
)
.
to
({
alpha
:
0
},
3000
).
call
(
function
()
{
_this
.
verseImg
.
visible
=
false
;
_this
.
verseImg
.
alpha
=
1
;
_this
.
_touchEnabled
=
true
;
});
return
[
2
];
});
var
_this
=
this
;
this
.
verseImg
.
visible
=
true
;
var
len
=
props
.
verses
.
length
;
var
random
=
Math
.
floor
(
Math
.
random
()
*
len
);
var
verse
=
props
.
verses
[
random
];
this
.
verseLabel
.
text
=
verse
;
var
y
=
this
.
verseImg
.
y
;
engine
.
Tween
.
get
(
this
.
verseImg
)
.
to
({
alpha
:
0
},
3000
).
call
(
function
()
{
_this
.
verseImg
.
visible
=
false
;
_this
.
verseImg
.
alpha
=
1
;
});
};
GameView
.
prototype
.
setTeaNum
=
function
(
TeaNums
)
{
var
_this
=
this
;
if
(
this
.
schedule
)
{
console
.
log
(
'清理定时器,重新设置同步'
);
clearInterval
(
this
.
schedule
);
}
var
totalNum
=
TeaNums
.
totalNum
;
var
nowNum
=
TeaNums
.
nowNum
;
this
.
pickTeaCount
.
text
=
nowNum
+
'/'
+
totalNum
;
this
.
getTeaPercentage
(
nowNum
,
totalNum
);
var
nowNum
=
TeaNums
.
nowNum
+
1
;
var
surplus
=
nowNum
-
totalNum
;
if
(
surplus
==
0
)
{
console
.
log
(
'达到最大长度'
);
this
.
progressbarImg
.
x
=
this
.
teaFullFlagImg
.
width
/
2
;
this
.
teaHalfFlagImg
.
visible
=
false
;
this
.
teaFullFlagImg
.
visible
=
!
this
.
teaHalfFlagImg
.
visible
;
this
.
addOneSvga
.
visible
=
!
this
.
teaHalfFlagImg
.
visible
;
this
.
addOneSvga
.
stop
();
return
;
}
console
.
log
(
'surplus'
,
surplus
);
var
width
=
this
.
progressbarImg
.
width
;
var
myDate
=
new
Date
();
var
nowData
=
myDate
.
getTime
();
var
serverData
=
TeaNums
.
serverData
;
var
fbdvalue
=
Math
.
abs
((
nowData
-
serverData
/
1000
));
var
fbdvalue
=
Math
.
abs
((
nowData
-
serverData
));
console
.
log
(
'fbdvalue'
,
fbdvalue
);
var
dataDiff
=
0
;
var
x
=
-
width
*
(
1
-
nowNum
/
totalNum
);
console
.
log
(
'x'
,
x
);
this
.
progressbarImg
.
x
=
parseFloat
(
x
.
toFixed
(
3
));
console
.
log
(
'parseFloat(x.toFixed(3))'
,
parseFloat
(
x
.
toFixed
(
3
)));
this
.
progressbarImg
.
x
=
parseFloat
(
x
.
toFixed
(
3
))
+
this
.
teaFullFlagImg
.
width
/
2
-
Math
.
abs
(
this
.
teaFullFlagImg
.
x
);
console
.
log
(
'this.progressbarImg.x'
,
this
.
progressbarImg
.
x
);
var
step
=
(
width
-
(
width
-
Math
.
abs
(
this
.
progressbarImg
.
x
)))
/
surplus
;
console
.
log
(
'进图条每秒比例原始step'
,
step
);
step
=
parseFloat
(
step
.
toFixed
(
3
));
console
.
log
(
'进图条每秒比例step'
,
step
);
var
step
=
(
this
.
teaFullFlagImg
.
width
/
2
-
this
.
progressbarImg
.
x
)
/
surplus
;
console
.
log
(
'step'
,
step
);
this
.
addOneSvga
.
play
(
1
,
true
);
var
speed
=
props
.
pickTeaSpeed
;
var
teaFullRotation
=
engine
.
Tween
.
get
(
this
.
teaHalfFlagImg
,
{
loop
:
true
})
...
...
@@ -244,31 +227,32 @@
if
(
nowNum
==
totalNum
)
{
console
.
log
(
'达到最大长度'
);
clearInterval
(
_this
.
schedule
);
engine
.
Tween
.
paus
eTweens
(
teaFullRotation
);
_this
.
progressbarImg
.
x
=
0
;
engine
.
Tween
.
remov
eTweens
(
teaFullRotation
);
_this
.
progressbarImg
.
x
=
_this
.
teaFullFlagImg
.
width
/
2
;
_this
.
teaHalfFlagImg
.
visible
=
false
;
_this
.
teaFullFlagImg
.
visible
=
!
_this
.
teaHalfFlagImg
.
visible
;
_this
.
addOneSvga
.
visible
=
!
_this
.
teaHalfFlagImg
.
visible
;
_this
.
addOneSvga
.
stop
();
}
if
(
_this
.
progressbarImg
.
x
<=
-
2
)
{
console
.
log
(
'nowNum'
,
nowNum
,
'totalNum'
,
totalNum
);
_this
.
getTeaPercentage
(
nowNum
,
totalNum
);
if
(
_this
.
progressbarImg
.
x
<
_this
.
teaFullFlagImg
.
width
/
2
+
step
)
{
_this
.
progressbarImg
.
x
-=
step
;
}
_this
.
getTeaPercentage
(
nowNum
,
totalNum
);
nowNum
++
;
dataDiff
++
;
dataDiff
+=
speed
;
myDate
=
new
Date
();
nowData
=
myDate
.
getTime
();
console
.
log
(
'nowData'
);
console
.
log
(
nowData
);
console
.
log
(
'nowData - serverData) / 1000 - dataDiff'
,
(
nowData
-
serverData
)
/
1000
-
(
fbdvalue
+
dataDiff
));
if
(
Math
.
abs
((
nowData
-
serverData
)
/
1000
)
-
dataDiff
>
(
fbdvalue
+
3
))
{
if
(
Math
.
abs
((
nowData
-
serverData
))
-
dataDiff
>
(
fbdvalue
+
3000
))
{
console
.
log
(
'校准数据前后数据偏差过大'
);
console
.
log
(
Math
.
abs
((
nowData
-
serverData
))
-
dataDiff
-
(
fbdvalue
+
3000
));
clearInterval
(
_this
.
schedule
);
engine
.
Tween
.
paus
eTweens
(
teaFullRotation
);
engine
.
Tween
.
remov
eTweens
(
teaFullRotation
);
engine
.
globalEvent
.
dispatchEvent
(
'event-setchange-TeaNum'
);
_this
.
addOneSvga
.
visible
=
false
;
_this
.
addOneSvga
.
stop
();
return
;
}
console
.
log
(
'this.progressbarImg.x'
,
_this
.
progressbarImg
.
x
);
},
speed
);
};
GameView
.
prototype
.
getTeaPercentage
=
function
(
nowNum
,
totalNum
)
{
...
...
@@ -283,18 +267,13 @@
}
console
.
log
(
'teaPercentage'
,
teaPercentage
);
if
(
this
.
nowPercentage
!=
teaPercentage
)
{
console
.
log
(
'状态改变'
);
this
.
nowPercentage
=
teaPercentage
;
this
.
updateTeaPercentage
(
teaPercentage
);
}
};
GameView
.
prototype
.
updateTeaPercentage
=
function
(
teaPercentage
)
{
if
(
teaPercentage
===
void
0
)
{
teaPercentage
=
0
;
}
console
.
log
(
'需要更换茶叶数量皮肤'
);
console
.
log
(
'延迟500ms'
);
var
pickTeaSVGA
=
this
.
basketSvgaGroup
[
1
];
console
.
log
(
'pickTeaSVGA'
);
console
.
log
(
pickTeaSVGA
);
pickTeaSVGA
.
removeChildAt
(
10
);
var
originframes
=
pickTeaSVGA
.
children
[
7
];
if
(
!
originframes
)
{
...
...
@@ -309,37 +288,34 @@
}
this
.
teaHalfImg
.
visible
=
false
;
this
.
teaHalfImg
[
'frames'
]
=
teaBucketframes
;
console
.
log
(
'this.teaHalfImg'
);
console
.
log
(
this
.
teaHalfImg
);
pickTeaSVGA
.
addChildAt
(
this
.
teaHalfImg
,
10
);
};
GameView
.
prototype
.
setPickTeaLevel
=
function
(
level
)
{
var
_this
=
this
;
console
.
log
(
'setPickTeaLevel'
,
level
);
var
pickTeaSVGA
=
this
.
basketSvgaGroup
[
level
];
pickTeaSVGA
.
visible
=
true
;
setTimeout
(
function
()
{
console
.
log
(
'延迟500ms'
);
var
originframes
=
pickTeaSVGA
.
children
[
7
];
var
teaBucketframes
=
JSON
.
parse
(
JSON
.
stringify
(
originframes
.
frames
));
if
(
_this
.
teaHalfImg
)
{
_this
.
teaHalfImg
[
'frames'
]
=
teaBucketframes
;
}
console
.
log
(
'this.teaHalfImg'
);
console
.
log
(
_this
.
teaHalfImg
);
showLog
(
_this
.
teaHalfImg
);
pickTeaSVGA
.
addChildAt
(
_this
.
teaHalfImg
,
10
);
pickTeaSVGA
.
gotoAndPlay
(
1
,
true
);
},
300
);
};
GameView
.
prototype
.
handGrasp
=
function
()
{
console
.
log
(
'handGrasp'
);
var
that
=
this
;
setTimeout
(
function
()
{
that
.
handGraspSvga
.
play
(
1
,
true
);
engine
.
Tween
.
get
(
that
.
handGraspSvga
)
.
to
({
x
:
props
.
handGraspMovePos
[
0
],
y
:
props
.
handGraspMovePos
[
1
]
},
600
).
call
(
function
()
{
that
.
handGraspSvga
.
x
=
props
.
handGraspSvgaPos
[
0
];
that
.
handGraspSvga
.
y
=
props
.
handGraspSvgaPos
[
1
];
.
to
({
x
:
props
.
handGraspMovePos
[
0
],
y
:
props
.
handGraspMovePos
[
1
]
},
400
).
call
(
function
()
{
that
.
handGraspSvga
.
play
(
1
,
true
);
setTimeout
(
function
()
{
that
.
handGraspSvga
.
stop
();
that
.
handGraspSvga
.
x
=
props
.
handGraspSvgaPos
[
0
];
that
.
handGraspSvga
.
y
=
props
.
handGraspSvgaPos
[
1
];
},
600
);
that
.
pickTeaSvga
.
visible
=
true
;
that
.
pickTeaSvga
.
play
(
1
,
false
);
});
...
...
@@ -349,12 +325,12 @@
});
that
.
teaSkyUpSvga
.
addEventListener
(
engine
.
Event
.
END_FRAME
,
function
()
{
that
.
teaSkyUpSvga
.
visible
=
false
;
that
.
updateTeaPercentage
(
0
);
});
},
500
);
};
return
GameView
;
}(
engine
.
Container
));
//# sourceMappingURL=GameView.js.map
var
GameWrapper
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameWrapper
,
_super
);
...
...
@@ -362,6 +338,7 @@
var
_this
=
_super
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
'event-pickTeaGame-init'
,
_this
.
reset
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'event-hand-grasp'
,
_this
.
handGrasp
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'event-getClick-person'
,
_this
.
clickPerson
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'event-getchange-TeaNum'
,
_this
.
setTeaNum
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'event-getBasket-Type'
,
_this
.
setPickTeaLevel
,
_this
);
var
gameView
=
_this
.
_gameView
=
new
GameView
();
...
...
@@ -376,6 +353,12 @@
injectProps
(
event
.
data
);
this
.
_gameView
.
setPickTeaLevel
(
event
.
data
);
};
GameWrapper
.
prototype
.
handGrasp
=
function
()
{
this
.
_gameView
.
handGrasp
();
};
GameWrapper
.
prototype
.
clickPerson
=
function
()
{
this
.
_gameView
.
showVerse
();
};
GameWrapper
.
prototype
.
reset
=
function
(
event
)
{
injectProps
(
event
.
data
);
this
.
_gameView
.
visible
=
true
;
...
...
@@ -398,9 +381,6 @@
GameWrapper
.
prototype
.
clear
=
function
()
{
this
.
_gameView
.
visible
=
false
;
};
GameWrapper
.
prototype
.
handGrasp
=
function
()
{
this
.
_gameView
.
handGrasp
();
};
GameWrapper
.
prototype
.
onTap
=
function
(
event
)
{
};
return
GameWrapper
;
...
...
src/custom/pick-tea/debug/main.js.map
View file @
57aa8bf6
{"version":3,"file":"index.js","sources":["src/custom/pick-tea/src/props.ts","src/custom/pick-tea/src/game/utils.ts","src/custom/pick-tea/src/game/GameView.ts","src/custom/pick-tea/src/game/GameWrapper.ts","src/custom/pick-tea/src/index.ts"],"sourcesContent":["/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport let props: any = {};\r\n\r\nexport function prepareProps() {\r\n\tlet metaProps = getProps();\r\n\r\n\tengine.injectProp(props, metaProps);\r\n}\r\n\r\nexport function injectProps(p) {\r\n\tengine.injectProp(props, p);\r\n}\r\n","/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport function getTexture(uuid) {\r\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\r\n}\r\n\r\nexport function getTextureByName(name) {\r\n\treturn getTexture(engine.getAssetByName(name).uuid);\r\n}\r\n\r\nexport function playSound(name) {\r\n\tengine.playSound(engine.getAssetByName(name).uuid, {keep: true});\r\n}\r\nexport function createSvga(name, anchorName?) {\r\n\tlet inst = new svga.Svga();\r\n\tinst.source = 'asset://' + engine.getAssetByName(name).uuid;\r\n\treturn inst;\r\n}","/**\r\n * Created by rockyl on 2018/8/16.\r\n */\r\n\r\nimport { props } from \"../props\";\r\nimport { playSound, createSvga } from \"./utils\";\r\nimport ObjectPool = engine.ObjectPool;\r\nimport { getTextureByName } from \"./utils\";\r\nimport { Tealeaf } from \"./Tealeaf\";\r\n\r\nconst MAXX = -8;\r\nexport default class GameView extends engine.Container {\r\n\r\n\tprivate _hasSetup;\r\n\r\n\t/**采茶叶自定义模块*/\r\n\tprivate teaImgSource: any;\r\n\tprivate tealeaf: Tealeaf;\r\n\tprivate teaHalfImg: engine.Image;\r\n\tprivate nowPercentage: any = 0;\r\n\tprivate progressbarBgImg: engine.Image;\r\n\tprivate progressbarImg: engine.Image;\r\n\tprivate teaFullFlagImg: engine.Image;\r\n\tprivate teaHalfFlagImg: engine.Image;\r\n\tprivate teaStarImg: engine.Image;\r\n\r\n\tprivate verseImg: engine.Image;\r\n\t//采茶背景层\r\n\tprivate pickTeaBg: engine.Container;\r\n\t//采茶进度计时器\r\n\tprivate pickTeaTimer: any\r\n\t//茶叶的数量进度 100/240\r\n\tprivate pickTeaCount: engine.Label;\r\n\t//语句\r\n\tprivate verseLabel: engine.TextField;\r\n\t//篮子集合\r\n\tprivate basketSvgaGroup: any;\r\n\r\n\t//纸篮子svga\r\n\tprivate paperBasketSvga\r\n\t//布篮子svga\r\n\tprivate clothBasketSvga\r\n\t//竹篮子svga\r\n\tprivate bambooBasketSvga\r\n\t//木篮子svga\r\n\tprivate woodBasketSvga\r\n\t//+1\r\n\tprivate addOneSvga\r\n\t//采茶叶\r\n\tprivate pickTeaSvga\r\n\t//茶叶向上飞\r\n\tprivate teaSkyUpSvga\r\n\t//手抓去\r\n\tprivate handGraspSvga\r\n\r\n\r\n\r\n\t/**采茶叶自定义模块*/\r\n\r\n\t//玩家\r\n\tprivate player: engine.Container;\r\n\r\n\t//触摸层\r\n\tprivate rectBg: engine.Rect;\r\n\t//npc层\r\n\t//private NpcBg: engine.Container;\r\n\r\n\t//当前分数\r\n\tprivate score\r\n\t//游戏状态\r\n\tprivate gameIng;\r\n\t//npc出身计时器\r\n\tprivate timer\r\n\t//倒计时计时器\r\n\tprivate countdownTimer: any\r\n\t//倒计时\r\n\tprivate countdown: number\r\n\t//当前速度\r\n\tprivate speed: number\r\n\r\n\tprivate schedule: any\r\n\t// 当前场景上面的物品\r\n\tprivate goodsItems = []\r\n\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\r\n\t}\r\n\r\n\r\n\r\n\r\n\tprivate waterSvga\r\n\tprivate boomSvga\r\n\tprivate playerSvga\r\n\tprivate _touchEnabled = true\r\n\tsetup() {\r\n\t\tif (this._hasSetup) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis._hasSetup = true;\r\n\t\tthis.pickTeaBg = new engine.Container();\r\n\r\n\t\tlet bgGroud = new engine.Image()\r\n\t\tbgGroud.source = '//yun.duiba.com.cn/aurora/assets/a988c47db8d3131faad175c7c2944773392be643.png'\r\n\t\tthis.addChild(bgGroud);\r\n\r\n\t\tthis.addChild(this.pickTeaBg);\r\n\t\tthis.teaHalfImg = new engine.Image();\r\n\r\n\t\tthis.paperBasketSvga = createSvga(\"采茶童-纸篮子\");\r\n\t\tthis.clothBasketSvga = createSvga(\"采茶童-布篮子\");\r\n\t\tthis.bambooBasketSvga = createSvga(\"采茶童-竹编篮\");\r\n\t\tthis.woodBasketSvga = createSvga(\"采茶童-木篮子\");\r\n\t\tthis.addOneSvga = createSvga(\"+1\");\r\n\t\tthis.pickTeaSvga = createSvga(\"采茶叶\");\r\n\t\tthis.teaSkyUpSvga = createSvga(\"茶叶向上飞\");\r\n\t\tthis.handGraspSvga = createSvga(\"手抓去\");\r\n\t\tthis.pickTeaBg.addChild(this.paperBasketSvga);\r\n\t\tthis.pickTeaBg.addChild(this.clothBasketSvga);\r\n\t\tthis.pickTeaBg.addChild(this.bambooBasketSvga);\r\n\t\tthis.pickTeaBg.addChild(this.woodBasketSvga);\r\n\t\tthis.pickTeaBg.addChild(this.addOneSvga);\r\n\t\tthis.pickTeaBg.addChild(this.pickTeaSvga);\r\n\t\tthis.pickTeaBg.addChild(this.teaSkyUpSvga);\r\n\t\tthis.pickTeaBg.addChild(this.handGraspSvga);\r\n\t\tthis.basketSvgaGroup = [this.paperBasketSvga, this.clothBasketSvga, this.bambooBasketSvga, this.woodBasketSvga]\r\n\r\n\t\tthis.progressbarBgImg = new engine.Image(getTextureByName('进度条底框'));\r\n\t\tthis.progressbarImg = new engine.Image(getTextureByName('进度'));\r\n\t\tthis.teaHalfFlagImg = new engine.Image(getTextureByName('茶叶进度缺'));\r\n\t\tthis.teaFullFlagImg = new engine.Image(getTextureByName('茶叶进度满'));\r\n\t\tthis.teaStarImg = new engine.Image(getTextureByName('小茶叶'));\r\n\r\n\r\n\t\tthis.verseImg = new engine.Image(getTextureByName('气泡框'));\r\n\t\tthis.pickTeaBg.addChild(this.verseImg);\r\n\r\n\r\n\t\tlet mask = new engine.Rect();\r\n\t\tmask.width = 600;\r\n\t\tmask.height = 50;\r\n\t\tmask.x = 10;\r\n\t\tmask.y = 0;\r\n\t\tmask.alpha = 1;\r\n\r\n\t\t//mask.fillColor = 'black'\r\n\r\n\t\tthis.progressbarImg.mask = mask\r\n\t\tconsole.log(this.progressbarImg.mask)\r\n\r\n\t\tthis.progressbarBgImg.addChild(this.progressbarImg);\r\n\t\tthis.progressbarBgImg.addChild(mask);\r\n\t\tconsole.log('遮罩坐标')\r\n\t\tconsole.log(mask.x, mask.y)\r\n\r\n\t\tthis.progressbarBgImg.addChild(this.teaHalfFlagImg);\r\n\t\tthis.progressbarBgImg.addChild(this.teaFullFlagImg);\r\n\t\tthis.progressbarBgImg.addChild(this.teaStarImg);\r\n\t\tthis.pickTeaCount = new engine.Label();\r\n\t\tthis.progressbarBgImg.addChild(this.pickTeaCount);\r\n\r\n\t\tthis.addChild(this.progressbarBgImg);\r\n\r\n\r\n\t\t// this.initView();\r\n\t\t// this.setPickTeaLevel(1)\r\n\r\n\t\tlet myDate = new Date();\r\n\t\tlet nowData = myDate.getTime();\r\n\t\tthis.setTeaNum({ totalNum: 430, nowNum: 0, serverData: nowData })\r\n\t\tthis.initChildrenPos();\r\n\r\n\t\tsetInterval(() => {\r\n\t\t\tthis.handGrasp();\r\n\t\t\t//this.setTeaNum({ totalNum: 430, nowNum: 120 })\r\n\t\t}, 5000)\r\n\r\n\r\n\t}\r\n\treset() {\r\n\t\tconsole.log('111111111reset1')\r\n\t\tthis.initView()\r\n\t\tsetTimeout(() =>\r\n\t\t\tthis.setPickTeaLevel(1)\r\n\t\t\t, 500)\r\n\r\n\t}\r\n\tstart() {\r\n\r\n\t}\r\n\tpause() {\r\n\t\tthis.gameIng = false;\r\n\t}\r\n\trevive() {\r\n\t\tthis.gameIng = true;\r\n\t}\r\n\r\n\tresume() {\r\n\t\tthis.reset();\r\n\t\tthis.start()\r\n\t}\r\n\r\n\tinitView() {\r\n\t\t// for (let i = 0; i < this.basketSvgaGroup.length; i++) {\r\n\t\t// \tthis.basketSvgaGroup[i].visible = false\r\n\t\t// \tthis.basketSvgaGroup[i].x = props.basketSvgaPos[0];\r\n\t\t// \tthis.basketSvgaGroup[i].y = props.basketSvgaPos[1];;\r\n\t\t// \tthis.basketSvgaGroup[i].addEventListener(engine.MouseEvent.CLICK, this.showVerse, this);\r\n\t\t// }\r\n\t\tthis.pickTeaBg.mouseEnabled = false;\r\n\t\tthis.teaHalfImg.visible = false;\r\n\t\t//this.teaHalfImg.source = '';\r\n\t\tthis.pickTeaSvga.visible = false;\r\n\t\tthis.teaSkyUpSvga.visible = false;\r\n\t\tthis.verseImg.visible = false;\r\n\t\tthis.initChildrenPos()\r\n\t}\r\n\tinitChildrenPos() {\r\n\t\tfor (let i = 0; i < this.basketSvgaGroup.length; i++) {\r\n\t\t\tthis.basketSvgaGroup[i].visible = false\r\n\t\t\tthis.basketSvgaGroup[i].x = props.basketSvgaPos[0];\r\n\t\t\tthis.basketSvgaGroup[i].y = props.basketSvgaPos[1];;\r\n\t\t\tthis.basketSvgaGroup[i].addEventListener(engine.MouseEvent.CLICK, this.showVerse, this);\r\n\t\t}\r\n\t\tthis.verseImg.x = props.versePos[0]\r\n\t\tthis.verseImg.y = props.versePos[1]\r\n\t\tthis.addOneSvga.x = props.addOneSvgaPos[0]\r\n\t\tthis.addOneSvga.y = props.addOneSvgaPos[1];\r\n\t\tthis.pickTeaSvga.x = props.pickTeaSvgaPos[0];\r\n\t\tthis.pickTeaSvga.y = props.pickTeaSvgaPos[1];\r\n\t\tthis.teaSkyUpSvga.x = props.teaSkyUpSvgaPos[0];\r\n\t\tthis.teaSkyUpSvga.y = props.teaSkyUpSvgaPos[1];\r\n\t\tthis.handGraspSvga.x = props.handGraspSvgaPos[0];\r\n\t\tthis.handGraspSvga.y = props.handGraspSvgaPos[1];\r\n\r\n\t\tthis.progressbarBgImg.x = props.progressbarBgImgPos[0]\r\n\r\n\t\tthis.progressbarBgImg.y = props.progressbarBgImgPos[1]\r\n\r\n\t\tthis.progressbarImg.x = props.progressbarImgPos[0]\r\n\t\tthis.progressbarImg.y = props.progressbarImgPos[1]\r\n\t\t//this.progressbarImg.width = 0;\r\n\r\n\t\tthis.teaHalfFlagImg.x = props.teaHalfFlagImgPos[0]\r\n\t\tthis.teaHalfFlagImg.y = props.teaHalfFlagImgPos[1]\r\n\t\tthis.teaHalfFlagImg.anchorX = this.teaHalfFlagImg.width / 2\r\n\t\tthis.teaHalfFlagImg.anchorY = this.teaHalfFlagImg.height / 2\r\n\r\n\t\tthis.teaFullFlagImg.x = props.teaHalfFlagImgPos[0]\r\n\t\tthis.teaFullFlagImg.y = props.teaHalfFlagImgPos[1]\r\n\r\n\r\n\t\tthis.teaFullFlagImg.visible = false;\r\n\r\n\t\tthis.teaStarImg.x = props.teaStarImgPos[0]\r\n\t\tthis.teaStarImg.y = props.teaStarImgPos[1]\r\n\r\n\t\tthis.pickTeaCount.fillColor = 'white';\r\n\t\tthis.pickTeaCount.size = 30;\r\n\t\tthis.pickTeaCount.text = ''\r\n\r\n\t\tthis.pickTeaCount.x = props.pickTeaCountPos[0]\r\n\t\tthis.pickTeaCount.y = props.pickTeaCountPos[1]\r\n\r\n\t\tthis.pickTeaCount.height = 50;\r\n\t\tthis.pickTeaCount.width = 200;\r\n\r\n\t\tthis.verseLabel = new engine.TextField();\r\n\t\tthis.verseLabel.size = props.verseLabel[2];\r\n\t\tthis.verseLabel.text = '11'\r\n\t\tthis.verseLabel.fillColor = props.verseColor[0]\r\n\t\tthis.verseLabel.height = props.verseLabel[1];\r\n\t\tthis.verseLabel.width = props.verseLabel[0];\r\n\t\tthis.verseLabel.strokeColor = props.verseColor[1]\r\n\t\tthis.verseLabel.stroke = 0.5;\r\n\r\n\t\tthis.verseLabel.y = 15;\r\n\t\tthis.verseLabel['textHeight'] = 14;\r\n\t\tthis.verseLabel.textAlign = engine.TEXT_ALIGN.CENTER;\r\n\t\tthis.verseImg.visible = false;\r\n\t\tthis.verseImg.addChild(this.verseLabel);\r\n\r\n\t\t// label.x = (width - label.width) / 2;\r\n\t\t// label.y = guideHole.y + guideHole.height + 50;\r\n\t}\r\n\tasync showVerse() {\r\n\t\tconsole.log('显示诗句')\r\n\t\tif (!this._touchEnabled) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis._touchEnabled = false;\r\n\t\tthis.verseImg.visible = true;\r\n\t\tlet random = Math.floor(Math.random() * 3);\r\n\t\tconsole.log('random', random)\r\n\t\tconsole.log('props.verses')\r\n\r\n\t\tconsole.log(props.verses)\r\n\t\tlet verse = props.verses[random];\r\n\t\tconsole.log('verse', verse)\r\n\t\tthis.verseLabel.text = verse;\r\n\t\tlet y = this.verseImg.y\r\n\t\tengine.Tween.get(this.verseImg)\r\n\t\t\t.to({ alpha: 0 }, 3000).call(() => {\r\n\t\t\t\tthis.verseImg.visible = false;\r\n\t\t\t\tthis.verseImg.alpha = 1\r\n\t\t\t\tthis._touchEnabled = true;\r\n\t\t\t})\r\n\t};\r\n\t/*采茶叶活动*/\r\n\t//总量除以当前 小于3分之1 没有树叶 ,3分之1到3分之2一点点树叶 ,大于3分之2满树叶\r\n\tsetTeaNum(TeaNums) {\r\n\t\tif (this.schedule) {\r\n\t\t\tconsole.log('清理定时器,重新设置同步')\r\n\t\t\tclearInterval(this.schedule);\r\n\t\t}\r\n\t\tlet totalNum = TeaNums.totalNum;\r\n\t\tlet nowNum = TeaNums.nowNum;\r\n\r\n\t\tthis.pickTeaCount.text = nowNum + '/' + totalNum;\r\n\t\tthis.getTeaPercentage(nowNum, totalNum);\r\n\t\tlet surplus = nowNum - totalNum;\r\n\t\tconsole.log('surplus', surplus);\r\n\t\tlet width = this.progressbarImg.width;\r\n\t\tlet myDate = new Date();\r\n\t\tlet nowData = myDate.getTime();\r\n\t\tlet serverData = TeaNums.serverData;\r\n\t\t//前后端本身的差值\r\n\t\tlet fbdvalue = Math.abs((nowData - serverData / 1000))\r\n\t\tconsole.log('fbdvalue', fbdvalue)\r\n\r\n\t\t/**/\r\n\t\t//设置数据校正\r\n\r\n\t\t// let serverData = 0;\r\n\t\tlet dataDiff = 0;\r\n\t\t/**/\r\n\t\t//let rate = (443 - width * (1 - nowNum / totalNum))\r\n\t\t//已经走得\r\n\t\tlet x = -width * (1 - nowNum / totalNum)\r\n\t\tconsole.log('x', x);\r\n\t\tthis.progressbarImg.x = parseFloat(x.toFixed(3));\r\n\t\tconsole.log('this.progressbarImg.x', this.progressbarImg.x)\r\n\t\tlet step = (width - (width - Math.abs(this.progressbarImg.x))) / surplus\r\n\r\n\t\tconsole.log('进图条每秒比例原始step', step)\r\n\t\tstep = parseFloat(step.toFixed(3));\r\n\t\tconsole.log('进图条每秒比例step', step)\r\n\t\tthis.addOneSvga.play(1, true);\r\n\r\n\t\tlet speed = props.pickTeaSpeed;\r\n\r\n\t\tlet teaFullRotation = engine.Tween.get(this.teaHalfFlagImg, { loop: true })\r\n\t\t\t.to({ rotation: 360 }, speed).call(() => {\r\n\t\t\t\tthis.teaHalfFlagImg.rotation = 0;\r\n\t\t\t})\r\n\t\tthis.schedule = setInterval(() => {\r\n\t\t\tif (nowNum == totalNum) {\r\n\t\t\t\tconsole.log('达到最大长度');\r\n\t\t\t\tclearInterval(this.schedule);\r\n\t\t\t\tengine.Tween.pauseTweens(teaFullRotation);\r\n\t\t\t\tthis.progressbarImg.x = 0\r\n\t\t\t\tthis.teaHalfFlagImg.visible = false;\r\n\t\t\t\tthis.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible\r\n\t\t\t\tthis.addOneSvga.visible = !this.teaHalfFlagImg.visible\r\n\t\t\t\tthis.addOneSvga.stop();\r\n\t\t\t}\r\n\t\t\tif (this.progressbarImg.x <= -2) {\r\n\t\t\t\tthis.progressbarImg.x -= step;\r\n\t\t\t}\r\n\t\t\tthis.getTeaPercentage(nowNum, totalNum);\r\n\t\t\tnowNum++;\r\n\t\t\tdataDiff++;\r\n\t\t\tmyDate = new Date();\r\n\t\t\tnowData = myDate.getTime();\r\n\t\t\tconsole.log('nowData')\r\n\t\t\tconsole.log(nowData)\r\n\t\t\tconsole.log('nowData - serverData) / 1000 - dataDiff', (nowData - serverData) / 1000 - (fbdvalue + dataDiff))\r\n\r\n\t\t\tif (Math.abs((nowData - serverData) / 1000) - dataDiff > (fbdvalue + 3)) {\r\n\t\t\t\tclearInterval(this.schedule);\r\n\t\t\t\tengine.Tween.pauseTweens(teaFullRotation);\r\n\t\t\t\tengine.globalEvent.dispatchEvent('event-setchange-TeaNum');\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tconsole.log('this.progressbarImg.x', this.progressbarImg.x)\r\n\t\t}, speed)\r\n\t}\r\n\tgetTeaPercentage(nowNum, totalNum) {\r\n\t\tthis.pickTeaCount.text = nowNum + '/' + totalNum;\r\n\t\tlet teaPercentage = 2;\r\n\t\tlet portion = totalNum / 3\r\n\t\tif (nowNum < portion) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (nowNum < (portion * 2)) {\r\n\t\t\tteaPercentage = 1;\r\n\t\t}\r\n\t\tconsole.log('teaPercentage', teaPercentage)\r\n\t\tif (this.nowPercentage != teaPercentage) {\r\n\t\t\tconsole.log('状态改变')\r\n\t\t\tthis.nowPercentage = teaPercentage;\r\n\t\t\tthis.updateTeaPercentage(teaPercentage);\r\n\t\t}\r\n\t}\r\n\r\n\t//需要更换茶叶数量皮肤\r\n\tupdateTeaPercentage(teaPercentage = 0) {\r\n\t\tconsole.log('需要更换茶叶数量皮肤')\r\n\t\tconsole.log('延迟500ms')\r\n\t\tlet pickTeaSVGA = this.basketSvgaGroup[1];\r\n\t\tconsole.log('pickTeaSVGA')\r\n\t\tconsole.log(pickTeaSVGA)\r\n\t\tpickTeaSVGA.removeChildAt(10);\r\n\t\tlet originframes = pickTeaSVGA.children[7];\r\n\t\tif (!originframes) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t//按照采茶叶的多少来 设置茶叶是不是满的图片\r\n\t\tlet teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));\r\n\t\t//let teaNumImg = this.teaHalfImg;\r\n\t\tif (teaPercentage == 1) {\r\n\t\t\tthis.teaHalfImg = new engine.Image(getTextureByName('茶叶-少'));\r\n\t\t}\r\n\t\telse if (teaPercentage == 2) {\r\n\t\t\tthis.teaHalfImg = new engine.Image(getTextureByName('茶叶-满'));\r\n\t\t}\r\n\t\tthis.teaHalfImg.visible = false;\r\n\t\tthis.teaHalfImg['frames'] = teaBucketframes;\r\n\r\n\t\tconsole.log('this.teaHalfImg');\r\n\t\tconsole.log(this.teaHalfImg);\r\n\t\tpickTeaSVGA.addChildAt(this.teaHalfImg, 10)\r\n\t}\r\n\r\n\tsetPickTeaLevel(level) {\r\n\t\tconsole.log('setPickTeaLevel', level);\r\n\t\tlet pickTeaSVGA = this.basketSvgaGroup[level];\r\n\t\tpickTeaSVGA.visible = true;\r\n\t\t// console.log('littleTea url')\r\n\t\t// console.log(this.teaHalfImg['_source'])\r\n\t\t//需要svga缓存结束\r\n\t\tsetTimeout(() => {\r\n\t\t\tconsole.log('延迟500ms')\r\n\t\t\tlet originframes = pickTeaSVGA.children[7];\r\n\t\t\t//按照采茶叶的多少来 设置茶叶是不是满的图片\r\n\t\t\tlet teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));\r\n\t\t\t//this.teaHalfImg = //new engine.Image(getTextureByName('茶叶-少'));\r\n\t\t\tif (this.teaHalfImg) {\r\n\t\t\t\t//this.teaHalfImg.source = ''\r\n\t\t\t\tthis.teaHalfImg['frames'] = teaBucketframes;\r\n\t\t\t}\r\n\t\t\tconsole.log('this.teaHalfImg');\r\n\t\t\tconsole.log(this.teaHalfImg);\r\n\t\t\tpickTeaSVGA.addChildAt(this.teaHalfImg, 10)\r\n\t\t\tpickTeaSVGA.gotoAndPlay(1, true);\r\n\t\t}, 300)\r\n\t}\r\n\thandGrasp() {\r\n\t\tconsole.log('handGrasp')\r\n\t\tlet that = this;\r\n\t\tsetTimeout(() => {\r\n\t\t\tthat.handGraspSvga.play(1, true);\r\n\t\t\t// this.pickTeaSvga.play(1, false);\r\n\t\t\t// this.teaSkyUpSvga.play(1, false);\r\n\t\t\t//console.log('手指移动')\r\n\t\t\tengine.Tween.get(that.handGraspSvga)\r\n\t\t\t\t.to({ x: props.handGraspMovePos[0], y: props.handGraspMovePos[1] }, 600).call(() => {\r\n\t\t\t\t\tthat.handGraspSvga.x = props.handGraspSvgaPos[0];\r\n\t\t\t\t\tthat.handGraspSvga.y = props.handGraspSvgaPos[1];\r\n\t\t\t\t\t//console.log('this.pickTeaSvga.play')\r\n\t\t\t\t\t//setTimeout(() => {\r\n\t\t\t\t\tthat.pickTeaSvga.visible = true\r\n\t\t\t\t\tthat.pickTeaSvga.play(1, false);\r\n\t\t\t\t})\r\n\r\n\t\t\tthat.pickTeaSvga.addEventListener(engine.Event.END_FRAME, function () {\r\n\t\t\t\t//console.log('this.teaSkyUpSvga.play')\r\n\t\t\t\tthat.teaSkyUpSvga.visible = true\r\n\t\t\t\tthat.teaSkyUpSvga.play(1, false);\r\n\t\t\t})\r\n\r\n\t\t\tthat.teaSkyUpSvga.addEventListener(engine.Event.END_FRAME, function () {\r\n\t\t\t\tthat.teaSkyUpSvga.visible = false;\r\n\t\t\t})\r\n\r\n\t\t}, 500);\r\n\t}\r\n\t/*采茶叶活动*/\r\n}\r\n","/**\r\n * Created by rockyl on 2020-01-09.\r\n */\r\n\r\nimport GameView from \"./GameView\";\r\nimport { injectProps } from \"../props\";\r\n\r\n\r\nexport class GameWrapper extends engine.Container {\r\n\tprivate _status;\r\n\tprivate _gameView: GameView;\r\n\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\t/*\r\n\t\tevent-pickTeaGame-init //游戏初始化\r\n\t\t//event-wait-uplevel //待升级\r\n\t\tevent-add-oneScore //+1\r\n\t\tevent-pick-tea //采茶叶\r\n\t\tevent-tea-skyup //茶叶向上飞\r\n\t\tevent-hand-grasp //手抓去\r\n\t\tevent-change-TeaNum //茶叶数量 改变svga动画\r\n\t\tevent-getBasket-Type //获得篮子类型\r\n\t\tevent-setBasket-Type //设置篮子类型\r\n\t\t*/\r\n\t\t// event-getchange-TeaNum //茶叶数量{初始值totalNum,总量nowNum} 改变svga动画\r\n\t\t// event-getBasket-Type //获得篮子类型\r\n\t\t// event-hand-grasp //手抓去\r\n\r\n\t\t//event-pickTeaGame-init 游戏初始化\r\n\t\tengine.globalEvent.addEventListener('event-pickTeaGame-init', this.reset, this);\r\n\r\n\t\tengine.globalEvent.addEventListener('event-hand-grasp', this.handGrasp, this);\r\n\t\tengine.globalEvent.addEventListener('event-getchange-TeaNum', this.setTeaNum, this);\r\n\t\tengine.globalEvent.addEventListener('event-getBasket-Type', this.setPickTeaLevel, this);\r\n\r\n\r\n\r\n\r\n\t\tlet gameView = this._gameView = new GameView();\r\n\t\tthis.addChild(gameView);\r\n\t}\r\n\r\n\t//设置茶叶数量\r\n\tsetTeaNum(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\t\tthis._gameView.setTeaNum(event.data);\r\n\t}\r\n\r\n\t//设置茶蓝等级\r\n\tsetPickTeaLevel(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\t\tthis._gameView.setPickTeaLevel(event.data);\r\n\t}\r\n\r\n\treset(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\t\tthis._gameView.visible = true;\r\n\t\tthis._gameView.reset();\r\n\t}\r\n\r\n\r\n\tstart(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\t\tthis._status = 1;\r\n\t\tthis._gameView.start();\r\n\t}\r\n\r\n\tpause() {\r\n\t\tthis._gameView.pause();\r\n\t}\r\n\r\n\tresume() {\r\n\t\tthis._gameView.resume();\r\n\t}\r\n\r\n\trevive() {\r\n\t\tthis._gameView.revive();\r\n\t}\r\n\r\n\tclear() {\r\n\t\tthis._gameView.visible = false;\r\n\t}\r\n\r\n\thandGrasp() {\r\n\t\tthis._gameView.handGrasp();\r\n\t}\r\n\r\n\r\n\r\n\r\n\tprivate onTap(event) {\r\n\t\t//\tthis._gameView.tap(event);\r\n\t}\r\n}\r\n","/**\r\n * Created by rockyl on 2019-11-20.\r\n */\r\n\r\nimport {GameWrapper} from \"./game/GameWrapper\";\r\nimport {injectProps, prepareProps} from \"./props\";\r\n\r\nexport default function (props) {\r\n\tprepareProps();\r\n\tinjectProps(props);\r\n\r\n\tlet instance = new GameWrapper();\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;CAIO,IAAI,KAAK,GAAQ,EAAE,CAAC;AAE3B,UAAgB,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;AAED,UAAgB,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;;;CCRD;KAAsCA,kCAAgB;KA0ErD;SAAA,YACC,iBAAO,SAEP;SArEO,mBAAa,GAAQ,CAAC,CAAC;SA+DvB,gBAAU,GAAG,E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AC,OAAO,GAAG,CAAC,CAAC;SACjB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KAED,2BAAK,GAAL;SACC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KAED,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;KAED,+BAAS,GAAT;SACC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;MAC3B;KAKO,2BAAK,GAAb,UAAc,KAAK;MAElB;KACF,kBAAC;CAAD,CAAC,CAvFgC,MAAM,CAAC,SAAS,GAuFhD;;;iBCxFwB,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/pick-tea/src/props.ts","src/custom/pick-tea/src/game/utils.ts","src/custom/pick-tea/src/game/GameView.ts","src/custom/pick-tea/src/game/GameWrapper.ts","src/custom/pick-tea/src/index.ts"],"sourcesContent":["/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport let props: any = {};\r\n\r\nexport function prepareProps() {\r\n\tlet metaProps = getProps();\r\n\r\n\tengine.injectProp(props, metaProps);\r\n}\r\n\r\nexport function injectProps(p) {\r\n\tengine.injectProp(props, p);\r\n}\r\n","/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\nconst showlog = false;\r\nexport function getTexture(uuid) {\r\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\r\n}\r\n\r\nexport function getTextureByName(name) {\r\n\treturn getTexture(engine.getAssetByName(name).uuid);\r\n}\r\n\r\nexport function playSound(name) {\r\n\tengine.playSound(engine.getAssetByName(name).uuid, { keep: true });\r\n}\r\nexport function createSvga(name, anchorName?) {\r\n\tlet inst = new svga.Svga();\r\n\tinst.source = 'asset://' + engine.getAssetByName(name).uuid;\r\n\treturn inst;\r\n}\r\nexport function showLog(abjname, obj?) {\r\n\tif (showlog) {\r\n\t\tconsole.log(abjname)\r\n\t\tif (obj)\r\n\t\t\tconsole.log(obj)\r\n\t}\r\n\t// let inst = new svga.Svga();\r\n\t// inst.source = 'asset://' + engine.getAssetByName(name).uuid;\r\n\t// return inst;\r\n}","/**\r\n * Created by rockyl on 2018/8/16.\r\n */\r\n\r\nimport { props } from \"../props\";\r\nimport { playSound, createSvga } from \"./utils\";\r\nimport ObjectPool = engine.ObjectPool;\r\nimport { getTextureByName } from \"./utils\";\r\nimport { showLog } from \"./utils\";\r\nimport { Tealeaf } from \"./Tealeaf\";\r\n\r\n\r\nconst MAXX = -8;\r\nexport default class GameView extends engine.Container {\r\n\r\n\tprivate _hasSetup;\r\n\r\n\t/**采茶叶自定义模块*/\r\n\tprivate teaImgSource: any;\r\n\tprivate tealeaf: Tealeaf;\r\n\tprivate teaHalfImg: engine.Image;\r\n\tprivate nowPercentage: any = 0;\r\n\tprivate progressbarBgImg: engine.Image;\r\n\tprivate progressbarImg: engine.Image;\r\n\tprivate teaFullFlagImg: engine.Image;\r\n\tprivate teaHalfFlagImg: engine.Image;\r\n\tprivate teaStarImg: engine.Image;\r\n\tprivate frontImg: engine.Image;\r\n\tprivate verseImg: engine.Image;\r\n\t//采茶背景层\r\n\tprivate pickTeaBg: engine.Container;\r\n\t//采茶进度计时器\r\n\tprivate pickTeaTimer: any\r\n\t//茶叶的数量进度 100/240\r\n\tprivate pickTeaCount: engine.Label;\r\n\t//语句\r\n\tprivate verseLabel: engine.TextField;\r\n\t//篮子集合\r\n\tprivate basketSvgaGroup: any;\r\n\r\n\t//纸篮子svga\r\n\tprivate paperBasketSvga\r\n\t//布篮子svga\r\n\tprivate clothBasketSvga\r\n\t//竹篮子svga\r\n\tprivate bambooBasketSvga\r\n\t//木篮子svga\r\n\tprivate woodBasketSvga\r\n\t//+1\r\n\tprivate addOneSvga\r\n\t//采茶叶\r\n\tprivate pickTeaSvga\r\n\t//茶叶向上飞\r\n\tprivate teaSkyUpSvga\r\n\t//手抓去\r\n\tprivate handGraspSvga\r\n\t//半缺旋转\r\n\tprivate teaFullRotation\r\n\r\n\r\n\t/**采茶叶自定义模块*/\r\n\r\n\t//玩家\r\n\tprivate player: engine.Container;\r\n\r\n\t//触摸层\r\n\tprivate rectBg: engine.Rect;\r\n\t//npc层\r\n\t//private NpcBg: engine.Container;\r\n\r\n\t//当前分数\r\n\tprivate score\r\n\t//游戏状态\r\n\tprivate gameIng;\r\n\t//npc出身计时器\r\n\tprivate timer\r\n\t//倒计时计时器\r\n\tprivate countdownTimer: any\r\n\t//倒计时\r\n\tprivate countdown: number\r\n\t//当前速度\r\n\tprivate speed: number\r\n\r\n\tprivate schedule: any\r\n\t// 当前场景上面的物品\r\n\tprivate goodsItems = []\r\n\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\r\n\t}\r\n\r\n\tprivate waterSvga\r\n\tprivate boomSvga\r\n\tprivate playerSvga\r\n\tprivate _touchEnabled = true\r\n\tsetup() {\r\n\t\tif (this._hasSetup) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis._hasSetup = true;\r\n\t\tthis.pickTeaBg = new engine.Container();\r\n\r\n\t\t// let bgGroud = new engine.Image()\r\n\t\t// bgGroud.source = '//yun.duiba.com.cn/aurora/assets/a988c47db8d3131faad175c7c2944773392be643.png'\r\n\t\t// this.addChild(bgGroud);\r\n\r\n\t\tthis.addChild(this.pickTeaBg);\r\n\t\tthis.teaHalfImg = new engine.Image();\r\n\r\n\t\tthis.paperBasketSvga = createSvga(\"采茶童-纸篮子\");\r\n\t\tthis.clothBasketSvga = createSvga(\"采茶童-布篮子\");\r\n\t\tthis.bambooBasketSvga = createSvga(\"采茶童-竹编篮\");\r\n\t\tthis.woodBasketSvga = createSvga(\"采茶童-木篮子\");\r\n\t\tthis.addOneSvga = createSvga(\"+1\");\r\n\t\tthis.pickTeaSvga = createSvga(\"采茶叶\");\r\n\r\n\t\tthis.teaSkyUpSvga = createSvga(\"茶叶向上飞\");\r\n\t\tthis.handGraspSvga = createSvga(\"手抓去\");\r\n\r\n\t\tthis.frontImg = new engine.Image(getTextureByName('前景'));\r\n\r\n\t\tthis.pickTeaBg.addChild(this.paperBasketSvga);\r\n\t\tthis.pickTeaBg.addChild(this.clothBasketSvga);\r\n\t\tthis.pickTeaBg.addChild(this.bambooBasketSvga);\r\n\t\tthis.pickTeaBg.addChild(this.woodBasketSvga);\r\n\t\t//this.pickTeaBg.addChild(this.addOneSvga);\r\n\t\tthis.pickTeaBg.addChild(this.pickTeaSvga);\r\n\t\tthis.pickTeaBg.addChild(this.teaSkyUpSvga);\r\n\t\t//this.pickTeaBg.addChild(this.handGraspSvga);\r\n\t\tthis.basketSvgaGroup = [this.paperBasketSvga, this.clothBasketSvga, this.bambooBasketSvga, this.woodBasketSvga]\r\n\r\n\t\tthis.progressbarBgImg = new engine.Image(getTextureByName('进度条底框'));\r\n\t\tthis.progressbarImg = new engine.Image(getTextureByName('进度'));\r\n\t\tthis.teaHalfFlagImg = new engine.Image(getTextureByName('茶叶进度缺'));\r\n\t\tthis.teaFullFlagImg = new engine.Image(getTextureByName('茶叶进度满'));\r\n\t\tthis.teaStarImg = new engine.Image(getTextureByName('小茶叶'));\r\n\r\n\r\n\t\tthis.verseImg = new engine.Image(getTextureByName('气泡框'));\r\n\t\tthis.pickTeaBg.addChild(this.verseImg);\r\n\r\n\r\n\t\tlet mask = new engine.Rect();\r\n\t\tmask.width = 600;\r\n\t\tmask.height = 50;\r\n\t\tmask.x = 10;\r\n\t\tmask.y = 0;\r\n\t\tmask.alpha = 1;\r\n\r\n\t\t//mask.fillColor = 'black'\r\n\r\n\t\tthis.progressbarImg.mask = mask\r\n\t\tshowLog(this.progressbarImg.mask)\r\n\r\n\t\tthis.addChild(this.frontImg);\r\n\r\n\t\tthis.progressbarBgImg.addChild(this.progressbarImg);\r\n\r\n\t\tthis.progressbarBgImg.addChild(mask);\r\n\t\tshowLog('遮罩坐标')\r\n\t\tshowLog(mask.x, mask.y)\r\n\t\tthis.progressbarBgImg.addChild(this.addOneSvga);\r\n\t\tthis.progressbarBgImg.addChild(this.handGraspSvga);\r\n\r\n\t\tthis.progressbarBgImg.addChild(this.teaHalfFlagImg);\r\n\t\tthis.progressbarBgImg.addChild(this.teaFullFlagImg);\r\n\t\tthis.progressbarBgImg.addChild(this.teaStarImg);\r\n\t\tthis.pickTeaCount = new engine.Label();\r\n\t\tthis.progressbarBgImg.addChild(this.pickTeaCount);\r\n\r\n\t\tthis.addChild(this.progressbarBgImg);\r\n\t\t// let myDate = new Date();\r\n\t\t// let nowData = myDate.getTime();\r\n\t\t//this.setTeaNum({ totalNum: 430, nowNum: 425, serverData: 1585290768011 })\r\n\t\tthis.initView();\r\n\r\n\t\tsetTimeout(() => {\r\n\t\t\tthis.setTeaNum({ totalNum: 10, nowNum: 0, serverData: 1585290768011 })\r\n\t\t\t//this.setTeaNum({ totalNum: 100, nowNum: 0 })\r\n\t\t}, 500)\r\n\r\n\r\n\t}\r\n\treset() {\r\n\t\tthis.initView()\r\n\t}\r\n\tstart() {\r\n\r\n\t}\r\n\tpause() {\r\n\t\tthis.gameIng = false;\r\n\t}\r\n\trevive() {\r\n\t\tthis.gameIng = true;\r\n\t}\r\n\r\n\tresume() {\r\n\t\tthis.reset();\r\n\t\tthis.start()\r\n\t}\r\n\r\n\tinitView() {\r\n\t\tthis.pickTeaBg.mouseEnabled = false;\r\n\t\tthis.teaHalfImg.visible = false;\r\n\t\t//this.teaHalfImg.source = '';\r\n\t\tthis.pickTeaSvga.visible = false;\r\n\t\tthis.teaSkyUpSvga.visible = false;\r\n\t\tthis.verseImg.visible = false;\r\n\t\tthis.frontImg.visible = props.showFrontImg == 1;\r\n\t\tthis.initChildrenPos()\r\n\t}\r\n\tinitChildrenPos() {\r\n\t\tfor (let i = 0; i < this.basketSvgaGroup.length; i++) {\r\n\t\t\tthis.basketSvgaGroup[i].visible = false\r\n\t\t\tthis.basketSvgaGroup[i].x = props.basketSvgaPos[0];\r\n\t\t\tthis.basketSvgaGroup[i].y = props.basketSvgaPos[1];;\r\n\t\t\t//this.basketSvgaGroup[i].addEventListener(engine.MouseEvent.CLICK, this.showVerse, this);\r\n\t\t}\r\n\t\tthis.verseImg.x = props.versePos[0]\r\n\t\tthis.verseImg.y = props.versePos[1]\r\n\t\tthis.addOneSvga.x = props.addOneSvgaPos[0]\r\n\t\tthis.addOneSvga.y = props.addOneSvgaPos[1];\r\n\t\tthis.pickTeaSvga.x = props.pickTeaSvgaPos[0];\r\n\t\tthis.pickTeaSvga.y = props.pickTeaSvgaPos[1];\r\n\r\n\t\tthis.teaSkyUpSvga.x = props.teaSkyUpSvgaPos[0];\r\n\t\tthis.teaSkyUpSvga.y = props.teaSkyUpSvgaPos[1];\r\n\r\n\t\tthis.handGraspSvga.x = props.handGraspSvgaPos[0];\r\n\t\tthis.handGraspSvga.y = props.handGraspSvgaPos[1];\r\n\r\n\t\tthis.progressbarBgImg.x = props.progressbarBgImgPos[0]\r\n\r\n\t\tthis.progressbarBgImg.y = props.progressbarBgImgPos[1]\r\n\r\n\t\tthis.progressbarImg.x = props.progressbarImgPos[0]\r\n\t\tthis.progressbarImg.y = props.progressbarImgPos[1]\r\n\r\n\t\tthis.teaHalfFlagImg.x = props.teaHalfFlagImgPos[0]\r\n\t\tthis.teaHalfFlagImg.y = props.teaHalfFlagImgPos[1]\r\n\t\tthis.teaHalfFlagImg.anchorX = this.teaHalfFlagImg.width / 2\r\n\t\tthis.teaHalfFlagImg.anchorY = this.teaHalfFlagImg.height / 2\r\n\r\n\t\tthis.teaFullFlagImg.x = props.teaHalfFlagImgPos[0]\r\n\t\tthis.teaFullFlagImg.y = props.teaHalfFlagImgPos[1]\r\n\r\n\t\tthis.frontImg.x = props.FrontImgPos[0]\r\n\t\tthis.frontImg.y = props.FrontImgPos[1]\r\n\r\n\t\tthis.teaFullFlagImg.visible = false;\r\n\r\n\t\tthis.teaStarImg.x = props.teaStarImgPos[0]\r\n\t\tthis.teaStarImg.y = props.teaStarImgPos[1]\r\n\r\n\t\tthis.pickTeaCount.fillColor = 'white';\r\n\t\tthis.pickTeaCount.size = 30;\r\n\t\tthis.pickTeaCount.text = ''\r\n\r\n\t\tthis.pickTeaCount.x = props.pickTeaCountPos[0]\r\n\t\tthis.pickTeaCount.y = props.pickTeaCountPos[1]\r\n\r\n\t\tthis.pickTeaCount.height = 50;\r\n\t\tthis.pickTeaCount.width = 200;\r\n\r\n\t\tthis.verseLabel = new engine.TextField();\r\n\t\tthis.verseLabel.size = props.verseLabel[2];\r\n\t\tthis.verseLabel.text = ''\r\n\t\tthis.verseLabel.fillColor = props.verseColor[0]\r\n\t\tthis.verseLabel.height = props.verseLabel[1];\r\n\t\tthis.verseLabel.width = props.verseLabel[0];\r\n\t\tthis.verseLabel.strokeColor = props.verseColor[1]\r\n\t\tthis.verseLabel.stroke = 0.5;\r\n\r\n\t\tthis.verseLabel.y = 15;\r\n\t\tthis.verseLabel['textHeight'] = 14;\r\n\t\tthis.verseLabel.textAlign = engine.TEXT_ALIGN.CENTER;\r\n\t\tthis.verseImg.visible = false;\r\n\t\tthis.verseImg.addChild(this.verseLabel);\r\n\r\n\t\t// label.x = (width - label.width) / 2;\r\n\t\t// label.y = guideHole.y + guideHole.height + 50;\r\n\t}\r\n\tshowVerse() {\r\n\t\tshowLog('显示诗句')\r\n\t\t// if (!this._touchEnabled) {\r\n\t\t// \treturn;\r\n\t\t// }\r\n\t\t//this._touchEnabled = false;\r\n\t\tthis.verseImg.visible = true;\r\n\t\tlet len = props.verses.length;\r\n\t\tlet random = Math.floor(Math.random() * len);\r\n\t\tshowLog('random', random)\r\n\t\tshowLog('props.verses')\r\n\t\tshowLog(props.verses)\r\n\t\tlet verse = props.verses[random];\r\n\t\tshowLog('verse', verse)\r\n\t\tthis.verseLabel.text = verse;\r\n\t\tlet y = this.verseImg.y\r\n\t\tengine.Tween.get(this.verseImg)\r\n\t\t\t.to({ alpha: 0 }, 3000).call(() => {\r\n\t\t\t\tthis.verseImg.visible = false;\r\n\t\t\t\tthis.verseImg.alpha = 1\r\n\t\t\t})\r\n\t};\r\n\t/*采茶叶活动*/\r\n\t//总量除以当前 小于3分之1 没有树叶 ,3分之1到3分之2一点点树叶 ,大于3分之2满树叶\r\n\tsetTeaNum(TeaNums) {\r\n\t\tif (this.schedule) {\r\n\t\t\tshowLog('清理定时器,重新设置同步')\r\n\t\t\tclearInterval(this.schedule);\r\n\t\t}\r\n\t\tlet totalNum = TeaNums.totalNum;\r\n\t\tlet nowNum = TeaNums.nowNum + 1\r\n\r\n\t\tlet surplus = nowNum - totalNum;\r\n\t\tif (surplus == 0) {\r\n\t\t\tconsole.log('达到最大长度');\r\n\t\t\tthis.progressbarImg.x = this.teaFullFlagImg.width / 2\r\n\t\t\tthis.teaHalfFlagImg.visible = false;\r\n\t\t\tthis.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible\r\n\t\t\tthis.addOneSvga.visible = !this.teaHalfFlagImg.visible\r\n\t\t\tthis.addOneSvga.stop();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconsole.log('surplus', surplus);\r\n\t\tlet width = this.progressbarImg.width;\r\n\t\tlet myDate = new Date();\r\n\t\tlet nowData = myDate.getTime();\r\n\t\tlet serverData = TeaNums.serverData;\r\n\t\t//前后端本身的差值\r\n\t\tlet fbdvalue = Math.abs((nowData - serverData))\r\n\t\tconsole.log('fbdvalue', fbdvalue)\r\n\t\t/**/\r\n\t\t//设置数据校正\r\n\t\t// let serverData = 0;\r\n\t\tlet dataDiff = 0;\r\n\t\t/**/\r\n\t\t//let rate = (443 - width * (1 - nowNum / totalNum))\r\n\t\t//已经走得\r\n\t\tlet x = -width * (1 - nowNum / totalNum)\r\n\t\tconsole.log('x', x);\r\n\t\tconsole.log('parseFloat(x.toFixed(3))', parseFloat(x.toFixed(3)))\r\n\r\n\t\tthis.progressbarImg.x = parseFloat(x.toFixed(3)) + this.teaFullFlagImg.width / 2 - Math.abs(this.teaFullFlagImg.x)//)//this.teaFullFlagImg.width - Math.abs(this.teaFullFlagImg.x)\r\n\t\tconsole.log('this.progressbarImg.x', this.progressbarImg.x)\r\n\r\n\t\tlet step = (this.teaFullFlagImg.width / 2 - this.progressbarImg.x) / surplus\r\n\r\n\t\tconsole.log('step', step)\r\n\t\t//step = parseFloat(step.toFixed(6));\r\n\t\t//console.log('进图条每秒比例step', step)\r\n\t\tthis.addOneSvga.play(1, true);\r\n\r\n\t\tlet speed = props.pickTeaSpeed;\r\n\t\t//this.progressbarImg.x += step;\r\n\t\tlet teaFullRotation = engine.Tween.get(this.teaHalfFlagImg, { loop: true })\r\n\t\t\t.to({ rotation: 360 }, speed).call(() => {\r\n\t\t\t\tthis.teaHalfFlagImg.rotation = 0;\r\n\t\t\t})\r\n\t\tthis.schedule = setInterval(() => {\r\n\t\t\tif (nowNum == totalNum) {\r\n\t\t\t\tconsole.log('达到最大长度');\r\n\t\t\t\tclearInterval(this.schedule);\r\n\t\t\t\tengine.Tween.removeTweens(teaFullRotation);\r\n\t\t\t\tthis.progressbarImg.x = this.teaFullFlagImg.width / 2\r\n\t\t\t\tthis.teaHalfFlagImg.visible = false;\r\n\t\t\t\tthis.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible\r\n\t\t\t\tthis.addOneSvga.visible = !this.teaHalfFlagImg.visible\r\n\t\t\t\tthis.addOneSvga.stop();\r\n\t\t\t}\r\n\t\t\tconsole.log('nowNum', nowNum, 'totalNum', totalNum)\r\n\t\t\tthis.getTeaPercentage(nowNum, totalNum);\r\n\t\t\tif (this.progressbarImg.x < this.teaFullFlagImg.width / 2 + step) {\r\n\t\t\t\tthis.progressbarImg.x -= step;\r\n\t\t\t}\r\n\t\t\tnowNum++;\r\n\t\t\tdataDiff += speed;\r\n\t\t\tmyDate = new Date();\r\n\t\t\tnowData = myDate.getTime();\r\n\r\n\t\t\tif (Math.abs((nowData - serverData)) - dataDiff > (fbdvalue + 3000)) {\r\n\t\t\t\tconsole.log('校准数据前后数据偏差过大');\r\n\t\t\t\tconsole.log(Math.abs((nowData - serverData)) - dataDiff - (fbdvalue + 3000))\r\n\t\t\t\tclearInterval(this.schedule);\r\n\t\t\t\tengine.Tween.removeTweens(teaFullRotation);\r\n\t\t\t\tengine.globalEvent.dispatchEvent('event-setchange-TeaNum');\r\n\t\t\t\tthis.addOneSvga.visible = false;\r\n\t\t\t\tthis.addOneSvga.stop();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}, speed)\r\n\t}\r\n\tgetTeaPercentage(nowNum, totalNum) {\r\n\t\tthis.pickTeaCount.text = nowNum + '/' + totalNum;\r\n\t\tlet teaPercentage = 2;\r\n\t\tlet portion = totalNum / 3\r\n\t\tif (nowNum < portion) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (nowNum < (portion * 2)) {\r\n\t\t\tteaPercentage = 1;\r\n\t\t}\r\n\t\tconsole.log('teaPercentage', teaPercentage)\r\n\t\tif (this.nowPercentage != teaPercentage) {\r\n\t\t\tshowLog('状态改变')\r\n\t\t\tthis.nowPercentage = teaPercentage;\r\n\t\t\tthis.updateTeaPercentage(teaPercentage);\r\n\t\t}\r\n\t}\r\n\r\n\t//需要更换茶叶数量皮肤\r\n\tupdateTeaPercentage(teaPercentage = 0) {\r\n\t\tshowLog('需要更换茶叶数量皮肤')\r\n\t\tshowLog('延迟500ms')\r\n\t\tlet pickTeaSVGA = this.basketSvgaGroup[1];\r\n\t\tshowLog('pickTeaSVGA')\r\n\t\tshowLog(pickTeaSVGA)\r\n\t\tpickTeaSVGA.removeChildAt(10);\r\n\t\tlet originframes = pickTeaSVGA.children[7];\r\n\t\tif (!originframes) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t//按照采茶叶的多少来 设置茶叶是不是满的图片\r\n\t\tlet teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));\r\n\t\t//let teaNumImg = this.teaHalfImg;\r\n\t\tif (teaPercentage == 1) {\r\n\t\t\tthis.teaHalfImg = new engine.Image(getTextureByName('茶叶-少'));\r\n\t\t}\r\n\t\telse if (teaPercentage == 2) {\r\n\t\t\tthis.teaHalfImg = new engine.Image(getTextureByName('茶叶-满'));\r\n\t\t}\r\n\t\tthis.teaHalfImg.visible = false;\r\n\t\tthis.teaHalfImg['frames'] = teaBucketframes;\r\n\r\n\t\t//showLog('this.teaHalfImg');\r\n\t\t//showLog(this.teaHalfImg);\r\n\t\tpickTeaSVGA.addChildAt(this.teaHalfImg, 10)\r\n\t}\r\n\r\n\tsetPickTeaLevel(level) {\r\n\t\tshowLog('setPickTeaLevel', level);\r\n\t\tlet pickTeaSVGA = this.basketSvgaGroup[level];\r\n\t\tpickTeaSVGA.visible = true;\r\n\t\t//showLog('littleTea url')\r\n\t\t//showLog(this.teaHalfImg['_source'])\r\n\t\t//需要svga缓存结束\r\n\t\tsetTimeout(() => {\r\n\t\t\tshowLog('延迟500ms')\r\n\t\t\tlet originframes = pickTeaSVGA.children[7];\r\n\t\t\t//按照采茶叶的多少来 设置茶叶是不是满的图片\r\n\t\t\tlet teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));\r\n\t\t\t//this.teaHalfImg = //new engine.Image(getTextureByName('茶叶-少'));\r\n\t\t\tif (this.teaHalfImg) {\r\n\t\t\t\t//this.teaHalfImg.source = ''\r\n\t\t\t\tthis.teaHalfImg['frames'] = teaBucketframes;\r\n\t\t\t}\r\n\t\t\tshowLog('this.teaHalfImg');\r\n\t\t\tshowLog(this.teaHalfImg);\r\n\t\t\tpickTeaSVGA.addChildAt(this.teaHalfImg, 10)\r\n\t\t\tpickTeaSVGA.gotoAndPlay(1, true);\r\n\t\t}, 300)\r\n\t}\r\n\thandGrasp() {\r\n\t\tshowLog('handGrasp')\r\n\t\tlet that = this;\r\n\t\tsetTimeout(() => {\r\n\t\t\t//that.handGraspSvga.play(1, true);\r\n\t\t\t// this.pickTeaSvga.play(1, false);\r\n\t\t\t// this.teaSkyUpSvga.play(1, false);\r\n\t\t\tengine.Tween.get(that.handGraspSvga)\r\n\t\t\t\t.to({ x: props.handGraspMovePos[0], y: props.handGraspMovePos[1] }, 400).call(() => {\r\n\t\t\t\t\tshowLog('this.pickTeaSvga.play')\r\n\t\t\t\t\tthat.handGraspSvga.play(1, true);\r\n\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\tthat.handGraspSvga.stop()\r\n\t\t\t\t\t\tthat.handGraspSvga.x = props.handGraspSvgaPos[0];\r\n\t\t\t\t\t\tthat.handGraspSvga.y = props.handGraspSvgaPos[1];\r\n\t\t\t\t\t}, 600)\r\n\t\t\t\t\tthat.pickTeaSvga.visible = true\r\n\t\t\t\t\tthat.pickTeaSvga.play(1, false);\r\n\t\t\t\t})\r\n\r\n\t\t\tthat.pickTeaSvga.addEventListener(engine.Event.END_FRAME, function () {\r\n\t\t\t\tshowLog('this.teaSkyUpSvga.play')\r\n\t\t\t\tthat.teaSkyUpSvga.visible = true\r\n\t\t\t\tthat.teaSkyUpSvga.play(1, false);\r\n\t\t\t})\r\n\r\n\t\t\tthat.teaSkyUpSvga.addEventListener(engine.Event.END_FRAME, function () {\r\n\t\t\t\tthat.teaSkyUpSvga.visible = false;\r\n\t\t\t\tthat.updateTeaPercentage(0);\r\n\t\t\t})\r\n\r\n\t\t}, 500);\r\n\t}\r\n\r\n\t/*采茶叶活动*/\r\n}\r\n","/**\r\n * Created by rockyl on 2020-01-09.\r\n */\r\n\r\nimport GameView from \"./GameView\";\r\nimport { injectProps } from \"../props\";\r\n\r\n\r\nexport class GameWrapper extends engine.Container {\r\n\tprivate _status;\r\n\tprivate _gameView: GameView;\r\n\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\t/*\r\n\t\tevent-pickTeaGame-init //游戏初始化\r\n\t\t//event-wait-uplevel //待升级\r\n\t\tevent-add-oneScore //+1\r\n\t\tevent-pick-tea //采茶叶\r\n\t\tevent-tea-skyup //茶叶向上飞\r\n\t\tevent-hand-grasp //手抓去\r\n\t\tevent-change-TeaNum //茶叶数量 改变svga动画\r\n\t\tevent-getBasket-Type //获得篮子类型\r\n\t\tevent-setBasket-Type //设置篮子类型\r\n\t\t*/\r\n\t\t// event-getchange-TeaNum //茶叶数量{初始值totalNum,总量nowNum} 改变svga动画\r\n\t\t// event-getBasket-Type //获得篮子类型\r\n\t\t// event-hand-grasp //手抓去\r\n\r\n\t\t//event-pickTeaGame-init 游戏初始化\r\n\t\tengine.globalEvent.addEventListener('event-pickTeaGame-init', this.reset, this);\r\n\r\n\t\tengine.globalEvent.addEventListener('event-hand-grasp', this.handGrasp, this);\r\n\t\tengine.globalEvent.addEventListener('event-getClick-person', this.clickPerson, this);\r\n\t\tengine.globalEvent.addEventListener('event-getchange-TeaNum', this.setTeaNum, this);\r\n\t\tengine.globalEvent.addEventListener('event-getBasket-Type', this.setPickTeaLevel, this);\r\n\r\n\r\n\r\n\t\tlet gameView = this._gameView = new GameView();\r\n\t\tthis.addChild(gameView);\r\n\t}\r\n\r\n\t//设置茶叶数量\r\n\tsetTeaNum(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\t\tthis._gameView.setTeaNum(event.data);\r\n\t}\r\n\r\n\t//设置茶蓝等级\r\n\tsetPickTeaLevel(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\t\tthis._gameView.setPickTeaLevel(event.data);\r\n\t}\r\n\t\r\n\thandGrasp() {\r\n\t\tthis._gameView.handGrasp();\r\n\t}\r\n\t//点击人物\r\n\tclickPerson() {\r\n\t\tthis._gameView.showVerse();\r\n\t}\r\n\treset(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\t\tthis._gameView.visible = true;\r\n\t\tthis._gameView.reset();\r\n\t}\r\n\r\n\r\n\tstart(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\t\tthis._status = 1;\r\n\t\tthis._gameView.start();\r\n\t}\r\n\r\n\tpause() {\r\n\t\tthis._gameView.pause();\r\n\t}\r\n\r\n\tresume() {\r\n\t\tthis._gameView.resume();\r\n\t}\r\n\r\n\trevive() {\r\n\t\tthis._gameView.revive();\r\n\t}\r\n\r\n\tclear() {\r\n\t\tthis._gameView.visible = false;\r\n\t}\r\n\r\n\r\n\r\n\r\n\r\n\tprivate onTap(event) {\r\n\t\t//\tthis._gameView.tap(event);\r\n\t}\r\n}\r\n","/**\r\n * Created by rockyl on 2019-11-20.\r\n */\r\n\r\nimport {GameWrapper} from \"./game/GameWrapper\";\r\nimport {injectProps, prepareProps} from \"./props\";\r\n\r\nexport default function (props) {\r\n\tprepareProps();\r\n\tinjectProps(props);\r\n\r\n\tlet instance = new GameWrapper();\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;CAIO,IAAI,KAAK,GAAQ,EAAE,CAAC;AAE3B,UAAgB,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;AAED,UAAgB,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;K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GAAG,CAAC,CAAC;SACjB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KAED,2BAAK,GAAL;SACC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KAED,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;KAMO,2BAAK,GAAb,UAAc,KAAK;MAElB;KACF,kBAAC;CAAD,CAAC,CA3FgC,MAAM,CAAC,SAAS,GA2FhD;;;iBC5FwB,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/pick-tea/meta.json
View file @
57aa8bf6
{
"name"
:
"采茶叶"
,
"desc"
:
"采茶叶模
块
"
,
"desc"
:
"采茶叶模
左上角0,0点
"
,
"props"
:
{
"versePos"
:
{
"alias"
:
"诗句的起始位置"
,
...
...
@@ -10,7 +10,7 @@
"verses"
:
{
"alias"
:
"诗句"
,
"type"
:
"array<string>"
,
"default"
:
"今
朝有酒今朝醉,今宵更有湘江月,找出霏霏满碗花,雨过林霏清石气,秋将山翠入诗心,生怕芳丛鹰嘴芽,老郎封寄谪仙家
"
"default"
:
"今
宵更有湘江月,照出霏霏满碗花,雨过林霏清石气,秋将山翠入诗心
"
},
"verseLabel"
:
{
"alias"
:
"提示语框xys"
,
...
...
@@ -22,6 +22,16 @@
"type"
:
"array<string>"
,
"default"
:
"#33628b,#99b1c5"
},
"showFrontImg"
:
{
"alias"
:
"茶叶前景图1显示2隐藏"
,
"type"
:
"number"
,
"default"
:
"1"
},
"FrontImgPos"
:
{
"alias"
:
"茶叶前景图位置"
,
"type"
:
"array<number>"
,
"default"
:
"0,584"
},
"pickTeaSpeed"
:
{
"alias"
:
"采集茶叶的速度ms"
,
"type"
:
"number"
,
...
...
@@ -30,12 +40,12 @@
"basketSvgaPos"
:
{
"alias"
:
"人物的位置"
,
"type"
:
"array<number>"
,
"default"
:
"110,4
2
0"
"default"
:
"110,4
1
0"
},
"addOneSvgaPos"
:
{
"alias"
:
"+1SVGA的位置"
,
"type"
:
"array<number>"
,
"default"
:
"
70,72
0"
"default"
:
"
0,-10
0"
},
"pickTeaSvgaPos"
:
{
"alias"
:
"采茶叶SVGA的位置"
,
...
...
@@ -50,12 +60,12 @@
"handGraspSvgaPos"
:
{
"alias"
:
"手点击SVGA的位置"
,
"type"
:
"array<number>"
,
"default"
:
"
543,791
"
"default"
:
"
477,-29
"
},
"handGraspMovePos"
:
{
"alias"
:
"手点击移动的位置"
,
"type"
:
"array<number>"
,
"default"
:
"
460,700
"
"default"
:
"
372,-145
"
},
"progressbarBgImgPos"
:
{
"alias"
:
"进度条底图的位置"
,
...
...
@@ -65,7 +75,7 @@
"progressbarImgPos"
:
{
"alias"
:
"进度条的位置"
,
"type"
:
"array<number>"
,
"default"
:
"-
443
,4"
"default"
:
"-
335
,4"
},
"teaStarImgPos"
:
{
"alias"
:
"小茶叶的位置"
,
...
...
@@ -84,6 +94,12 @@
}
},
"assets"
:
[
{
"name"
:
"前景"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/1da0ea14267ff35f90f49c22deb1b34181571e90.png"
,
"uuid"
:
"9f5db57e-47f9-43e5-af80-adf41299280d"
,
"ext"
:
".png"
},
{
"name"
:
"气泡框"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/585743f25262b6992ac97015e22d91054d506821.png"
,
...
...
@@ -98,7 +114,7 @@
},
{
"name"
:
"进度"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
047218962662ed238192f211719c109fa107e8e1
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
afb6b2655838ea955d250663fc535cc166b466e7
.png"
,
"uuid"
:
"23e7861c-75a9-46bd-93f8-2825d4810d31"
,
"ext"
:
".png"
},
...
...
@@ -190,22 +206,25 @@
"events"
:
{
"in"
:
{
"event-getchange-TeaNum"
:
{
"alias"
:
"茶叶数量{初始值
totalNum,总量nowNum
} "
"alias"
:
"茶叶数量{初始值
nowNum,总量totalNum,后端时间serverData
} "
},
"event-getBasket-Type"
:
{
"alias"
:
"获得篮子类型"
"alias"
:
"获得篮子类型
(纸 布 竹 木)0 1 2 3
"
},
"event-hand-grasp"
:
{
"alias"
:
"手抓去"
},
"event-getClick-person"
:
{
"alias"
:
"点击人物"
}
},
"out"
:
{
"event-setchange-TeaNum"
:
{
"alias"
:
""
,
"alias"
:
"
获取茶叶数量{初始值nowNum,总量totalNum,后端时间serverData}
"
,
"data"
:
{}
},
"event-setBasket-Typ"
:
{
"alias"
:
""
,
"alias"
:
"
获得篮子类型(纸 布 竹 木)0 1 2 3
"
,
"data"
:
{}
}
}
...
...
src/custom/pick-tea/src/game/GameView.ts
View file @
57aa8bf6
...
...
@@ -6,8 +6,10 @@ import { props } from "../props";
import
{
playSound
,
createSvga
}
from
"./utils"
;
import
ObjectPool
=
engine
.
ObjectPool
;
import
{
getTextureByName
}
from
"./utils"
;
import
{
showLog
}
from
"./utils"
;
import
{
Tealeaf
}
from
"./Tealeaf"
;
const
MAXX
=
-
8
;
export
default
class
GameView
extends
engine
.
Container
{
...
...
@@ -23,7 +25,7 @@ export default class GameView extends engine.Container {
private
teaFullFlagImg
:
engine
.
Image
;
private
teaHalfFlagImg
:
engine
.
Image
;
private
teaStarImg
:
engine
.
Image
;
private
frontImg
:
engine
.
Image
;
private
verseImg
:
engine
.
Image
;
//采茶背景层
private
pickTeaBg
:
engine
.
Container
;
...
...
@@ -52,7 +54,8 @@ export default class GameView extends engine.Container {
private
teaSkyUpSvga
//手抓去
private
handGraspSvga
//半缺旋转
private
teaFullRotation
/**采茶叶自定义模块*/
...
...
@@ -88,9 +91,6 @@ export default class GameView extends engine.Container {
this
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
this
.
setup
,
this
);
}
private
waterSvga
private
boomSvga
private
playerSvga
...
...
@@ -102,9 +102,9 @@ export default class GameView extends engine.Container {
this
.
_hasSetup
=
true
;
this
.
pickTeaBg
=
new
engine
.
Container
();
let
bgGroud
=
new
engine
.
Image
()
bgGroud
.
source
=
'//yun.duiba.com.cn/aurora/assets/a988c47db8d3131faad175c7c2944773392be643.png'
this
.
addChild
(
bgGroud
);
//
let bgGroud = new engine.Image()
//
bgGroud.source = '//yun.duiba.com.cn/aurora/assets/a988c47db8d3131faad175c7c2944773392be643.png'
//
this.addChild(bgGroud);
this
.
addChild
(
this
.
pickTeaBg
);
this
.
teaHalfImg
=
new
engine
.
Image
();
...
...
@@ -115,16 +115,20 @@ export default class GameView extends engine.Container {
this
.
woodBasketSvga
=
createSvga
(
"采茶童-木篮子"
);
this
.
addOneSvga
=
createSvga
(
"+1"
);
this
.
pickTeaSvga
=
createSvga
(
"采茶叶"
);
this
.
teaSkyUpSvga
=
createSvga
(
"茶叶向上飞"
);
this
.
handGraspSvga
=
createSvga
(
"手抓去"
);
this
.
frontImg
=
new
engine
.
Image
(
getTextureByName
(
'前景'
));
this
.
pickTeaBg
.
addChild
(
this
.
paperBasketSvga
);
this
.
pickTeaBg
.
addChild
(
this
.
clothBasketSvga
);
this
.
pickTeaBg
.
addChild
(
this
.
bambooBasketSvga
);
this
.
pickTeaBg
.
addChild
(
this
.
woodBasketSvga
);
this
.
pickTeaBg
.
addChild
(
this
.
addOneSvga
);
//
this.pickTeaBg.addChild(this.addOneSvga);
this
.
pickTeaBg
.
addChild
(
this
.
pickTeaSvga
);
this
.
pickTeaBg
.
addChild
(
this
.
teaSkyUpSvga
);
this
.
pickTeaBg
.
addChild
(
this
.
handGraspSvga
);
//
this.pickTeaBg.addChild(this.handGraspSvga);
this
.
basketSvgaGroup
=
[
this
.
paperBasketSvga
,
this
.
clothBasketSvga
,
this
.
bambooBasketSvga
,
this
.
woodBasketSvga
]
this
.
progressbarBgImg
=
new
engine
.
Image
(
getTextureByName
(
'进度条底框'
));
...
...
@@ -148,12 +152,17 @@ export default class GameView extends engine.Container {
//mask.fillColor = 'black'
this
.
progressbarImg
.
mask
=
mask
console
.
log
(
this
.
progressbarImg
.
mask
)
showLog
(
this
.
progressbarImg
.
mask
)
this
.
addChild
(
this
.
frontImg
);
this
.
progressbarBgImg
.
addChild
(
this
.
progressbarImg
);
this
.
progressbarBgImg
.
addChild
(
mask
);
console
.
log
(
'遮罩坐标'
)
console
.
log
(
mask
.
x
,
mask
.
y
)
showLog
(
'遮罩坐标'
)
showLog
(
mask
.
x
,
mask
.
y
)
this
.
progressbarBgImg
.
addChild
(
this
.
addOneSvga
);
this
.
progressbarBgImg
.
addChild
(
this
.
handGraspSvga
);
this
.
progressbarBgImg
.
addChild
(
this
.
teaHalfFlagImg
);
this
.
progressbarBgImg
.
addChild
(
this
.
teaFullFlagImg
);
...
...
@@ -162,30 +171,20 @@ export default class GameView extends engine.Container {
this
.
progressbarBgImg
.
addChild
(
this
.
pickTeaCount
);
this
.
addChild
(
this
.
progressbarBgImg
);
// let myDate = new Date();
// let nowData = myDate.getTime();
//this.setTeaNum({ totalNum: 430, nowNum: 425, serverData: 1585290768011 })
this
.
initView
();
// this.initView();
// this.setPickTeaLevel(1)
let
myDate
=
new
Date
();
let
nowData
=
myDate
.
getTime
();
this
.
setTeaNum
({
totalNum
:
430
,
nowNum
:
0
,
serverData
:
nowData
})
this
.
initChildrenPos
();
setInterval
(()
=>
{
this
.
handGrasp
();
//this.setTeaNum({ totalNum: 430, nowNum: 120 })
},
5000
)
setTimeout
(()
=>
{
this
.
setTeaNum
({
totalNum
:
10
,
nowNum
:
0
,
serverData
:
1585290768011
})
//this.setTeaNum({ totalNum: 100, nowNum: 0 })
},
500
)
}
reset
()
{
console
.
log
(
'111111111reset1'
)
this
.
initView
()
setTimeout
(()
=>
this
.
setPickTeaLevel
(
1
)
,
500
)
}
start
()
{
...
...
@@ -203,18 +202,13 @@ export default class GameView extends engine.Container {
}
initView
()
{
// for (let i = 0; i < this.basketSvgaGroup.length; i++) {
// this.basketSvgaGroup[i].visible = false
// this.basketSvgaGroup[i].x = props.basketSvgaPos[0];
// this.basketSvgaGroup[i].y = props.basketSvgaPos[1];;
// this.basketSvgaGroup[i].addEventListener(engine.MouseEvent.CLICK, this.showVerse, this);
// }
this
.
pickTeaBg
.
mouseEnabled
=
false
;
this
.
teaHalfImg
.
visible
=
false
;
//this.teaHalfImg.source = '';
this
.
pickTeaSvga
.
visible
=
false
;
this
.
teaSkyUpSvga
.
visible
=
false
;
this
.
verseImg
.
visible
=
false
;
this
.
frontImg
.
visible
=
props
.
showFrontImg
==
1
;
this
.
initChildrenPos
()
}
initChildrenPos
()
{
...
...
@@ -222,7 +216,7 @@ export default class GameView extends engine.Container {
this
.
basketSvgaGroup
[
i
].
visible
=
false
this
.
basketSvgaGroup
[
i
].
x
=
props
.
basketSvgaPos
[
0
];
this
.
basketSvgaGroup
[
i
].
y
=
props
.
basketSvgaPos
[
1
];;
this
.
basketSvgaGroup
[
i
].
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
showVerse
,
this
);
//
this.basketSvgaGroup[i].addEventListener(engine.MouseEvent.CLICK, this.showVerse, this);
}
this
.
verseImg
.
x
=
props
.
versePos
[
0
]
this
.
verseImg
.
y
=
props
.
versePos
[
1
]
...
...
@@ -230,8 +224,10 @@ export default class GameView extends engine.Container {
this
.
addOneSvga
.
y
=
props
.
addOneSvgaPos
[
1
];
this
.
pickTeaSvga
.
x
=
props
.
pickTeaSvgaPos
[
0
];
this
.
pickTeaSvga
.
y
=
props
.
pickTeaSvgaPos
[
1
];
this
.
teaSkyUpSvga
.
x
=
props
.
teaSkyUpSvgaPos
[
0
];
this
.
teaSkyUpSvga
.
y
=
props
.
teaSkyUpSvgaPos
[
1
];
this
.
handGraspSvga
.
x
=
props
.
handGraspSvgaPos
[
0
];
this
.
handGraspSvga
.
y
=
props
.
handGraspSvgaPos
[
1
];
...
...
@@ -241,7 +237,6 @@ export default class GameView extends engine.Container {
this
.
progressbarImg
.
x
=
props
.
progressbarImgPos
[
0
]
this
.
progressbarImg
.
y
=
props
.
progressbarImgPos
[
1
]
//this.progressbarImg.width = 0;
this
.
teaHalfFlagImg
.
x
=
props
.
teaHalfFlagImgPos
[
0
]
this
.
teaHalfFlagImg
.
y
=
props
.
teaHalfFlagImgPos
[
1
]
...
...
@@ -251,6 +246,8 @@ export default class GameView extends engine.Container {
this
.
teaFullFlagImg
.
x
=
props
.
teaHalfFlagImgPos
[
0
]
this
.
teaFullFlagImg
.
y
=
props
.
teaHalfFlagImgPos
[
1
]
this
.
frontImg
.
x
=
props
.
FrontImgPos
[
0
]
this
.
frontImg
.
y
=
props
.
FrontImgPos
[
1
]
this
.
teaFullFlagImg
.
visible
=
false
;
...
...
@@ -269,7 +266,7 @@ export default class GameView extends engine.Container {
this
.
verseLabel
=
new
engine
.
TextField
();
this
.
verseLabel
.
size
=
props
.
verseLabel
[
2
];
this
.
verseLabel
.
text
=
'
11
'
this
.
verseLabel
.
text
=
''
this
.
verseLabel
.
fillColor
=
props
.
verseColor
[
0
]
this
.
verseLabel
.
height
=
props
.
verseLabel
[
1
];
this
.
verseLabel
.
width
=
props
.
verseLabel
[
0
];
...
...
@@ -285,54 +282,58 @@ export default class GameView extends engine.Container {
// label.x = (width - label.width) / 2;
// label.y = guideHole.y + guideHole.height + 50;
}
async
showVerse
()
{
console
.
l
og
(
'显示诗句'
)
if
(
!
this
.
_touchEnabled
)
{
return
;
}
this
.
_touchEnabled
=
false
;
showVerse
()
{
showL
og
(
'显示诗句'
)
//
if (!this._touchEnabled) {
//
return;
//
}
//
this._touchEnabled = false;
this
.
verseImg
.
visible
=
true
;
let
random
=
Math
.
floor
(
Math
.
random
()
*
3
)
;
console
.
log
(
'random'
,
random
)
console
.
log
(
'props.verses'
)
console
.
l
og
(
props
.
verses
)
let
len
=
props
.
verses
.
length
;
let
random
=
Math
.
floor
(
Math
.
random
()
*
len
);
showLog
(
'random'
,
random
)
showLog
(
'props.verses'
)
showL
og
(
props
.
verses
)
let
verse
=
props
.
verses
[
random
];
console
.
l
og
(
'verse'
,
verse
)
showL
og
(
'verse'
,
verse
)
this
.
verseLabel
.
text
=
verse
;
let
y
=
this
.
verseImg
.
y
engine
.
Tween
.
get
(
this
.
verseImg
)
.
to
({
alpha
:
0
},
3000
).
call
(()
=>
{
this
.
verseImg
.
visible
=
false
;
this
.
verseImg
.
alpha
=
1
this
.
_touchEnabled
=
true
;
})
};
/*采茶叶活动*/
//总量除以当前 小于3分之1 没有树叶 ,3分之1到3分之2一点点树叶 ,大于3分之2满树叶
setTeaNum
(
TeaNums
)
{
if
(
this
.
schedule
)
{
console
.
l
og
(
'清理定时器,重新设置同步'
)
showL
og
(
'清理定时器,重新设置同步'
)
clearInterval
(
this
.
schedule
);
}
let
totalNum
=
TeaNums
.
totalNum
;
let
nowNum
=
TeaNums
.
nowNum
;
let
nowNum
=
TeaNums
.
nowNum
+
1
this
.
pickTeaCount
.
text
=
nowNum
+
'/'
+
totalNum
;
this
.
getTeaPercentage
(
nowNum
,
totalNum
);
let
surplus
=
nowNum
-
totalNum
;
if
(
surplus
==
0
)
{
console
.
log
(
'达到最大长度'
);
this
.
progressbarImg
.
x
=
this
.
teaFullFlagImg
.
width
/
2
this
.
teaHalfFlagImg
.
visible
=
false
;
this
.
teaFullFlagImg
.
visible
=
!
this
.
teaHalfFlagImg
.
visible
this
.
addOneSvga
.
visible
=
!
this
.
teaHalfFlagImg
.
visible
this
.
addOneSvga
.
stop
();
return
;
}
console
.
log
(
'surplus'
,
surplus
);
let
width
=
this
.
progressbarImg
.
width
;
let
myDate
=
new
Date
();
let
nowData
=
myDate
.
getTime
();
let
serverData
=
TeaNums
.
serverData
;
//前后端本身的差值
let
fbdvalue
=
Math
.
abs
((
nowData
-
serverData
/
1000
))
let
fbdvalue
=
Math
.
abs
((
nowData
-
serverData
))
console
.
log
(
'fbdvalue'
,
fbdvalue
)
/**/
//设置数据校正
// let serverData = 0;
let
dataDiff
=
0
;
/**/
...
...
@@ -340,17 +341,20 @@ export default class GameView extends engine.Container {
//已经走得
let
x
=
-
width
*
(
1
-
nowNum
/
totalNum
)
console
.
log
(
'x'
,
x
);
this
.
progressbarImg
.
x
=
parseFloat
(
x
.
toFixed
(
3
));
console
.
log
(
'parseFloat(x.toFixed(3))'
,
parseFloat
(
x
.
toFixed
(
3
)))
this
.
progressbarImg
.
x
=
parseFloat
(
x
.
toFixed
(
3
))
+
this
.
teaFullFlagImg
.
width
/
2
-
Math
.
abs
(
this
.
teaFullFlagImg
.
x
)
//)//this.teaFullFlagImg.width - Math.abs(this.teaFullFlagImg.x)
console
.
log
(
'this.progressbarImg.x'
,
this
.
progressbarImg
.
x
)
let
step
=
(
width
-
(
width
-
Math
.
abs
(
this
.
progressbarImg
.
x
)))
/
surplus
console
.
log
(
'进图条每秒比例原始step'
,
step
)
step
=
parseFloat
(
step
.
toFixed
(
3
));
console
.
log
(
'进图条每秒比例step'
,
step
)
let
step
=
(
this
.
teaFullFlagImg
.
width
/
2
-
this
.
progressbarImg
.
x
)
/
surplus
console
.
log
(
'step'
,
step
)
//step = parseFloat(step.toFixed(6));
//console.log('进图条每秒比例step', step)
this
.
addOneSvga
.
play
(
1
,
true
);
let
speed
=
props
.
pickTeaSpeed
;
//this.progressbarImg.x += step;
let
teaFullRotation
=
engine
.
Tween
.
get
(
this
.
teaHalfFlagImg
,
{
loop
:
true
})
.
to
({
rotation
:
360
},
speed
).
call
(()
=>
{
this
.
teaHalfFlagImg
.
rotation
=
0
;
...
...
@@ -359,32 +363,33 @@ export default class GameView extends engine.Container {
if
(
nowNum
==
totalNum
)
{
console
.
log
(
'达到最大长度'
);
clearInterval
(
this
.
schedule
);
engine
.
Tween
.
paus
eTweens
(
teaFullRotation
);
this
.
progressbarImg
.
x
=
0
engine
.
Tween
.
remov
eTweens
(
teaFullRotation
);
this
.
progressbarImg
.
x
=
this
.
teaFullFlagImg
.
width
/
2
this
.
teaHalfFlagImg
.
visible
=
false
;
this
.
teaFullFlagImg
.
visible
=
!
this
.
teaHalfFlagImg
.
visible
this
.
addOneSvga
.
visible
=
!
this
.
teaHalfFlagImg
.
visible
this
.
addOneSvga
.
stop
();
}
if
(
this
.
progressbarImg
.
x
<=
-
2
)
{
console
.
log
(
'nowNum'
,
nowNum
,
'totalNum'
,
totalNum
)
this
.
getTeaPercentage
(
nowNum
,
totalNum
);
if
(
this
.
progressbarImg
.
x
<
this
.
teaFullFlagImg
.
width
/
2
+
step
)
{
this
.
progressbarImg
.
x
-=
step
;
}
this
.
getTeaPercentage
(
nowNum
,
totalNum
);
nowNum
++
;
dataDiff
++
;
dataDiff
+=
speed
;
myDate
=
new
Date
();
nowData
=
myDate
.
getTime
();
console
.
log
(
'nowData'
)
console
.
log
(
nowData
)
console
.
log
(
'nowData - serverData) / 1000 - dataDiff'
,
(
nowData
-
serverData
)
/
1000
-
(
fbdvalue
+
dataDiff
))
if
(
Math
.
abs
((
nowData
-
serverData
)
/
1000
)
-
dataDiff
>
(
fbdvalue
+
3
))
{
if
(
Math
.
abs
((
nowData
-
serverData
))
-
dataDiff
>
(
fbdvalue
+
3000
))
{
console
.
log
(
'校准数据前后数据偏差过大'
);
console
.
log
(
Math
.
abs
((
nowData
-
serverData
))
-
dataDiff
-
(
fbdvalue
+
3000
))
clearInterval
(
this
.
schedule
);
engine
.
Tween
.
paus
eTweens
(
teaFullRotation
);
engine
.
Tween
.
remov
eTweens
(
teaFullRotation
);
engine
.
globalEvent
.
dispatchEvent
(
'event-setchange-TeaNum'
);
this
.
addOneSvga
.
visible
=
false
;
this
.
addOneSvga
.
stop
();
return
;
}
console
.
log
(
'this.progressbarImg.x'
,
this
.
progressbarImg
.
x
)
},
speed
)
}
getTeaPercentage
(
nowNum
,
totalNum
)
{
...
...
@@ -399,7 +404,7 @@ export default class GameView extends engine.Container {
}
console
.
log
(
'teaPercentage'
,
teaPercentage
)
if
(
this
.
nowPercentage
!=
teaPercentage
)
{
console
.
l
og
(
'状态改变'
)
showL
og
(
'状态改变'
)
this
.
nowPercentage
=
teaPercentage
;
this
.
updateTeaPercentage
(
teaPercentage
);
}
...
...
@@ -407,11 +412,11 @@ export default class GameView extends engine.Container {
//需要更换茶叶数量皮肤
updateTeaPercentage
(
teaPercentage
=
0
)
{
console
.
l
og
(
'需要更换茶叶数量皮肤'
)
console
.
l
og
(
'延迟500ms'
)
showL
og
(
'需要更换茶叶数量皮肤'
)
showL
og
(
'延迟500ms'
)
let
pickTeaSVGA
=
this
.
basketSvgaGroup
[
1
];
console
.
l
og
(
'pickTeaSVGA'
)
console
.
l
og
(
pickTeaSVGA
)
showL
og
(
'pickTeaSVGA'
)
showL
og
(
pickTeaSVGA
)
pickTeaSVGA
.
removeChildAt
(
10
);
let
originframes
=
pickTeaSVGA
.
children
[
7
];
if
(
!
originframes
)
{
...
...
@@ -429,20 +434,20 @@ export default class GameView extends engine.Container {
this
.
teaHalfImg
.
visible
=
false
;
this
.
teaHalfImg
[
'frames'
]
=
teaBucketframes
;
console
.
l
og
(
'this.teaHalfImg'
);
console
.
l
og
(
this
.
teaHalfImg
);
//showL
og('this.teaHalfImg');
//showL
og(this.teaHalfImg);
pickTeaSVGA
.
addChildAt
(
this
.
teaHalfImg
,
10
)
}
setPickTeaLevel
(
level
)
{
console
.
l
og
(
'setPickTeaLevel'
,
level
);
showL
og
(
'setPickTeaLevel'
,
level
);
let
pickTeaSVGA
=
this
.
basketSvgaGroup
[
level
];
pickTeaSVGA
.
visible
=
true
;
//
console.l
og('littleTea url')
//
console.l
og(this.teaHalfImg['_source'])
//
showL
og('littleTea url')
//
showL
og(this.teaHalfImg['_source'])
//需要svga缓存结束
setTimeout
(()
=>
{
console
.
l
og
(
'延迟500ms'
)
showL
og
(
'延迟500ms'
)
let
originframes
=
pickTeaSVGA
.
children
[
7
];
//按照采茶叶的多少来 设置茶叶是不是满的图片
let
teaBucketframes
=
JSON
.
parse
(
JSON
.
stringify
(
originframes
.
frames
));
...
...
@@ -451,41 +456,45 @@ export default class GameView extends engine.Container {
//this.teaHalfImg.source = ''
this
.
teaHalfImg
[
'frames'
]
=
teaBucketframes
;
}
console
.
l
og
(
'this.teaHalfImg'
);
console
.
l
og
(
this
.
teaHalfImg
);
showL
og
(
'this.teaHalfImg'
);
showL
og
(
this
.
teaHalfImg
);
pickTeaSVGA
.
addChildAt
(
this
.
teaHalfImg
,
10
)
pickTeaSVGA
.
gotoAndPlay
(
1
,
true
);
},
300
)
}
handGrasp
()
{
console
.
l
og
(
'handGrasp'
)
showL
og
(
'handGrasp'
)
let
that
=
this
;
setTimeout
(()
=>
{
that
.
handGraspSvga
.
play
(
1
,
true
);
//
that.handGraspSvga.play(1, true);
// this.pickTeaSvga.play(1, false);
// this.teaSkyUpSvga.play(1, false);
//console.log('手指移动')
engine
.
Tween
.
get
(
that
.
handGraspSvga
)
.
to
({
x
:
props
.
handGraspMovePos
[
0
],
y
:
props
.
handGraspMovePos
[
1
]
},
600
).
call
(()
=>
{
that
.
handGraspSvga
.
x
=
props
.
handGraspSvgaPos
[
0
];
that
.
handGraspSvga
.
y
=
props
.
handGraspSvgaPos
[
1
];
//console.log('this.pickTeaSvga.play')
//setTimeout(() => {
.
to
({
x
:
props
.
handGraspMovePos
[
0
],
y
:
props
.
handGraspMovePos
[
1
]
},
400
).
call
(()
=>
{
showLog
(
'this.pickTeaSvga.play'
)
that
.
handGraspSvga
.
play
(
1
,
true
);
setTimeout
(()
=>
{
that
.
handGraspSvga
.
stop
()
that
.
handGraspSvga
.
x
=
props
.
handGraspSvgaPos
[
0
];
that
.
handGraspSvga
.
y
=
props
.
handGraspSvgaPos
[
1
];
},
600
)
that
.
pickTeaSvga
.
visible
=
true
that
.
pickTeaSvga
.
play
(
1
,
false
);
})
that
.
pickTeaSvga
.
addEventListener
(
engine
.
Event
.
END_FRAME
,
function
()
{
//console.l
og('this.teaSkyUpSvga.play')
showL
og
(
'this.teaSkyUpSvga.play'
)
that
.
teaSkyUpSvga
.
visible
=
true
that
.
teaSkyUpSvga
.
play
(
1
,
false
);
})
that
.
teaSkyUpSvga
.
addEventListener
(
engine
.
Event
.
END_FRAME
,
function
()
{
that
.
teaSkyUpSvga
.
visible
=
false
;
that
.
updateTeaPercentage
(
0
);
})
},
500
);
}
/*采茶叶活动*/
}
src/custom/pick-tea/src/game/GameWrapper.ts
View file @
57aa8bf6
...
...
@@ -32,12 +32,12 @@ export class GameWrapper extends engine.Container {
engine
.
globalEvent
.
addEventListener
(
'event-pickTeaGame-init'
,
this
.
reset
,
this
);
engine
.
globalEvent
.
addEventListener
(
'event-hand-grasp'
,
this
.
handGrasp
,
this
);
engine
.
globalEvent
.
addEventListener
(
'event-getClick-person'
,
this
.
clickPerson
,
this
);
engine
.
globalEvent
.
addEventListener
(
'event-getchange-TeaNum'
,
this
.
setTeaNum
,
this
);
engine
.
globalEvent
.
addEventListener
(
'event-getBasket-Type'
,
this
.
setPickTeaLevel
,
this
);
let
gameView
=
this
.
_gameView
=
new
GameView
();
this
.
addChild
(
gameView
);
}
...
...
@@ -53,7 +53,14 @@ export class GameWrapper extends engine.Container {
injectProps
(
event
.
data
);
this
.
_gameView
.
setPickTeaLevel
(
event
.
data
);
}
handGrasp
()
{
this
.
_gameView
.
handGrasp
();
}
//点击人物
clickPerson
()
{
this
.
_gameView
.
showVerse
();
}
reset
(
event
:
engine
.
Event
)
{
injectProps
(
event
.
data
);
this
.
_gameView
.
visible
=
true
;
...
...
@@ -83,9 +90,6 @@ export class GameWrapper extends engine.Container {
this
.
_gameView
.
visible
=
false
;
}
handGrasp
()
{
this
.
_gameView
.
handGrasp
();
}
...
...
src/custom/pick-tea/src/game/utils.ts
View file @
57aa8bf6
/**
* Created by rockyl on 2020-01-21.
*/
const
showlog
=
false
;
export
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
...
...
@@ -11,10 +11,20 @@ export function getTextureByName(name) {
}
export
function
playSound
(
name
)
{
engine
.
playSound
(
engine
.
getAssetByName
(
name
).
uuid
,
{
keep
:
true
});
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
;
}
export
function
showLog
(
abjname
,
obj
?)
{
if
(
showlog
)
{
console
.
log
(
abjname
)
if
(
obj
)
console
.
log
(
obj
)
}
// let inst = new svga.Svga();
// inst.source = 'asset://' + engine.getAssetByName(name).uuid;
// return inst;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment