Commit 5854544b authored by 任建锋's avatar 任建锋

Merge branch 'dev' of http://gitlab2.dui88.com/laoqifeng/zeroing-libs into dev

parents e9112f73 140f0a58
{
"name": "采茶叶",
"desc": "采茶叶模左上角0,0点",
"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"
},
"showFrontImg": {
"alias": "茶叶前景图1显示2隐藏",
"type": "number",
"default": "1"
},
"FrontImgPos": {
"alias": "茶叶前景图位置",
"type": "array<number>",
"default": "0,584"
},
"pickTeaSpeed": {
"alias": "采集茶叶的速度ms",
"type": "number",
"default": 1000
},
"basketSvgaPos": {
"alias": "人物的位置",
"type": "array<number>",
"default": "110,410"
},
"addOneSvgaPos": {
"alias": "+1SVGA的位置",
"type": "array<number>",
"default": "0,-100"
},
"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": "477,-29"
},
"handGraspMovePos": {
"alias": "手点击移动的位置",
"type": "array<number>",
"default": "372,-145"
},
"progressbarBgImgPos": {
"alias": "进度条底图的位置",
"type": "array<number>",
"default": "69,818"
},
"progressbarImgPos": {
"alias": "进度条的位置",
"type": "array<number>",
"default": "-335,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/1da0ea14267ff35f90f49c22deb1b34181571e90.png",
"uuid": "9f5db57e-47f9-43e5-af80-adf41299280d",
"ext": ".png"
},
{
"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/afb6b2655838ea955d250663fc535cc166b466e7.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": "茶叶数量{初始值nowNum,总量totalNum,后端时间serverData} "
},
"event-getBasket-Type": {
"alias": "获得篮子类型(纸 布 竹 木)0 1 2 3"
},
"event-hand-grasp": {
"alias": "手抓去"
},
"event-getClick-person": {
"alias": "点击人物"
}
},
"out": {
"event-setchange-TeaNum": {
"alias": "获取茶叶数量{初始值nowNum,总量totalNum,后端时间serverData}",
"data": {}
},
"event-setBasket-Typ": {
"alias": "获得篮子类型(纸 布 竹 木)0 1 2 3",
"data": {}
}
}
},
"id": "pick-tea",
"code": "(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :\n\ttypeof define === 'function' && define.amd ? define(['tslib'], factory) :\n\t(global = global || self, global['pick-tea'] = factory(global.tslib));\n}(this, (function (tslib) { 'use strict';\n\n\tvar props = {};\r\n\tfunction prepareProps() {\r\n\t var metaProps = getProps();\r\n\t engine.injectProp(props, metaProps);\r\n\t}\r\n\tfunction injectProps(p) {\r\n\t engine.injectProp(props, p);\r\n\t}\r\n\t//# sourceMappingURL=props.js.map\n\n\tfunction getTexture(uuid) {\r\n\t return engine.Texture.from(getAssetByUUID(uuid).uuid);\r\n\t}\r\n\tfunction getTextureByName(name) {\r\n\t return getTexture(engine.getAssetByName(name).uuid);\r\n\t}\r\n\tfunction createSvga(name, anchorName) {\r\n\t var inst = new svga.Svga();\r\n\t inst.source = 'asset://' + engine.getAssetByName(name).uuid;\r\n\t return inst;\r\n\t}\r\n\tfunction showLog(abjname, obj) {\r\n\t}\r\n\t//# sourceMappingURL=utils.js.map\n\n\tvar GameView = (function (_super) {\r\n\t tslib.__extends(GameView, _super);\r\n\t function GameView() {\r\n\t var _this = _super.call(this) || this;\r\n\t _this.nowPercentage = 0;\r\n\t _this.goodsItems = [];\r\n\t _this._touchEnabled = true;\r\n\t _this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);\r\n\t return _this;\r\n\t }\r\n\t GameView.prototype.setup = function () {\r\n\t if (this._hasSetup) {\r\n\t return;\r\n\t }\r\n\t this._hasSetup = true;\r\n\t this.pickTeaBg = new engine.Container();\r\n\t this.addChild(this.pickTeaBg);\r\n\t this.teaHalfImg = new engine.Image();\r\n\t this.paperBasketSvga = createSvga(\"采茶童-纸篮子\");\r\n\t this.clothBasketSvga = createSvga(\"采茶童-布篮子\");\r\n\t this.bambooBasketSvga = createSvga(\"采茶童-竹编篮\");\r\n\t this.woodBasketSvga = createSvga(\"采茶童-木篮子\");\r\n\t this.addOneSvga = createSvga(\"+1\");\r\n\t this.pickTeaSvga = createSvga(\"采茶叶\");\r\n\t this.teaSkyUpSvga = createSvga(\"茶叶向上飞\");\r\n\t this.handGraspSvga = createSvga(\"手抓去\");\r\n\t this.frontImg = new engine.Image(getTextureByName('前景'));\r\n\t this.pickTeaBg.addChild(this.paperBasketSvga);\r\n\t this.pickTeaBg.addChild(this.clothBasketSvga);\r\n\t this.pickTeaBg.addChild(this.bambooBasketSvga);\r\n\t this.pickTeaBg.addChild(this.woodBasketSvga);\r\n\t this.pickTeaBg.addChild(this.pickTeaSvga);\r\n\t this.pickTeaBg.addChild(this.teaSkyUpSvga);\r\n\t this.basketSvgaGroup = [this.paperBasketSvga, this.clothBasketSvga, this.bambooBasketSvga, this.woodBasketSvga];\r\n\t this.progressbarBgImg = new engine.Image(getTextureByName('进度条底框'));\r\n\t this.progressbarImg = new engine.Image(getTextureByName('进度'));\r\n\t this.teaHalfFlagImg = new engine.Image(getTextureByName('茶叶进度缺'));\r\n\t this.teaFullFlagImg = new engine.Image(getTextureByName('茶叶进度满'));\r\n\t this.teaStarImg = new engine.Image(getTextureByName('小茶叶'));\r\n\t this.verseImg = new engine.Image(getTextureByName('气泡框'));\r\n\t this.pickTeaBg.addChild(this.verseImg);\r\n\t var mask = new engine.Rect();\r\n\t mask.width = 600;\r\n\t mask.height = 50;\r\n\t mask.x = 10;\r\n\t mask.y = 0;\r\n\t mask.alpha = 1;\r\n\t this.progressbarImg.mask = mask;\r\n\t showLog(this.progressbarImg.mask);\r\n\t this.addChild(this.frontImg);\r\n\t this.progressbarBgImg.addChild(this.progressbarImg);\r\n\t this.progressbarBgImg.addChild(mask);\r\n\t this.progressbarBgImg.addChild(this.addOneSvga);\r\n\t this.progressbarBgImg.addChild(this.handGraspSvga);\r\n\t this.progressbarBgImg.addChild(this.teaHalfFlagImg);\r\n\t this.progressbarBgImg.addChild(this.teaFullFlagImg);\r\n\t this.progressbarBgImg.addChild(this.teaStarImg);\r\n\t this.pickTeaCount = new engine.Label();\r\n\t this.progressbarBgImg.addChild(this.pickTeaCount);\r\n\t this.addChild(this.progressbarBgImg);\r\n\t this.initView();\r\n\t };\r\n\t GameView.prototype.reset = function () {\r\n\t this.initView();\r\n\t };\r\n\t GameView.prototype.start = function () {\r\n\t };\r\n\t GameView.prototype.pause = function () {\r\n\t this.gameIng = false;\r\n\t };\r\n\t GameView.prototype.revive = function () {\r\n\t this.gameIng = true;\r\n\t };\r\n\t GameView.prototype.resume = function () {\r\n\t this.reset();\r\n\t this.start();\r\n\t };\r\n\t GameView.prototype.initView = function () {\r\n\t this.pickTeaBg.mouseEnabled = false;\r\n\t this.teaHalfImg.visible = false;\r\n\t this.pickTeaSvga.visible = false;\r\n\t this.teaSkyUpSvga.visible = false;\r\n\t this.verseImg.visible = false;\r\n\t this.frontImg.visible = props.showFrontImg == 1;\r\n\t this.initChildrenPos();\r\n\t };\r\n\t GameView.prototype.initChildrenPos = function () {\r\n\t for (var i = 0; i < this.basketSvgaGroup.length; i++) {\r\n\t this.basketSvgaGroup[i].visible = false;\r\n\t this.basketSvgaGroup[i].x = props.basketSvgaPos[0];\r\n\t this.basketSvgaGroup[i].y = props.basketSvgaPos[1];\r\n\t }\r\n\t this.verseImg.x = props.versePos[0];\r\n\t this.verseImg.y = props.versePos[1];\r\n\t this.addOneSvga.x = props.addOneSvgaPos[0];\r\n\t this.addOneSvga.y = props.addOneSvgaPos[1];\r\n\t this.pickTeaSvga.x = props.pickTeaSvgaPos[0];\r\n\t this.pickTeaSvga.y = props.pickTeaSvgaPos[1];\r\n\t this.teaSkyUpSvga.x = props.teaSkyUpSvgaPos[0];\r\n\t this.teaSkyUpSvga.y = props.teaSkyUpSvgaPos[1];\r\n\t this.handGraspSvga.x = props.handGraspSvgaPos[0];\r\n\t this.handGraspSvga.y = props.handGraspSvgaPos[1];\r\n\t this.progressbarBgImg.x = props.progressbarBgImgPos[0];\r\n\t this.progressbarBgImg.y = props.progressbarBgImgPos[1];\r\n\t this.progressbarImg.x = props.progressbarImgPos[0];\r\n\t this.progressbarImg.y = props.progressbarImgPos[1];\r\n\t this.teaHalfFlagImg.x = props.teaHalfFlagImgPos[0];\r\n\t this.teaHalfFlagImg.y = props.teaHalfFlagImgPos[1];\r\n\t this.teaHalfFlagImg.anchorX = this.teaHalfFlagImg.width / 2;\r\n\t this.teaHalfFlagImg.anchorY = this.teaHalfFlagImg.height / 2;\r\n\t this.teaFullFlagImg.x = props.teaHalfFlagImgPos[0];\r\n\t this.teaFullFlagImg.y = props.teaHalfFlagImgPos[1];\r\n\t this.frontImg.x = props.FrontImgPos[0];\r\n\t this.frontImg.y = props.FrontImgPos[1];\r\n\t this.teaFullFlagImg.visible = false;\r\n\t this.teaStarImg.x = props.teaStarImgPos[0];\r\n\t this.teaStarImg.y = props.teaStarImgPos[1];\r\n\t this.pickTeaCount.fillColor = 'white';\r\n\t this.pickTeaCount.size = 30;\r\n\t this.pickTeaCount.text = '';\r\n\t this.pickTeaCount.x = props.pickTeaCountPos[0];\r\n\t this.pickTeaCount.y = props.pickTeaCountPos[1];\r\n\t this.pickTeaCount.height = 50;\r\n\t this.pickTeaCount.width = 200;\r\n\t this.verseLabel = new engine.TextField();\r\n\t this.verseLabel.size = props.verseLabel[2];\r\n\t this.verseLabel.text = '';\r\n\t this.verseLabel.fillColor = props.verseColor[0];\r\n\t this.verseLabel.height = props.verseLabel[1];\r\n\t this.verseLabel.width = props.verseLabel[0];\r\n\t this.verseLabel.strokeColor = props.verseColor[1];\r\n\t this.verseLabel.stroke = 0.5;\r\n\t this.verseLabel.y = 15;\r\n\t this.verseLabel['textHeight'] = 14;\r\n\t this.verseLabel.textAlign = engine.TEXT_ALIGN.CENTER;\r\n\t this.verseImg.visible = false;\r\n\t this.verseImg.addChild(this.verseLabel);\r\n\t };\r\n\t GameView.prototype.showVerse = function () {\r\n\t var _this = this;\r\n\t this.verseImg.visible = true;\r\n\t var len = props.verses.length;\r\n\t var random = Math.floor(Math.random() * len);\r\n\t var verse = props.verses[random];\r\n\t this.verseLabel.text = verse;\r\n\t var y = this.verseImg.y;\r\n\t engine.Tween.get(this.verseImg)\r\n\t .to({ alpha: 0 }, 3000).call(function () {\r\n\t _this.verseImg.visible = false;\r\n\t _this.verseImg.alpha = 1;\r\n\t });\r\n\t };\r\n\t GameView.prototype.setTeaNum = function (TeaNums) {\r\n\t var _this = this;\r\n\t if (this.schedule) {\r\n\t clearInterval(this.schedule);\r\n\t }\r\n\t var totalNum = TeaNums.totalNum;\r\n\t var nowNum = TeaNums.nowNum;\r\n\t this.getTeaPercentage(nowNum, totalNum);\r\n\t var surplus = nowNum - totalNum;\r\n\t if (surplus == 0) {\r\n\t this.gotoMaxLength();\r\n\t return;\r\n\t }\r\n\t var width = this.progressbarImg.width;\r\n\t var myDate = new Date();\r\n\t var nowData = myDate.getTime();\r\n\t var serverData = TeaNums.serverData;\r\n\t var fbdvalue = Math.abs((nowData - serverData));\r\n\t var dataDiff = 0;\r\n\t var x = -width * (1 - (nowNum / totalNum));\r\n\t showLog('原先的X:', this.progressbarImg.x);\r\n\t this.progressbarImg.x = parseFloat(x.toFixed(5)) + this.teaFullFlagImg.width - Math.abs(this.teaFullFlagImg.x);\r\n\t showLog('减去长款的x', this.progressbarImg.x);\r\n\t showLog('this.teaFullFlagImg.width', this.teaFullFlagImg.width);\r\n\t if (this.progressbarImg.x > (this.teaFullFlagImg.width / 2)) {\r\n\t var minus = this.teaFullFlagImg.width - Math.abs(this.teaFullFlagImg.x) - this.progressbarImg.x;\r\n\t this.progressbarImg.x = this.progressbarImg.x - this.teaFullFlagImg.width / 2 + Math.abs(this.teaFullFlagImg.x);\r\n\t showLog('负段x重组', this.progressbarImg.x);\r\n\t }\r\n\t showLog('补宽的X', this.progressbarImg.x);\r\n\t showLog('this.progressbarImg.x', this.progressbarImg.x);\r\n\t var step = (this.teaFullFlagImg.width / 2 - this.progressbarImg.x) / surplus;\r\n\t var speed = props.pickTeaSpeed;\r\n\t if (!this.teaFullRotation) {\r\n\t this.teaFullRotation = engine.Tween.get(this.teaHalfFlagImg, { loop: true })\r\n\t .to({ rotation: 360 }, speed).call(function () {\r\n\t _this.teaHalfFlagImg.rotation = 0;\r\n\t });\r\n\t }\r\n\t engine.Tween.resumeTweens(this.teaFullRotation);\r\n\t this.schedule = setInterval(function () {\r\n\t nowNum++;\r\n\t _this.addOneSvga.play(1, true);\r\n\t if (nowNum == totalNum) {\r\n\t _this.gotoMaxLength();\r\n\t engine.Tween.pauseTweens(_this.teaFullRotation);\r\n\t }\r\n\t if (_this.progressbarImg.x < _this.teaFullFlagImg.width / 2) {\r\n\t _this.progressbarImg.x -= step;\r\n\t }\r\n\t _this.getTeaPercentage(nowNum, totalNum);\r\n\t dataDiff += speed;\r\n\t myDate = new Date();\r\n\t nowData = myDate.getTime();\r\n\t if (Math.abs((nowData - serverData)) - dataDiff > (fbdvalue + 3000)) {\r\n\t showLog(_this.schedule);\r\n\t clearInterval(_this.schedule);\r\n\t engine.Tween.pauseTweens(_this.teaFullRotation);\r\n\t engine.globalEvent.dispatchEvent('event-setchange-TeaNum');\r\n\t _this.addOneSvga.visible = false;\r\n\t _this.addOneSvga.stop();\r\n\t return;\r\n\t }\r\n\t }, speed);\r\n\t };\r\n\t GameView.prototype.getTeaPercentage = function (nowNum, totalNum) {\r\n\t if (nowNum > totalNum) {\r\n\t return;\r\n\t }\r\n\t this.pickTeaCount.text = nowNum + '/' + totalNum;\r\n\t var teaPercentage = 2;\r\n\t var portion = totalNum / 3;\r\n\t if (nowNum < portion) {\r\n\t return;\r\n\t }\r\n\t if (nowNum < (portion * 2)) {\r\n\t teaPercentage = 1;\r\n\t }\r\n\t if (this.nowPercentage != teaPercentage) {\r\n\t this.nowPercentage = teaPercentage;\r\n\t this.updateTeaPercentage(teaPercentage);\r\n\t }\r\n\t };\r\n\t GameView.prototype.gotoMaxLength = function () {\r\n\t if (this.schedule) {\r\n\t clearInterval(this.schedule);\r\n\t }\r\n\t this.progressbarImg.x = this.teaFullFlagImg.width / 2;\r\n\t this.teaHalfFlagImg.visible = false;\r\n\t this.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible;\r\n\t this.addOneSvga.visible = this.teaHalfFlagImg.visible;\r\n\t this.addOneSvga.stop();\r\n\t };\r\n\t GameView.prototype.updateTeaPercentage = function (teaPercentage) {\r\n\t if (teaPercentage === void 0) { teaPercentage = 0; }\r\n\t var pickTeaSVGA = this.basketSvgaGroup[1];\r\n\t pickTeaSVGA.removeChildAt(10);\r\n\t var originframes = pickTeaSVGA.children[7];\r\n\t if (!originframes) {\r\n\t return;\r\n\t }\r\n\t var teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));\r\n\t if (teaPercentage == 1) {\r\n\t this.teaHalfImg = new engine.Image(getTextureByName('茶叶-少'));\r\n\t }\r\n\t else if (teaPercentage == 2) {\r\n\t this.teaHalfImg = new engine.Image(getTextureByName('茶叶-满'));\r\n\t }\r\n\t this.teaHalfImg.visible = false;\r\n\t this.teaHalfImg['frames'] = teaBucketframes;\r\n\t pickTeaSVGA.addChildAt(this.teaHalfImg, 10);\r\n\t };\r\n\t GameView.prototype.setPickTeaLevel = function (level) {\r\n\t var _this = this;\r\n\t var pickTeaSVGA = this.basketSvgaGroup[level];\r\n\t pickTeaSVGA.visible = true;\r\n\t setTimeout(function () {\r\n\t var originframes = pickTeaSVGA.children[7];\r\n\t var teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));\r\n\t if (_this.teaHalfImg) {\r\n\t _this.teaHalfImg['frames'] = teaBucketframes;\r\n\t }\r\n\t showLog(_this.teaHalfImg);\r\n\t pickTeaSVGA.addChildAt(_this.teaHalfImg, 10);\r\n\t pickTeaSVGA.gotoAndPlay(1, true);\r\n\t }, 300);\r\n\t };\r\n\t GameView.prototype.handGrasp = function () {\r\n\t var that = this;\r\n\t setTimeout(function () {\r\n\t engine.Tween.get(that.handGraspSvga)\r\n\t .to({ x: props.handGraspMovePos[0], y: props.handGraspMovePos[1] }, 400).call(function () {\r\n\t that.handGraspSvga.play(1, true);\r\n\t setTimeout(function () {\r\n\t that.handGraspSvga.stop();\r\n\t that.handGraspSvga.x = props.handGraspSvgaPos[0];\r\n\t that.handGraspSvga.y = props.handGraspSvgaPos[1];\r\n\t }, 600);\r\n\t that.pickTeaSvga.visible = true;\r\n\t that.pickTeaSvga.play(1, false);\r\n\t });\r\n\t that.pickTeaSvga.addEventListener(engine.Event.END_FRAME, function () {\r\n\t that.teaSkyUpSvga.visible = true;\r\n\t that.teaSkyUpSvga.play(1, false);\r\n\t });\r\n\t that.teaSkyUpSvga.addEventListener(engine.Event.END_FRAME, function () {\r\n\t that.teaSkyUpSvga.visible = false;\r\n\t that.updateTeaPercentage(0);\r\n\t });\r\n\t }, 500);\r\n\t };\r\n\t return GameView;\r\n\t}(engine.Container));\r\n\t//# sourceMappingURL=GameView.js.map\n\n\tvar GameWrapper = (function (_super) {\r\n\t tslib.__extends(GameWrapper, _super);\r\n\t function GameWrapper() {\r\n\t var _this = _super.call(this) || this;\r\n\t engine.globalEvent.addEventListener('event-pickTeaGame-init', _this.reset, _this);\r\n\t engine.globalEvent.addEventListener('event-hand-grasp', _this.handGrasp, _this);\r\n\t engine.globalEvent.addEventListener('event-getClick-person', _this.clickPerson, _this);\r\n\t engine.globalEvent.addEventListener('event-getchange-TeaNum', _this.setTeaNum, _this);\r\n\t engine.globalEvent.addEventListener('event-getBasket-Type', _this.setPickTeaLevel, _this);\r\n\t var gameView = _this._gameView = new GameView();\r\n\t _this.addChild(gameView);\r\n\t return _this;\r\n\t }\r\n\t GameWrapper.prototype.setTeaNum = function (event) {\r\n\t injectProps(event.data);\r\n\t this._gameView.setTeaNum(event.data);\r\n\t };\r\n\t GameWrapper.prototype.setPickTeaLevel = function (event) {\r\n\t injectProps(event.data);\r\n\t this._gameView.setPickTeaLevel(event.data);\r\n\t };\r\n\t GameWrapper.prototype.handGrasp = function () {\r\n\t this._gameView.handGrasp();\r\n\t };\r\n\t GameWrapper.prototype.clickPerson = function () {\r\n\t this._gameView.showVerse();\r\n\t };\r\n\t GameWrapper.prototype.reset = function (event) {\r\n\t injectProps(event.data);\r\n\t this._gameView.visible = true;\r\n\t this._gameView.reset();\r\n\t };\r\n\t GameWrapper.prototype.start = function (event) {\r\n\t injectProps(event.data);\r\n\t this._status = 1;\r\n\t this._gameView.start();\r\n\t };\r\n\t GameWrapper.prototype.pause = function () {\r\n\t this._gameView.pause();\r\n\t };\r\n\t GameWrapper.prototype.resume = function () {\r\n\t this._gameView.resume();\r\n\t };\r\n\t GameWrapper.prototype.revive = function () {\r\n\t this._gameView.revive();\r\n\t };\r\n\t GameWrapper.prototype.clear = function () {\r\n\t this._gameView.visible = false;\r\n\t };\r\n\t GameWrapper.prototype.onTap = function (event) {\r\n\t };\r\n\t return GameWrapper;\r\n\t}(engine.Container));\r\n\t//# sourceMappingURL=GameWrapper.js.map\n\n\tfunction index (props) {\r\n\t prepareProps();\r\n\t injectProps(props);\r\n\t var instance = new GameWrapper();\r\n\t return instance;\r\n\t}\r\n\t//# sourceMappingURL=index.js.map\n\n\treturn index;\n\n})));\n"
}
/**
* 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;
}
function showLog(abjname, obj) {
}
//# sourceMappingURL=utils.js.map
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 () {
if (this._hasSetup) {
return;
}
this._hasSetup = true;
this.pickTeaBg = new engine.Container();
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.frontImg = new engine.Image(getTextureByName('前景'));
this.pickTeaBg.addChild(this.paperBasketSvga);
this.pickTeaBg.addChild(this.clothBasketSvga);
this.pickTeaBg.addChild(this.bambooBasketSvga);
this.pickTeaBg.addChild(this.woodBasketSvga);
this.pickTeaBg.addChild(this.pickTeaSvga);
this.pickTeaBg.addChild(this.teaSkyUpSvga);
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;
showLog(this.progressbarImg.mask);
this.addChild(this.frontImg);
this.progressbarBgImg.addChild(this.progressbarImg);
this.progressbarBgImg.addChild(mask);
this.progressbarBgImg.addChild(this.addOneSvga);
this.progressbarBgImg.addChild(this.handGraspSvga);
this.progressbarBgImg.addChild(this.teaHalfFlagImg);
this.progressbarBgImg.addChild(this.teaFullFlagImg);
this.progressbarBgImg.addChild(this.teaStarImg);
this.pickTeaCount = new engine.Label();
this.progressbarBgImg.addChild(this.pickTeaCount);
this.addChild(this.progressbarBgImg);
this.initView();
};
GameView.prototype.reset = function () {
this.initView();
};
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.frontImg.visible = props.showFrontImg == 1;
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.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.frontImg.x = props.FrontImgPos[0];
this.frontImg.y = props.FrontImgPos[1];
this.teaFullFlagImg.visible = false;
this.teaStarImg.x = props.teaStarImgPos[0];
this.teaStarImg.y = props.teaStarImgPos[1];
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 = '';
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 () {
var _this = this;
this.verseImg.visible = true;
var len = props.verses.length;
var random = Math.floor(Math.random() * len);
var verse = props.verses[random];
this.verseLabel.text = verse;
var y = this.verseImg.y;
engine.Tween.get(this.verseImg)
.to({ alpha: 0 }, 3000).call(function () {
_this.verseImg.visible = false;
_this.verseImg.alpha = 1;
});
};
GameView.prototype.setTeaNum = function (TeaNums) {
var _this = this;
if (this.schedule) {
clearInterval(this.schedule);
}
var totalNum = TeaNums.totalNum;
var nowNum = TeaNums.nowNum;
this.getTeaPercentage(nowNum, totalNum);
var surplus = nowNum - totalNum;
if (surplus == 0) {
this.gotoMaxLength();
return;
}
var width = this.progressbarImg.width;
var myDate = new Date();
var nowData = myDate.getTime();
var serverData = TeaNums.serverData;
var fbdvalue = Math.abs((nowData - serverData));
var dataDiff = 0;
var x = -width * (1 - (nowNum / totalNum));
showLog('原先的X:', this.progressbarImg.x);
this.progressbarImg.x = parseFloat(x.toFixed(5)) + this.teaFullFlagImg.width - Math.abs(this.teaFullFlagImg.x);
showLog('减去长款的x', this.progressbarImg.x);
showLog('this.teaFullFlagImg.width', this.teaFullFlagImg.width);
if (this.progressbarImg.x > (this.teaFullFlagImg.width / 2)) {
var minus = this.teaFullFlagImg.width - Math.abs(this.teaFullFlagImg.x) - this.progressbarImg.x;
this.progressbarImg.x = this.progressbarImg.x - this.teaFullFlagImg.width / 2 + Math.abs(this.teaFullFlagImg.x);
showLog('负段x重组', this.progressbarImg.x);
}
showLog('补宽的X', this.progressbarImg.x);
showLog('this.progressbarImg.x', this.progressbarImg.x);
var step = (this.teaFullFlagImg.width / 2 - this.progressbarImg.x) / surplus;
var speed = props.pickTeaSpeed;
if (!this.teaFullRotation) {
this.teaFullRotation = engine.Tween.get(this.teaHalfFlagImg, { loop: true })
.to({ rotation: 360 }, speed).call(function () {
_this.teaHalfFlagImg.rotation = 0;
});
}
engine.Tween.resumeTweens(this.teaFullRotation);
this.schedule = setInterval(function () {
nowNum++;
_this.addOneSvga.play(1, true);
if (nowNum == totalNum) {
_this.gotoMaxLength();
engine.Tween.pauseTweens(_this.teaFullRotation);
}
if (_this.progressbarImg.x < _this.teaFullFlagImg.width / 2) {
_this.progressbarImg.x -= step;
}
_this.getTeaPercentage(nowNum, totalNum);
dataDiff += speed;
myDate = new Date();
nowData = myDate.getTime();
if (Math.abs((nowData - serverData)) - dataDiff > (fbdvalue + 3000)) {
showLog(_this.schedule);
clearInterval(_this.schedule);
engine.Tween.pauseTweens(_this.teaFullRotation);
engine.globalEvent.dispatchEvent('event-setchange-TeaNum');
_this.addOneSvga.visible = false;
_this.addOneSvga.stop();
return;
}
}, speed);
};
GameView.prototype.getTeaPercentage = function (nowNum, totalNum) {
if (nowNum > totalNum) {
return;
}
this.pickTeaCount.text = nowNum + '/' + totalNum;
var teaPercentage = 2;
var portion = totalNum / 3;
if (nowNum < portion) {
return;
}
if (nowNum < (portion * 2)) {
teaPercentage = 1;
}
if (this.nowPercentage != teaPercentage) {
this.nowPercentage = teaPercentage;
this.updateTeaPercentage(teaPercentage);
}
};
GameView.prototype.gotoMaxLength = function () {
if (this.schedule) {
clearInterval(this.schedule);
}
this.progressbarImg.x = this.teaFullFlagImg.width / 2;
this.teaHalfFlagImg.visible = false;
this.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible;
this.addOneSvga.visible = this.teaHalfFlagImg.visible;
this.addOneSvga.stop();
};
GameView.prototype.updateTeaPercentage = function (teaPercentage) {
if (teaPercentage === void 0) { teaPercentage = 0; }
var pickTeaSVGA = this.basketSvgaGroup[1];
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;
pickTeaSVGA.addChildAt(this.teaHalfImg, 10);
};
GameView.prototype.setPickTeaLevel = function (level) {
var _this = this;
var pickTeaSVGA = this.basketSvgaGroup[level];
pickTeaSVGA.visible = true;
setTimeout(function () {
var originframes = pickTeaSVGA.children[7];
var teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));
if (_this.teaHalfImg) {
_this.teaHalfImg['frames'] = teaBucketframes;
}
showLog(_this.teaHalfImg);
pickTeaSVGA.addChildAt(_this.teaHalfImg, 10);
pickTeaSVGA.gotoAndPlay(1, true);
}, 300);
};
GameView.prototype.handGrasp = function () {
var that = this;
setTimeout(function () {
engine.Tween.get(that.handGraspSvga)
.to({ x: props.handGraspMovePos[0], y: props.handGraspMovePos[1] }, 400).call(function () {
that.handGraspSvga.play(1, true);
setTimeout(function () {
that.handGraspSvga.stop();
that.handGraspSvga.x = props.handGraspSvgaPos[0];
that.handGraspSvga.y = props.handGraspSvgaPos[1];
}, 600);
that.pickTeaSvga.visible = true;
that.pickTeaSvga.play(1, false);
});
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;
that.updateTeaPercentage(0);
});
}, 500);
};
return GameView;
}(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super);
function GameWrapper() {
var _this = _super.call(this) || this;
engine.globalEvent.addEventListener('event-pickTeaGame-init', _this.reset, _this);
engine.globalEvent.addEventListener('event-hand-grasp', _this.handGrasp, _this);
engine.globalEvent.addEventListener('event-getClick-person', _this.clickPerson, _this);
engine.globalEvent.addEventListener('event-getchange-TeaNum', _this.setTeaNum, _this);
engine.globalEvent.addEventListener('event-getBasket-Type', _this.setPickTeaLevel, _this);
var gameView = _this._gameView = new GameView();
_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.handGrasp = function () {
this._gameView.handGrasp();
};
GameWrapper.prototype.clickPerson = function () {
this._gameView.showVerse();
};
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.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/GameView.ts","src/custom/pick-tea/src/game/GameWrapper.ts","src/custom/pick-tea/src/index.ts"],"sourcesContent":["/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\n\r\nexport let props: any = {};\r\n\r\nexport function prepareProps() {\r\n\tlet metaProps = getProps();\r\n\r\n\tengine.injectProp(props, metaProps);\r\n}\r\n\r\nexport function injectProps(p) {\r\n\tengine.injectProp(props, p);\r\n}\r\n","/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\nconst showlog = false;\r\nexport function getTexture(uuid) {\r\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\r\n}\r\n\r\nexport function getTextureByName(name) {\r\n\treturn getTexture(engine.getAssetByName(name).uuid);\r\n}\r\n\r\nexport function playSound(name) {\r\n\tengine.playSound(engine.getAssetByName(name).uuid, { keep: true });\r\n}\r\nexport function createSvga(name, anchorName?) {\r\n\tlet inst = new svga.Svga();\r\n\tinst.source = 'asset://' + engine.getAssetByName(name).uuid;\r\n\treturn inst;\r\n}\r\nexport function showLog(abjname, obj?) {\r\n\tif (showlog) {\r\n\t\tconsole.log(abjname)\r\n\t\tif (obj)\r\n\t\t\tconsole.log(obj)\r\n\t}\r\n\t// let inst = new svga.Svga();\r\n\t// inst.source = 'asset://' + engine.getAssetByName(name).uuid;\r\n\t// return inst;\r\n}","/**\r\n * Created by rockyl on 2018/8/16.\r\n */\r\n\r\nimport { props } from \"../props\";\r\nimport { playSound, createSvga } from \"./utils\";\r\nimport ObjectPool = engine.ObjectPool;\r\nimport { getTextureByName } from \"./utils\";\r\nimport { showLog } from \"./utils\";\r\nimport { Tealeaf } from \"./Tealeaf\";\r\n\r\n\r\nconst MAXX = -8;\r\nexport default class GameView extends engine.Container {\r\n\r\n\tprivate _hasSetup;\r\n\r\n\t/**采茶叶自定义模块*/\r\n\tprivate teaImgSource: any;\r\n\tprivate tealeaf: Tealeaf;\r\n\tprivate teaHalfImg: engine.Image;\r\n\tprivate nowPercentage: any = 0;\r\n\tprivate progressbarBgImg: engine.Image;\r\n\tprivate progressbarImg: engine.Image;\r\n\tprivate teaFullFlagImg: engine.Image;\r\n\tprivate teaHalfFlagImg: engine.Image;\r\n\tprivate teaStarImg: engine.Image;\r\n\tprivate frontImg: engine.Image;\r\n\tprivate verseImg: engine.Image;\r\n\t//采茶背景层\r\n\tprivate pickTeaBg: engine.Container;\r\n\t//采茶进度计时器\r\n\tprivate pickTeaTimer: any\r\n\t//茶叶的数量进度 100/240\r\n\tprivate pickTeaCount: engine.Label;\r\n\t//语句\r\n\tprivate verseLabel: engine.TextField;\r\n\t//篮子集合\r\n\tprivate basketSvgaGroup: any;\r\n\r\n\t//纸篮子svga\r\n\tprivate paperBasketSvga\r\n\t//布篮子svga\r\n\tprivate clothBasketSvga\r\n\t//竹篮子svga\r\n\tprivate bambooBasketSvga\r\n\t//木篮子svga\r\n\tprivate woodBasketSvga\r\n\t//+1\r\n\tprivate addOneSvga\r\n\t//采茶叶\r\n\tprivate pickTeaSvga\r\n\t//茶叶向上飞\r\n\tprivate teaSkyUpSvga\r\n\t//手抓去\r\n\tprivate handGraspSvga\r\n\t//半缺旋转\r\n\tprivate teaFullRotation\r\n\r\n\r\n\t/**采茶叶自定义模块*/\r\n\r\n\t//玩家\r\n\tprivate player: engine.Container;\r\n\r\n\t//触摸层\r\n\tprivate rectBg: engine.Rect;\r\n\t//npc层\r\n\t//private NpcBg: engine.Container;\r\n\r\n\t//当前分数\r\n\tprivate score\r\n\t//游戏状态\r\n\tprivate gameIng;\r\n\t//npc出身计时器\r\n\tprivate timer\r\n\t//倒计时计时器\r\n\tprivate countdownTimer: any\r\n\t//倒计时\r\n\tprivate countdown: number\r\n\t//当前速度\r\n\tprivate speed: number\r\n\r\n\tprivate schedule: any\r\n\t// 当前场景上面的物品\r\n\tprivate goodsItems = []\r\n\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\r\n\t}\r\n\r\n\tprivate waterSvga\r\n\tprivate boomSvga\r\n\tprivate playerSvga\r\n\tprivate _touchEnabled = true\r\n\tsetup() {\r\n\t\tif (this._hasSetup) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis._hasSetup = true;\r\n\t\tthis.pickTeaBg = new engine.Container();\r\n\r\n\t\t// let bgGroud = new engine.Image()\r\n\t\t// bgGroud.source = '//yun.duiba.com.cn/aurora/assets/a988c47db8d3131faad175c7c2944773392be643.png'\r\n\t\t// this.addChild(bgGroud);\r\n\r\n\t\tthis.addChild(this.pickTeaBg);\r\n\t\tthis.teaHalfImg = new engine.Image();\r\n\r\n\t\tthis.paperBasketSvga = createSvga(\"采茶童-纸篮子\");\r\n\t\tthis.clothBasketSvga = createSvga(\"采茶童-布篮子\");\r\n\t\tthis.bambooBasketSvga = createSvga(\"采茶童-竹编篮\");\r\n\t\tthis.woodBasketSvga = createSvga(\"采茶童-木篮子\");\r\n\t\tthis.addOneSvga = createSvga(\"+1\");\r\n\t\tthis.pickTeaSvga = createSvga(\"采茶叶\");\r\n\r\n\t\tthis.teaSkyUpSvga = createSvga(\"茶叶向上飞\");\r\n\t\tthis.handGraspSvga = createSvga(\"手抓去\");\r\n\r\n\t\tthis.frontImg = new engine.Image(getTextureByName('前景'));\r\n\r\n\t\tthis.pickTeaBg.addChild(this.paperBasketSvga);\r\n\t\tthis.pickTeaBg.addChild(this.clothBasketSvga);\r\n\t\tthis.pickTeaBg.addChild(this.bambooBasketSvga);\r\n\t\tthis.pickTeaBg.addChild(this.woodBasketSvga);\r\n\t\t//this.pickTeaBg.addChild(this.addOneSvga);\r\n\t\tthis.pickTeaBg.addChild(this.pickTeaSvga);\r\n\t\tthis.pickTeaBg.addChild(this.teaSkyUpSvga);\r\n\t\t//this.pickTeaBg.addChild(this.handGraspSvga);\r\n\t\tthis.basketSvgaGroup = [this.paperBasketSvga, this.clothBasketSvga, this.bambooBasketSvga, this.woodBasketSvga]\r\n\r\n\t\tthis.progressbarBgImg = new engine.Image(getTextureByName('进度条底框'));\r\n\t\tthis.progressbarImg = new engine.Image(getTextureByName('进度'));\r\n\t\tthis.teaHalfFlagImg = new engine.Image(getTextureByName('茶叶进度缺'));\r\n\t\tthis.teaFullFlagImg = new engine.Image(getTextureByName('茶叶进度满'));\r\n\t\tthis.teaStarImg = new engine.Image(getTextureByName('小茶叶'));\r\n\r\n\r\n\t\tthis.verseImg = new engine.Image(getTextureByName('气泡框'));\r\n\t\tthis.pickTeaBg.addChild(this.verseImg);\r\n\r\n\r\n\t\tlet mask = new engine.Rect();\r\n\t\tmask.width = 600;\r\n\t\tmask.height = 50;\r\n\t\tmask.x = 10;\r\n\t\tmask.y = 0;\r\n\t\tmask.alpha = 1;\r\n\r\n\t\tthis.progressbarImg.mask = mask\r\n\t\tshowLog(this.progressbarImg.mask)\r\n\r\n\t\tthis.addChild(this.frontImg);\r\n\r\n\t\tthis.progressbarBgImg.addChild(this.progressbarImg);\r\n\r\n\t\tthis.progressbarBgImg.addChild(mask);\r\n\t\tshowLog('遮罩坐标')\r\n\t\tshowLog(mask.x, mask.y)\r\n\t\tthis.progressbarBgImg.addChild(this.addOneSvga);\r\n\t\tthis.progressbarBgImg.addChild(this.handGraspSvga);\r\n\r\n\t\tthis.progressbarBgImg.addChild(this.teaHalfFlagImg);\r\n\t\tthis.progressbarBgImg.addChild(this.teaFullFlagImg);\r\n\t\tthis.progressbarBgImg.addChild(this.teaStarImg);\r\n\t\tthis.pickTeaCount = new engine.Label();\r\n\t\tthis.progressbarBgImg.addChild(this.pickTeaCount);\r\n\r\n\t\tthis.addChild(this.progressbarBgImg);\r\n\t\t// let myDate = new Date();\r\n\t\t// let nowData = myDate.getTime();\r\n\t\t//this.setTeaNum({ totalNum: 430, nowNum: 425, serverData: 1585290768011 })\r\n\t\tthis.initView();\r\n\r\n\t\t// setTimeout(() => {\r\n\t\t// \tthis.setTeaNum({ totalNum: 100, nowNum: 0, serverData: 1585290768011 })\r\n\t\t// \t//this.setTeaNum({ totalNum: 100, nowNum: 0 })\r\n\t\t// }, 500)\r\n\r\n\r\n\t}\r\n\treset() {\r\n\t\tthis.initView()\r\n\t}\r\n\tstart() {\r\n\r\n\t}\r\n\tpause() {\r\n\t\tthis.gameIng = false;\r\n\t}\r\n\trevive() {\r\n\t\tthis.gameIng = true;\r\n\t}\r\n\r\n\tresume() {\r\n\t\tthis.reset();\r\n\t\tthis.start()\r\n\t}\r\n\r\n\tinitView() {\r\n\t\tthis.pickTeaBg.mouseEnabled = false;\r\n\t\tthis.teaHalfImg.visible = false;\r\n\t\t//this.teaHalfImg.source = '';\r\n\t\tthis.pickTeaSvga.visible = false;\r\n\t\tthis.teaSkyUpSvga.visible = false;\r\n\t\tthis.verseImg.visible = false;\r\n\t\tthis.frontImg.visible = props.showFrontImg == 1;\r\n\t\tthis.initChildrenPos()\r\n\t}\r\n\tinitChildrenPos() {\r\n\t\tfor (let i = 0; i < this.basketSvgaGroup.length; i++) {\r\n\t\t\tthis.basketSvgaGroup[i].visible = false\r\n\t\t\tthis.basketSvgaGroup[i].x = props.basketSvgaPos[0];\r\n\t\t\tthis.basketSvgaGroup[i].y = props.basketSvgaPos[1];;\r\n\t\t\t//this.basketSvgaGroup[i].addEventListener(engine.MouseEvent.CLICK, this.showVerse, this);\r\n\t\t}\r\n\t\tthis.verseImg.x = props.versePos[0]\r\n\t\tthis.verseImg.y = props.versePos[1]\r\n\t\tthis.addOneSvga.x = props.addOneSvgaPos[0]\r\n\t\tthis.addOneSvga.y = props.addOneSvgaPos[1];\r\n\t\tthis.pickTeaSvga.x = props.pickTeaSvgaPos[0];\r\n\t\tthis.pickTeaSvga.y = props.pickTeaSvgaPos[1];\r\n\r\n\t\tthis.teaSkyUpSvga.x = props.teaSkyUpSvgaPos[0];\r\n\t\tthis.teaSkyUpSvga.y = props.teaSkyUpSvgaPos[1];\r\n\r\n\t\tthis.handGraspSvga.x = props.handGraspSvgaPos[0];\r\n\t\tthis.handGraspSvga.y = props.handGraspSvgaPos[1];\r\n\r\n\t\tthis.progressbarBgImg.x = props.progressbarBgImgPos[0]\r\n\r\n\t\tthis.progressbarBgImg.y = props.progressbarBgImgPos[1]\r\n\r\n\t\tthis.progressbarImg.x = props.progressbarImgPos[0]\r\n\t\tthis.progressbarImg.y = props.progressbarImgPos[1]\r\n\r\n\t\tthis.teaHalfFlagImg.x = props.teaHalfFlagImgPos[0]\r\n\t\tthis.teaHalfFlagImg.y = props.teaHalfFlagImgPos[1]\r\n\t\tthis.teaHalfFlagImg.anchorX = this.teaHalfFlagImg.width / 2\r\n\t\tthis.teaHalfFlagImg.anchorY = this.teaHalfFlagImg.height / 2\r\n\r\n\t\tthis.teaFullFlagImg.x = props.teaHalfFlagImgPos[0]\r\n\t\tthis.teaFullFlagImg.y = props.teaHalfFlagImgPos[1]\r\n\r\n\t\tthis.frontImg.x = props.FrontImgPos[0]\r\n\t\tthis.frontImg.y = props.FrontImgPos[1]\r\n\r\n\t\tthis.teaFullFlagImg.visible = false;\r\n\r\n\t\tthis.teaStarImg.x = props.teaStarImgPos[0]\r\n\t\tthis.teaStarImg.y = props.teaStarImgPos[1]\r\n\r\n\t\tthis.pickTeaCount.fillColor = 'white';\r\n\t\tthis.pickTeaCount.size = 30;\r\n\t\tthis.pickTeaCount.text = ''\r\n\r\n\t\tthis.pickTeaCount.x = props.pickTeaCountPos[0]\r\n\t\tthis.pickTeaCount.y = props.pickTeaCountPos[1]\r\n\r\n\t\tthis.pickTeaCount.height = 50;\r\n\t\tthis.pickTeaCount.width = 200;\r\n\r\n\t\tthis.verseLabel = new engine.TextField();\r\n\t\tthis.verseLabel.size = props.verseLabel[2];\r\n\t\tthis.verseLabel.text = ''\r\n\t\tthis.verseLabel.fillColor = props.verseColor[0]\r\n\t\tthis.verseLabel.height = props.verseLabel[1];\r\n\t\tthis.verseLabel.width = props.verseLabel[0];\r\n\t\tthis.verseLabel.strokeColor = props.verseColor[1]\r\n\t\tthis.verseLabel.stroke = 0.5;\r\n\r\n\t\tthis.verseLabel.y = 15;\r\n\t\tthis.verseLabel['textHeight'] = 14;\r\n\t\tthis.verseLabel.textAlign = engine.TEXT_ALIGN.CENTER;\r\n\t\tthis.verseImg.visible = false;\r\n\t\tthis.verseImg.addChild(this.verseLabel);\r\n\r\n\t\t// label.x = (width - label.width) / 2;\r\n\t\t// label.y = guideHole.y + guideHole.height + 50;\r\n\t}\r\n\tshowVerse() {\r\n\t\tshowLog('显示诗句')\r\n\t\t// if (!this._touchEnabled) {\r\n\t\t// \treturn;\r\n\t\t// }\r\n\t\t//this._touchEnabled = false;\r\n\t\tthis.verseImg.visible = true;\r\n\t\tlet len = props.verses.length;\r\n\t\tlet random = Math.floor(Math.random() * len);\r\n\t\tshowLog('random', random)\r\n\t\tshowLog('props.verses')\r\n\t\tshowLog(props.verses)\r\n\t\tlet verse = props.verses[random];\r\n\t\tshowLog('verse', verse)\r\n\t\tthis.verseLabel.text = verse;\r\n\t\tlet y = this.verseImg.y\r\n\t\tengine.Tween.get(this.verseImg)\r\n\t\t\t.to({ alpha: 0 }, 3000).call(() => {\r\n\t\t\t\tthis.verseImg.visible = false;\r\n\t\t\t\tthis.verseImg.alpha = 1\r\n\t\t\t})\r\n\t};\r\n\t/*采茶叶活动*/\r\n\t//总量除以当前 小于3分之1 没有树叶 ,3分之1到3分之2一点点树叶 ,大于3分之2满树叶\r\n\tsetTeaNum(TeaNums) {\r\n\t\tif (this.schedule) {\r\n\t\t\tshowLog('清理定时器,重新设置同步')\r\n\t\t\tclearInterval(this.schedule);\r\n\t\t}\r\n\t\tlet totalNum = TeaNums.totalNum;\r\n\t\tlet nowNum = TeaNums.nowNum\r\n\t\tshowLog('nowNum:', nowNum)\r\n\t\tthis.getTeaPercentage(nowNum, totalNum);\r\n\t\tlet surplus = nowNum - totalNum;\r\n\t\tif (surplus == 0) {\r\n\t\t\tthis.gotoMaxLength();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tshowLog('surplus', surplus);\r\n\t\tlet width = this.progressbarImg.width;\r\n\t\tlet myDate = new Date();\r\n\t\tlet nowData = myDate.getTime();\r\n\t\tlet serverData = TeaNums.serverData;\r\n\t\t//前后端本身的差值\r\n\t\tlet fbdvalue = Math.abs((nowData - serverData))\r\n\t\tshowLog('fbdvalue', fbdvalue)\r\n\t\t/**/\r\n\t\t//设置数据校正\r\n\t\t// let serverData = 0;\r\n\t\tlet dataDiff = 0;\r\n\t\t/**/\r\n\t\t//let rate = (443 - width * (1 - nowNum / totalNum))\r\n\t\t//已经走得\r\n\t\tlet x = -width * (1 - (nowNum / totalNum))\r\n\r\n\t\tshowLog('原先的X:', this.progressbarImg.x)\r\n\t\tshowLog('比例后的X', x);\r\n\t\t//showLog('parseFloat(x.toFixed(3))', parseFloat(x.toFixed(5)))\r\n\r\n\t\tthis.progressbarImg.x = parseFloat(x.toFixed(5)) + this.teaFullFlagImg.width - Math.abs(this.teaFullFlagImg.x)\r\n\t\tshowLog('减去长款的x', this.progressbarImg.x)\r\n\t\tshowLog('this.teaFullFlagImg.width', this.teaFullFlagImg.width)\r\n\r\n\t\tif (this.progressbarImg.x > (this.teaFullFlagImg.width / 2)) {\r\n\t\t\tlet minus = this.teaFullFlagImg.width - Math.abs(this.teaFullFlagImg.x) - this.progressbarImg.x\r\n\t\t\tshowLog('minus', minus)\r\n\t\t\tthis.progressbarImg.x = this.progressbarImg.x - this.teaFullFlagImg.width / 2 + Math.abs(this.teaFullFlagImg.x)\r\n\t\t\tshowLog('负段x重组', this.progressbarImg.x)\r\n\t\t}\r\n\r\n\t\tshowLog('补宽的X', this.progressbarImg.x);\r\n\t\tshowLog('this.progressbarImg.x', this.progressbarImg.x)\r\n\t\tlet step = (this.teaFullFlagImg.width / 2 - this.progressbarImg.x) / surplus\r\n\t\tshowLog('step', step)\r\n\t\t//step = parseFloat(step.toFixed(6));\r\n\t\t//showLog('进图条每秒比例step', step)\r\n\t\tlet speed = props.pickTeaSpeed;\r\n\t\tif (!this.teaFullRotation) {\r\n\t\t\tthis.teaFullRotation = engine.Tween.get(this.teaHalfFlagImg, { loop: true })\r\n\t\t\t\t.to({ rotation: 360 }, speed).call(() => {\r\n\t\t\t\t\tthis.teaHalfFlagImg.rotation = 0;\r\n\t\t\t\t})\r\n\t\t}\r\n\t\tengine.Tween.resumeTweens(this.teaFullRotation);\r\n\t\tthis.schedule = setInterval(() => {\r\n\t\t\t//showLog('nowNum', nowNum, 'totalNum', totalNum)\r\n\t\t\tnowNum++;\r\n\t\t\tthis.addOneSvga.play(1, true);\r\n\t\t\tif (nowNum == totalNum) {\r\n\t\t\t\tthis.gotoMaxLength();\r\n\t\t\t\tengine.Tween.pauseTweens(this.teaFullRotation);\r\n\t\t\t}\r\n\t\t\tif (this.progressbarImg.x < this.teaFullFlagImg.width / 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\tdataDiff += speed;\r\n\t\t\tmyDate = new Date();\r\n\t\t\tnowData = myDate.getTime();\r\n\t\t\tif (Math.abs((nowData - serverData)) - dataDiff > (fbdvalue + 3000)) {\r\n\t\t\t\tshowLog('校准数据前后数据偏差过大');\r\n\t\t\t\tshowLog(Math.abs((nowData - serverData)) - dataDiff - (fbdvalue + 3000))\r\n\t\t\t\tshowLog(this.schedule)\r\n\t\t\t\tclearInterval(this.schedule);\r\n\t\t\t\tengine.Tween.pauseTweens(this.teaFullRotation);\r\n\t\t\t\tengine.globalEvent.dispatchEvent('event-setchange-TeaNum');\r\n\t\t\t\tthis.addOneSvga.visible = false;\r\n\t\t\t\tthis.addOneSvga.stop();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}, speed)\r\n\t}\r\n\tgetTeaPercentage(nowNum, totalNum) {\r\n\t\tif (nowNum > totalNum) {\r\n\t\t\treturn;\r\n\t\t}\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\tshowLog('teaPercentage', teaPercentage)\r\n\t\tif (this.nowPercentage != teaPercentage) {\r\n\t\t\tshowLog('状态改变')\r\n\t\t\tthis.nowPercentage = teaPercentage;\r\n\t\t\tthis.updateTeaPercentage(teaPercentage);\r\n\t\t}\r\n\t}\r\n\t//进度条达到最大长度\r\n\tgotoMaxLength() {\r\n\t\tshowLog('达到最大长度');\r\n\t\tif (this.schedule) {\r\n\t\t\tclearInterval(this.schedule);\r\n\t\t}\r\n\t\tthis.progressbarImg.x = this.teaFullFlagImg.width / 2\r\n\t\tthis.teaHalfFlagImg.visible = false;\r\n\t\tthis.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible\r\n\t\tthis.addOneSvga.visible = this.teaHalfFlagImg.visible\r\n\t\tthis.addOneSvga.stop();\r\n\t}\r\n\t//需要更换茶叶数量皮肤\r\n\tupdateTeaPercentage(teaPercentage = 0) {\r\n\t\tshowLog('需要更换茶叶数量皮肤')\r\n\t\tshowLog('延迟500ms')\r\n\t\tlet pickTeaSVGA = this.basketSvgaGroup[1];\r\n\t\tshowLog('pickTeaSVGA')\r\n\t\tshowLog(pickTeaSVGA)\r\n\t\tpickTeaSVGA.removeChildAt(10);\r\n\t\tlet originframes = pickTeaSVGA.children[7];\r\n\t\tif (!originframes) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t//按照采茶叶的多少来 设置茶叶是不是满的图片\r\n\t\tlet teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));\r\n\t\t//let teaNumImg = this.teaHalfImg;\r\n\t\tif (teaPercentage == 1) {\r\n\t\t\tthis.teaHalfImg = new engine.Image(getTextureByName('茶叶-少'));\r\n\t\t}\r\n\t\telse if (teaPercentage == 2) {\r\n\t\t\tthis.teaHalfImg = new engine.Image(getTextureByName('茶叶-满'));\r\n\t\t}\r\n\t\tthis.teaHalfImg.visible = false;\r\n\t\tthis.teaHalfImg['frames'] = teaBucketframes;\r\n\r\n\t\t//showLog('this.teaHalfImg');\r\n\t\t//showLog(this.teaHalfImg);\r\n\t\tpickTeaSVGA.addChildAt(this.teaHalfImg, 10)\r\n\t}\r\n\r\n\tsetPickTeaLevel(level) {\r\n\t\tshowLog('setPickTeaLevel', level);\r\n\t\tlet pickTeaSVGA = this.basketSvgaGroup[level];\r\n\t\tpickTeaSVGA.visible = true;\r\n\t\t//showLog('littleTea url')\r\n\t\t//showLog(this.teaHalfImg['_source'])\r\n\t\t//需要svga缓存结束\r\n\t\tsetTimeout(() => {\r\n\t\t\tshowLog('延迟500ms')\r\n\t\t\tlet originframes = pickTeaSVGA.children[7];\r\n\t\t\t//按照采茶叶的多少来 设置茶叶是不是满的图片\r\n\t\t\tlet teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));\r\n\t\t\t//this.teaHalfImg = //new engine.Image(getTextureByName('茶叶-少'));\r\n\t\t\tif (this.teaHalfImg) {\r\n\t\t\t\t//this.teaHalfImg.source = ''\r\n\t\t\t\tthis.teaHalfImg['frames'] = teaBucketframes;\r\n\t\t\t}\r\n\t\t\tshowLog('this.teaHalfImg');\r\n\t\t\tshowLog(this.teaHalfImg);\r\n\t\t\tpickTeaSVGA.addChildAt(this.teaHalfImg, 10)\r\n\t\t\tpickTeaSVGA.gotoAndPlay(1, true);\r\n\t\t}, 300)\r\n\t}\r\n\thandGrasp() {\r\n\t\tshowLog('handGrasp')\r\n\t\tlet that = this;\r\n\t\tsetTimeout(() => {\r\n\t\t\t//that.handGraspSvga.play(1, true);\r\n\t\t\t// this.pickTeaSvga.play(1, false);\r\n\t\t\t// this.teaSkyUpSvga.play(1, false);\r\n\t\t\tengine.Tween.get(that.handGraspSvga)\r\n\t\t\t\t.to({ x: props.handGraspMovePos[0], y: props.handGraspMovePos[1] }, 400).call(() => {\r\n\t\t\t\t\tshowLog('this.pickTeaSvga.play')\r\n\t\t\t\t\tthat.handGraspSvga.play(1, true);\r\n\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\tthat.handGraspSvga.stop()\r\n\t\t\t\t\t\tthat.handGraspSvga.x = props.handGraspSvgaPos[0];\r\n\t\t\t\t\t\tthat.handGraspSvga.y = props.handGraspSvgaPos[1];\r\n\t\t\t\t\t}, 600)\r\n\t\t\t\t\tthat.pickTeaSvga.visible = true\r\n\t\t\t\t\tthat.pickTeaSvga.play(1, false);\r\n\t\t\t\t})\r\n\r\n\t\t\tthat.pickTeaSvga.addEventListener(engine.Event.END_FRAME, function () {\r\n\t\t\t\tshowLog('this.teaSkyUpSvga.play')\r\n\t\t\t\tthat.teaSkyUpSvga.visible = true\r\n\t\t\t\tthat.teaSkyUpSvga.play(1, false);\r\n\t\t\t})\r\n\r\n\t\t\tthat.teaSkyUpSvga.addEventListener(engine.Event.END_FRAME, function () {\r\n\t\t\t\tthat.teaSkyUpSvga.visible = false;\r\n\t\t\t\tthat.updateTeaPercentage(0);\r\n\t\t\t})\r\n\r\n\t\t}, 500);\r\n\t}\r\n\r\n\t/*采茶叶活动*/\r\n}\r\n","/**\r\n * Created by rockyl on 2020-01-09.\r\n */\r\n\r\nimport GameView from \"./GameView\";\r\nimport { injectProps } from \"../props\";\r\n\r\n\r\nexport class GameWrapper extends engine.Container {\r\n\tprivate _status;\r\n\tprivate _gameView: GameView;\r\n\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\t/*\r\n\t\tevent-pickTeaGame-init //游戏初始化\r\n\t\t//event-wait-uplevel //待升级\r\n\t\tevent-add-oneScore //+1\r\n\t\tevent-pick-tea //采茶叶\r\n\t\tevent-tea-skyup //茶叶向上飞\r\n\t\tevent-hand-grasp //手抓去\r\n\t\tevent-change-TeaNum //茶叶数量 改变svga动画\r\n\t\tevent-getBasket-Type //获得篮子类型\r\n\t\tevent-setBasket-Type //设置篮子类型\r\n\t\t*/\r\n\t\t// event-getchange-TeaNum //茶叶数量{初始值totalNum,总量nowNum} 改变svga动画\r\n\t\t// event-getBasket-Type //获得篮子类型\r\n\t\t// event-hand-grasp //手抓去\r\n\r\n\t\t//event-pickTeaGame-init 游戏初始化\r\n\t\tengine.globalEvent.addEventListener('event-pickTeaGame-init', this.reset, this);\r\n\r\n\t\tengine.globalEvent.addEventListener('event-hand-grasp', this.handGrasp, this);\r\n\t\tengine.globalEvent.addEventListener('event-getClick-person', this.clickPerson, this);\r\n\t\tengine.globalEvent.addEventListener('event-getchange-TeaNum', this.setTeaNum, this);\r\n\t\tengine.globalEvent.addEventListener('event-getBasket-Type', this.setPickTeaLevel, this);\r\n\r\n\r\n\r\n\t\tlet gameView = this._gameView = new GameView();\r\n\t\tthis.addChild(gameView);\r\n\t}\r\n\r\n\t//设置茶叶数量\r\n\tsetTeaNum(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\t\tthis._gameView.setTeaNum(event.data);\r\n\t}\r\n\r\n\t//设置茶蓝等级\r\n\tsetPickTeaLevel(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\t\tthis._gameView.setPickTeaLevel(event.data);\r\n\t}\r\n\t\r\n\thandGrasp() {\r\n\t\tthis._gameView.handGrasp();\r\n\t}\r\n\t//点击人物\r\n\tclickPerson() {\r\n\t\tthis._gameView.showVerse();\r\n\t}\r\n\treset(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\t\tthis._gameView.visible = true;\r\n\t\tthis._gameView.reset();\r\n\t}\r\n\r\n\r\n\tstart(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\t\tthis._status = 1;\r\n\t\tthis._gameView.start();\r\n\t}\r\n\r\n\tpause() {\r\n\t\tthis._gameView.pause();\r\n\t}\r\n\r\n\tresume() {\r\n\t\tthis._gameView.resume();\r\n\t}\r\n\r\n\trevive() {\r\n\t\tthis._gameView.revive();\r\n\t}\r\n\r\n\tclear() {\r\n\t\tthis._gameView.visible = false;\r\n\t}\r\n\r\n\r\n\r\n\r\n\r\n\tprivate onTap(event) {\r\n\t\t//\tthis._gameView.tap(event);\r\n\t}\r\n}\r\n","/**\r\n * Created by rockyl on 2019-11-20.\r\n */\r\n\r\nimport {GameWrapper} from \"./game/GameWrapper\";\r\nimport {injectProps, prepareProps} from \"./props\";\r\n\r\nexport default function (props) {\r\n\tprepareProps();\r\n\tinjectProps(props);\r\n\r\n\tlet instance = new GameWrapper();\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;CAIO,IAAI,KAAK,GAAQ,EAAE,CAAC;AAE3B,UAAgB,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;AAED,UAAgB,WAAW,CAAC,CAAC;KAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC7B,CAAC;;;UCVe,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;AAED,UAAgB,gBAAgB,CAAC,IAAI;KACpC,OAAO,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACrD,CAAC;AAED,UAGgB,UAAU,CAAC,IAAI,EAAE,UAAW;KAC3C,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;KAC3B,IAAI,CAAC,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;KAC5D,OAAO,IAAI,CAAC;CACb,CAAC;AACD,UAAgB,OAAO,CAAC,OAAO,EAAE,GAAI;CASrC,CAAC;;;CChBD;KAAsCA,kCAAgB;KA2ErD;SAAA,YACC,iBAAO,SAEP;SAtEO,mBAAa,GAAQ,CAAC,CAAC;SAgEvB,gBAAU,GAAG,EAAE,CAAA;SAWf,mBAAa,GAAG,IAAI,CAAA;SAN3B,KAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,KAAI,CA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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": "采茶叶模左上角0,0点",
"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"
},
"showFrontImg": {
"alias": "茶叶前景图1显示2隐藏",
"type": "number",
"default": "1"
},
"FrontImgPos": {
"alias": "茶叶前景图位置",
"type": "array<number>",
"default": "0,584"
},
"pickTeaSpeed": {
"alias": "采集茶叶的速度ms",
"type": "number",
"default": 1000
},
"basketSvgaPos": {
"alias": "人物的位置",
"type": "array<number>",
"default": "110,410"
},
"addOneSvgaPos": {
"alias": "+1SVGA的位置",
"type": "array<number>",
"default": "0,-100"
},
"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": "477,-29"
},
"handGraspMovePos": {
"alias": "手点击移动的位置",
"type": "array<number>",
"default": "372,-145"
},
"progressbarBgImgPos": {
"alias": "进度条底图的位置",
"type": "array<number>",
"default": "69,818"
},
"progressbarImgPos": {
"alias": "进度条的位置",
"type": "array<number>",
"default": "-335,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/1da0ea14267ff35f90f49c22deb1b34181571e90.png",
"uuid": "9f5db57e-47f9-43e5-af80-adf41299280d",
"ext": ".png"
},
{
"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/afb6b2655838ea955d250663fc535cc166b466e7.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": "茶叶数量{初始值nowNum,总量totalNum,后端时间serverData} "
},
"event-getBasket-Type": {
"alias": "获得篮子类型(纸 布 竹 木)0 1 2 3"
},
"event-hand-grasp": {
"alias": "手抓去"
},
"event-getClick-person": {
"alias": "点击人物"
}
},
"out": {
"event-setchange-TeaNum": {
"alias": "获取茶叶数量{初始值nowNum,总量totalNum,后端时间serverData}",
"data": {}
},
"event-setBasket-Typ": {
"alias": "获得篮子类型(纸 布 竹 木)0 1 2 3",
"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 { showLog } from "./utils";
import { Tealeaf } from "./Tealeaf";
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 frontImg: 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 teaFullRotation
/**采茶叶自定义模块*/
//玩家
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 = []
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.frontImg = new engine.Image(getTextureByName('前景'));
this.pickTeaBg.addChild(this.paperBasketSvga);
this.pickTeaBg.addChild(this.clothBasketSvga);
this.pickTeaBg.addChild(this.bambooBasketSvga);
this.pickTeaBg.addChild(this.woodBasketSvga);
//this.pickTeaBg.addChild(this.addOneSvga);
this.pickTeaBg.addChild(this.pickTeaSvga);
this.pickTeaBg.addChild(this.teaSkyUpSvga);
//this.pickTeaBg.addChild(this.handGraspSvga);
this.basketSvgaGroup = [this.paperBasketSvga, this.clothBasketSvga, this.bambooBasketSvga, this.woodBasketSvga]
this.progressbarBgImg = new engine.Image(getTextureByName('进度条底框'));
this.progressbarImg = new engine.Image(getTextureByName('进度'));
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;
this.progressbarImg.mask = mask
showLog(this.progressbarImg.mask)
this.addChild(this.frontImg);
this.progressbarBgImg.addChild(this.progressbarImg);
this.progressbarBgImg.addChild(mask);
showLog('遮罩坐标')
showLog(mask.x, mask.y)
this.progressbarBgImg.addChild(this.addOneSvga);
this.progressbarBgImg.addChild(this.handGraspSvga);
this.progressbarBgImg.addChild(this.teaHalfFlagImg);
this.progressbarBgImg.addChild(this.teaFullFlagImg);
this.progressbarBgImg.addChild(this.teaStarImg);
this.pickTeaCount = new engine.Label();
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.setTeaNum({ totalNum: 100, nowNum: 0 })
// }, 500)
}
reset() {
this.initView()
}
start() {
}
pause() {
this.gameIng = false;
}
revive() {
this.gameIng = true;
}
resume() {
this.reset();
this.start()
}
initView() {
this.pickTeaBg.mouseEnabled = false;
this.teaHalfImg.visible = false;
//this.teaHalfImg.source = '';
this.pickTeaSvga.visible = false;
this.teaSkyUpSvga.visible = false;
this.verseImg.visible = false;
this.frontImg.visible = props.showFrontImg == 1;
this.initChildrenPos()
}
initChildrenPos() {
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.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.frontImg.x = props.FrontImgPos[0]
this.frontImg.y = props.FrontImgPos[1]
this.teaFullFlagImg.visible = false;
this.teaStarImg.x = props.teaStarImgPos[0]
this.teaStarImg.y = props.teaStarImgPos[1]
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 = ''
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;
}
showVerse() {
showLog('显示诗句')
// if (!this._touchEnabled) {
// return;
// }
//this._touchEnabled = false;
this.verseImg.visible = true;
let len = props.verses.length;
let random = Math.floor(Math.random() * len);
showLog('random', random)
showLog('props.verses')
showLog(props.verses)
let verse = props.verses[random];
showLog('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
})
};
/*采茶叶活动*/
//总量除以当前 小于3分之1 没有树叶 ,3分之1到3分之2一点点树叶 ,大于3分之2满树叶
setTeaNum(TeaNums) {
if (this.schedule) {
showLog('清理定时器,重新设置同步')
clearInterval(this.schedule);
}
let totalNum = TeaNums.totalNum;
let nowNum = TeaNums.nowNum
showLog('nowNum:', nowNum)
this.getTeaPercentage(nowNum, totalNum);
let surplus = nowNum - totalNum;
if (surplus == 0) {
this.gotoMaxLength();
return;
}
showLog('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))
showLog('fbdvalue', fbdvalue)
/**/
//设置数据校正
// let serverData = 0;
let dataDiff = 0;
/**/
//let rate = (443 - width * (1 - nowNum / totalNum))
//已经走得
let x = -width * (1 - (nowNum / totalNum))
showLog('原先的X:', this.progressbarImg.x)
showLog('比例后的X', x);
//showLog('parseFloat(x.toFixed(3))', parseFloat(x.toFixed(5)))
this.progressbarImg.x = parseFloat(x.toFixed(5)) + this.teaFullFlagImg.width - Math.abs(this.teaFullFlagImg.x)
showLog('减去长款的x', this.progressbarImg.x)
showLog('this.teaFullFlagImg.width', this.teaFullFlagImg.width)
if (this.progressbarImg.x > (this.teaFullFlagImg.width / 2)) {
let minus = this.teaFullFlagImg.width - Math.abs(this.teaFullFlagImg.x) - this.progressbarImg.x
showLog('minus', minus)
this.progressbarImg.x = this.progressbarImg.x - this.teaFullFlagImg.width / 2 + Math.abs(this.teaFullFlagImg.x)
showLog('负段x重组', this.progressbarImg.x)
}
showLog('补宽的X', this.progressbarImg.x);
showLog('this.progressbarImg.x', this.progressbarImg.x)
let step = (this.teaFullFlagImg.width / 2 - this.progressbarImg.x) / surplus
showLog('step', step)
//step = parseFloat(step.toFixed(6));
//showLog('进图条每秒比例step', step)
let speed = props.pickTeaSpeed;
if (!this.teaFullRotation) {
this.teaFullRotation = engine.Tween.get(this.teaHalfFlagImg, { loop: true })
.to({ rotation: 360 }, speed).call(() => {
this.teaHalfFlagImg.rotation = 0;
})
}
engine.Tween.resumeTweens(this.teaFullRotation);
this.schedule = setInterval(() => {
//showLog('nowNum', nowNum, 'totalNum', totalNum)
nowNum++;
this.addOneSvga.play(1, true);
if (nowNum == totalNum) {
this.gotoMaxLength();
engine.Tween.pauseTweens(this.teaFullRotation);
}
if (this.progressbarImg.x < this.teaFullFlagImg.width / 2) {
this.progressbarImg.x -= step;
}
this.getTeaPercentage(nowNum, totalNum);
dataDiff += speed;
myDate = new Date();
nowData = myDate.getTime();
if (Math.abs((nowData - serverData)) - dataDiff > (fbdvalue + 3000)) {
showLog('校准数据前后数据偏差过大');
showLog(Math.abs((nowData - serverData)) - dataDiff - (fbdvalue + 3000))
showLog(this.schedule)
clearInterval(this.schedule);
engine.Tween.pauseTweens(this.teaFullRotation);
engine.globalEvent.dispatchEvent('event-setchange-TeaNum');
this.addOneSvga.visible = false;
this.addOneSvga.stop();
return;
}
}, speed)
}
getTeaPercentage(nowNum, totalNum) {
if (nowNum > totalNum) {
return;
}
this.pickTeaCount.text = nowNum + '/' + totalNum;
let teaPercentage = 2;
let portion = totalNum / 3
if (nowNum < portion) {
return;
}
if (nowNum < (portion * 2)) {
teaPercentage = 1;
}
showLog('teaPercentage', teaPercentage)
if (this.nowPercentage != teaPercentage) {
showLog('状态改变')
this.nowPercentage = teaPercentage;
this.updateTeaPercentage(teaPercentage);
}
}
//进度条达到最大长度
gotoMaxLength() {
showLog('达到最大长度');
if (this.schedule) {
clearInterval(this.schedule);
}
this.progressbarImg.x = this.teaFullFlagImg.width / 2
this.teaHalfFlagImg.visible = false;
this.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible
this.addOneSvga.visible = this.teaHalfFlagImg.visible
this.addOneSvga.stop();
}
//需要更换茶叶数量皮肤
updateTeaPercentage(teaPercentage = 0) {
showLog('需要更换茶叶数量皮肤')
showLog('延迟500ms')
let pickTeaSVGA = this.basketSvgaGroup[1];
showLog('pickTeaSVGA')
showLog(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;
//showLog('this.teaHalfImg');
//showLog(this.teaHalfImg);
pickTeaSVGA.addChildAt(this.teaHalfImg, 10)
}
setPickTeaLevel(level) {
showLog('setPickTeaLevel', level);
let pickTeaSVGA = this.basketSvgaGroup[level];
pickTeaSVGA.visible = true;
//showLog('littleTea url')
//showLog(this.teaHalfImg['_source'])
//需要svga缓存结束
setTimeout(() => {
showLog('延迟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;
}
showLog('this.teaHalfImg');
showLog(this.teaHalfImg);
pickTeaSVGA.addChildAt(this.teaHalfImg, 10)
pickTeaSVGA.gotoAndPlay(1, true);
}, 300)
}
handGrasp() {
showLog('handGrasp')
let that = this;
setTimeout(() => {
//that.handGraspSvga.play(1, true);
// this.pickTeaSvga.play(1, false);
// this.teaSkyUpSvga.play(1, false);
engine.Tween.get(that.handGraspSvga)
.to({ x: props.handGraspMovePos[0], y: props.handGraspMovePos[1] }, 400).call(() => {
showLog('this.pickTeaSvga.play')
that.handGraspSvga.play(1, true);
setTimeout(() => {
that.handGraspSvga.stop()
that.handGraspSvga.x = props.handGraspSvgaPos[0];
that.handGraspSvga.y = props.handGraspSvgaPos[1];
}, 600)
that.pickTeaSvga.visible = true
that.pickTeaSvga.play(1, false);
})
that.pickTeaSvga.addEventListener(engine.Event.END_FRAME, function () {
showLog('this.teaSkyUpSvga.play')
that.teaSkyUpSvga.visible = true
that.teaSkyUpSvga.play(1, false);
})
that.teaSkyUpSvga.addEventListener(engine.Event.END_FRAME, function () {
that.teaSkyUpSvga.visible = false;
that.updateTeaPercentage(0);
})
}, 500);
}
/*采茶叶活动*/
}
/**
* 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-getClick-person', this.clickPerson, this);
engine.globalEvent.addEventListener('event-getchange-TeaNum', this.setTeaNum, this);
engine.globalEvent.addEventListener('event-getBasket-Type', this.setPickTeaLevel, this);
let gameView = this._gameView = new GameView();
this.addChild(gameView);
}
//设置茶叶数量
setTeaNum(event: engine.Event) {
injectProps(event.data);
this._gameView.setTeaNum(event.data);
}
//设置茶蓝等级
setPickTeaLevel(event: engine.Event) {
injectProps(event.data);
this._gameView.setPickTeaLevel(event.data);
}
handGrasp() {
this._gameView.handGrasp();
}
//点击人物
clickPerson() {
this._gameView.showVerse();
}
reset(event: engine.Event) {
injectProps(event.data);
this._gameView.visible = true;
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;
}
private onTap(event) {
// this._gameView.tap(event);
}
}
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-01-21.
*/
const showlog = false;
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;
}
export function showLog(abjname, obj?) {
if (showlog) {
console.log(abjname)
if (obj)
console.log(obj)
}
// let inst = new svga.Svga();
// inst.source = 'asset://' + engine.getAssetByName(name).uuid;
// return inst;
}
\ No newline at end of file
/**
* 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