Commit a4973078 authored by 任建锋's avatar 任建锋

--

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