Commit 7ee77b47 authored by 13732208043's avatar 13732208043

最新代码

parent 140f0a58
This diff is collapsed.
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
function injectProps(p) { function injectProps(p) {
engine.injectProp(props, p); engine.injectProp(props, p);
} }
//# sourceMappingURL=props.js.map
function getTexture(uuid) { function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid); return engine.Texture.from(getAssetByUUID(uuid).uuid);
...@@ -20,6 +19,9 @@ ...@@ -20,6 +19,9 @@
function getTextureByName(name) { function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid); return getTexture(engine.getAssetByName(name).uuid);
} }
function playSound(name) {
engine.playSound(engine.getAssetByName(name).uuid, { keep: true });
}
function createSvga(name, anchorName) { function createSvga(name, anchorName) {
var inst = new svga.Svga(); var inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid; inst.source = 'asset://' + engine.getAssetByName(name).uuid;
...@@ -27,7 +29,6 @@ ...@@ -27,7 +29,6 @@
} }
function showLog(abjname, obj) { function showLog(abjname, obj) {
} }
//# sourceMappingURL=utils.js.map
var GameView = (function (_super) { var GameView = (function (_super) {
tslib.__extends(GameView, _super); tslib.__extends(GameView, _super);
...@@ -45,6 +46,7 @@ ...@@ -45,6 +46,7 @@
} }
this._hasSetup = true; this._hasSetup = true;
this.pickTeaBg = new engine.Container(); this.pickTeaBg = new engine.Container();
this.basketLevel = null;
this.addChild(this.pickTeaBg); this.addChild(this.pickTeaBg);
this.teaHalfImg = new engine.Image(); this.teaHalfImg = new engine.Image();
this.paperBasketSvga = createSvga("采茶童-纸篮子"); this.paperBasketSvga = createSvga("采茶童-纸篮子");
...@@ -68,6 +70,7 @@ ...@@ -68,6 +70,7 @@
this.teaHalfFlagImg = new engine.Image(getTextureByName('茶叶进度缺')); this.teaHalfFlagImg = new engine.Image(getTextureByName('茶叶进度缺'));
this.teaFullFlagImg = new engine.Image(getTextureByName('茶叶进度满')); this.teaFullFlagImg = new engine.Image(getTextureByName('茶叶进度满'));
this.teaStarImg = new engine.Image(getTextureByName('小茶叶')); this.teaStarImg = new engine.Image(getTextureByName('小茶叶'));
this.handGraspBgImg = new engine.Image(getTextureByName('茶叶收取底图'));
this.verseImg = new engine.Image(getTextureByName('气泡框')); this.verseImg = new engine.Image(getTextureByName('气泡框'));
this.pickTeaBg.addChild(this.verseImg); this.pickTeaBg.addChild(this.verseImg);
var mask = new engine.Rect(); var mask = new engine.Rect();
...@@ -82,7 +85,8 @@ ...@@ -82,7 +85,8 @@
this.progressbarBgImg.addChild(this.progressbarImg); this.progressbarBgImg.addChild(this.progressbarImg);
this.progressbarBgImg.addChild(mask); this.progressbarBgImg.addChild(mask);
this.progressbarBgImg.addChild(this.addOneSvga); this.progressbarBgImg.addChild(this.addOneSvga);
this.progressbarBgImg.addChild(this.handGraspSvga); this.progressbarBgImg.addChild(this.handGraspBgImg);
this.handGraspBgImg.addChild(this.handGraspSvga);
this.progressbarBgImg.addChild(this.teaHalfFlagImg); this.progressbarBgImg.addChild(this.teaHalfFlagImg);
this.progressbarBgImg.addChild(this.teaFullFlagImg); this.progressbarBgImg.addChild(this.teaFullFlagImg);
this.progressbarBgImg.addChild(this.teaStarImg); this.progressbarBgImg.addChild(this.teaStarImg);
...@@ -121,6 +125,8 @@ ...@@ -121,6 +125,8 @@
this.basketSvgaGroup[i].x = props.basketSvgaPos[0]; this.basketSvgaGroup[i].x = props.basketSvgaPos[0];
this.basketSvgaGroup[i].y = props.basketSvgaPos[1]; this.basketSvgaGroup[i].y = props.basketSvgaPos[1];
} }
var pickTeaSVGA = this.basketSvgaGroup[0];
this.allFrames = pickTeaSVGA.children.length;
this.verseImg.x = props.versePos[0]; this.verseImg.x = props.versePos[0];
this.verseImg.y = props.versePos[1]; this.verseImg.y = props.versePos[1];
this.addOneSvga.x = props.addOneSvgaPos[0]; this.addOneSvga.x = props.addOneSvgaPos[0];
...@@ -131,6 +137,8 @@ ...@@ -131,6 +137,8 @@
this.teaSkyUpSvga.y = props.teaSkyUpSvgaPos[1]; this.teaSkyUpSvga.y = props.teaSkyUpSvgaPos[1];
this.handGraspSvga.x = props.handGraspSvgaPos[0]; this.handGraspSvga.x = props.handGraspSvgaPos[0];
this.handGraspSvga.y = props.handGraspSvgaPos[1]; this.handGraspSvga.y = props.handGraspSvgaPos[1];
this.handGraspBgImg.x = props.handGraspBgImgPos[0];
this.handGraspBgImg.y = props.handGraspBgImgPos[1];
this.progressbarBgImg.x = props.progressbarBgImgPos[0]; this.progressbarBgImg.x = props.progressbarBgImgPos[0];
this.progressbarBgImg.y = props.progressbarBgImgPos[1]; this.progressbarBgImg.y = props.progressbarBgImgPos[1];
this.progressbarImg.x = props.progressbarImgPos[0]; this.progressbarImg.x = props.progressbarImgPos[0];
...@@ -220,13 +228,18 @@ ...@@ -220,13 +228,18 @@
_this.teaHalfFlagImg.rotation = 0; _this.teaHalfFlagImg.rotation = 0;
}); });
} }
this.teaHalfFlagImg.visible = true;
this.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible;
this.addOneSvga.visible = this.teaHalfFlagImg.visible;
engine.Tween.resumeTweens(this.teaFullRotation); engine.Tween.resumeTweens(this.teaFullRotation);
this.schedule = setInterval(function () { this.schedule = setInterval(function () {
nowNum++; nowNum++;
_this.addOneSvga.play(1, true); _this.addOneSvga.play(1, true);
if (nowNum == totalNum) { if (nowNum == totalNum) {
_this.gotoMaxLength(); _this.gotoMaxLength();
_this.getTeaPercentage(nowNum, totalNum);
engine.Tween.pauseTweens(_this.teaFullRotation); engine.Tween.pauseTweens(_this.teaFullRotation);
return;
} }
if (_this.progressbarImg.x < _this.teaFullFlagImg.width / 2) { if (_this.progressbarImg.x < _this.teaFullFlagImg.width / 2) {
_this.progressbarImg.x -= step; _this.progressbarImg.x -= step;
...@@ -276,7 +289,11 @@ ...@@ -276,7 +289,11 @@
}; };
GameView.prototype.updateTeaPercentage = function (teaPercentage) { GameView.prototype.updateTeaPercentage = function (teaPercentage) {
if (teaPercentage === void 0) { teaPercentage = 0; } if (teaPercentage === void 0) { teaPercentage = 0; }
var pickTeaSVGA = this.basketSvgaGroup[1]; if (!this.basketLevel)
this.basketLevel = 0;
var pickTeaSVGA = this.basketSvgaGroup[this.basketLevel];
var templength = pickTeaSVGA.children.length;
if (this.allFrames < templength)
pickTeaSVGA.removeChildAt(10); pickTeaSVGA.removeChildAt(10);
var originframes = pickTeaSVGA.children[7]; var originframes = pickTeaSVGA.children[7];
if (!originframes) { if (!originframes) {
...@@ -295,10 +312,13 @@ ...@@ -295,10 +312,13 @@
}; };
GameView.prototype.setPickTeaLevel = function (level) { GameView.prototype.setPickTeaLevel = function (level) {
var _this = this; var _this = this;
this.basketLevel = level;
var pickTeaSVGA = this.basketSvgaGroup[level]; var pickTeaSVGA = this.basketSvgaGroup[level];
pickTeaSVGA.visible = true; pickTeaSVGA.visible = true;
console.log('总共有多少', pickTeaSVGA.children.length);
setTimeout(function () { setTimeout(function () {
var originframes = pickTeaSVGA.children[7]; var originframes = pickTeaSVGA.children[7];
_this.teaHalfImg.visible = true;
var teaBucketframes = JSON.parse(JSON.stringify(originframes.frames)); var teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));
if (_this.teaHalfImg) { if (_this.teaHalfImg) {
_this.teaHalfImg['frames'] = teaBucketframes; _this.teaHalfImg['frames'] = teaBucketframes;
...@@ -310,6 +330,7 @@ ...@@ -310,6 +330,7 @@
}; };
GameView.prototype.handGrasp = function () { GameView.prototype.handGrasp = function () {
var that = this; var that = this;
this.updateTeaPercentage(0);
setTimeout(function () { setTimeout(function () {
engine.Tween.get(that.handGraspSvga) engine.Tween.get(that.handGraspSvga)
.to({ x: props.handGraspMovePos[0], y: props.handGraspMovePos[1] }, 400).call(function () { .to({ x: props.handGraspMovePos[0], y: props.handGraspMovePos[1] }, 400).call(function () {
...@@ -320,21 +341,23 @@ ...@@ -320,21 +341,23 @@
that.handGraspSvga.y = props.handGraspSvgaPos[1]; that.handGraspSvga.y = props.handGraspSvgaPos[1];
}, 600); }, 600);
that.pickTeaSvga.visible = true; that.pickTeaSvga.visible = true;
playSound('采茶叶');
that.teaHalfImg.source = '';
that.pickTeaSvga.play(1, false); that.pickTeaSvga.play(1, false);
}); });
that.pickTeaSvga.addEventListener(engine.Event.END_FRAME, function () { that.pickTeaSvga.addEventListener(engine.Event.END_FRAME, function () {
that.teaSkyUpSvga.visible = true; that.teaSkyUpSvga.visible = true;
playSound('茶叶飞起');
that.teaSkyUpSvga.play(1, false); that.teaSkyUpSvga.play(1, false);
}); });
that.teaSkyUpSvga.addEventListener(engine.Event.END_FRAME, function () { that.teaSkyUpSvga.addEventListener(engine.Event.END_FRAME, function () {
that.teaSkyUpSvga.visible = false; that.teaSkyUpSvga.visible = false;
that.updateTeaPercentage(0); console.log('茶叶初始化');
}); });
}, 500); }, 500);
}; };
return GameView; return GameView;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) { var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super); tslib.__extends(GameWrapper, _super);
...@@ -389,7 +412,6 @@ ...@@ -389,7 +412,6 @@
}; };
return GameWrapper; return GameWrapper;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=GameWrapper.js.map
function index (props) { function index (props) {
prepareProps(); prepareProps();
...@@ -397,7 +419,6 @@ ...@@ -397,7 +419,6 @@
var instance = new GameWrapper(); var instance = new GameWrapper();
return instance; return instance;
} }
//# sourceMappingURL=index.js.map
return index; return index;
......
This diff is collapsed.
...@@ -22,11 +22,17 @@ ...@@ -22,11 +22,17 @@
"type": "array<string>", "type": "array<string>",
"default": "#33628b,#99b1c5" "default": "#33628b,#99b1c5"
}, },
"showFrontImg": { "showFrontImg": {
"alias": "茶叶前景图1显示2隐藏", "alias": "茶叶前景图1显示2隐藏",
"type": "number", "type": "number",
"default": "1" "default": "1"
}, },
"handGraspBgImgPos": {
"alias": "茶叶收取底图位置",
"type": "array<number>",
"default": "459,-41"
},
"FrontImgPos": { "FrontImgPos": {
"alias": "茶叶前景图位置", "alias": "茶叶前景图位置",
"type": "array<number>", "type": "array<number>",
...@@ -60,12 +66,12 @@ ...@@ -60,12 +66,12 @@
"handGraspSvgaPos": { "handGraspSvgaPos": {
"alias": "手点击SVGA的位置", "alias": "手点击SVGA的位置",
"type": "array<number>", "type": "array<number>",
"default": "477,-29" "default": "10,12"
}, },
"handGraspMovePos": { "handGraspMovePos": {
"alias": "手点击移动的位置", "alias": "手点击移动的位置",
"type": "array<number>", "type": "array<number>",
"default": "372,-145" "default": "-85,-65"
}, },
"progressbarBgImgPos": { "progressbarBgImgPos": {
"alias": "进度条底图的位置", "alias": "进度条底图的位置",
...@@ -94,6 +100,13 @@ ...@@ -94,6 +100,13 @@
} }
}, },
"assets": [ "assets": [
{
"name": "茶叶收取底图",
"url": "//yun.duiba.com.cn/aurora/assets/8d85ca90a60ff9f2c0923c760539586ebcc75ffc.png",
"uuid": "0b0c3f22-f625-4944-b46b-250c9c9e3da2",
"ext": ".png"
},
{ {
"name": "前景", "name": "前景",
"url": "//yun.duiba.com.cn/aurora/assets/1da0ea14267ff35f90f49c22deb1b34181571e90.png", "url": "//yun.duiba.com.cn/aurora/assets/1da0ea14267ff35f90f49c22deb1b34181571e90.png",
...@@ -201,6 +214,18 @@ ...@@ -201,6 +214,18 @@
"url": "//yun.duiba.com.cn/aurora/assets/6b774da91be08d1c9f773d88ace4927c3c5de583.svga", "url": "//yun.duiba.com.cn/aurora/assets/6b774da91be08d1c9f773d88ace4927c3c5de583.svga",
"uuid": "f1e7a7cf-95c7-4c91-a30b-935e31ea0084", "uuid": "f1e7a7cf-95c7-4c91-a30b-935e31ea0084",
"ext": ".svga" "ext": ".svga"
},
{
"name": "采茶叶",
"url": "//yun.duiba.com.cn/aurora/assets/989fd73d25c68d8b1ddf174232bb329159b170f1.mp3",
"uuid": "ca5c194f-1ddb-4ad3-8bc9-9170ab890e92",
"ext": ".mp3"
},
{
"name": "茶叶飞起",
"url": "//yun.duiba.com.cn/aurora/assets/74f2de0b645bd6b8a4f87e2e0cc44c7e36efa9c6.mp3",
"uuid": "fb513ed3-a0ab-4791-8845-a2f23e95032e",
"ext": ".mp3"
} }
], ],
"events": { "events": {
......
...@@ -27,6 +27,7 @@ export default class GameView extends engine.Container { ...@@ -27,6 +27,7 @@ export default class GameView extends engine.Container {
private teaStarImg: engine.Image; private teaStarImg: engine.Image;
private frontImg: engine.Image; private frontImg: engine.Image;
private verseImg: engine.Image; private verseImg: engine.Image;
private handGraspBgImg: engine.Image;
//采茶背景层 //采茶背景层
private pickTeaBg: engine.Container; private pickTeaBg: engine.Container;
//采茶进度计时器 //采茶进度计时器
...@@ -38,6 +39,7 @@ export default class GameView extends engine.Container { ...@@ -38,6 +39,7 @@ export default class GameView extends engine.Container {
//篮子集合 //篮子集合
private basketSvgaGroup: any; private basketSvgaGroup: any;
private basketLevel: any;
//纸篮子svga //纸篮子svga
private paperBasketSvga private paperBasketSvga
//布篮子svga //布篮子svga
...@@ -57,7 +59,7 @@ export default class GameView extends engine.Container { ...@@ -57,7 +59,7 @@ export default class GameView extends engine.Container {
//半缺旋转 //半缺旋转
private teaFullRotation private teaFullRotation
private allFrames;
/**采茶叶自定义模块*/ /**采茶叶自定义模块*/
//玩家 //玩家
...@@ -101,7 +103,7 @@ export default class GameView extends engine.Container { ...@@ -101,7 +103,7 @@ export default class GameView extends engine.Container {
} }
this._hasSetup = true; this._hasSetup = true;
this.pickTeaBg = new engine.Container(); this.pickTeaBg = new engine.Container();
this.basketLevel = null;
// let bgGroud = new engine.Image() // let bgGroud = new engine.Image()
// bgGroud.source = '//yun.duiba.com.cn/aurora/assets/a988c47db8d3131faad175c7c2944773392be643.png' // bgGroud.source = '//yun.duiba.com.cn/aurora/assets/a988c47db8d3131faad175c7c2944773392be643.png'
// this.addChild(bgGroud); // this.addChild(bgGroud);
...@@ -137,7 +139,7 @@ export default class GameView extends engine.Container { ...@@ -137,7 +139,7 @@ export default class GameView extends engine.Container {
this.teaFullFlagImg = new engine.Image(getTextureByName('茶叶进度满')); this.teaFullFlagImg = new engine.Image(getTextureByName('茶叶进度满'));
this.teaStarImg = new engine.Image(getTextureByName('小茶叶')); this.teaStarImg = new engine.Image(getTextureByName('小茶叶'));
this.handGraspBgImg = new engine.Image(getTextureByName('茶叶收取底图'));
this.verseImg = new engine.Image(getTextureByName('气泡框')); this.verseImg = new engine.Image(getTextureByName('气泡框'));
this.pickTeaBg.addChild(this.verseImg); this.pickTeaBg.addChild(this.verseImg);
...@@ -160,7 +162,10 @@ export default class GameView extends engine.Container { ...@@ -160,7 +162,10 @@ export default class GameView extends engine.Container {
showLog('遮罩坐标') showLog('遮罩坐标')
showLog(mask.x, mask.y) showLog(mask.x, mask.y)
this.progressbarBgImg.addChild(this.addOneSvga); this.progressbarBgImg.addChild(this.addOneSvga);
this.progressbarBgImg.addChild(this.handGraspSvga);
this.progressbarBgImg.addChild(this.handGraspBgImg);
this.handGraspBgImg.addChild(this.handGraspSvga);
this.progressbarBgImg.addChild(this.teaHalfFlagImg); this.progressbarBgImg.addChild(this.teaHalfFlagImg);
this.progressbarBgImg.addChild(this.teaFullFlagImg); this.progressbarBgImg.addChild(this.teaFullFlagImg);
...@@ -169,16 +174,20 @@ export default class GameView extends engine.Container { ...@@ -169,16 +174,20 @@ export default class GameView extends engine.Container {
this.progressbarBgImg.addChild(this.pickTeaCount); this.progressbarBgImg.addChild(this.pickTeaCount);
this.addChild(this.progressbarBgImg); this.addChild(this.progressbarBgImg);
// let myDate = new Date();
// let nowData = myDate.getTime();
//this.setTeaNum({ totalNum: 430, nowNum: 425, serverData: 1585290768011 })
this.initView(); this.initView();
// setTimeout(() => { // setTimeout(() => {
// this.setTeaNum({ totalNum: 100, nowNum: 0, serverData: 1585290768011 }) // this.setPickTeaLevel(1)
// this.setTeaNum({ totalNum: 10, nowNum: 0, serverData: 1585290768011 })
// //this.setTeaNum({ totalNum: 100, nowNum: 0 }) // //this.setTeaNum({ totalNum: 100, nowNum: 0 })
// }, 500) // }, 500)
// setTimeout(() => {
// this.handGrasp();
// this.setTeaNum({ totalNum: 10, nowNum: 0, serverData: 1585290768011 })
// }, 12000)
//playSound('采茶叶');
} }
reset() { reset() {
...@@ -216,6 +225,11 @@ export default class GameView extends engine.Container { ...@@ -216,6 +225,11 @@ export default class GameView extends engine.Container {
this.basketSvgaGroup[i].y = props.basketSvgaPos[1];; 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);
} }
let pickTeaSVGA = this.basketSvgaGroup[0];
//console.log('总共有多少',pickTeaSVGA.children.length)
this.allFrames = pickTeaSVGA.children.length;
this.verseImg.x = props.versePos[0] this.verseImg.x = props.versePos[0]
this.verseImg.y = props.versePos[1] this.verseImg.y = props.versePos[1]
this.addOneSvga.x = props.addOneSvgaPos[0] this.addOneSvga.x = props.addOneSvgaPos[0]
...@@ -229,6 +243,9 @@ export default class GameView extends engine.Container { ...@@ -229,6 +243,9 @@ export default class GameView extends engine.Container {
this.handGraspSvga.x = props.handGraspSvgaPos[0]; this.handGraspSvga.x = props.handGraspSvgaPos[0];
this.handGraspSvga.y = props.handGraspSvgaPos[1]; this.handGraspSvga.y = props.handGraspSvgaPos[1];
this.handGraspBgImg.x = props.handGraspBgImgPos[0];
this.handGraspBgImg.y = props.handGraspBgImgPos[1];
this.progressbarBgImg.x = props.progressbarBgImgPos[0] this.progressbarBgImg.x = props.progressbarBgImgPos[0]
this.progressbarBgImg.y = props.progressbarBgImgPos[1] this.progressbarBgImg.y = props.progressbarBgImgPos[1]
...@@ -363,6 +380,10 @@ export default class GameView extends engine.Container { ...@@ -363,6 +380,10 @@ export default class GameView extends engine.Container {
this.teaHalfFlagImg.rotation = 0; this.teaHalfFlagImg.rotation = 0;
}) })
} }
this.teaHalfFlagImg.visible = true;
this.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible
this.addOneSvga.visible = this.teaHalfFlagImg.visible
engine.Tween.resumeTweens(this.teaFullRotation); engine.Tween.resumeTweens(this.teaFullRotation);
this.schedule = setInterval(() => { this.schedule = setInterval(() => {
//showLog('nowNum', nowNum, 'totalNum', totalNum) //showLog('nowNum', nowNum, 'totalNum', totalNum)
...@@ -370,7 +391,10 @@ export default class GameView extends engine.Container { ...@@ -370,7 +391,10 @@ export default class GameView extends engine.Container {
this.addOneSvga.play(1, true); this.addOneSvga.play(1, true);
if (nowNum == totalNum) { if (nowNum == totalNum) {
this.gotoMaxLength(); this.gotoMaxLength();
this.getTeaPercentage(nowNum, totalNum);
engine.Tween.pauseTweens(this.teaFullRotation); engine.Tween.pauseTweens(this.teaFullRotation);
//this.setTeaNum({ totalNum: 100, nowNum: 0, serverData: 1585290768011 });
return;
} }
if (this.progressbarImg.x < this.teaFullFlagImg.width / 2) { if (this.progressbarImg.x < this.teaFullFlagImg.width / 2) {
this.progressbarImg.x -= step; this.progressbarImg.x -= step;
...@@ -426,11 +450,14 @@ export default class GameView extends engine.Container { ...@@ -426,11 +450,14 @@ export default class GameView extends engine.Container {
} }
//需要更换茶叶数量皮肤 //需要更换茶叶数量皮肤
updateTeaPercentage(teaPercentage = 0) { updateTeaPercentage(teaPercentage = 0) {
showLog('需要更换茶叶数量皮肤') // console.log('需要更换茶叶数量皮肤')
showLog('延迟500ms') // console.log('this.basketLevel', this.basketLevel)
let pickTeaSVGA = this.basketSvgaGroup[1]; if (!this.basketLevel)
showLog('pickTeaSVGA') this.basketLevel = 0;
showLog(pickTeaSVGA) let pickTeaSVGA = this.basketSvgaGroup[this.basketLevel];
let templength = pickTeaSVGA.children.length;
//console.log('templength',templength)
if (this.allFrames < templength)
pickTeaSVGA.removeChildAt(10); pickTeaSVGA.removeChildAt(10);
let originframes = pickTeaSVGA.children[7]; let originframes = pickTeaSVGA.children[7];
if (!originframes) { if (!originframes) {
...@@ -439,6 +466,7 @@ export default class GameView extends engine.Container { ...@@ -439,6 +466,7 @@ export default class GameView extends engine.Container {
//按照采茶叶的多少来 设置茶叶是不是满的图片 //按照采茶叶的多少来 设置茶叶是不是满的图片
let teaBucketframes = JSON.parse(JSON.stringify(originframes.frames)); let teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));
//let teaNumImg = this.teaHalfImg; //let teaNumImg = this.teaHalfImg;
if (teaPercentage == 1) { if (teaPercentage == 1) {
this.teaHalfImg = new engine.Image(getTextureByName('茶叶-少')); this.teaHalfImg = new engine.Image(getTextureByName('茶叶-少'));
} }
...@@ -455,15 +483,19 @@ export default class GameView extends engine.Container { ...@@ -455,15 +483,19 @@ export default class GameView extends engine.Container {
setPickTeaLevel(level) { setPickTeaLevel(level) {
showLog('setPickTeaLevel', level); showLog('setPickTeaLevel', level);
this.basketLevel = level;
let pickTeaSVGA = this.basketSvgaGroup[level]; let pickTeaSVGA = this.basketSvgaGroup[level];
pickTeaSVGA.visible = true; pickTeaSVGA.visible = true;
console.log('总共有多少', pickTeaSVGA.children.length)
//showLog('littleTea url') //showLog('littleTea url')
//showLog(this.teaHalfImg['_source']) //showLog(this.teaHalfImg['_source'])
//需要svga缓存结束 //需要svga缓存结束
setTimeout(() => { setTimeout(() => {
showLog('延迟500ms') showLog('延迟500ms')
let originframes = pickTeaSVGA.children[7]; let originframes = pickTeaSVGA.children[7];
//按照采茶叶的多少来 设置茶叶是不是满的图片 //按照采茶叶的多少来 设置茶叶是不是满的图片
this.teaHalfImg.visible = true;
let teaBucketframes = JSON.parse(JSON.stringify(originframes.frames)); let teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));
//this.teaHalfImg = //new engine.Image(getTextureByName('茶叶-少')); //this.teaHalfImg = //new engine.Image(getTextureByName('茶叶-少'));
if (this.teaHalfImg) { if (this.teaHalfImg) {
...@@ -479,6 +511,7 @@ export default class GameView extends engine.Container { ...@@ -479,6 +511,7 @@ export default class GameView extends engine.Container {
handGrasp() { handGrasp() {
showLog('handGrasp') showLog('handGrasp')
let that = this; let that = this;
this.updateTeaPercentage(0);
setTimeout(() => { setTimeout(() => {
//that.handGraspSvga.play(1, true); //that.handGraspSvga.play(1, true);
// this.pickTeaSvga.play(1, false); // this.pickTeaSvga.play(1, false);
...@@ -493,20 +526,24 @@ export default class GameView extends engine.Container { ...@@ -493,20 +526,24 @@ export default class GameView extends engine.Container {
that.handGraspSvga.y = props.handGraspSvgaPos[1]; that.handGraspSvga.y = props.handGraspSvgaPos[1];
}, 600) }, 600)
that.pickTeaSvga.visible = true that.pickTeaSvga.visible = true
playSound('采茶叶');
that.teaHalfImg.source = ''
that.pickTeaSvga.play(1, false); that.pickTeaSvga.play(1, false);
}) })
that.pickTeaSvga.addEventListener(engine.Event.END_FRAME, function () { that.pickTeaSvga.addEventListener(engine.Event.END_FRAME, function () {
showLog('this.teaSkyUpSvga.play') showLog('this.teaSkyUpSvga.play')
that.teaSkyUpSvga.visible = true that.teaSkyUpSvga.visible = true
playSound('茶叶飞起');
that.teaSkyUpSvga.play(1, false); that.teaSkyUpSvga.play(1, false);
}) })
that.teaSkyUpSvga.addEventListener(engine.Event.END_FRAME, function () { that.teaSkyUpSvga.addEventListener(engine.Event.END_FRAME, function () {
that.teaSkyUpSvga.visible = false; that.teaSkyUpSvga.visible = false;
that.updateTeaPercentage(0); //that.updateTeaPercentage(0)
console.log('茶叶初始化')
}) })
}, 500); }, 500);
} }
......
...@@ -11,6 +11,7 @@ export function getTextureByName(name) { ...@@ -11,6 +11,7 @@ export function getTextureByName(name) {
} }
export function playSound(name) { export function playSound(name) {
//console.log('playSound', name)
engine.playSound(engine.getAssetByName(name).uuid, { keep: true }); engine.playSound(engine.getAssetByName(name).uuid, { keep: true });
} }
export function createSvga(name, anchorName?) { export function createSvga(name, anchorName?) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment