Commit af3ba169 authored by 13732208043's avatar 13732208043

ddddd

parent f0684238
/**
* Created by renjianfeng on 2020-03-13.
*/
const customId = 'pick-tea';
(async function () {
let customModule = await fetch(`../meta.json`);
customModule = await customModule.json();
console.log(customModule);
await loadAssets(customModule.assets);
launchWithCustomModule(customModule);
})();
function launchWithCustomModule(customModule) {
//engine.registerCustomCodeModule(customModule);
engine.registerCustomModule(customId, window[customId]);
const { props: propsOption, assets } = customModule;
let props = engine.computeProps(customModuleProps, propsOption);
const customModuleIns = {
id: customId,
props,
assets,
};
engine.registerCustomModules([customModuleIns]);
engine.launchWithConfig({
options: {
entrySceneView: 'entry',
},
assets: [],
views: [{
name: 'entry',
type: 'node',
properties: {
x: 0,
y: 0,
}
}],
}, null, function () {
setTimeout(() => {
engine.addCustomModule(customId, engine.gameStage.sceneContainer.getChildAt(0));
}, 100);
//先抛出初始化消息
setTimeout(() => {
engine.globalEvent.dispatchEvent('event-pickTeaGame-init');
//获得引用端的篮子类型event-setBasket-Type event-setchange-TeaNum
engine.globalEvent.dispatchEvent('event-setBasket-Type');
engine.globalEvent.dispatchEvent('event-setchange-TeaNum');
}, 500);
});
// +1显示
engine.globalEvent.addEventListener('event-add-oneScore', (e) => {
console.log(e.type, e.data);
});
// 收集茶叶
engine.globalEvent.addEventListener('event-pick-tea', (e) => {
console.log(e.type, e.data);
});
// 茶叶散开
engine.globalEvent.addEventListener('event-tea-skyup', (e) => {
console.log(e.type, e.data);
});
// 茶叶上升
engine.globalEvent.addEventListener('event-hand-grasp', (e) => {
console.log(e.type, e.data);
});
// 改变篮子里的茶叶
engine.globalEvent.addEventListener('event-change-TeaNum', (e) => {
console.log(e.type, e.data);
});
}
function getAssetByUUID(uuid) {
return engine.resolveCustomAsset(customId, uuid);
}
function getProps() {
return engine.getProps(customId);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>采茶叶</title>
<meta name="viewport"
content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="full-screen" content="true" />
<meta name="screen-orientation" content="portrait" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<style>
html,
body {
padding: 0;
margin: 0;
border: 0;
width: 100%;
height: 100%;
overflow: hidden;
position: absolute;
background-color: transparent;
}
</style>
</head>
<body>
<div id="game-container" style="line-height:0;font-size:0"></div>
<script crossorigin="anonymous"
src="//yun.duiba.com.cn/editor/zeroing/libs/engine.50cdcef6ebe4e8c0fbc624f9d4fbf225102c5750.js"></script>
<script crossorigin="anonymous"
src="//yun.duiba.com.cn/editor/zeroing/libs/svga.fd3923ae6e664251ca7981801a65809cc5f36bc3.js"></script>
<!-- <script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.ebc906f6b50b8da0a669f77027981d5f3cb560ce.js"></script> -->
<!-- <script src="http://localhost:4002/debug/engine.js"></script>
<script src="http://localhost:4003/debug/engine-svga.js"></script> -->
<!--<script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.9a9dbfda4cb2dd5508ecddfe3d95dfd88063f7b5.js"></script>-->
<script src="app.js"></script>
<script src="props.js"></script>
<script src="load-assets.js"></script>
<script src="main.js"></script>
<script>
</script>
</body>
\ No newline at end of file
/**
* Created by rockyl on 2020-01-21.
*/
const assets = [
{
"name": "进度条底框",
"url": "//yun.duiba.com.cn/aurora/assets/e394fce3576ddeed52fa4dceededc98820318f15.png",
"uuid": "7436ffbc-8906-4cdc-9e9a-80a3f7126e30",
"ext": ".png"
},
{
"name": "进度",
"url": "//yun.duiba.com.cn/aurora/assets/047218962662ed238192f211719c109fa107e8e1.png",
"uuid": "23e7861c-75a9-46bd-93f8-2825d4810d31",
"ext": ".png"
},
{
"name": "茶叶进度缺",
"url": "//yun.duiba.com.cn/aurora/assets/a99ad1582f44237f9391aeffa53b72c316a8ea83.png",
"uuid": "cc4f6b6c-0542-4b8d-b83d-1ee31e9c0e39",
"ext": ".png"
},
{
"name": "茶叶进度满",
"url": "//yun.duiba.com.cn/aurora/assets/7b1ac4e33309adfde360c92c1cdc8299a3e1efd0.png",
"uuid": "81728f22-c616-4133-8c78-c041cde68b79",
"ext": ".png"
},
{
"name": "小茶叶",
"url": "//yun.duiba.com.cn/aurora/assets/e938df1513919985c573128e1ed8074c9cc19dd5.png",
"uuid": "b30b3093-6097-4cc5-9364-ad1050f86c6e",
"ext": ".png"
},
{
"name": "茶叶-满",
"url": "//yun.duiba.com.cn/aurora/assets/acd219c8c8d472a3469183ba8d32568372e75797.png",
"uuid": "41431fe5-523c-4e21-a2bc-9dc4641d27e8",
"ext": ".png"
},
{
"name": "茶叶-少",
"url": "//yun.duiba.com.cn/aurora/assets/38f1874d0688fb8b621dfb1d3028d6f8ac61374d.png",
"uuid": "5765bb2b-3e7b-48fe-9e06-3c76a78c92dc",
"ext": ".png"
},
{
"name": "采茶童-纸篮子",
"url": "//yun.duiba.com.cn/aurora/assets/52f24f84d31709faea0fc35193692b134fe2e40d.svga",
"uuid": "8a7801dd-b802-4571-9f8e-e9acfb9c4527",
"ext": ".svga"
},
{
"name": "采茶童-布篮子",
"url": "//yun.duiba.com.cn/aurora/assets/7ca607d0fd5471d33a4bb58c0d92122fe4ae425f.svga",
"uuid": "ba183e10-4059-4c3e-b9ec-c78192d5e980",
"ext": ".svga"
},
{
"name": "采茶童-竹编篮",
"url": "//yun.duiba.com.cn/aurora/assets/91b8f35ce06b9c65cb504c59ac6c3961f625fb2e.svga",
"uuid": "c7414e60-5312-4586-984a-d8b45a614621",
"ext": ".svga"
},
{
"name": "采茶童-木篮子",
"url": "//yun.duiba.com.cn/aurora/assets/de210099641d4d4fb2d323cc9da17f2f4e48a038.svga",
"uuid": "c492cbd4-aa42-4425-846f-86a91fd3f198",
"ext": ".svga"
},
{
"name": "待升级",
"url": "//yun.duiba.com.cn/aurora/assets/80834a2a25aca30b79dae655003fb7d6b8dc1b49.svga",
"uuid": "eb1f7929-f812-4b88-8345-5d61977fce39",
"ext": ".svga"
},
{
"name": "+1",
"url": "//yun.duiba.com.cn/aurora/assets/72c631a1da7b7969b7995fa16ccc1f435b9b57db.svga",
"uuid": "16a57950-0201-4904-8c65-6378fab65f59",
"ext": ".svga"
},
{
"name": "采茶叶",
"url": "//yun.duiba.com.cn/aurora/assets/6b89b11a26d0f91f1dad9e14b2d099e0d8450032.svga",
"uuid": " 81428208-0274-4e73-9f5e-27bb4a57f80a",
"ext": ".svga"
},
{
"name": "茶叶向上飞",
"url": "//yun.duiba.com.cn/aurora/assets/676ff9aabe60a49ca92f6ade26e62c6bb76be922.svga",
"uuid": "de7273ab-41be-4248-9f05-cdf8a7e3585b",
"ext": ".svga"
},
{
"name": "手抓去",
"url": "//yun.duiba.com.cn/aurora/assets/6b774da91be08d1c9f773d88ace4927c3c5de583.svga",
"uuid": "f1e7a7cf-95c7-4c91-a30b-935e31ea0084",
"ext": ".svga"
}
];
function loadAssets(customModuleAssets, onProgress, onComplete) {
return engine.loadAssets(assets.concat(...customModuleAssets), onProgress, onComplete);
}
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :
typeof define === 'function' && define.amd ? define(['tslib'], factory) :
(global = global || self, global['pick-tea'] = factory(global.tslib));
}(this, (function (tslib) { 'use strict';
var props = {};
function prepareProps() {
var metaProps = getProps();
engine.injectProp(props, metaProps);
}
function injectProps(p) {
engine.injectProp(props, p);
}
//# sourceMappingURL=props.js.map
function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
}
function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
}
function createSvga(name, anchorName) {
var inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
return inst;
}
//# sourceMappingURL=utils.js.map
var Goods = (function (_super) {
tslib.__extends(Goods, _super);
function Goods() {
var _this = _super.call(this) || this;
var body;
body = _this._body = new engine.Rect();
var rain = new engine.Sprite(getTextureByName('雨滴'));
rain["npcType"] = "rain";
var stone = new engine.Sprite(getTextureByName('石块'));
stone["npcType"] = "stone";
var boom = new engine.Sprite(getTextureByName('炸弹'));
boom["npcType"] = "boom";
rain.visible = false;
stone.visible = false;
boom.visible = false;
body.addChild(rain);
body.addChild(stone);
body.addChild(boom);
_this.addChild(body);
body.width = .0001;
body.height = .0001;
body.mouseEnabled = false;
return _this;
}
Goods.prototype.getRandomNumberByRange = function (start, end) {
return Math.floor(Math.random() * (end - start) + start);
};
Goods.prototype.reset = function () {
this.visible = true;
this.rotation = 0;
this.anchorOffsetY = 0;
this.y = 0;
this.x = (750 - 120) * Math.random() + 30;
this.rotation = 0;
var random = Math.random();
if (random < props.goodsProbability[0]) {
this.showNpc("rain");
}
else if (random >= props.goodsProbability[0] && random <= (props.goodsProbability[0] + props.goodsProbability[1])) {
this.showNpc("stone");
}
else if (random > (props.goodsProbability[0] + props.goodsProbability[1])) {
this.showNpc("boom");
}
};
Goods.prototype.showNpc = function (type) {
for (var i = 0; i < this._body.children.length; i++) {
this._body.children[i].visible = false;
this._body.children[i].mouseEnabled = false;
}
for (var i = 0; i < this._body.children.length; i++) {
if (this._body.children[i]["npcType"] == type) {
this["npcType"] = type;
this._body.children[i].visible = true;
this._body.children[i].mouseEnabled = false;
}
}
};
Object.defineProperty(Goods.prototype, "anchorOffsetY", {
set: function (v) {
this._body.y = v;
},
enumerable: true,
configurable: true
});
return Goods;
}(engine.Container));
//# sourceMappingURL=Goods.js.map
var ObjectPool = engine.ObjectPool;
var PoolName = 'goods';
ObjectPool.registerPool(PoolName, function () {
return new Goods();
}, function (item, data) {
item.reset();
});
//# sourceMappingURL=object-pool-init.js.map
var ObjectPool$1 = engine.ObjectPool;
var GameView = (function (_super) {
tslib.__extends(GameView, _super);
function GameView() {
var _this = _super.call(this) || this;
_this.nowPercentage = 0;
_this.goodsItems = [];
_this._touchEnabled = true;
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
return _this;
}
GameView.prototype.setup = function () {
var _this = this;
if (this._hasSetup) {
return;
}
this._hasSetup = true;
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("采茶童-纸篮子");
this.clothBasketSvga = createSvga("采茶童-布篮子");
this.bambooBasketSvga = createSvga("采茶童-竹编篮");
this.woodBasketSvga = createSvga("采茶童-木篮子");
this.addOneSvga = createSvga("+1");
this.pickTeaSvga = createSvga("采茶叶");
this.teaSkyUpSvga = createSvga("茶叶向上飞");
this.handGraspSvga = createSvga("手抓去");
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('进度'));
this.teaHalfFlagImg = new engine.Image(getTextureByName('茶叶进度缺'));
this.teaFullFlagImg = new engine.Image(getTextureByName('茶叶进度满'));
this.teaStarImg = new engine.Image(getTextureByName('小茶叶'));
this.verseImg = new engine.Image(getTextureByName('气泡框'));
this.pickTeaBg.addChild(this.verseImg);
var mask = new engine.Rect();
mask.width = 600;
mask.height = 50;
mask.x = 10;
mask.y = 0;
mask.alpha = 1;
this.progressbarImg.mask = mask;
console.log(this.progressbarImg.mask);
this.progressbarBgImg.addChild(this.progressbarImg);
this.progressbarBgImg.addChild(mask);
console.log('遮罩坐标');
console.log(mask.x, mask.y);
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);
}, 500);
};
GameView.prototype.start = function () {
};
GameView.prototype.pause = function () {
this.gameIng = false;
};
GameView.prototype.revive = function () {
this.gameIng = true;
};
GameView.prototype.resume = function () {
this.reset();
this.start();
};
GameView.prototype.initView = function () {
this.pickTeaBg.mouseEnabled = false;
this.teaHalfImg.visible = false;
this.pickTeaSvga.visible = false;
this.teaSkyUpSvga.visible = false;
this.verseImg.visible = false;
this.initChildrenPos();
};
GameView.prototype.initChildrenPos = function () {
for (var 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.verseImg.x = props.versePos[0];
this.verseImg.y = props.versePos[1];
this.addOneSvga.x = props.addOneSvgaPos[0];
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];
this.progressbarBgImg.x = props.progressbarBgImgPos[0];
this.progressbarBgImg.y = props.progressbarBgImgPos[1];
this.progressbarImg.x = props.progressbarImgPos[0];
this.progressbarImg.y = props.progressbarImgPos[1];
this.teaHalfFlagImg.x = props.teaHalfFlagImgPos[0];
this.teaHalfFlagImg.y = props.teaHalfFlagImgPos[1];
this.teaHalfFlagImg.anchorX = this.teaHalfFlagImg.width / 2;
this.teaHalfFlagImg.anchorY = this.teaHalfFlagImg.height / 2;
this.teaFullFlagImg.x = props.teaHalfFlagImgPos[0];
this.teaFullFlagImg.y = props.teaHalfFlagImgPos[1];
this.teaFullFlagImg.visible = false;
this.teaStarImg.x = props.teaStarImgPos[0];
this.teaStarImg.y = props.teaStarImgPos[1];
this.pickTeaCount.fillColor = 'white';
this.pickTeaCount.size = 30;
this.pickTeaCount.text = '';
this.pickTeaCount.x = props.pickTeaCountPos[0];
this.pickTeaCount.y = props.pickTeaCountPos[1];
this.pickTeaCount.height = 50;
this.pickTeaCount.width = 200;
this.verseLabel = new engine.TextField();
this.verseLabel.size = props.verseLabel[2];
this.verseLabel.text = '11';
this.verseLabel.fillColor = props.verseColor[0];
this.verseLabel.height = props.verseLabel[1];
this.verseLabel.width = props.verseLabel[0];
this.verseLabel.strokeColor = props.verseColor[1];
this.verseLabel.stroke = 0.5;
this.verseLabel.y = 15;
this.verseLabel['textHeight'] = 14;
this.verseLabel.textAlign = engine.TEXT_ALIGN.CENTER;
this.verseImg.visible = false;
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];
});
});
};
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 surplus = nowNum - totalNum;
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));
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('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);
this.addOneSvga.play(1, true);
var speed = props.pickTeaSpeed;
var teaFullRotation = engine.Tween.get(this.teaHalfFlagImg, { loop: true })
.to({ rotation: 360 }, speed).call(function () {
_this.teaHalfFlagImg.rotation = 0;
});
this.schedule = setInterval(function () {
if (nowNum == totalNum) {
console.log('达到最大长度');
clearInterval(_this.schedule);
engine.Tween.pauseTweens(teaFullRotation);
_this.progressbarImg.x = 0;
_this.teaHalfFlagImg.visible = false;
_this.teaFullFlagImg.visible = !_this.teaHalfFlagImg.visible;
_this.addOneSvga.visible = !_this.teaHalfFlagImg.visible;
_this.addOneSvga.stop();
}
if (_this.progressbarImg.x <= -2) {
_this.progressbarImg.x -= step;
}
_this.getTeaPercentage(nowNum, totalNum);
nowNum++;
dataDiff++;
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)) {
clearInterval(_this.schedule);
engine.Tween.pauseTweens(teaFullRotation);
engine.globalEvent.dispatchEvent('event-setchange-TeaNum');
return;
}
console.log('this.progressbarImg.x', _this.progressbarImg.x);
}, speed);
};
GameView.prototype.getTeaPercentage = function (nowNum, totalNum) {
this.pickTeaCount.text = nowNum + '/' + totalNum;
var teaPercentage = 2;
var portion = totalNum / 3;
if (nowNum < portion) {
return;
}
if (nowNum < (portion * 2)) {
teaPercentage = 1;
}
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) {
return;
}
var teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));
if (teaPercentage == 1) {
this.teaHalfImg = new engine.Image(getTextureByName('茶叶-少'));
}
else if (teaPercentage == 2) {
this.teaHalfImg = new engine.Image(getTextureByName('茶叶-满'));
}
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);
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];
that.pickTeaSvga.visible = true;
that.pickTeaSvga.play(1, false);
});
that.pickTeaSvga.addEventListener(engine.Event.END_FRAME, function () {
that.teaSkyUpSvga.visible = true;
that.teaSkyUpSvga.play(1, false);
});
that.teaSkyUpSvga.addEventListener(engine.Event.END_FRAME, function () {
that.teaSkyUpSvga.visible = false;
});
}, 500);
};
GameView.prototype.recycleGoods = function () {
return;
};
return GameView;
}(engine.Container));
var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super);
function GameWrapper() {
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-getchange-TeaNum', _this.setTeaNum, _this);
engine.globalEvent.addEventListener('event-getBasket-Type', _this.setPickTeaLevel, _this);
var gameView = _this._gameView = new GameView();
_this.addChild(gameView);
return _this;
}
GameWrapper.prototype.setTeaNum = function (event) {
injectProps(event.data);
this._gameView.setTeaNum(event.data);
};
GameWrapper.prototype.setPickTeaLevel = function (event) {
injectProps(event.data);
this._gameView.setPickTeaLevel(event.data);
};
GameWrapper.prototype.reset = function (event) {
injectProps(event.data);
this._gameView.visible = true;
this._gameView.reset();
};
GameWrapper.prototype.start = function (event) {
injectProps(event.data);
this._status = 1;
this._gameView.start();
};
GameWrapper.prototype.pause = function () {
this._gameView.pause();
};
GameWrapper.prototype.resume = function () {
this._gameView.resume();
};
GameWrapper.prototype.revive = function () {
this._gameView.revive();
};
GameWrapper.prototype.clear = function () {
this._gameView.visible = false;
};
GameWrapper.prototype.handGrasp = function () {
this._gameView.handGrasp();
};
GameWrapper.prototype.onTap = function (event) {
};
return GameWrapper;
}(engine.Container));
//# sourceMappingURL=GameWrapper.js.map
function index (props) {
prepareProps();
injectProps(props);
var instance = new GameWrapper();
return instance;
}
//# sourceMappingURL=index.js.map
return index;
})));
//# sourceMappingURL=main.js.map
\ No newline at end of file
{"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/Goods.ts","src/custom/pick-tea/src/game/object-pool-init.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 2020-02-02.\r\n *\r\n * 掉落物品\r\n */\r\nimport {getTextureByName} from \"./utils\";\r\nimport {props} from \"../props\";\r\n\r\nexport class Goods extends engine.Container {\r\n\tprivate _body:engine.Rect\r\n\tprivate _toY;\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tlet body\r\n\t\tbody = this._body =new engine.Rect()\r\n\t\t\r\n\t\t\r\n\t\tlet rain = new engine.Sprite(getTextureByName('雨滴'));\r\n\t\train[\"npcType\"]=\"rain\"\r\n\t\tlet stone = new engine.Sprite(getTextureByName('石块'));\r\n\t\tstone[\"npcType\"]=\"stone\"\r\n\t\tlet boom = new engine.Sprite(getTextureByName('炸弹'));\r\n\t\tboom[\"npcType\"]=\"boom\"\r\n\r\n\t\train.visible=false;\r\n\t\tstone.visible=false;\r\n\t\tboom.visible=false;\r\n\t\tbody.addChild(rain)\r\n\t\tbody.addChild(stone)\r\n\t\tbody.addChild(boom)\r\n\t\t\r\n\t\tthis.addChild(body);\r\n\t\tbody.width=.0001;\r\n\t\tbody.height=.0001;\r\n\t\tbody.mouseEnabled=false;\r\n\t}\r\n\r\n\r\n\tgetRandomNumberByRange(start, end) {\r\n\t\treturn Math.floor(Math.random() * (end - start) + start)\r\n\t}\r\n\r\n\treset() {\r\n\t\tthis.visible = true;\r\n\t\tthis.rotation = 0;\r\n\t\tthis.anchorOffsetY = 0;\r\n\t\tthis.y = 0;\r\n\t\tthis.x = (750-120)*Math.random()+30;\r\n\t\tthis.rotation = 0;\r\n\t\tlet random=Math.random()\r\n\r\n\t\tif(random<props.goodsProbability[0]){\r\n\t\t\tthis.showNpc(\"rain\")\r\n\t\t}else if(random>=props.goodsProbability[0]&&random<=(props.goodsProbability[0]+props.goodsProbability[1])){\r\n\t\t\tthis.showNpc(\"stone\")\r\n\t\t}else if(random>(props.goodsProbability[0]+props.goodsProbability[1])){\r\n\t\t\tthis.showNpc(\"boom\")\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tshowNpc(type){\r\n\t\tfor(let i=0;i<this._body.children.length;i++){\r\n\t\t\tthis._body.children[i].visible=false;\r\n\t\t\tthis._body.children[i].mouseEnabled=false;\r\n\t\t}\r\n\r\n\t\tfor(let i=0;i<this._body.children.length;i++){\r\n\t\t\tif(this._body.children[i][\"npcType\"]==type){\r\n\t\t\t\tthis[\"npcType\"]=type\r\n\t\t\t\tthis._body.children[i].visible=true;\r\n\t\t\t\tthis._body.children[i].mouseEnabled=false;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t}\r\n\r\n\tset anchorOffsetY(v) {\r\n\t\tthis._body.y = v;\r\n\t}\r\n}\r\n","/**\r\n * Created by rockyl on 2020-02-03.\r\n */\r\n\r\nimport {Goods} from \"./Goods\";\r\nimport ObjectPool = engine.ObjectPool;\r\n\r\nexport const PoolName: string = 'goods';\r\n\r\nObjectPool.registerPool(PoolName, function () {\r\n\treturn new Goods();\r\n}, function (item: Goods, data) {\r\n\titem.reset();\r\n});\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 { Goods } from \"./Goods\";\r\nimport { PoolName } from \"./object-pool-init\";\r\nimport { Tealeaf } from \"./Tealeaf\";\r\nimport { RedPackRain } from \"../../../redpack-rain/src/game/RedPackRain\";\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\tprivate _goods: Goods;\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\t/**\r\n\t * 回收对象\r\n\t */\r\n\tprivate recycleGoods() {\r\n\t\treturn\r\n\t\tclearTimeout(this.timer)\r\n\t\tclearInterval(this.countdownTimer)\r\n\t\tfor (let goods of this.goodsItems) {\r\n\t\t\tif (goods) {\r\n\t\t\t\tthis.removeChild(goods);\r\n\t\t\t\tObjectPool.recycleObject(PoolName, goods);\r\n\t\t\t\tgoods.removeEventListener(engine.Event.ENTER_FRAME, goods[\"onGoodsEnter\"], this);\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.goodsItems = []\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","ObjectPool"],"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,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E,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
/**
* Created by rockyl on 2020-01-21.
*/
let customModuleProps = {
};
{
"name": "采茶叶",
"desc": "采茶叶模块",
"props": {
"versePos": {
"alias": "诗句的起始位置",
"type": "array<number>",
"default": "160,360"
},
"verses": {
"alias": "诗句",
"type": "array<string>",
"default": "今朝有酒今朝醉,今宵更有湘江月,找出霏霏满碗花,雨过林霏清石气,秋将山翠入诗心,生怕芳丛鹰嘴芽,老郎封寄谪仙家"
},
"verseLabel": {
"alias": "提示语框xys",
"type": "array<number>",
"default": "396,50,22"
},
"verseColor": {
"alias": "颜色描边",
"type": "array<string>",
"default": "#33628b,#99b1c5"
},
"pickTeaSpeed": {
"alias": "采集茶叶的速度ms",
"type": "number",
"default": 1000
},
"basketSvgaPos": {
"alias": "人物的位置",
"type": "array<number>",
"default": "110,420"
},
"addOneSvgaPos": {
"alias": "+1SVGA的位置",
"type": "array<number>",
"default": "70,720"
},
"pickTeaSvgaPos": {
"alias": "采茶叶SVGA的位置",
"type": "array<number>",
"default": "377,530"
},
"teaSkyUpSvgaPos": {
"alias": "收集茶叶SVGA的位置",
"type": "array<number>",
"default": "320,192"
},
"handGraspSvgaPos": {
"alias": "手点击SVGA的位置",
"type": "array<number>",
"default": "543,791"
},
"handGraspMovePos": {
"alias": "手点击移动的位置",
"type": "array<number>",
"default": "460,700"
},
"progressbarBgImgPos": {
"alias": "进度条底图的位置",
"type": "array<number>",
"default": "69,818"
},
"progressbarImgPos": {
"alias": "进度条的位置",
"type": "array<number>",
"default": "-443,4"
},
"teaStarImgPos": {
"alias": "小茶叶的位置",
"type": "array<number>",
"default": "9,7"
},
"teaHalfFlagImgPos": {
"alias": "满缺的位置",
"type": "array<number>",
"default": "-15,-15"
},
"pickTeaCountPos": {
"alias": "文本进度的位置",
"type": "array<number>",
"default": "180,10"
}
},
"assets": [
{
"name": "气泡框",
"url": "//yun.duiba.com.cn/aurora/assets/585743f25262b6992ac97015e22d91054d506821.png",
"uuid": "1e6c4615-e1f4-43fe-b5de-9bfdaa27888c",
"ext": ".png"
},
{
"name": "进度条底框",
"url": "//yun.duiba.com.cn/aurora/assets/e394fce3576ddeed52fa4dceededc98820318f15.png",
"uuid": "7436ffbc-8906-4cdc-9e9a-80a3f7126e30",
"ext": ".png"
},
{
"name": "进度",
"url": "//yun.duiba.com.cn/aurora/assets/047218962662ed238192f211719c109fa107e8e1.png",
"uuid": "23e7861c-75a9-46bd-93f8-2825d4810d31",
"ext": ".png"
},
{
"name": "茶叶进度缺",
"url": "//yun.duiba.com.cn/aurora/assets/a99ad1582f44237f9391aeffa53b72c316a8ea83.png",
"uuid": "cc4f6b6c-0542-4b8d-b83d-1ee31e9c0e39",
"ext": ".png"
},
{
"name": "茶叶进度满",
"url": "//yun.duiba.com.cn/aurora/assets/7b1ac4e33309adfde360c92c1cdc8299a3e1efd0.png",
"uuid": "81728f22-c616-4133-8c78-c041cde68b79",
"ext": ".png"
},
{
"name": "小茶叶",
"url": "//yun.duiba.com.cn/aurora/assets/e938df1513919985c573128e1ed8074c9cc19dd5.png",
"uuid": "b30b3093-6097-4cc5-9364-ad1050f86c6e",
"ext": ".png"
},
{
"name": "茶叶-满",
"url": "//yun.duiba.com.cn/aurora/assets/acd219c8c8d472a3469183ba8d32568372e75797.png",
"uuid": "41431fe5-523c-4e21-a2bc-9dc4641d27e8",
"ext": ".png"
},
{
"name": "茶叶-少",
"url": "//yun.duiba.com.cn/aurora/assets/38f1874d0688fb8b621dfb1d3028d6f8ac61374d.png",
"uuid": "5765bb2b-3e7b-48fe-9e06-3c76a78c92dc",
"ext": ".png"
},
{
"name": "采茶童-纸篮子",
"url": "//yun.duiba.com.cn/aurora/assets/52f24f84d31709faea0fc35193692b134fe2e40d.svga",
"uuid": "8a7801dd-b802-4571-9f8e-e9acfb9c4527",
"ext": ".svga"
},
{
"name": "采茶童-布篮子",
"url": "//yun.duiba.com.cn/aurora/assets/7ca607d0fd5471d33a4bb58c0d92122fe4ae425f.svga",
"uuid": "ba183e10-4059-4c3e-b9ec-c78192d5e980",
"ext": ".svga"
},
{
"name": "采茶童-竹编篮",
"url": "//yun.duiba.com.cn/aurora/assets/91b8f35ce06b9c65cb504c59ac6c3961f625fb2e.svga",
"uuid": "c7414e60-5312-4586-984a-d8b45a614621",
"ext": ".svga"
},
{
"name": "采茶童-木篮子",
"url": "//yun.duiba.com.cn/aurora/assets/de210099641d4d4fb2d323cc9da17f2f4e48a038.svga",
"uuid": "c492cbd4-aa42-4425-846f-86a91fd3f198",
"ext": ".svga"
},
{
"name": "待升级",
"url": "//yun.duiba.com.cn/aurora/assets/80834a2a25aca30b79dae655003fb7d6b8dc1b49.svga",
"uuid": "eb1f7929-f812-4b88-8345-5d61977fce39",
"ext": ".svga"
},
{
"name": "+1",
"url": "//yun.duiba.com.cn/aurora/assets/72c631a1da7b7969b7995fa16ccc1f435b9b57db.svga",
"uuid": "16a57950-0201-4904-8c65-6378fab65f59",
"ext": ".svga"
},
{
"name": "采茶叶",
"url": "//yun.duiba.com.cn/aurora/assets/6b89b11a26d0f91f1dad9e14b2d099e0d8450032.svga",
"uuid": " 81428208-0274-4e73-9f5e-27bb4a57f80a",
"ext": ".svga"
},
{
"name": "茶叶向上飞",
"url": "//yun.duiba.com.cn/aurora/assets/676ff9aabe60a49ca92f6ade26e62c6bb76be922.svga",
"uuid": "de7273ab-41be-4248-9f05-cdf8a7e3585b",
"ext": ".svga"
},
{
"name": "手抓去",
"url": "//yun.duiba.com.cn/aurora/assets/6b774da91be08d1c9f773d88ace4927c3c5de583.svga",
"uuid": "f1e7a7cf-95c7-4c91-a30b-935e31ea0084",
"ext": ".svga"
}
],
"events": {
"in": {
"event-getchange-TeaNum": {
"alias": "茶叶数量{初始值totalNum,总量nowNum} "
},
"event-getBasket-Type": {
"alias": "获得篮子类型"
},
"event-hand-grasp": {
"alias": "手抓去"
}
},
"out": {
"event-setchange-TeaNum": {
"alias": "",
"data": {}
},
"event-setBasket-Typ": {
"alias": "",
"data": {}
}
}
}
}
\ No newline at end of file
/**
* Created by rockyl on 2018/8/16.
*/
import { props } from "../props";
import { playSound, createSvga } from "./utils";
import ObjectPool = engine.ObjectPool;
import { getTextureByName } from "./utils";
import { Goods } from "./Goods";
import { PoolName } from "./object-pool-init";
import { Tealeaf } from "./Tealeaf";
import { RedPackRain } from "../../../redpack-rain/src/game/RedPackRain";
const MAXX = -8;
export default class GameView extends engine.Container {
private _hasSetup;
/**采茶叶自定义模块*/
private teaImgSource: any;
private tealeaf: Tealeaf;
private teaHalfImg: engine.Image;
private nowPercentage: any = 0;
private progressbarBgImg: engine.Image;
private progressbarImg: engine.Image;
private teaFullFlagImg: engine.Image;
private teaHalfFlagImg: engine.Image;
private teaStarImg: engine.Image;
private verseImg: engine.Image;
//采茶背景层
private pickTeaBg: engine.Container;
//采茶进度计时器
private pickTeaTimer: any
//茶叶的数量进度 100/240
private pickTeaCount: engine.Label;
//语句
private verseLabel: engine.TextField;
//篮子集合
private basketSvgaGroup: any;
//纸篮子svga
private paperBasketSvga
//布篮子svga
private clothBasketSvga
//竹篮子svga
private bambooBasketSvga
//木篮子svga
private woodBasketSvga
//+1
private addOneSvga
//采茶叶
private pickTeaSvga
//茶叶向上飞
private teaSkyUpSvga
//手抓去
private handGraspSvga
/**采茶叶自定义模块*/
//玩家
private player: engine.Container;
//触摸层
private rectBg: engine.Rect;
//npc层
//private NpcBg: engine.Container;
//当前分数
private score
//游戏状态
private gameIng;
//npc出身计时器
private timer
//倒计时计时器
private countdownTimer: any
//倒计时
private countdown: number
//当前速度
private speed: number
private schedule: any
// 当前场景上面的物品
private goodsItems = []
private _goods: Goods;
constructor() {
super();
this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);
}
private waterSvga
private boomSvga
private playerSvga
private _touchEnabled = true
setup() {
if (this._hasSetup) {
return;
}
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);
this.addChild(this.pickTeaBg);
this.teaHalfImg = new engine.Image();
this.paperBasketSvga = createSvga("采茶童-纸篮子");
this.clothBasketSvga = createSvga("采茶童-布篮子");
this.bambooBasketSvga = createSvga("采茶童-竹编篮");
this.woodBasketSvga = createSvga("采茶童-木篮子");
this.addOneSvga = createSvga("+1");
this.pickTeaSvga = createSvga("采茶叶");
this.teaSkyUpSvga = createSvga("茶叶向上飞");
this.handGraspSvga = createSvga("手抓去");
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('进度'));
this.teaHalfFlagImg = new engine.Image(getTextureByName('茶叶进度缺'));
this.teaFullFlagImg = new engine.Image(getTextureByName('茶叶进度满'));
this.teaStarImg = new engine.Image(getTextureByName('小茶叶'));
this.verseImg = new engine.Image(getTextureByName('气泡框'));
this.pickTeaBg.addChild(this.verseImg);
let mask = new engine.Rect();
mask.width = 600;
mask.height = 50;
mask.x = 10;
mask.y = 0;
mask.alpha = 1;
//mask.fillColor = 'black'
this.progressbarImg.mask = mask
console.log(this.progressbarImg.mask)
this.progressbarBgImg.addChild(this.progressbarImg);
this.progressbarBgImg.addChild(mask);
console.log('遮罩坐标')
console.log(mask.x, mask.y)
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);
// 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)
}
reset() {
console.log('111111111reset1')
this.initView()
setTimeout(() =>
this.setPickTeaLevel(1)
, 500)
}
start() {
}
pause() {
this.gameIng = false;
}
revive() {
this.gameIng = true;
}
resume() {
this.reset();
this.start()
}
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.initChildrenPos()
}
initChildrenPos() {
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.verseImg.x = props.versePos[0]
this.verseImg.y = props.versePos[1]
this.addOneSvga.x = props.addOneSvgaPos[0]
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];
this.progressbarBgImg.x = props.progressbarBgImgPos[0]
this.progressbarBgImg.y = props.progressbarBgImgPos[1]
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]
this.teaHalfFlagImg.anchorX = this.teaHalfFlagImg.width / 2
this.teaHalfFlagImg.anchorY = this.teaHalfFlagImg.height / 2
this.teaFullFlagImg.x = props.teaHalfFlagImgPos[0]
this.teaFullFlagImg.y = props.teaHalfFlagImgPos[1]
this.teaFullFlagImg.visible = false;
this.teaStarImg.x = props.teaStarImgPos[0]
this.teaStarImg.y = props.teaStarImgPos[1]
this.pickTeaCount.fillColor = 'white';
this.pickTeaCount.size = 30;
this.pickTeaCount.text = ''
this.pickTeaCount.x = props.pickTeaCountPos[0]
this.pickTeaCount.y = props.pickTeaCountPos[1]
this.pickTeaCount.height = 50;
this.pickTeaCount.width = 200;
this.verseLabel = new engine.TextField();
this.verseLabel.size = props.verseLabel[2];
this.verseLabel.text = '11'
this.verseLabel.fillColor = props.verseColor[0]
this.verseLabel.height = props.verseLabel[1];
this.verseLabel.width = props.verseLabel[0];
this.verseLabel.strokeColor = props.verseColor[1]
this.verseLabel.stroke = 0.5;
this.verseLabel.y = 15;
this.verseLabel['textHeight'] = 14;
this.verseLabel.textAlign = engine.TEXT_ALIGN.CENTER;
this.verseImg.visible = false;
this.verseImg.addChild(this.verseLabel);
// label.x = (width - label.width) / 2;
// label.y = guideHole.y + guideHole.height + 50;
}
async showVerse() {
console.log('显示诗句')
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.log(props.verses)
let verse = props.verses[random];
console.log('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.log('清理定时器,重新设置同步')
clearInterval(this.schedule);
}
let totalNum = TeaNums.totalNum;
let nowNum = TeaNums.nowNum;
this.pickTeaCount.text = nowNum + '/' + totalNum;
this.getTeaPercentage(nowNum, totalNum);
let surplus = nowNum - totalNum;
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))
console.log('fbdvalue', fbdvalue)
/**/
//设置数据校正
// let serverData = 0;
let dataDiff = 0;
/**/
//let rate = (443 - width * (1 - nowNum / totalNum))
//已经走得
let x = -width * (1 - nowNum / totalNum)
console.log('x', x);
this.progressbarImg.x = parseFloat(x.toFixed(3));
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)
this.addOneSvga.play(1, true);
let speed = props.pickTeaSpeed;
let teaFullRotation = engine.Tween.get(this.teaHalfFlagImg, { loop: true })
.to({ rotation: 360 }, speed).call(() => {
this.teaHalfFlagImg.rotation = 0;
})
this.schedule = setInterval(() => {
if (nowNum == totalNum) {
console.log('达到最大长度');
clearInterval(this.schedule);
engine.Tween.pauseTweens(teaFullRotation);
this.progressbarImg.x = 0
this.teaHalfFlagImg.visible = false;
this.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible
this.addOneSvga.visible = !this.teaHalfFlagImg.visible
this.addOneSvga.stop();
}
if (this.progressbarImg.x <= -2) {
this.progressbarImg.x -= step;
}
this.getTeaPercentage(nowNum, totalNum);
nowNum++;
dataDiff++;
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)) {
clearInterval(this.schedule);
engine.Tween.pauseTweens(teaFullRotation);
engine.globalEvent.dispatchEvent('event-setchange-TeaNum');
return;
}
console.log('this.progressbarImg.x', this.progressbarImg.x)
}, speed)
}
getTeaPercentage(nowNum, totalNum) {
this.pickTeaCount.text = nowNum + '/' + totalNum;
let teaPercentage = 2;
let portion = totalNum / 3
if (nowNum < portion) {
return;
}
if (nowNum < (portion * 2)) {
teaPercentage = 1;
}
console.log('teaPercentage', teaPercentage)
if (this.nowPercentage != teaPercentage) {
console.log('状态改变')
this.nowPercentage = teaPercentage;
this.updateTeaPercentage(teaPercentage);
}
}
//需要更换茶叶数量皮肤
updateTeaPercentage(teaPercentage = 0) {
console.log('需要更换茶叶数量皮肤')
console.log('延迟500ms')
let pickTeaSVGA = this.basketSvgaGroup[1];
console.log('pickTeaSVGA')
console.log(pickTeaSVGA)
pickTeaSVGA.removeChildAt(10);
let originframes = pickTeaSVGA.children[7];
if (!originframes) {
return;
}
//按照采茶叶的多少来 设置茶叶是不是满的图片
let teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));
//let teaNumImg = this.teaHalfImg;
if (teaPercentage == 1) {
this.teaHalfImg = new engine.Image(getTextureByName('茶叶-少'));
}
else if (teaPercentage == 2) {
this.teaHalfImg = new engine.Image(getTextureByName('茶叶-满'));
}
this.teaHalfImg.visible = false;
this.teaHalfImg['frames'] = teaBucketframes;
console.log('this.teaHalfImg');
console.log(this.teaHalfImg);
pickTeaSVGA.addChildAt(this.teaHalfImg, 10)
}
setPickTeaLevel(level) {
console.log('setPickTeaLevel', level);
let pickTeaSVGA = this.basketSvgaGroup[level];
pickTeaSVGA.visible = true;
// console.log('littleTea url')
// console.log(this.teaHalfImg['_source'])
//需要svga缓存结束
setTimeout(() => {
console.log('延迟500ms')
let originframes = pickTeaSVGA.children[7];
//按照采茶叶的多少来 设置茶叶是不是满的图片
let teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));
//this.teaHalfImg = //new engine.Image(getTextureByName('茶叶-少'));
if (this.teaHalfImg) {
//this.teaHalfImg.source = ''
this.teaHalfImg['frames'] = teaBucketframes;
}
console.log('this.teaHalfImg');
console.log(this.teaHalfImg);
pickTeaSVGA.addChildAt(this.teaHalfImg, 10)
pickTeaSVGA.gotoAndPlay(1, true);
}, 300)
}
handGrasp() {
console.log('handGrasp')
let that = this;
setTimeout(() => {
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(() => {
that.pickTeaSvga.visible = true
that.pickTeaSvga.play(1, false);
})
that.pickTeaSvga.addEventListener(engine.Event.END_FRAME, function () {
//console.log('this.teaSkyUpSvga.play')
that.teaSkyUpSvga.visible = true
that.teaSkyUpSvga.play(1, false);
})
that.teaSkyUpSvga.addEventListener(engine.Event.END_FRAME, function () {
that.teaSkyUpSvga.visible = false;
})
}, 500);
}
/*采茶叶活动*/
/**
* 回收对象
*/
private recycleGoods() {
return
clearTimeout(this.timer)
clearInterval(this.countdownTimer)
for (let goods of this.goodsItems) {
if (goods) {
this.removeChild(goods);
ObjectPool.recycleObject(PoolName, goods);
goods.removeEventListener(engine.Event.ENTER_FRAME, goods["onGoodsEnter"], this);
}
}
this.goodsItems = []
}
}
/**
* Created by rockyl on 2020-01-09.
*/
import GameView from "./GameView";
import { injectProps } from "../props";
export class GameWrapper extends engine.Container {
private _status;
private _gameView: GameView;
constructor() {
super();
/*
event-pickTeaGame-init //游戏初始化
//event-wait-uplevel //待升级
event-add-oneScore //+1
event-pick-tea //采茶叶
event-tea-skyup //茶叶向上飞
event-hand-grasp //手抓去
event-change-TeaNum //茶叶数量 改变svga动画
event-getBasket-Type //获得篮子类型
event-setBasket-Type //设置篮子类型
*/
// event-getchange-TeaNum //茶叶数量{初始值totalNum,总量nowNum} 改变svga动画
// event-getBasket-Type //获得篮子类型
// event-hand-grasp //手抓去
//event-pickTeaGame-init 游戏初始化
engine.globalEvent.addEventListener('event-pickTeaGame-init', this.reset, this);
engine.globalEvent.addEventListener('event-hand-grasp', this.handGrasp, 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);
}
//设置茶叶数量
setTeaNum(event: engine.Event) {
injectProps(event.data);
this._gameView.setTeaNum(event.data);
}
//设置茶蓝等级
setPickTeaLevel(event: engine.Event) {
injectProps(event.data);
this._gameView.setPickTeaLevel(event.data);
}
reset(event: engine.Event) {
injectProps(event.data);
this._gameView.visible = true;
this._gameView.reset();
}
start(event: engine.Event) {
injectProps(event.data);
this._status = 1;
this._gameView.start();
}
pause() {
this._gameView.pause();
}
resume() {
this._gameView.resume();
}
revive() {
this._gameView.revive();
}
clear() {
this._gameView.visible = false;
}
handGrasp() {
this._gameView.handGrasp();
}
private onTap(event) {
// this._gameView.tap(event);
}
}
/**
* Created by rockyl on 2020-02-02.
*
* 掉落物品
*/
import {getTextureByName} from "./utils";
import {props} from "../props";
export class Goods extends engine.Container {
private _body:engine.Rect
private _toY;
constructor() {
super();
let body
body = this._body =new engine.Rect()
let rain = new engine.Sprite(getTextureByName('雨滴'));
rain["npcType"]="rain"
let stone = new engine.Sprite(getTextureByName('石块'));
stone["npcType"]="stone"
let boom = new engine.Sprite(getTextureByName('炸弹'));
boom["npcType"]="boom"
rain.visible=false;
stone.visible=false;
boom.visible=false;
body.addChild(rain)
body.addChild(stone)
body.addChild(boom)
this.addChild(body);
body.width=.0001;
body.height=.0001;
body.mouseEnabled=false;
}
getRandomNumberByRange(start, end) {
return Math.floor(Math.random() * (end - start) + start)
}
reset() {
this.visible = true;
this.rotation = 0;
this.anchorOffsetY = 0;
this.y = 0;
this.x = (750-120)*Math.random()+30;
this.rotation = 0;
let random=Math.random()
if(random<props.goodsProbability[0]){
this.showNpc("rain")
}else if(random>=props.goodsProbability[0]&&random<=(props.goodsProbability[0]+props.goodsProbability[1])){
this.showNpc("stone")
}else if(random>(props.goodsProbability[0]+props.goodsProbability[1])){
this.showNpc("boom")
}
}
showNpc(type){
for(let i=0;i<this._body.children.length;i++){
this._body.children[i].visible=false;
this._body.children[i].mouseEnabled=false;
}
for(let i=0;i<this._body.children.length;i++){
if(this._body.children[i]["npcType"]==type){
this["npcType"]=type
this._body.children[i].visible=true;
this._body.children[i].mouseEnabled=false;
}
}
}
set anchorOffsetY(v) {
this._body.y = v;
}
}
import { getTextureByName } from "./utils";
export class Tealeaf extends engine.Container {
private _teaFull: engine.Image;
private _teaHalfFull: engine.Image;
private _teaImages: any
constructor() {
super();
this._teaFull = new engine.Image(getTextureByName('茶叶-满'));
this._teaHalfFull = new engine.Image(getTextureByName('茶叶-少'));
this._teaImages = [this._teaFull, this._teaHalfFull]
this.addChild(this._teaFull);
this.addChild(this._teaHalfFull);
}
reset() {
this.visible = true;
}
getSpriteUrl(index) {
let url = this._teaImages[index].url;
return url;
}
}
/**
* Created by rockyl on 2020-02-03.
*/
import {Goods} from "./Goods";
import ObjectPool = engine.ObjectPool;
export const PoolName: string = 'goods';
ObjectPool.registerPool(PoolName, function () {
return new Goods();
}, function (item: Goods, data) {
item.reset();
});
/**
* Created by rockyl on 2020-01-21.
*/
export function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
}
export function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
}
export function playSound(name) {
engine.playSound(engine.getAssetByName(name).uuid, {keep: true});
}
export function createSvga(name, anchorName?) {
let inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
return inst;
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-20.
*/
import {GameWrapper} from "./game/GameWrapper";
import {injectProps, prepareProps} from "./props";
export default function (props) {
prepareProps();
injectProps(props);
let instance = new GameWrapper();
return instance;
}
/**
* Created by rockyl on 2020-01-21.
*/
export let props: any = {};
export function prepareProps() {
let metaProps = getProps();
engine.injectProp(props, metaProps);
}
export function injectProps(p) {
engine.injectProp(props, p);
}
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