Commit a699f487 authored by 13732208043's avatar 13732208043

采茶叶

parent f0684238
{
"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": {}
}
}
},
"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\t//# sourceMappingURL=utils.js.map\n\n\tvar Goods = (function (_super) {\r\n\t tslib.__extends(Goods, _super);\r\n\t function Goods() {\r\n\t var _this = _super.call(this) || this;\r\n\t var body;\r\n\t body = _this._body = new engine.Rect();\r\n\t var rain = new engine.Sprite(getTextureByName('雨滴'));\r\n\t rain[\"npcType\"] = \"rain\";\r\n\t var stone = new engine.Sprite(getTextureByName('石块'));\r\n\t stone[\"npcType\"] = \"stone\";\r\n\t var boom = new engine.Sprite(getTextureByName('炸弹'));\r\n\t boom[\"npcType\"] = \"boom\";\r\n\t rain.visible = false;\r\n\t stone.visible = false;\r\n\t boom.visible = false;\r\n\t body.addChild(rain);\r\n\t body.addChild(stone);\r\n\t body.addChild(boom);\r\n\t _this.addChild(body);\r\n\t body.width = .0001;\r\n\t body.height = .0001;\r\n\t body.mouseEnabled = false;\r\n\t return _this;\r\n\t }\r\n\t Goods.prototype.getRandomNumberByRange = function (start, end) {\r\n\t return Math.floor(Math.random() * (end - start) + start);\r\n\t };\r\n\t Goods.prototype.reset = function () {\r\n\t this.visible = true;\r\n\t this.rotation = 0;\r\n\t this.anchorOffsetY = 0;\r\n\t this.y = 0;\r\n\t this.x = (750 - 120) * Math.random() + 30;\r\n\t this.rotation = 0;\r\n\t var random = Math.random();\r\n\t if (random < props.goodsProbability[0]) {\r\n\t this.showNpc(\"rain\");\r\n\t }\r\n\t else if (random >= props.goodsProbability[0] && random <= (props.goodsProbability[0] + props.goodsProbability[1])) {\r\n\t this.showNpc(\"stone\");\r\n\t }\r\n\t else if (random > (props.goodsProbability[0] + props.goodsProbability[1])) {\r\n\t this.showNpc(\"boom\");\r\n\t }\r\n\t };\r\n\t Goods.prototype.showNpc = function (type) {\r\n\t for (var i = 0; i < this._body.children.length; i++) {\r\n\t this._body.children[i].visible = false;\r\n\t this._body.children[i].mouseEnabled = false;\r\n\t }\r\n\t for (var i = 0; i < this._body.children.length; i++) {\r\n\t if (this._body.children[i][\"npcType\"] == type) {\r\n\t this[\"npcType\"] = type;\r\n\t this._body.children[i].visible = true;\r\n\t this._body.children[i].mouseEnabled = false;\r\n\t }\r\n\t }\r\n\t };\r\n\t Object.defineProperty(Goods.prototype, \"anchorOffsetY\", {\r\n\t set: function (v) {\r\n\t this._body.y = v;\r\n\t },\r\n\t enumerable: true,\r\n\t configurable: true\r\n\t });\r\n\t return Goods;\r\n\t}(engine.Container));\r\n\t//# sourceMappingURL=Goods.js.map\n\n\tvar ObjectPool = engine.ObjectPool;\r\n\tvar PoolName = 'goods';\r\n\tObjectPool.registerPool(PoolName, function () {\r\n\t return new Goods();\r\n\t}, function (item, data) {\r\n\t item.reset();\r\n\t});\r\n\t//# sourceMappingURL=object-pool-init.js.map\n\n\tvar ObjectPool$1 = engine.ObjectPool;\r\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 var _this = this;\r\n\t if (this._hasSetup) {\r\n\t return;\r\n\t }\r\n\t this._hasSetup = true;\r\n\t this.pickTeaBg = new engine.Container();\r\n\t var bgGroud = new engine.Image();\r\n\t bgGroud.source = '//yun.duiba.com.cn/aurora/assets/a988c47db8d3131faad175c7c2944773392be643.png';\r\n\t this.addChild(bgGroud);\r\n\t this.addChild(this.pickTeaBg);\r\n\t this.teaHalfImg = new engine.Image();\r\n\t this.paperBasketSvga = createSvga(\"采茶童-纸篮子\");\r\n\t this.clothBasketSvga = createSvga(\"采茶童-布篮子\");\r\n\t this.bambooBasketSvga = createSvga(\"采茶童-竹编篮\");\r\n\t this.woodBasketSvga = createSvga(\"采茶童-木篮子\");\r\n\t this.addOneSvga = createSvga(\"+1\");\r\n\t this.pickTeaSvga = createSvga(\"采茶叶\");\r\n\t this.teaSkyUpSvga = createSvga(\"茶叶向上飞\");\r\n\t this.handGraspSvga = createSvga(\"手抓去\");\r\n\t this.pickTeaBg.addChild(this.paperBasketSvga);\r\n\t this.pickTeaBg.addChild(this.clothBasketSvga);\r\n\t this.pickTeaBg.addChild(this.bambooBasketSvga);\r\n\t this.pickTeaBg.addChild(this.woodBasketSvga);\r\n\t this.pickTeaBg.addChild(this.addOneSvga);\r\n\t this.pickTeaBg.addChild(this.pickTeaSvga);\r\n\t this.pickTeaBg.addChild(this.teaSkyUpSvga);\r\n\t this.pickTeaBg.addChild(this.handGraspSvga);\r\n\t this.basketSvgaGroup = [this.paperBasketSvga, this.clothBasketSvga, this.bambooBasketSvga, this.woodBasketSvga];\r\n\t this.progressbarBgImg = new engine.Image(getTextureByName('进度条底框'));\r\n\t this.progressbarImg = new engine.Image(getTextureByName('进度'));\r\n\t this.teaHalfFlagImg = new engine.Image(getTextureByName('茶叶进度缺'));\r\n\t this.teaFullFlagImg = new engine.Image(getTextureByName('茶叶进度满'));\r\n\t this.teaStarImg = new engine.Image(getTextureByName('小茶叶'));\r\n\t this.verseImg = new engine.Image(getTextureByName('气泡框'));\r\n\t this.pickTeaBg.addChild(this.verseImg);\r\n\t var mask = new engine.Rect();\r\n\t mask.width = 600;\r\n\t mask.height = 50;\r\n\t mask.x = 10;\r\n\t mask.y = 0;\r\n\t mask.alpha = 1;\r\n\t this.progressbarImg.mask = mask;\r\n\t console.log(this.progressbarImg.mask);\r\n\t this.progressbarBgImg.addChild(this.progressbarImg);\r\n\t this.progressbarBgImg.addChild(mask);\r\n\t console.log('遮罩坐标');\r\n\t console.log(mask.x, mask.y);\r\n\t this.progressbarBgImg.addChild(this.teaHalfFlagImg);\r\n\t this.progressbarBgImg.addChild(this.teaFullFlagImg);\r\n\t this.progressbarBgImg.addChild(this.teaStarImg);\r\n\t this.pickTeaCount = new engine.Label();\r\n\t this.progressbarBgImg.addChild(this.pickTeaCount);\r\n\t this.addChild(this.progressbarBgImg);\r\n\t this.initView();\r\n\t this.setPickTeaLevel(1);\r\n\t this.setTeaNum({ totalNum: 430, nowNum: 0 });\r\n\t setInterval(function () {\r\n\t _this.handGrasp();\r\n\t }, 5000);\r\n\t };\r\n\t GameView.prototype.reset = function () {\r\n\t console.log('111111111reset1');\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 for (var i = 0; i < this.basketSvgaGroup.length; i++) {\r\n\t this.basketSvgaGroup[i].visible = false;\r\n\t this.basketSvgaGroup[i].x = props.basketSvgaPos[0];\r\n\t this.basketSvgaGroup[i].y = props.basketSvgaPos[1];\r\n\t this.basketSvgaGroup[i].addEventListener(engine.MouseEvent.CLICK, this.showVerse, this);\r\n\t }\r\n\t this.pickTeaBg.mouseEnabled = false;\r\n\t this.teaHalfImg.visible = false;\r\n\t this.pickTeaSvga.visible = false;\r\n\t this.teaSkyUpSvga.visible = false;\r\n\t this.verseImg.visible = false;\r\n\t this.initChildrenPos();\r\n\t };\r\n\t GameView.prototype.initChildrenPos = function () {\r\n\t this.verseImg.x = props.versePos[0];\r\n\t this.verseImg.y = props.versePos[1];\r\n\t this.addOneSvga.x = props.addOneSvgaPos[0];\r\n\t this.addOneSvga.y = props.addOneSvgaPos[1];\r\n\t this.pickTeaSvga.x = props.pickTeaSvgaPos[0];\r\n\t this.pickTeaSvga.y = props.pickTeaSvgaPos[1];\r\n\t this.teaSkyUpSvga.x = props.teaSkyUpSvgaPos[0];\r\n\t this.teaSkyUpSvga.y = props.teaSkyUpSvgaPos[1];\r\n\t this.handGraspSvga.x = props.handGraspSvgaPos[0];\r\n\t this.handGraspSvga.y = props.handGraspSvgaPos[1];\r\n\t this.progressbarBgImg.x = props.progressbarBgImgPos[0];\r\n\t this.progressbarBgImg.y = props.progressbarBgImgPos[1];\r\n\t this.progressbarImg.x = props.progressbarImgPos[0];\r\n\t this.progressbarImg.y = props.progressbarImgPos[1];\r\n\t this.teaHalfFlagImg.x = props.teaHalfFlagImgPos[0];\r\n\t this.teaHalfFlagImg.y = props.teaHalfFlagImgPos[1];\r\n\t this.teaHalfFlagImg.anchorX = this.teaHalfFlagImg.width / 2;\r\n\t this.teaHalfFlagImg.anchorY = this.teaHalfFlagImg.height / 2;\r\n\t this.teaFullFlagImg.x = props.teaHalfFlagImgPos[0];\r\n\t this.teaFullFlagImg.y = props.teaHalfFlagImgPos[1];\r\n\t this.teaFullFlagImg.visible = false;\r\n\t this.teaStarImg.x = props.teaStarImgPos[0];\r\n\t this.teaStarImg.y = props.teaStarImgPos[1];\r\n\t this.pickTeaCount.fillColor = 'white';\r\n\t this.pickTeaCount.size = 30;\r\n\t this.pickTeaCount.text = '';\r\n\t this.pickTeaCount.x = props.pickTeaCountPos[0];\r\n\t this.pickTeaCount.y = props.pickTeaCountPos[1];\r\n\t this.pickTeaCount.height = 50;\r\n\t this.pickTeaCount.width = 200;\r\n\t this.verseLabel = new engine.TextField();\r\n\t this.verseLabel.size = props.verseLabel[2];\r\n\t this.verseLabel.text = '11';\r\n\t this.verseLabel.fillColor = props.verseColor[0];\r\n\t this.verseLabel.height = props.verseLabel[1];\r\n\t this.verseLabel.width = props.verseLabel[0];\r\n\t this.verseLabel.strokeColor = props.verseColor[1];\r\n\t this.verseLabel.stroke = 0.5;\r\n\t this.verseLabel.y = 15;\r\n\t this.verseLabel['textHeight'] = 14;\r\n\t this.verseLabel.textAlign = engine.TEXT_ALIGN.CENTER;\r\n\t this.verseImg.addChild(this.verseLabel);\r\n\t };\r\n\t GameView.prototype.showVerse = function () {\r\n\t return tslib.__awaiter(this, void 0, void 0, function () {\r\n\t var random, verse, y;\r\n\t var _this = this;\r\n\t return tslib.__generator(this, function (_a) {\r\n\t console.log('显示诗句');\r\n\t if (!this._touchEnabled) {\r\n\t return [2];\r\n\t }\r\n\t this._touchEnabled = false;\r\n\t this.verseImg.visible = true;\r\n\t random = Math.floor(Math.random() * 3);\r\n\t console.log('random', random);\r\n\t console.log('props.verses');\r\n\t console.log(props.verses);\r\n\t verse = props.verses[random];\r\n\t console.log('verse', verse);\r\n\t this.verseLabel.text = verse;\r\n\t y = this.verseImg.y;\r\n\t engine.Tween.get(this.verseImg)\r\n\t .to({ alpha: 0 }, 3000).call(function () {\r\n\t _this.verseImg.visible = false;\r\n\t _this.verseImg.alpha = 1;\r\n\t _this._touchEnabled = true;\r\n\t });\r\n\t return [2];\r\n\t });\r\n\t });\r\n\t };\r\n\t GameView.prototype.setTeaNum = function (TeaNums) {\r\n\t var _this = this;\r\n\t var totalNum = 200;\r\n\t var nowNum = 10;\r\n\t this.pickTeaCount.text = nowNum + '/' + totalNum;\r\n\t this.getTeaPercentage(nowNum, totalNum);\r\n\t var chaju = nowNum - totalNum;\r\n\t console.log('chaju', chaju);\r\n\t var width = this.progressbarImg.width;\r\n\t var x = -width * (1 - nowNum / totalNum);\r\n\t console.log('x', x);\r\n\t this.progressbarImg.x = parseFloat(x.toFixed(3));\r\n\t console.log('this.progressbarImg.x', this.progressbarImg.x);\r\n\t var step = (width - (width - Math.abs(this.progressbarImg.x))) / chaju;\r\n\t console.log('进图条每秒比例原始step', step);\r\n\t step = parseFloat(step.toFixed(3));\r\n\t console.log('进图条每秒比例step', step);\r\n\t this.addOneSvga.play(1, true);\r\n\t var speed = props.pickTeaSpeed;\r\n\t var teaFullRotation = engine.Tween.get(this.teaHalfFlagImg, { loop: true })\r\n\t .to({ rotation: 360 }, speed).call(function () {\r\n\t _this.teaHalfFlagImg.rotation = 0;\r\n\t });\r\n\t var schedule = setInterval(function () {\r\n\t if (nowNum == totalNum) {\r\n\t console.log('达到最大长度');\r\n\t clearInterval(schedule);\r\n\t engine.Tween.pauseTweens(teaFullRotation);\r\n\t _this.progressbarImg.x = 0;\r\n\t _this.teaHalfFlagImg.visible = false;\r\n\t _this.teaFullFlagImg.visible = !_this.teaHalfFlagImg.visible;\r\n\t _this.addOneSvga.visible = !_this.teaHalfFlagImg.visible;\r\n\t _this.addOneSvga.stop();\r\n\t }\r\n\t if (_this.progressbarImg.x <= -2) {\r\n\t _this.progressbarImg.x -= step;\r\n\t }\r\n\t _this.getTeaPercentage(nowNum, totalNum);\r\n\t nowNum++;\r\n\t }, speed);\r\n\t };\r\n\t GameView.prototype.getTeaPercentage = function (nowNum, totalNum) {\r\n\t this.pickTeaCount.text = nowNum + '/' + totalNum;\r\n\t var teaPercentage = 2;\r\n\t var portion = totalNum / 3;\r\n\t if (nowNum < portion) {\r\n\t return;\r\n\t }\r\n\t if (nowNum < (portion * 2)) {\r\n\t teaPercentage = 1;\r\n\t }\r\n\t console.log('teaPercentage', teaPercentage);\r\n\t if (this.nowPercentage != teaPercentage) {\r\n\t console.log('状态改变');\r\n\t this.nowPercentage = teaPercentage;\r\n\t this.updateTeaPercentage(teaPercentage);\r\n\t }\r\n\t };\r\n\t GameView.prototype.updateTeaPercentage = function (teaPercentage) {\r\n\t if (teaPercentage === void 0) { teaPercentage = 0; }\r\n\t console.log('需要更换茶叶数量皮肤');\r\n\t console.log('延迟500ms');\r\n\t var pickTeaSVGA = this.basketSvgaGroup[1];\r\n\t console.log('pickTeaSVGA');\r\n\t console.log(pickTeaSVGA);\r\n\t pickTeaSVGA.removeChildAt(10);\r\n\t var originframes = pickTeaSVGA.children[7];\r\n\t if (!originframes) {\r\n\t return;\r\n\t }\r\n\t var teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));\r\n\t if (teaPercentage == 1) {\r\n\t this.teaHalfImg = new engine.Image(getTextureByName('茶叶-少'));\r\n\t }\r\n\t else if (teaPercentage == 2) {\r\n\t this.teaHalfImg = new engine.Image(getTextureByName('茶叶-满'));\r\n\t }\r\n\t this.teaHalfImg.visible = false;\r\n\t this.teaHalfImg['frames'] = teaBucketframes;\r\n\t console.log('this.teaHalfImg');\r\n\t console.log(this.teaHalfImg);\r\n\t pickTeaSVGA.addChildAt(this.teaHalfImg, 10);\r\n\t };\r\n\t GameView.prototype.setPickTeaLevel = function (level) {\r\n\t var _this = this;\r\n\t console.log('setPickTeaLevel', level);\r\n\t var pickTeaSVGA = this.basketSvgaGroup[level];\r\n\t pickTeaSVGA.visible = true;\r\n\t setTimeout(function () {\r\n\t console.log('延迟500ms');\r\n\t var originframes = pickTeaSVGA.children[7];\r\n\t var teaBucketframes = JSON.parse(JSON.stringify(originframes.frames));\r\n\t if (_this.teaHalfImg) {\r\n\t _this.teaHalfImg['frames'] = teaBucketframes;\r\n\t }\r\n\t console.log('this.teaHalfImg');\r\n\t console.log(_this.teaHalfImg);\r\n\t pickTeaSVGA.addChildAt(_this.teaHalfImg, 10);\r\n\t pickTeaSVGA.gotoAndPlay(1, true);\r\n\t }, 500);\r\n\t };\r\n\t GameView.prototype.handGrasp = function () {\r\n\t console.log('handGrasp');\r\n\t var that = this;\r\n\t setTimeout(function () {\r\n\t that.handGraspSvga.play(1, true);\r\n\t engine.Tween.get(that.handGraspSvga)\r\n\t .to({ x: props.handGraspMovePos[0], y: props.handGraspMovePos[1] }, 600).call(function () {\r\n\t that.handGraspSvga.x = props.handGraspSvgaPos[0];\r\n\t that.handGraspSvga.y = props.handGraspSvgaPos[1];\r\n\t that.pickTeaSvga.visible = true;\r\n\t that.pickTeaSvga.play(1, false);\r\n\t });\r\n\t that.pickTeaSvga.addEventListener(engine.Event.END_FRAME, function () {\r\n\t that.teaSkyUpSvga.visible = true;\r\n\t that.teaSkyUpSvga.play(1, false);\r\n\t });\r\n\t that.teaSkyUpSvga.addEventListener(engine.Event.END_FRAME, function () {\r\n\t that.teaSkyUpSvga.visible = false;\r\n\t });\r\n\t }, 500);\r\n\t };\r\n\t GameView.prototype.recycleGoods = function () {\r\n\t return;\r\n\t };\r\n\t return GameView;\r\n\t}(engine.Container));\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-getchange-TeaNum', _this.setTeaNum, _this);\r\n\t engine.globalEvent.addEventListener('event-getBasket-Type', _this.setPickTeaLevel, _this);\r\n\t var gameView = _this._gameView = new GameView();\r\n\t _this.addChild(gameView);\r\n\t return _this;\r\n\t }\r\n\t GameWrapper.prototype.setTeaNum = function (event) {\r\n\t injectProps(event.data);\r\n\t this._gameView.setTeaNum(event.data);\r\n\t };\r\n\t GameWrapper.prototype.setPickTeaLevel = function (event) {\r\n\t injectProps(event.data);\r\n\t this._gameView.setPickTeaLevel(event.data);\r\n\t };\r\n\t GameWrapper.prototype.reset = function (event) {\r\n\t injectProps(event.data);\r\n\t this._gameView.visible = true;\r\n\t this._gameView.reset();\r\n\t };\r\n\t GameWrapper.prototype.start = function (event) {\r\n\t injectProps(event.data);\r\n\t this._status = 1;\r\n\t this._gameView.start();\r\n\t };\r\n\t GameWrapper.prototype.pause = function () {\r\n\t this._gameView.pause();\r\n\t };\r\n\t GameWrapper.prototype.resume = function () {\r\n\t this._gameView.resume();\r\n\t };\r\n\t GameWrapper.prototype.revive = function () {\r\n\t this._gameView.revive();\r\n\t };\r\n\t GameWrapper.prototype.clear = function () {\r\n\t this._gameView.visible = false;\r\n\t };\r\n\t GameWrapper.prototype.handGrasp = function () {\r\n\t this._gameView.handGrasp();\r\n\t };\r\n\t GameWrapper.prototype.onTap = function (event) {\r\n\t };\r\n\t return GameWrapper;\r\n\t}(engine.Container));\r\n\t//# sourceMappingURL=GameWrapper.js.map\n\n\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"
}
......@@ -407,6 +407,8 @@ var GameView = (function (_super) {
GameView.prototype.playShake = function () {
var _this = this;
var _a = this.frontContainer, x = _a.x, y = _a.y;
let a = '';
a.substr
return new Promise(function (resolve) {
var shakeOffset = 7;
var duration = 30;
......
/**
* Created by rockyl on 2019-12-16.
*/
const customId = 'dxbcyj-game';
(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('dxbcyj-game-start', {guide: 0});
}, 500);
});
engine.globalEvent.addEventListener('dxbcyj-game-result', (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 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/svga.fd3923ae6e664251ca7981801a65809cc5f36bc3.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 = [
];
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['dxbcyj-game'] = 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
var ObjectPool = engine.ObjectPool;
var Road = (function (_super) {
tslib.__extends(Road, _super);
function Road() {
return _super !== null && _super.apply(this, arguments) || this;
}
Road.prototype.setup = function () {
this.lastPos = 0;
this.addPier();
};
Road.prototype.getFristPier = function () {
return this.getChildAt(0).width;
};
Road.prototype.getDistance = function () {
var distance = [];
var pier1 = this.getChildAt(0);
var pier2 = this.getChildAt(1);
distance.push(pier2.x - pier1.x);
distance.push(pier2.width);
return distance;
};
Road.prototype.addPier = function () {
while (this.children.length < props.pierCount + 1) {
var childrenNum = this.children.length;
var randomPos = this.makeRandomFloat(props.pierMaxDistance, props.pierMinDistance);
var pier = ObjectPool.getObject('pier');
this.addChild(pier);
if (childrenNum == 0) {
pier.x = 0;
}
else {
pier.x = this.lastPos + randomPos;
}
this.lastPos = pier.x;
}
};
Road.prototype.moveAddPier = function () {
var randomPos = this.makeRandomFloat(props.pierMaxDistance, props.pierMinDistance);
var pier = ObjectPool.getObject('pier');
var lastChild = this.getChildAt(this.children.length - 1);
pier.x = lastChild.x + randomPos;
this.addChild(pier);
};
Road.prototype.makeRandomFloat = function (max, min) {
if (min === void 0) { min = 0; }
return Math.random() * (max - min) + min;
};
Road.prototype.setViewport = function () {
var _this = this;
var tmpMovepos = this.getMovePos();
this.children.forEach(function (item, index) {
_this.playTween(item, index, tmpMovepos);
});
};
Road.prototype.getMovePos = function () {
var movePos = this.getChildAt(1);
return movePos.x;
};
Road.prototype.playTween = function (item, index, tmpMovepos) {
var _this = this;
engine.Tween.get(item, { loop: false })
.to({ x: item.x - tmpMovepos }, props.pierMoveTime)
.call(function () {
if (_this.getChildIndex(item) == 0) {
engine.Tween.removeTweens(item);
_this.removeChild(item);
ObjectPool.recycleObject('pier', item);
}
if (index == 0) {
_this.moveAddPier();
}
});
};
Road.prototype.getStartGold = function (index, isClose) {
if (isClose === void 0) { isClose = true; }
var tmpNode = this.getChildAt(index);
var haveGold = tmpNode.haveGold;
if (haveGold && isClose) {
tmpNode.closeGold();
}
return haveGold;
};
Road.prototype.setGuide = function () {
var tmpNode = this.getChildAt(1);
if (!tmpNode.haveGold) {
tmpNode.children.forEach(function (item) {
if (item.name == 'gold') {
item.visible = true;
}
});
tmpNode.haveGold = true;
}
};
return Road;
}(engine.Container));
//# sourceMappingURL=Road.js.map
function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
}
function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
}
function getStage() {
return engine.gameStage.stage;
}
function createSvga(name) {
var inst = new svga.Svga();
inst.source = engine.getAssetByName(name).uuid;
return inst;
}
//# sourceMappingURL=utils.js.map
var GuideLayer = (function (_super) {
tslib.__extends(GuideLayer, _super);
function GuideLayer() {
var _this = _super.call(this) || this;
_this._canClear = [];
_this.setup();
return _this;
}
GuideLayer.prototype.setup = function () {
};
GuideLayer.prototype.show = function (id, options, callback) {
this.visible = true;
this._callBack = callback ? callback : null;
if (!this.guideMask) {
this._options = options;
var _a = this.stage, width = _a.width, height = _a.height;
var guideMask = this.guideMask = new engine.Container();
var guideHole = this._guideHole = new engine.Image(getTextureByName('guide'));
guideHole.x = options.x;
guideHole.y = options.y;
guideHole.width = 250;
guideHole.height = 250;
guideHole.name = 'guideHole';
guideMask.addChild(guideHole);
this.createRect(guideMask, 0, 0, width, guideHole.y);
this.createRect(guideMask, 0, guideHole.y, guideHole.x, guideHole.height);
this.createRect(guideMask, guideHole.x + guideHole.width, guideHole.y, width - guideHole.x - guideHole.width, guideHole.height);
this.createRect(guideMask, 0, guideHole.y + guideHole.height, width, height - guideHole.y - guideHole.height);
this.guideStep(id);
var label = this.label = new engine.Label();
label.fillColor = 'white';
label.size = 25;
label.text = options.guideText;
label.x = (width - label.width) / 2;
label.y = guideHole.y + guideHole.height + 50;
label.textAlign = engine.TEXT_ALIGN.CENTER;
label.name = 'labHint';
guideMask.addChild(label);
this.addChild(guideMask);
}
this.once(engine.MouseEvent.CLICK, function () {
this.removeChild(this.guideMask);
this.guideMask = null;
if (this._callBack) {
this._callBack();
}
}, this);
};
GuideLayer.prototype.createRect = function (container, x, y, width, height) {
var rect = new engine.Rect();
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
rect.fillColor = 'black';
rect.alpha = 0.7;
container.addChild(rect);
};
GuideLayer.prototype.guideStep = function (id) {
if (id == 1) {
var guideHand = new engine.Image(getTextureByName('guideHand'));
guideHand.x = this._options.x + 300;
guideHand.y = this._options.y + 100;
this.guideMask.addChild(guideHand);
var rect = new engine.Rect();
rect.x = this._options.x + 200;
rect.y = this._options.y - 15;
rect.width = props.strutWidth;
rect.height = 200;
rect.fillColor = props.strutColor;
this.guideMask.addChild(rect);
this._canClear.push(guideHand);
this._canClear.push(rect);
}
if (id == 2) {
var know = new engine.Image(getTextureByName('know'));
know.x = (this.stage.width - know.width) / 2;
know.y = this._options.y + 400;
this.guideMask.addChild(know);
this._canClear.push(know);
}
};
return GuideLayer;
}(engine.Container));
//# sourceMappingURL=GuideLayer.js.map
var LoopComponent = (function (_super) {
tslib.__extends(LoopComponent, _super);
function LoopComponent() {
var _this = _super.call(this) || this;
_this.onceInfo = { width: 0, height: 0, count: 0 };
_this.loopInfo = { width: 0, height: 0, count: 0 };
_this.parts = [];
return _this;
}
LoopComponent.prototype.setup = function (parts, info) {
var _this = this;
parts.forEach(function (item, index) {
var part;
if (typeof item == 'string') {
part = new engine.Sprite(getTextureByName(item));
}
else if (item instanceof engine.Texture) {
part = new engine.Sprite(item);
}
else {
part = item;
}
_this.addChild(part);
_this.parts.push(part);
if (index == 0) {
info.width = part.width;
info.height = part.height;
}
});
info.count = parts.length;
this.setViewport(0, 0);
};
LoopComponent.prototype.changeBg = function (changName) {
this.parts.forEach(function (item, index) {
item.texture = getTextureByName(changName);
});
};
LoopComponent.prototype.setupLoop = function (resArr) {
this.setup(resArr, this.loopInfo);
};
LoopComponent.prototype.setViewport = function (x, y) {
if (y === void 0) { y = 0; }
var sizeField = y == 0 ? 'width' : 'height';
var posField = y == 0 ? 'x' : 'y';
var pos = y == 0 ? x : y;
var index;
var onceSize = this.onceInfo[sizeField];
var onceCount = this.onceInfo.count;
var loopCount = this.loopInfo.count;
var loopSize = this.loopInfo[sizeField];
index = onceSize == 0 ? -1 : Math.floor(pos / onceSize);
if (index < 0 || index >= onceCount) {
var loopIndex = Math.floor((pos - onceCount * onceSize) / this.loopInfo[sizeField]);
index = onceCount + loopIndex;
}
var formerIndex = index < onceCount ? index : (index) % loopCount + onceCount;
var latterIndex = index < onceCount ? index + 1 : (index - onceCount + 1) % loopCount + onceCount;
var former = this.parts[formerIndex];
var latter = this.parts[latterIndex];
if (!former || !latter) {
console.log(formerIndex, latterIndex);
}
former[posField] = -(pos - loopSize * (index < onceCount ? index : index - onceCount) - (index < onceCount ? 0 : onceCount * onceSize));
latter[posField] = former.x + (index < onceCount ? onceSize : loopSize);
};
return LoopComponent;
}(engine.Container));
//# sourceMappingURL=LoopComponent.js.map
var Background = (function (_super) {
tslib.__extends(Background, _super);
function Background() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.partResHHL = ['hhl_after', 'hhl_front'];
_this.partResHB = ['hb_after', 'hb_front'];
_this.partResWH = ['wh_after', 'wh_front'];
_this.speeds = [];
_this.resArray = [];
_this.frameMovePos = 0;
return _this;
}
Background.prototype.initBg = function () {
this.sumMovePos = 0;
this.speeds.push(props.afterBGMoveSpeed);
this.speeds.push(props.frontBGMoveSpeed);
var bottomBg = new engine.Rect();
bottomBg.x = 0;
bottomBg.y = 0;
bottomBg.width = getStage().width;
bottomBg.height = 0;
bottomBg.fillColor = 0x75c9f5;
this.addChild(bottomBg);
this.resArray.push(this.partResHHL);
this.resArray.push(this.partResHB);
this.resArray.push(this.partResWH);
this._bgIndex = 0;
var parts = [];
for (var i = 0; i < 2; i++) {
var part = new LoopComponent();
part.setupLoop([
this.resArray[0][i],
this.resArray[0][i],
]);
parts.push(part);
this.addChild(part);
}
parts[1].y = 200;
};
Background.prototype.setViewport = function (pos) {
this.needFrameSum = (props.pierMoveTime / 1000) * 60;
this.frameMovePos = pos / this.needFrameSum;
this.frameIndex = 0;
this.addEventListener(engine.Event.ENTER_FRAME, this.frame, this);
};
Background.prototype.frame = function () {
if (this.frameIndex < this.needFrameSum) {
for (var i = 0; i < 2; i++) {
var part = this.getChildAt(i + 1);
var speed = this.speeds[i];
var tmpPos = ((this.frameMovePos * this.frameIndex) + this.sumMovePos) * speed;
part.setViewport(tmpPos);
}
this.frameIndex++;
}
else {
this.sumMovePos += this.frameMovePos * this.needFrameSum;
this.frameIndex = 0;
this.removeEventListener(engine.Event.ENTER_FRAME, this.frame, this);
}
};
Background.prototype.changeBg = function (index) {
for (var i = 0; i < 2; i++) {
var part = this.getChildAt(i + 1);
part.changeBg(this.resArray[index][i]);
if (i == 1 && index == 1) {
part.y = 400;
}
if (i == 1 && index == 2) {
part.y = 250;
}
}
this._bgIndex = index;
};
Background.prototype.getBgIndex = function () {
return this._bgIndex;
};
return Background;
}(engine.Container));
//# sourceMappingURL=Background.js.map
var Pier = (function (_super) {
tslib.__extends(Pier, _super);
function Pier() {
var _this = _super.call(this) || this;
_this.bmp = new engine.Sprite();
_this.addChild(_this.bmp);
return _this;
}
Pier.prototype.init = function () {
var bmp = this.bmp;
bmp.alpha = 1;
bmp.texture = getTextureByName('pier');
bmp.x = 0;
bmp.y = bmp.height;
if (this.children.length < 2) {
var gold = new engine.Sprite();
gold.texture = getTextureByName('gold');
gold.name = 'gold';
this.addChild(gold);
}
this.setGoldPosX(bmp);
this.setShowGold();
};
Pier.prototype.setShowGold = function () {
var nodeGold = this.getChildByName('gold');
var randomWard = Math.random();
nodeGold.alpha = 1;
var isShow = randomWard < props.reward ? true : false;
nodeGold.visible = isShow;
this.haveGold = isShow;
};
Pier.prototype.setGoldPosX = function (bmp) {
var nodeGold = this.getChildByName('gold');
var pos = bmp.width / 2 - nodeGold.width / 2;
nodeGold.x = pos;
nodeGold.y = bmp.height - nodeGold.height - 50;
nodeGold.visible = false;
};
Pier.prototype.closeGold = function () {
var _this = this;
this.children.forEach(function (item) {
if (item.name == 'gold') {
item.anchorX = item.width / 2;
item.anchorY = item.height / 2;
engine.Tween.get(item, { loop: false })
.to({ scaleX: 2.5, scaleY: 2.5 }, 200, engine.Ease.cubicOut)
.to({ scaleX: 1, scaleY: 1, alpha: 0 }, 200, engine.Ease.cubicIn)
.call(function () {
item.visible = false;
_this.haveGold = false;
});
}
});
};
return Pier;
}(engine.Container));
//# sourceMappingURL=Pier.js.map
var Player = (function (_super) {
tslib.__extends(Player, _super);
function Player() {
return _super !== null && _super.apply(this, arguments) || this;
}
Player.prototype.initPlayer = function (pierWidth) {
this._container = new engine.Container();
this.addChild(this._container);
this.playerNode = createSvga('walk');
this._container.addChild(this.playerNode);
this.playerNode.y = 675;
this.playerNode.x = pierWidth / 2 - 80;
this.playerNode.play();
};
Player.prototype.setViewport = function (pos, callBack, pierWidth) {
var tmpPos = 0;
var isSuccess = false;
if (!pierWidth) {
tmpPos = pos;
isSuccess = true;
}
else {
tmpPos = pierWidth - this.playerNode.x + pos - 60;
}
this.playGoTween(tmpPos, callBack, isSuccess);
};
Player.prototype.playGoTween = function (pos, callBack, isSuccess) {
var _this = this;
engine.Tween.get(this._container, { loop: false })
.to({ x: pos }, props.playerMoveSpeed)
.call(function () {
engine.Tween.removeTweens(_this._container);
if (isSuccess) {
if (callBack) {
callBack();
}
}
else {
_this.playDropTween(callBack);
}
});
};
Player.prototype.playDropTween = function (callBack) {
var _this = this;
engine.Tween.get(this._container, { loop: false })
.to({ y: 2000 }, 1000)
.call(function () {
engine.Tween.removeTweens(_this._container);
if (callBack) {
callBack();
}
});
};
Player.prototype.setBackViewport = function (callBack) {
var _this = this;
engine.Tween.get(this._container, { loop: false })
.to({ x: 0 }, props.pierMoveTime)
.call(function () {
engine.Tween.removeTweens(_this._container);
if (callBack) {
callBack();
}
});
};
return Player;
}(engine.Container));
//# sourceMappingURL=Player.js.map
var Strut = (function (_super) {
tslib.__extends(Strut, _super);
function Strut() {
return _super !== null && _super.apply(this, arguments) || this;
}
Strut.prototype.init = function () {
this._strut = new engine.Rect();
this.addChild(this._strut);
this._strut.width = props.strutWidth;
this._strut.y = 833;
this._strut.fillColor = props.strutColor;
this._strut.rotation = 180;
};
Strut.prototype.onMouseDown = function (pierWidth, distance, callBack) {
this._strut.x = pierWidth - 60;
this._distance = distance;
this._callBack = callBack;
this._strut.visible = true;
this.addEventListener(engine.Event.ENTER_FRAME, this.frame, this);
};
Strut.prototype.onMouseUp = function () {
var _this = this;
this.removeEventListener(engine.Event.ENTER_FRAME, this.frame, this);
setTimeout(function () {
_this.strutRotation();
}, 200);
};
Strut.prototype.strutRotation = function () {
var _this = this;
engine.Tween.get(this._strut, { loop: false })
.to({ rotation: 270 }, props.strutRotationSpeed)
.call(function () {
_this.judgeResult();
engine.Tween.removeTweens(_this._strut);
});
};
Strut.prototype.judgeResult = function () {
var isSuccess = false;
if (this._distance[0] - this._distance[1] + 60 <= this._strut.height && this._strut.height <= this._distance[0] + 30) {
isSuccess = true;
}
if (this._callBack) {
this._callBack(isSuccess);
}
};
Strut.prototype.frame = function () {
if (this._strut.height < 1000) {
this._strut.height += props.strutUpSpeed;
}
};
Strut.prototype.rest = function () {
this._strut.width = props.strutWidth;
this._strut.y = 833;
this._strut.fillColor = props.strutColor;
this._strut.rotation = 180;
this._strut.height = 0;
this._strut.visible = false;
};
Strut.prototype.getStrutHeight = function () {
var distance = this._strut.height > 1000 ? 1000 : this._strut.height;
return distance;
};
return Strut;
}(engine.Container));
//# sourceMappingURL=Strut.js.map
var ScoreLabel = (function (_super) {
tslib.__extends(ScoreLabel, _super);
function ScoreLabel() {
return _super !== null && _super.apply(this, arguments) || this;
}
ScoreLabel.prototype.updateScore = function (score, animation) {
if (animation === void 0) { animation = true; }
this._value = score;
if (animation && this._tmp) {
this.animationUpdate();
}
else {
this.updateLocal(score);
}
};
ScoreLabel.prototype.animationUpdate = function () {
var _this = this;
var tmpInterval = setInterval(function () {
_this._tmp += 1;
if (_this._tmp <= _this._value) {
_this.text = _this._tmp;
}
else {
_this._tmp = _this._value;
clearInterval(tmpInterval);
}
}, 50);
};
ScoreLabel.prototype.updateLocal = function (v) {
this._tmp = v;
this.text = v;
};
return ScoreLabel;
}(engine.Label));
//# sourceMappingURL=ScoreLabel.js.map
var ObjectPool$1 = engine.ObjectPool;
var PoolName = 'pier';
ObjectPool$1.registerPool(PoolName, function () {
return new Pier();
}, function (item, data) {
item.init();
});
var GameView = (function (_super) {
tslib.__extends(GameView, _super);
function GameView() {
var _this = _super.call(this) || this;
_this.moveX = 0;
return _this;
}
GameView.prototype.start = function (guide) {
return tslib.__awaiter(this, void 0, void 0, function () {
var road, pierWidth, player, strut, initScore;
return tslib.__generator(this, function (_a) {
this._isTouchLayer = true;
this._sumScore = 0;
this._isMouseDown = false;
this._backgroud = new Background();
this._backgroud.initBg();
this.addChild(this._backgroud);
road = this._road = new Road();
road.setup();
this.addChild(road);
pierWidth = this._road.getFristPier();
player = this._player = new Player();
player.initPlayer(pierWidth);
this.addChild(player);
strut = this._strut = new Strut();
strut.init();
this.addChild(strut);
this._scoreContainer = new engine.Container();
this.addChild(this._scoreContainer);
this.initLabScore();
initScore = this._road.getStartGold(0) ? props.goldScore : 0;
this.updateScore(initScore);
if (guide == '1') {
this.setGuide();
}
else {
this.initTouch();
this.registerEvent();
}
return [2];
});
});
};
GameView.prototype.setGuide = function () {
var _this = this;
this._road.setGuide();
var guideLayer = this.guideLayer = new GuideLayer();
this.addChild(guideLayer);
this.guideLayer.show(1, { x: 20, y: 650, guideText: props.guideText1 }, function () {
var posX = _this._road.getMovePos();
_this.guideLayer.show(2, { x: posX + 20, y: 620, guideText: props.guideText2 }, function () {
_this.initTouch();
_this.registerEvent();
});
});
};
GameView.prototype.initLabScore = function () {
var scoreBg = new engine.Sprite(getTextureByName('scoreBg'));
scoreBg.x = getStage().width / 2 - scoreBg.width / 2;
scoreBg.y = 80;
var scoreHint = new engine.Sprite(getTextureByName('scoreHint'));
scoreHint.x = getStage().width / 2 - scoreHint.width / 2;
scoreHint.y = 40;
this._scoreContainer.addChild(scoreHint);
this.labScore = new ScoreLabel();
this.labScore.fillColor = 0xff7646;
this.labScore.size = 70;
this.labScore.width = getStage().width;
this.labScore.height = scoreBg.height;
this.labScore.textAlign = engine.TEXT_ALIGN.CENTER;
this.labScore.x = 0;
this.labScore.y = scoreBg.y + 10;
this._scoreContainer.addChild(this.labScore);
};
GameView.prototype.registerEvent = function () {
this._touchLayer.addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onMouseDown, this);
this._touchLayer.addEventListener(engine.MouseEvent.MOUSE_UP, this.onMouseUp, this);
};
GameView.prototype.removeListener = function () {
this._touchLayer.removeEventListener(engine.MouseEvent.MOUSE_DOWN, this.onMouseDown, this);
this._touchLayer.removeEventListener(engine.MouseEvent.MOUSE_UP, this.onMouseUp, this);
};
GameView.prototype.initTouch = function () {
this._touchLayer = new engine.Rect();
this.addChild(this._touchLayer);
this._touchLayer.width = getStage().width;
this._touchLayer.height = getStage().height;
this._touchLayer.x = 0;
this._touchLayer.y = 0;
this._touchLayer.alpha = 0;
};
GameView.prototype.setScoreShow = function () {
};
GameView.prototype.onMouseDown = function () {
if (this._isTouchLayer) {
this._isMouseDown = true;
this._strut.onMouseDown(this._road.getFristPier(), this._road.getDistance(), this.goCallBcak.bind(this));
}
};
GameView.prototype.onMouseUp = function () {
if (this._isTouchLayer && this._isMouseDown) {
this._strut.onMouseUp();
this._isMouseDown = false;
this._isTouchLayer = false;
}
};
GameView.prototype.goCallBcak = function (isSuccess) {
var _this = this;
if (isSuccess) {
console.log('成功了');
var movePos = this._road.getMovePos();
if (this._road.getStartGold(1, false)) {
this.updateScore(props.singleScore + props.goldScore);
}
else {
this.updateScore(props.singleScore);
}
this._player.setViewport(movePos, this.complete.bind(this));
}
else {
console.log('失败了');
this._player.setViewport(this._strut.getStrutHeight(), function () {
console.log('掉下去了');
engine.globalEvent.dispatchEvent('dxbcyj-game-result', { score: _this._sumScore });
}, this._road.getFristPier());
}
};
GameView.prototype.complete = function () {
var _this = this;
this._road.getStartGold(1);
var movePos = this._road.getMovePos();
this._road.setViewport();
this._backgroud.setViewport(movePos);
this._player.setBackViewport(function () {
_this._isTouchLayer = true;
});
this.closeStrut();
};
GameView.prototype.closeStrut = function () {
this._strut.rest();
};
GameView.prototype.updateScore = function (score) {
this._sumScore += score;
if (0 <= this._sumScore && this._sumScore <= props.bgFristScore) {
this.changeBg(0);
}
else if (props.bgFristScore < this._sumScore && this._sumScore <= props.bgSecondScore) {
this.changeBg(1);
}
else {
this.changeBg(2);
}
this.labScore.updateScore(this._sumScore);
};
GameView.prototype.getScore = function () {
return this._sumScore;
};
GameView.prototype.changeBg = function (index) {
if (this._backgroud.getBgIndex() != index) {
this._backgroud.changeBg(index);
}
};
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('dxbcyj-game-start', _this.start, _this);
var gameView = _this._gameView = new GameView();
_this.addChild(gameView);
return _this;
}
GameWrapper.prototype.start = function (event) {
this._gameView.start(event.data.guide);
};
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/dxbcyj-game/src/props.ts","src/custom/dxbcyj-game/src/game/Road.ts","src/custom/dxbcyj-game/src/game/utils.ts","src/custom/dxbcyj-game/src/game/GuideLayer.ts","src/custom/dxbcyj-game/src/game/LoopComponent.ts","src/custom/dxbcyj-game/src/game/Background.ts","src/custom/dxbcyj-game/src/game/Pier.ts","src/custom/dxbcyj-game/src/game/Player.ts","src/custom/dxbcyj-game/src/game/Strut.ts","src/custom/dxbcyj-game/src/game/ScoreLabel.ts","src/custom/dxbcyj-game/src/game/GameView.ts","src/custom/dxbcyj-game/src/game/GameWrapper.ts","src/custom/dxbcyj-game/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\r\nimport { props } from './../props';\r\nimport ObjectPool = engine.ObjectPool;\r\nimport {getStage} from \"./utils\";\r\nimport { Pier } from './Pier';\r\nimport GameView from './GameView';\r\n\r\nexport class Road extends engine.Container{\r\n //container: engine.Container;\r\n lastPos;\r\n setup(){\r\n // this.container = new engine.Container();\r\n // this.addChild(this.container);\r\n this.lastPos = 0;\r\n this.addPier();\r\n\r\n }\r\n getFristPier(){\r\n return this.getChildAt(0).width;\r\n }\r\n getDistance(){\r\n let distance = [];\r\n let pier1 = this.getChildAt(0);\r\n let pier2 = this.getChildAt(1);\r\n distance.push(pier2.x - pier1.x);\r\n distance.push(pier2.width);\r\n\r\n return distance;\r\n }\r\n addPier(){ \r\n while(this.children.length < props.pierCount + 1){\r\n let childrenNum = this.children.length;\r\n let randomPos = this.makeRandomFloat(props.pierMaxDistance,props.pierMinDistance);\r\n const pier: Pier = ObjectPool.getObject('pier');\r\n this.addChild(pier);\r\n if(childrenNum == 0){\r\n pier.x = 0;\r\n }else{\r\n pier.x = this.lastPos + randomPos;\r\n }\r\n this.lastPos = pier.x;\r\n }\r\n }\r\n moveAddPier(){\r\n let randomPos = this.makeRandomFloat(props.pierMaxDistance,props.pierMinDistance);\r\n const pier: Pier = ObjectPool.getObject('pier');\r\n let lastChild = this.getChildAt(this.children.length -1);\r\n pier.x = lastChild.x + randomPos;\r\n this.addChild(pier);\r\n\r\n }\r\n makeRandomFloat(max: number, min: number = 0): number {\r\n return Math.random() * (max - min) + min;\r\n }\r\n setViewport(){\r\n let tmpMovepos = this.getMovePos();\r\n this.children.forEach((item,index) => {\r\n this.playTween(item,index,tmpMovepos);\r\n })\r\n }\r\n //获得移动位移\r\n getMovePos(){\r\n let movePos:any = this.getChildAt(1);\r\n return movePos.x;\r\n }\r\n playTween(item,index,tmpMovepos){\r\n engine.Tween.get(item,{loop:false})\r\n .to({x : item.x - tmpMovepos},props.pierMoveTime)\r\n .call(()=>{\r\n if(this.getChildIndex(item) == 0){\r\n engine.Tween.removeTweens(item);\r\n this.removeChild(item);\r\n ObjectPool.recycleObject('pier',item);\r\n }\r\n if(index == 0){\r\n this.moveAddPier();\r\n }\r\n })\r\n }\r\n //桥墩是否有金币\r\n getStartGold(index,isClose = true){\r\n let tmpNode:any = this.getChildAt(index);\r\n let haveGold = tmpNode.haveGold;\r\n if(haveGold && isClose){\r\n tmpNode.closeGold();\r\n }\r\n return haveGold;\r\n } \r\n //设置新手引导 第二个桥墩要有金币\r\n setGuide(){\r\n let tmpNode:any = this.getChildAt(1);\r\n if(!tmpNode.haveGold){\r\n tmpNode.children.forEach((item) => {\r\n if(item.name == 'gold'){\r\n item.visible = true;\r\n }\r\n })\r\n tmpNode.haveGold = true;\r\n }\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 getStage(){\r\n\treturn engine.gameStage.stage;\r\n}\r\n\r\nexport function createSvga(name) {\r\n\tlet inst = new svga.Svga();\r\n\tinst.source = engine.getAssetByName(name).uuid;\r\n\t// let anchor = props[(anchorName)];\r\n\t// if (anchor) {\r\n\t// \tinst.x = -anchor.x;\r\n\t// \tinst.y = -anchor.y;\r\n\r\n\t// \tinst.anchorX = anchor.x;\r\n\t// \tinst.anchorY = anchor.y;\r\n\t// }\r\n\treturn inst;\r\n}\r\n","/**\r\n * Created by rockyl on 2020-01-30.\r\n */\r\nimport {props} from \"../props\";\r\nimport {getTextureByName} from \"./utils\";\r\n\r\nexport class GuideLayer extends engine.Container {\r\n\tprivate guideMask: engine.Container;\r\n\tprivate _options;\r\n\t_guideHole;\r\n\t_canClear:any = [];\r\n\t_callBack;\r\n\tprivate label: engine.Label;\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tthis.setup();\r\n\t}\r\n\r\n\tprivate setup() {\r\n\r\n\t}\r\n\r\n\tshow(id, options,callback?) {\r\n\t\tthis.visible = true;\r\n\t\tthis._callBack = callback?callback:null;\r\n\t\tif (!this.guideMask) {\r\n\t\t\tthis._options = options;\r\n\t\t\tconst {width, height} = this.stage;\r\n\t\t\tlet guideMask = this.guideMask = new engine.Container();\r\n\t\t\t\r\n\t\t\tlet guideHole = this._guideHole= new engine.Image(getTextureByName('guide'));\r\n\t\t\tguideHole.x = options.x;\r\n\t\t\tguideHole.y = options.y;\r\n\t\t\tguideHole.width = 250;\r\n\t\t\tguideHole.height = 250;\r\n\t\t\tguideHole.name = 'guideHole';\r\n\t\t\tguideMask.addChild(guideHole);\r\n\r\n\t\t\t\r\n\t\t\tthis.createRect(guideMask, 0, 0, width, guideHole.y);\r\n\t\t\tthis.createRect(guideMask, 0, guideHole.y, guideHole.x, guideHole.height);\r\n\t\t\tthis.createRect(guideMask, guideHole.x + guideHole.width, guideHole.y, width - guideHole.x - guideHole.width, guideHole.height);\r\n\t\t\tthis.createRect(guideMask, 0, guideHole.y + guideHole.height, width, height - guideHole.y - guideHole.height);\r\n\t\t\tthis.guideStep(id);\r\n\t\t\tlet label = this.label = new engine.Label();\r\n\t\t\tlabel.fillColor = 'white';\r\n\t\t\tlabel.size = 25;\r\n\t\t\tlabel.text = options.guideText;\r\n\t\t\tlabel.x = (width - label.width) / 2;\r\n\t\t\tlabel.y = guideHole.y + guideHole.height + 50;\r\n\t\t\tlabel.textAlign = engine.TEXT_ALIGN.CENTER;\r\n\t\t\tlabel.name = 'labHint';\r\n\t\t\tguideMask.addChild(label);\r\n\r\n\t\t\tthis.addChild(guideMask);\r\n\t\t}\r\n\t\tthis.once(engine.MouseEvent.CLICK, function(){\r\n\t\r\n\t\t\tthis.removeChild(this.guideMask);\r\n\t\t\tthis.guideMask = null;\r\n\t\t\r\n\t\t\tif(this._callBack){\r\n\t\t\t\tthis._callBack();\r\n\t\t\t}\r\n\t\t\r\n\t\t}, this);\r\n\t}\r\n\r\n\tcreateRect(container, x, y, width, height) {\r\n\t\tlet rect = new engine.Rect();\r\n\t\trect.x = x;\r\n\t\trect.y = y;\r\n\t\trect.width = width;\r\n\t\trect.height = height;\r\n\t\trect.fillColor = 'black';\r\n\t\trect.alpha = 0.7;\r\n\r\n\t\tcontainer.addChild(rect);\r\n\t}\r\n\tguideStep(id){\r\n\t\tif(id == 1){\r\n\t\t\tlet guideHand = new engine.Image(getTextureByName('guideHand'));\r\n\t\t\tguideHand.x = this._options.x + 300;\r\n\t\t\tguideHand.y = this._options.y + 100;\r\n\t\t\tthis.guideMask.addChild(guideHand);\r\n\t\r\n\t\t\tlet rect = new engine.Rect();\r\n\t\t\trect.x = this._options.x + 200;\r\n\t\t\trect.y = this._options.y - 15;\r\n\t\t\trect.width = props.strutWidth;\r\n\t\t\trect.height = 200;\r\n\t\t\trect.fillColor = props.strutColor;\r\n\t\t\tthis.guideMask.addChild(rect);\r\n\r\n\t\t\tthis._canClear.push(guideHand);\r\n\t\t\tthis._canClear.push(rect);\r\n\t\t}\r\n\t\tif(id == 2){\r\n\r\n\t\t\tlet know = new engine.Image(getTextureByName('know'));\r\n\t\t\tknow.x = (this.stage.width - know.width) / 2;\r\n\t\t\tknow.y = this._options.y + 400;\r\n\t\t\tthis.guideMask.addChild(know);\r\n\t\t\tthis._canClear.push(know);\r\n\t\t}\r\n\t}\r\n}\r\n","\r\nimport {getTextureByName} from \"./utils\";\r\nexport class LoopComponent extends engine.Container{\r\n parts: any[];\r\n\r\n\tonceInfo: any = {width: 0, height: 0, count: 0};\r\n\tloopInfo: any = {width: 0, height: 0, count: 0};\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tthis.parts = [];\r\n }\r\n private setup(parts, info) {\r\n parts.forEach((item, index) => {\r\n\t\t\tlet part;\r\n\t\t\tif(typeof item == 'string'){\r\n\t\t\t\tpart = new engine.Sprite(getTextureByName(item));\r\n\t\t\t\r\n\t\t\t}else if(item instanceof engine.Texture){\r\n\t\t\t\tpart = new engine.Sprite(item);\r\n\t\t\t}else {\r\n\t\t\t\tpart = item;\r\n\t\t\t}\r\n\t\t\tthis.addChild(part);\r\n\t\t\tthis.parts.push(part);\r\n\r\n\t\t\tif (index == 0) {\r\n\t\t\t\tinfo.width = part.width;\r\n\t\t\t\tinfo.height = part.height;\r\n\t\t\t}\r\n\t\t});\r\n\t\tinfo.count = parts.length;\r\n\r\n\t\tthis.setViewport(0, 0)\r\n }\r\n\r\n\tchangeBg(changName){\r\n\t\tthis.parts.forEach((item, index) => {\r\n\t\t\titem.texture = getTextureByName(changName)\r\n\t\t});\r\n\t}\r\n\tsetupLoop(resArr) {\r\n\t\tthis.setup(resArr, this.loopInfo);\r\n }\r\n setViewport(x, y = 0) {\r\n\t\tconst sizeField = y == 0 ? 'width' : 'height';\r\n\t\tconst posField = y == 0 ? 'x' : 'y';\r\n\t\tconst pos = y == 0 ? x : y;\r\n\r\n\t\tlet index;\r\n\t\tconst onceSize = this.onceInfo[sizeField];\r\n\t\tconst onceCount = this.onceInfo.count;\r\n\t\tconst loopCount = this.loopInfo.count;\r\n\t\tconst loopSize = this.loopInfo[sizeField];\r\n\t\tindex = onceSize == 0 ? -1 : Math.floor(pos / onceSize);\r\n\r\n\t\tif (index < 0 || index >= onceCount) {\r\n\t\t\tconst loopIndex = Math.floor((pos - onceCount * onceSize) / this.loopInfo[sizeField]);\r\n\t\t\tindex = onceCount + loopIndex;\r\n\t\t}\r\n\r\n\t\tlet formerIndex = index < onceCount ? index : (index) % loopCount + onceCount;\r\n\t\tlet latterIndex = index < onceCount ? index + 1 : (index - onceCount + 1) % loopCount + onceCount;\r\n\t\tlet former = this.parts[formerIndex];\r\n\t\tlet latter = this.parts[latterIndex];\r\n\t\tif(!former || !latter){\r\n\t\t\tconsole.log(formerIndex, latterIndex);\r\n\t\t}\r\n\t\tformer[posField] = -(pos - loopSize * (index < onceCount ? index : index - onceCount) - (index < onceCount ? 0 : onceCount * onceSize));\r\n\t\tlatter[posField] = former.x + (index < onceCount ? onceSize : loopSize);\r\n\t}\r\n}","\r\n\r\nimport {getTextureByName} from \"./utils\";\r\nimport {getStage} from \"./utils\";\r\nimport {LoopComponent} from \"./LoopComponent\";\r\nimport { props } from './../props';\r\n\r\nexport class Background extends engine.Container{\r\n partResHHL = ['hhl_after', 'hhl_front'];\r\n partResHB = ['hb_after','hb_front'];\r\n partResWH = ['wh_after','wh_front'];\r\n speeds = [];\r\n resArray=[];\r\n frameMovePos = 0;\r\n frameIndex;\r\n sumMovePos;\r\n _bgIndex;\r\n //需要的总帧数\r\n needFrameSum;\r\n initBg(){\r\n this.sumMovePos = 0;\r\n this.speeds.push(props.afterBGMoveSpeed);\r\n this.speeds.push(props.frontBGMoveSpeed);\r\n \r\n let bottomBg = new engine.Rect();\r\n bottomBg.x = 0;\r\n bottomBg.y = 0;\r\n bottomBg.width = getStage().width;\r\n bottomBg.height = 0;\r\n bottomBg.fillColor = 0x75c9f5;\r\n\r\n this.addChild(bottomBg);\r\n this.resArray.push(this.partResHHL)\r\n this.resArray.push(this.partResHB)\r\n this.resArray.push(this.partResWH)\r\n this._bgIndex = 0;\r\n\t\tconst parts = [];\r\n\t\tfor(let i = 0; i < 2; i++){\r\n\t\t\tlet part = new LoopComponent();\r\n\t\t\tpart.setupLoop([\r\n\t\t\t\tthis.resArray[0][i],\r\n\t\t\t\tthis.resArray[0][i],\r\n\t\t\t]);\r\n\t\t\tparts.push(part);\r\n this.addChild(part);\r\n }\r\n \r\n //(height - parts[1].height) / 2 - 200\r\n parts[1].y = 200;\r\n }\r\n \r\n setViewport(pos) {\r\n this.needFrameSum = (props.pierMoveTime/1000)*60;\r\n this.frameMovePos = pos/this.needFrameSum;\r\n this.frameIndex = 0;\r\n this.addEventListener(engine.Event.ENTER_FRAME,this.frame,this);\r\n }\r\n frame(){\r\n if( this.frameIndex < this.needFrameSum){\r\n for (let i = 0; i < 2; i++) {\r\n const part = <LoopComponent>this.getChildAt(i + 1);\r\n const speed = this.speeds[i];\r\n let tmpPos = ((this.frameMovePos * this.frameIndex) + this.sumMovePos ) * speed;\r\n part.setViewport(tmpPos)\r\n }\r\n this.frameIndex++\r\n }else{\r\n this.sumMovePos += this.frameMovePos * this.needFrameSum;\r\n this.frameIndex = 0\r\n this.removeEventListener(engine.Event.ENTER_FRAME,this.frame,this);\r\n } \r\n }\r\n changeBg(index){\r\n for (let i = 0; i < 2; i++) {\r\n const part = <LoopComponent>this.getChildAt(i + 1);\r\n part.changeBg(this.resArray[index][i]);\r\n if(i == 1 && index ==1){\r\n part.y = 400;\r\n } \r\n if(i == 1 && index ==2){\r\n part.y = 250;\r\n } \r\n }\r\n this._bgIndex = index;\r\n }\r\n getBgIndex(){\r\n return this._bgIndex;\r\n }\r\n}","import { props } from './../props';\r\nimport {getTextureByName,getStage} from \"./utils\";\r\nexport class Pier extends engine.Container {\r\n bmp;\r\n public haveGold;\r\n constructor() {\r\n\t\tsuper();\r\n this.bmp = new engine.Sprite();\r\n this.addChild(this.bmp);\r\n\t\t\r\n }\r\n init(){\r\n\t\tconst bmp = this.bmp;\r\n\t\tbmp.alpha = 1;\r\n\t\tbmp.texture = getTextureByName('pier');\r\n\t\tbmp.x = 0;\r\n bmp.y = bmp.height ;\r\n if(this.children.length < 2){\r\n const gold = new engine.Sprite();\r\n gold.texture = getTextureByName('gold');\r\n gold.name = 'gold';\r\n this.addChild(gold);\r\n }\r\n this.setGoldPosX(bmp);\r\n this.setShowGold();\r\n }\r\n setShowGold(){\r\n let nodeGold = this.getChildByName('gold');\r\n let randomWard = Math.random();\r\n nodeGold.alpha = 1;\r\n let isShow = randomWard < props.reward ? true : false ;\r\n nodeGold.visible = isShow;\r\n this.haveGold = isShow;\r\n }\r\n setGoldPosX(bmp){\r\n let nodeGold = this.getChildByName('gold');\r\n let pos = bmp.width / 2 - nodeGold.width/2;\r\n nodeGold.x = pos\r\n nodeGold.y = bmp.height - nodeGold.height - 50;\r\n nodeGold.visible = false;\r\n }\r\n closeGold(){\r\n this.children.forEach((item) => {\r\n if(item.name == 'gold')\r\n {\r\n item.anchorX = item.width/2;\r\n item.anchorY = item.height/2;\r\n engine.Tween.get(item,{loop:false})\r\n .to({scaleX:2.5,scaleY:2.5},200,engine.Ease.cubicOut)\r\n .to({scaleX:1,scaleY:1,alpha:0},200,engine.Ease.cubicIn)\r\n .call(()=>{\r\n item.visible = false;\r\n this.haveGold = false;\r\n })\r\n }\r\n })\r\n }\r\n}","import {props} from \"../props\";\r\nimport {createSvga, playSound} from \"./utils\";\r\nexport class Player extends engine.Container{\r\n _container;\r\n private playerNode: svga.Svga;\r\n\r\n initPlayer(pierWidth){\r\n \r\n this._container = new engine.Container();\r\n this.addChild(this._container);\r\n\r\n\r\n this.playerNode = createSvga('walk');\r\n this._container.addChild(this.playerNode);\r\n this.playerNode.y = 675;\r\n this.playerNode.x = pierWidth/2 - 80;\r\n this.playerNode.play();\r\n }\r\n setViewport(pos,callBack,pierWidth?){\r\n let tmpPos = 0;\r\n let isSuccess = false;\r\n if(!pierWidth){\r\n tmpPos = pos;\r\n isSuccess = true;\r\n }else{\r\n tmpPos = pierWidth - this.playerNode.x + pos - 60;\r\n }\r\n this.playGoTween(tmpPos,callBack,isSuccess)\r\n }\r\n playGoTween(pos,callBack,isSuccess){\r\n engine.Tween.get(this._container,{loop:false})\r\n .to({x : pos},props.playerMoveSpeed)\r\n .call(()=>{\r\n engine.Tween.removeTweens(this._container);\r\n if(isSuccess){\r\n if(callBack){\r\n callBack();\r\n }\r\n }else{\r\n this.playDropTween(callBack);\r\n }\r\n \r\n })\r\n }\r\n playDropTween(callBack){\r\n engine.Tween.get(this._container,{loop:false})\r\n .to({y : 2000},1000)\r\n .call(()=>{\r\n engine.Tween.removeTweens(this._container);\r\n if(callBack){\r\n callBack();\r\n }\r\n })\r\n }\r\n setBackViewport(callBack){\r\n engine.Tween.get(this._container,{loop:false})\r\n .to({x : 0},props.pierMoveTime)\r\n .call(()=>{\r\n engine.Tween.removeTweens(this._container);\r\n if(callBack){\r\n callBack();\r\n }\r\n })\r\n }\r\n\r\n}","import { props } from \"../props\";\r\n\r\nexport class Strut extends engine.Container{\r\n _strut: engine.Rect;\r\n _distance;\r\n _callBack;\r\n init(){\r\n this._strut = new engine.Rect();\r\n this.addChild(this._strut);\r\n this._strut.width = props.strutWidth;\r\n this._strut.y = 833;\r\n this._strut.fillColor = props.strutColor;\r\n this._strut.rotation = 180;\r\n }\r\n onMouseDown(pierWidth,distance,callBack){\r\n this._strut.x = pierWidth - 60;\r\n this._distance = distance;\r\n this._callBack = callBack;\r\n this._strut.visible = true;\r\n this.addEventListener(engine.Event.ENTER_FRAME,this.frame,this);\r\n }\r\n onMouseUp(){\r\n this.removeEventListener(engine.Event.ENTER_FRAME,this.frame,this);\r\n setTimeout(() => {\r\n this.strutRotation();\r\n }, 200);\r\n }\r\n strutRotation(){\r\n engine.Tween.get(this._strut,{loop:false})\r\n .to({rotation:270},props.strutRotationSpeed)\r\n .call(()=>{\r\n this.judgeResult();\r\n engine.Tween.removeTweens(this._strut);\r\n })\r\n }\r\n judgeResult(){\r\n let isSuccess = false;\r\n if(this._distance[0] - this._distance[1] + 60 <= this._strut.height && this._strut.height <= this._distance[0] + 30){\r\n isSuccess = true;\r\n }\r\n if(this._callBack){\r\n this._callBack(isSuccess);\r\n }\r\n }\r\n frame(){\r\n if(this._strut.height < 1000){\r\n this._strut.height += props.strutUpSpeed;\r\n }\r\n }\r\n rest(){\r\n this._strut.width = props.strutWidth;\r\n this._strut.y = 833;\r\n this._strut.fillColor = props.strutColor;\r\n this._strut.rotation = 180;\r\n this._strut.height = 0;\r\n this._strut.visible = false;\r\n }\r\n getStrutHeight(){\r\n let distance = this._strut.height > 1000 ? 1000 :this._strut.height;\r\n return distance;\r\n }\r\n\r\n}","/**\r\n * Created by rockyl on 2018/9/10.\r\n *\r\n * 分数标签\r\n */\r\n\r\nexport class ScoreLabel extends engine.Label {\r\n _value;\r\n _tmp;\r\n\tupdateScore(score,animation = true) {\r\n this._value = score;\r\n\r\n\t\tif (animation && this._tmp) {\r\n this.animationUpdate();\r\n\t\t} else {\r\n this.updateLocal(score);\r\n\t\t}\r\n }\r\n \r\n animationUpdate(){\r\n let tmpInterval = setInterval(()=>{\r\n this._tmp += 1;\r\n if(this._tmp <= this._value){\r\n this.text = this._tmp\r\n }else{\r\n this._tmp = this._value;\r\n clearInterval(tmpInterval);\r\n }\r\n },50)\r\n }\r\n\r\n updateLocal(v){\r\n this._tmp = v;\r\n this.text = v;\r\n }\r\n\r\n}\r\n","\r\nimport { Road } from './Road';\r\n/**\r\n * Created by rockyl on 2018/8/16.\r\n */\r\n\r\nimport {props} from \"../props\";\r\nimport {getStage,getTextureByName} from \"./utils\";\r\nimport {GuideLayer} from \"./GuideLayer\";\r\nimport { Background } from \"./Background\";\r\nimport ObjectPool = engine.ObjectPool;\r\nimport { Pier } from './Pier';\r\nimport { Player } from './Player';\r\nimport { Strut } from './Strut';\r\nimport { ScoreLabel } from './ScoreLabel';\r\n\r\nexport const PoolName: string = 'pier';\r\n\r\nObjectPool.registerPool(PoolName, function () {\r\n\treturn new Pier();\r\n}, function (item: Pier, data) {\r\n\titem.init();\r\n});\r\n\r\nexport default class GameView extends engine.Container {\r\n\tguideLayer: GuideLayer;\r\n\t\r\n\tprivate _hasSetup;\r\n\t_backgroud:Background;\r\n\t_road:Road;\r\n\t_player:Player;\r\n\t_strut:Strut;\r\n\t_touchLayer: engine.Rect;\r\n\t_isTouchLayer;\r\n\t_scoreContainer;\r\n\tmoveX = 0;\r\n\tlabScore:ScoreLabel;\r\n\t_sumScore;\r\n\t_isMouseDown;\r\n\tconstructor() {\r\n\t\tsuper();\t\r\n\t}\r\n\r\n\tasync start(guide) {\r\n\t\tthis._isTouchLayer = true;\r\n\t\tthis._sumScore = 0;\r\n\t\tthis._isMouseDown = false;\r\n\r\n\t\tthis._backgroud = new Background();\r\n\t\tthis._backgroud.initBg();\r\n\t\tthis.addChild(this._backgroud);\r\n\r\n\t\tconst road = this._road = new Road();\r\n\t\troad.setup();\r\n\t\tthis.addChild(road);\r\n\r\n\t\tlet pierWidth = this._road.getFristPier();\r\n\t\tconst player = this._player = new Player();\r\n\t\tplayer.initPlayer(pierWidth);\r\n\t\tthis.addChild(player);\r\n\r\n\t\tconst strut = this._strut = new Strut();\r\n\t\tstrut.init();\r\n\t\tthis.addChild(strut);\r\n\r\n\t\tthis._scoreContainer = new engine.Container();\r\n\t\tthis.addChild(this._scoreContainer);\r\n\t\tthis.initLabScore();\r\n\r\n\t\tlet initScore = this._road.getStartGold(0) ? props.goldScore : 0;\r\n\t\tthis.updateScore(initScore);\r\n\r\n\t\t//是否是新手\r\n\t\tif(guide == '1'){\r\n\t\t\tthis.setGuide();\r\n\t\t}else{\r\n\t\t\tthis.initTouch();\r\n\t\t\tthis.registerEvent();\r\n\t\t}\r\n\t} \r\n\t//新手引导\r\n\tsetGuide(){\r\n\t\tthis._road.setGuide();\r\n\t\tconst guideLayer = this.guideLayer = new GuideLayer();\r\n\t\tthis.addChild(guideLayer);\r\n\t\tthis.guideLayer.show(1, {x:20,y: 650,guideText:props.guideText1},()=>{\r\n\t\t\tlet posX = this._road.getMovePos();\r\n\t\t\tthis.guideLayer.show(2, {x:posX+20,y: 620,guideText:props.guideText2},()=>{\r\n\t\t\t\tthis.initTouch();\r\n\t\t\t\tthis.registerEvent();\r\n\t\t\t})\r\n\t\t});\r\n\t}\r\n\tinitLabScore(){\r\n\t\tconst scoreBg = new engine.Sprite(getTextureByName('scoreBg'));\r\n\t\tscoreBg.x = getStage().width/2 - scoreBg.width/2; \r\n\t\tscoreBg.y = 80;\r\n\t\t//this._scoreContainer.addChild(scoreBg);\r\n\t\r\n\t\tconst scoreHint = new engine.Sprite(getTextureByName('scoreHint'));\r\n\t\tscoreHint.x = getStage().width/2 - scoreHint.width/2; \r\n\t\tscoreHint.y = 40;\r\n\t\tthis._scoreContainer.addChild(scoreHint);\r\n\r\n\t\tthis.labScore = new ScoreLabel();\r\n this.labScore.fillColor = 0xff7646;\r\n\t\tthis.labScore.size = 70;\r\n\t\tthis.labScore.width = getStage().width;\r\n\t\tthis.labScore.height = scoreBg.height;\r\n\t\tthis.labScore.textAlign = engine.TEXT_ALIGN.CENTER;\r\n\t\tthis.labScore.x = 0;\r\n\t\tthis.labScore.y = scoreBg.y+10;\r\n\t\tthis._scoreContainer.addChild(this.labScore);\r\n }\r\n\tregisterEvent(){\r\n this._touchLayer.addEventListener(engine.MouseEvent.MOUSE_DOWN,this.onMouseDown,this);\r\n this._touchLayer.addEventListener(engine.MouseEvent.MOUSE_UP,this.onMouseUp,this);\r\n\t}\r\n\tremoveListener(){\r\n this._touchLayer.removeEventListener(engine.MouseEvent.MOUSE_DOWN,this.onMouseDown,this);\r\n this._touchLayer.removeEventListener(engine.MouseEvent.MOUSE_UP,this.onMouseUp,this);\r\n\t}\r\n\t//触碰层\r\n\tinitTouch(){\r\n this._touchLayer = new engine.Rect();\r\n this.addChild(this._touchLayer);\r\n this._touchLayer.width = getStage().width;\r\n this._touchLayer.height = getStage().height;\r\n this._touchLayer.x = 0;\r\n this._touchLayer.y = 0;\r\n this._touchLayer.alpha = 0;\r\n\t}\r\n\tsetScoreShow(){\r\n\r\n\t}\r\n\t//鼠标事件\r\n\tonMouseDown(){\r\n\t\tif(this._isTouchLayer){\r\n\t\t\tthis._isMouseDown = true;\r\n\t\t\tthis._strut.onMouseDown(this._road.getFristPier(),this._road.getDistance(),this.goCallBcak.bind(this));\r\n\t\t}\r\n\t}\r\n\tonMouseUp(){\r\n\t\tif(this._isTouchLayer && this._isMouseDown){\r\n\t\t\tthis._strut.onMouseUp();\r\n\t\t\tthis._isMouseDown = false;\r\n\t\t\tthis._isTouchLayer = false;\r\n\t\t}\r\n\t}\r\n\t//撑杆回调\r\n\tgoCallBcak(isSuccess){\r\n\t\tif(isSuccess){\r\n\t\t\tconsole.log('成功了');\r\n\t\t\tlet movePos = this._road.getMovePos();\r\n\t\t\tif(this._road.getStartGold(1,false)){\r\n\t\t\t\tthis.updateScore(props.singleScore + props.goldScore);\r\n\t\t\t}else{\r\n\t\t\t\tthis.updateScore(props.singleScore);\r\n\t\t\t}\r\n\t\t\t//人物前行\r\n\t\t\tthis._player.setViewport(movePos,this.complete.bind(this));\r\n\t\t\t\r\n\t\t}else{\r\n\t\t\tconsole.log('失败了');\r\n\t\t\tthis._player.setViewport(this._strut.getStrutHeight(),()=>{\r\n\t\t\t\tconsole.log('掉下去了');\r\n\t\t\t\tengine.globalEvent.dispatchEvent('dxbcyj-game-result',{score:this._sumScore});\r\n\t\t\t},this._road.getFristPier())\r\n\t\t}\r\n\t}\r\n\t//人物前行结束\r\n\tcomplete(){\r\n\t\t//关闭金币\r\n\t\tthis._road.getStartGold(1);\r\n\t\t//获得位移距离\r\n\t\tlet movePos = this._road.getMovePos();\r\n\t\tthis._road.setViewport();\r\n\t\tthis._backgroud.setViewport(movePos);\r\n\t\t//移动完成 可以再次操作\r\n\t\tthis._player.setBackViewport(()=>{\r\n\t\t\tthis._isTouchLayer = true;\r\n\t\t});\r\n\t\tthis.closeStrut();\r\n\t}\r\n\tcloseStrut(){\r\n\t\tthis._strut.rest();\r\n\t}\r\n\r\n\tupdateScore(score){\r\n\t\tthis._sumScore += score;\r\n\t\tif(0 <= this._sumScore && this._sumScore <= props.bgFristScore){\r\n\t\t\tthis.changeBg(0);\r\n\t\t}else if(props.bgFristScore < this._sumScore && this._sumScore <= props.bgSecondScore){\r\n\t\t\tthis.changeBg(1);\r\n\t\t}else{\r\n\t\t\tthis.changeBg(2);\r\n\t\t}\r\n\t\tthis.labScore.updateScore(this._sumScore);\r\n\t}\r\n\tgetScore(){\r\n\t\treturn this._sumScore;\r\n\t}\r\n\r\n\tchangeBg(index){\r\n\t\tif(this._backgroud.getBgIndex() != index){\r\n\t\t\tthis._backgroud.changeBg(index);\r\n\t\t}\r\n\t}\r\n}\r\n","\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\nexport class GameWrapper extends engine.Container {\r\n\tprivate _gameView: GameView;\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tengine.globalEvent.addEventListener('dxbcyj-game-start', this.start, this);\r\n\r\n\t\tlet gameView = this._gameView = new GameView();\r\n\t\tthis.addChild(gameView);\r\n\r\n\t\t//this.once(engine.Event.ENTER_FRAME, this.onAddedToStage, this);\r\n\t}\r\n\r\n\tstart(event: engine.Event) {\r\n\t\tthis._gameView.start(event.data.guide);\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,C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AAC;CAAD,CAAC,CAxLqC,MAAM,CAAC,SAAS,GAwLrD;;;CCvMD;KAAiCA,qCAAgB;KAGhD;SAAA,YACC,iBAAO,SAQP;SANA,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,KAAI,CAAC,KAAK,EAAE,KAAI,CAAC,CAAC;SAE3E,IAAI,QAAQ,GAAG,KAAI,CAAC,SAAS,GAAG,IAAI,QAAQ,EAAE,CAAC;SAC/C,KAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;;MAGxB;KAED,2BAAK,GAAL,UAAM,KAAmB;SACxB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;MACvC;KACF,kBAAC;CAAD,CAAC,CAjBgC,MAAM,CAAC,SAAS,GAiBhD;;;iBCnBwB,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": {
"guideText1": {
"alias": "引导1的文本",
"type": "string",
"default": "长按屏幕\n杆子变长即可通过"
},
"guideText2": {
"alias": "引导2的文本",
"type": "string",
"default": "当度小宝获得金币时积分+5"
},
"pierMinDistance": {
"alias": "障碍物最小间距",
"type": "number",
"default": 400
},
"pierMaxDistance": {
"alias": "障碍物最大间距",
"type": "number",
"default": 500
},
"frontBGMoveSpeed": {
"alias": "前背影移动速度",
"type": "number",
"default": 0.5
},
"afterBGMoveSpeed": {
"alias": "后背影移动速度",
"type": "number",
"default": 0.2
},
"reward": {
"alias": "出现金币的概率(0-1区间 1为必出现 0为必不出现)",
"type": "number",
"default": 0
},
"pierCount": {
"alias": "一屏中最多出现的桥墩数量(最好默认为2)",
"type": "number",
"default": 2
},
"pierMoveTime": {
"alias": "一个周期内桥墩移动的总时长(毫秒)",
"type": "number",
"default": 1000
},
"strutUpSpeed": {
"alias": "撑杆上升速度(每帧上升增量,一秒60帧)",
"type": "number",
"default": 20
},
"strutWidth": {
"alias": "撑杆宽度",
"type": "number",
"default": 5
},
"strutColor": {
"alias": "撑杆颜色",
"type": "string",
"default": "#000000"
},
"strutRotationSpeed": {
"alias": "撑杆旋转总时长(毫秒)",
"type": "number",
"default": 300
},
"playerMoveSpeed": {
"alias": "人物移动总时长(毫秒)",
"type": "number",
"default": 1200
},
"singleScore": {
"alias": "每个桥墩分数",
"type": "number",
"default": 5
},
"goldScore": {
"alias": "每个金币分数",
"type": "number",
"default": 5
},
"bgFristScore": {
"alias": "第一张图的分数区间最大值(超过此值就更换第二张背景图)",
"type": "number",
"default": 30
},
"bgSecondScore": {
"alias": "第二张图的分数区间最大值(超过此值就更换第三张背景图)",
"type": "number",
"default": 80
}
},
"assets": [
{
"name": "hhl_after",
"url": "//yun.duiba.com.cn/aurora/assets/88252cca633a2f6d5c863d1678cb3d92c4e0e2a2.png",
"uuid": "76e73c53-d727-4746-b86e-92997af58c7f",
"ext": ".png"
},
{
"name": "hhl_front",
"url": "//yun.duiba.com.cn/aurora/assets/5c5a2581c91346de4d9fe66782aa8687cc9135e5.png",
"uuid": "848e2fdf-dcf0-44e2-b269-fdf0e2f84710",
"ext": ".png"
},
{
"name": "pier",
"url": "//yun.duiba.com.cn/aurora/assets/faf5cf941f1c3118bcf087352b812c2fb65ae992.png",
"uuid": "d784fe9f-5d1d-4522-ab4b-d6875a3da33f",
"ext": ".png"
},
{
"name": "gold",
"url": "//yun.duiba.com.cn/aurora/assets/ae210ad26cee13f8fb6e69be62f7f5498be50a5b.png",
"uuid": "7f4e19f2-c80f-4a65-bec2-1f3c3dc6d210",
"ext": ".png"
},
{
"name": "hb_after",
"url": "//yun.duiba.com.cn/aurora/assets/aaa76c50cfb00c602cc393df658670e1465a9b4e.png",
"uuid": "48a6636c-e04a-4836-8ae1-ed84db74c4f6",
"ext": ".png"
},
{
"name": "hb_front",
"url": "//yun.duiba.com.cn/aurora/assets/40d1dccd9d0c1dc1f4354d62e7c0b2eaab88457f.png",
"uuid": "b77802ea-7ee7-444e-aa11-72f85990f0c7",
"ext": ".png"
},
{
"name": "wh_after",
"url": "//yun.duiba.com.cn/aurora/assets/4e4f0adbca2b1d1e131271cc1ceddd97c3529f8b.png",
"uuid": "5efd9347-5e0d-4876-a483-7c22f3fdc3fb",
"ext": ".png"
},
{
"name": "wh_front",
"url": "//yun.duiba.com.cn/aurora/assets/b68ed0e4f49ac03736d80365e2ab66614ae97894.png",
"uuid": "8683ad45-3e7e-4944-ade0-eb4d5e48839f",
"ext": ".png"
},
{
"name": "walk",
"url": "//yun.duiba.com.cn/aurora/assets/a4ab1e1a2b49d140db4a0806562098a8b1619b06.svga",
"uuid": "10cd1fdd-4fd8-43cf-a1c7-6ff5846d8a91",
"ext": ".svga"
},
{
"name": "scoreBg",
"url": "//yun.duiba.com.cn/aurora/assets/1a61bd62c82c2ba872443fb14e0f5304d7aee224.png",
"uuid": "fb7f0d1a-c548-43ae-a86e-46ba98155813",
"ext": ".png"
},
{
"name": "scoreHint",
"url": "//yun.duiba.com.cn/aurora/assets/6bb8c64878288b074f840ea74f2956d0d0c65125.png",
"uuid": "0ab7dc8d-1388-4679-8637-54d6f3cd3a28",
"ext": ".png"
},
{
"name": "guide",
"url": "//yun.duiba.com.cn/aurora/assets/75cc4ea91654fd1e9900d071cac5ca5296b1bd19.png",
"uuid": "e904cd4e-cd87-421e-8292-25137299236e",
"ext": ".png"
},
{
"name": "guideHand",
"url": "//yun.duiba.com.cn/aurora/assets/4f014befa3c812e6882d578a6867afd3d05d7fe3.png",
"uuid": "fb1c2ead-dda8-495d-a846-7e4a26289d01",
"ext": ".png"
},
{
"name": "know",
"url": "//yun.duiba.com.cn/aurora/assets/3e695571aebebba6add5aae3d743fbd16b8ee915.png",
"uuid": "4999d4c5-507e-4ae9-8310-b90bf017a74f",
"ext": ".png"
}
],
"events": {
"in": {
"dxbcyj-game-start": {
"alias": "开始",
"data": {
}
}
},
"out": {
"dxbcyj-game-result": {
"alias": "游戏结束",
"data": {
}
}
}
}
}
\ No newline at end of file
import {getTextureByName} from "./utils";
import {getStage} from "./utils";
import {LoopComponent} from "./LoopComponent";
import { props } from './../props';
export class Background extends engine.Container{
partResHHL = ['hhl_after', 'hhl_front'];
partResHB = ['hb_after','hb_front'];
partResWH = ['wh_after','wh_front'];
speeds = [];
resArray=[];
frameMovePos = 0;
frameIndex;
sumMovePos;
_bgIndex;
//需要的总帧数
needFrameSum;
initBg(){
this.sumMovePos = 0;
this.speeds.push(props.afterBGMoveSpeed);
this.speeds.push(props.frontBGMoveSpeed);
let bottomBg = new engine.Rect();
bottomBg.x = 0;
bottomBg.y = 0;
bottomBg.width = getStage().width;
bottomBg.height = 0;
bottomBg.fillColor = 0x75c9f5;
this.addChild(bottomBg);
this.resArray.push(this.partResHHL)
this.resArray.push(this.partResHB)
this.resArray.push(this.partResWH)
this._bgIndex = 0;
const parts = [];
for(let i = 0; i < 2; i++){
let part = new LoopComponent();
part.setupLoop([
this.resArray[0][i],
this.resArray[0][i],
]);
parts.push(part);
this.addChild(part);
}
//(height - parts[1].height) / 2 - 200
parts[1].y = 200;
}
setViewport(pos) {
this.needFrameSum = (props.pierMoveTime/1000)*60;
this.frameMovePos = pos/this.needFrameSum;
this.frameIndex = 0;
this.addEventListener(engine.Event.ENTER_FRAME,this.frame,this);
}
frame(){
if( this.frameIndex < this.needFrameSum){
for (let i = 0; i < 2; i++) {
const part = <LoopComponent>this.getChildAt(i + 1);
const speed = this.speeds[i];
let tmpPos = ((this.frameMovePos * this.frameIndex) + this.sumMovePos ) * speed;
part.setViewport(tmpPos)
}
this.frameIndex++
}else{
this.sumMovePos += this.frameMovePos * this.needFrameSum;
this.frameIndex = 0
this.removeEventListener(engine.Event.ENTER_FRAME,this.frame,this);
}
}
changeBg(index){
for (let i = 0; i < 2; i++) {
const part = <LoopComponent>this.getChildAt(i + 1);
part.changeBg(this.resArray[index][i]);
if(i == 1 && index ==1){
part.y = 400;
}
if(i == 1 && index ==2){
part.y = 250;
}
}
this._bgIndex = index;
}
getBgIndex(){
return this._bgIndex;
}
}
\ No newline at end of file
import { Road } from './Road';
/**
* Created by rockyl on 2018/8/16.
*/
import {props} from "../props";
import {getStage,getTextureByName} from "./utils";
import {GuideLayer} from "./GuideLayer";
import { Background } from "./Background";
import ObjectPool = engine.ObjectPool;
import { Pier } from './Pier';
import { Player } from './Player';
import { Strut } from './Strut';
import { ScoreLabel } from './ScoreLabel';
export const PoolName: string = 'pier';
ObjectPool.registerPool(PoolName, function () {
return new Pier();
}, function (item: Pier, data) {
item.init();
});
export default class GameView extends engine.Container {
guideLayer: GuideLayer;
private _hasSetup;
_backgroud:Background;
_road:Road;
_player:Player;
_strut:Strut;
_touchLayer: engine.Rect;
_isTouchLayer;
_scoreContainer;
moveX = 0;
labScore:ScoreLabel;
_sumScore;
_isMouseDown;
constructor() {
super();
}
async start(guide) {
this._isTouchLayer = true;
this._sumScore = 0;
this._isMouseDown = false;
this._backgroud = new Background();
this._backgroud.initBg();
this.addChild(this._backgroud);
const road = this._road = new Road();
road.setup();
this.addChild(road);
let pierWidth = this._road.getFristPier();
const player = this._player = new Player();
player.initPlayer(pierWidth);
this.addChild(player);
const strut = this._strut = new Strut();
strut.init();
this.addChild(strut);
this._scoreContainer = new engine.Container();
this.addChild(this._scoreContainer);
this.initLabScore();
let initScore = this._road.getStartGold(0) ? props.goldScore : 0;
this.updateScore(initScore);
//是否是新手
if(guide == '1'){
this.setGuide();
}else{
this.initTouch();
this.registerEvent();
}
}
//新手引导
setGuide(){
this._road.setGuide();
const guideLayer = this.guideLayer = new GuideLayer();
this.addChild(guideLayer);
this.guideLayer.show(1, {x:20,y: 650,guideText:props.guideText1},()=>{
let posX = this._road.getMovePos();
this.guideLayer.show(2, {x:posX+20,y: 620,guideText:props.guideText2},()=>{
this.initTouch();
this.registerEvent();
})
});
}
initLabScore(){
const scoreBg = new engine.Sprite(getTextureByName('scoreBg'));
scoreBg.x = getStage().width/2 - scoreBg.width/2;
scoreBg.y = 80;
//this._scoreContainer.addChild(scoreBg);
const scoreHint = new engine.Sprite(getTextureByName('scoreHint'));
scoreHint.x = getStage().width/2 - scoreHint.width/2;
scoreHint.y = 40;
this._scoreContainer.addChild(scoreHint);
this.labScore = new ScoreLabel();
this.labScore.fillColor = 0xff7646;
this.labScore.size = 70;
this.labScore.width = getStage().width;
this.labScore.height = scoreBg.height;
this.labScore.textAlign = engine.TEXT_ALIGN.CENTER;
this.labScore.x = 0;
this.labScore.y = scoreBg.y+10;
this._scoreContainer.addChild(this.labScore);
}
registerEvent(){
this._touchLayer.addEventListener(engine.MouseEvent.MOUSE_DOWN,this.onMouseDown,this);
this._touchLayer.addEventListener(engine.MouseEvent.MOUSE_UP,this.onMouseUp,this);
}
removeListener(){
this._touchLayer.removeEventListener(engine.MouseEvent.MOUSE_DOWN,this.onMouseDown,this);
this._touchLayer.removeEventListener(engine.MouseEvent.MOUSE_UP,this.onMouseUp,this);
}
//触碰层
initTouch(){
this._touchLayer = new engine.Rect();
this.addChild(this._touchLayer);
this._touchLayer.width = getStage().width;
this._touchLayer.height = getStage().height;
this._touchLayer.x = 0;
this._touchLayer.y = 0;
this._touchLayer.alpha = 0;
}
setScoreShow(){
}
//鼠标事件
onMouseDown(){
if(this._isTouchLayer){
this._isMouseDown = true;
this._strut.onMouseDown(this._road.getFristPier(),this._road.getDistance(),this.goCallBcak.bind(this));
}
}
onMouseUp(){
if(this._isTouchLayer && this._isMouseDown){
this._strut.onMouseUp();
this._isMouseDown = false;
this._isTouchLayer = false;
}
}
//撑杆回调
goCallBcak(isSuccess){
if(isSuccess){
console.log('成功了');
let movePos = this._road.getMovePos();
if(this._road.getStartGold(1,false)){
this.updateScore(props.singleScore + props.goldScore);
}else{
this.updateScore(props.singleScore);
}
//人物前行
this._player.setViewport(movePos,this.complete.bind(this));
}else{
console.log('失败了');
this._player.setViewport(this._strut.getStrutHeight(),()=>{
console.log('掉下去了');
engine.globalEvent.dispatchEvent('dxbcyj-game-result',{score:this._sumScore});
},this._road.getFristPier())
}
}
//人物前行结束
complete(){
//关闭金币
this._road.getStartGold(1);
//获得位移距离
let movePos = this._road.getMovePos();
this._road.setViewport();
this._backgroud.setViewport(movePos);
//移动完成 可以再次操作
this._player.setBackViewport(()=>{
this._isTouchLayer = true;
});
this.closeStrut();
}
closeStrut(){
this._strut.rest();
}
updateScore(score){
this._sumScore += score;
if(0 <= this._sumScore && this._sumScore <= props.bgFristScore){
this.changeBg(0);
}else if(props.bgFristScore < this._sumScore && this._sumScore <= props.bgSecondScore){
this.changeBg(1);
}else{
this.changeBg(2);
}
this.labScore.updateScore(this._sumScore);
}
getScore(){
return this._sumScore;
}
changeBg(index){
if(this._backgroud.getBgIndex() != index){
this._backgroud.changeBg(index);
}
}
}
/**
* Created by rockyl on 2020-01-09.
*/
import GameView from "./GameView";
import {injectProps} from "../props";
export class GameWrapper extends engine.Container {
private _gameView: GameView;
constructor() {
super();
engine.globalEvent.addEventListener('dxbcyj-game-start', this.start, this);
let gameView = this._gameView = new GameView();
this.addChild(gameView);
//this.once(engine.Event.ENTER_FRAME, this.onAddedToStage, this);
}
start(event: engine.Event) {
this._gameView.start(event.data.guide);
}
}
/**
* Created by rockyl on 2020-01-30.
*/
import {props} from "../props";
import {getTextureByName} from "./utils";
export class GuideLayer extends engine.Container {
private guideMask: engine.Container;
private _options;
_guideHole;
_canClear:any = [];
_callBack;
private label: engine.Label;
constructor() {
super();
this.setup();
}
private setup() {
}
show(id, options,callback?) {
this.visible = true;
this._callBack = callback?callback:null;
if (!this.guideMask) {
this._options = options;
const {width, height} = this.stage;
let guideMask = this.guideMask = new engine.Container();
let guideHole = this._guideHole= new engine.Image(getTextureByName('guide'));
guideHole.x = options.x;
guideHole.y = options.y;
guideHole.width = 250;
guideHole.height = 250;
guideHole.name = 'guideHole';
guideMask.addChild(guideHole);
this.createRect(guideMask, 0, 0, width, guideHole.y);
this.createRect(guideMask, 0, guideHole.y, guideHole.x, guideHole.height);
this.createRect(guideMask, guideHole.x + guideHole.width, guideHole.y, width - guideHole.x - guideHole.width, guideHole.height);
this.createRect(guideMask, 0, guideHole.y + guideHole.height, width, height - guideHole.y - guideHole.height);
this.guideStep(id);
let label = this.label = new engine.Label();
label.fillColor = 'white';
label.size = 25;
label.text = options.guideText;
label.x = (width - label.width) / 2;
label.y = guideHole.y + guideHole.height + 50;
label.textAlign = engine.TEXT_ALIGN.CENTER;
label.name = 'labHint';
guideMask.addChild(label);
this.addChild(guideMask);
}
this.once(engine.MouseEvent.CLICK, function(){
this.removeChild(this.guideMask);
this.guideMask = null;
if(this._callBack){
this._callBack();
}
}, this);
}
createRect(container, x, y, width, height) {
let rect = new engine.Rect();
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
rect.fillColor = 'black';
rect.alpha = 0.7;
container.addChild(rect);
}
guideStep(id){
if(id == 1){
let guideHand = new engine.Image(getTextureByName('guideHand'));
guideHand.x = this._options.x + 300;
guideHand.y = this._options.y + 100;
this.guideMask.addChild(guideHand);
let rect = new engine.Rect();
rect.x = this._options.x + 200;
rect.y = this._options.y - 15;
rect.width = props.strutWidth;
rect.height = 200;
rect.fillColor = props.strutColor;
this.guideMask.addChild(rect);
this._canClear.push(guideHand);
this._canClear.push(rect);
}
if(id == 2){
let know = new engine.Image(getTextureByName('know'));
know.x = (this.stage.width - know.width) / 2;
know.y = this._options.y + 400;
this.guideMask.addChild(know);
this._canClear.push(know);
}
}
}
import {getTextureByName} from "./utils";
export class LoopComponent extends engine.Container{
parts: any[];
onceInfo: any = {width: 0, height: 0, count: 0};
loopInfo: any = {width: 0, height: 0, count: 0};
constructor() {
super();
this.parts = [];
}
private setup(parts, info) {
parts.forEach((item, index) => {
let part;
if(typeof item == 'string'){
part = new engine.Sprite(getTextureByName(item));
}else if(item instanceof engine.Texture){
part = new engine.Sprite(item);
}else {
part = item;
}
this.addChild(part);
this.parts.push(part);
if (index == 0) {
info.width = part.width;
info.height = part.height;
}
});
info.count = parts.length;
this.setViewport(0, 0)
}
changeBg(changName){
this.parts.forEach((item, index) => {
item.texture = getTextureByName(changName)
});
}
setupLoop(resArr) {
this.setup(resArr, this.loopInfo);
}
setViewport(x, y = 0) {
const sizeField = y == 0 ? 'width' : 'height';
const posField = y == 0 ? 'x' : 'y';
const pos = y == 0 ? x : y;
let index;
const onceSize = this.onceInfo[sizeField];
const onceCount = this.onceInfo.count;
const loopCount = this.loopInfo.count;
const loopSize = this.loopInfo[sizeField];
index = onceSize == 0 ? -1 : Math.floor(pos / onceSize);
if (index < 0 || index >= onceCount) {
const loopIndex = Math.floor((pos - onceCount * onceSize) / this.loopInfo[sizeField]);
index = onceCount + loopIndex;
}
let formerIndex = index < onceCount ? index : (index) % loopCount + onceCount;
let latterIndex = index < onceCount ? index + 1 : (index - onceCount + 1) % loopCount + onceCount;
let former = this.parts[formerIndex];
let latter = this.parts[latterIndex];
if(!former || !latter){
console.log(formerIndex, latterIndex);
}
former[posField] = -(pos - loopSize * (index < onceCount ? index : index - onceCount) - (index < onceCount ? 0 : onceCount * onceSize));
latter[posField] = former.x + (index < onceCount ? onceSize : loopSize);
}
}
\ No newline at end of file
import { props } from './../props';
import {getTextureByName,getStage} from "./utils";
export class Pier extends engine.Container {
bmp;
public haveGold;
constructor() {
super();
this.bmp = new engine.Sprite();
this.addChild(this.bmp);
}
init(){
const bmp = this.bmp;
bmp.alpha = 1;
bmp.texture = getTextureByName('pier');
bmp.x = 0;
bmp.y = bmp.height ;
if(this.children.length < 2){
const gold = new engine.Sprite();
gold.texture = getTextureByName('gold');
gold.name = 'gold';
this.addChild(gold);
}
this.setGoldPosX(bmp);
this.setShowGold();
}
setShowGold(){
let nodeGold = this.getChildByName('gold');
let randomWard = Math.random();
nodeGold.alpha = 1;
let isShow = randomWard < props.reward ? true : false ;
nodeGold.visible = isShow;
this.haveGold = isShow;
}
setGoldPosX(bmp){
let nodeGold = this.getChildByName('gold');
let pos = bmp.width / 2 - nodeGold.width/2;
nodeGold.x = pos
nodeGold.y = bmp.height - nodeGold.height - 50;
nodeGold.visible = false;
}
closeGold(){
this.children.forEach((item) => {
if(item.name == 'gold')
{
item.anchorX = item.width/2;
item.anchorY = item.height/2;
engine.Tween.get(item,{loop:false})
.to({scaleX:2.5,scaleY:2.5},200,engine.Ease.cubicOut)
.to({scaleX:1,scaleY:1,alpha:0},200,engine.Ease.cubicIn)
.call(()=>{
item.visible = false;
this.haveGold = false;
})
}
})
}
}
\ No newline at end of file
import {props} from "../props";
import {createSvga, playSound} from "./utils";
export class Player extends engine.Container{
_container;
private playerNode: svga.Svga;
initPlayer(pierWidth){
this._container = new engine.Container();
this.addChild(this._container);
this.playerNode = createSvga('walk');
this._container.addChild(this.playerNode);
this.playerNode.y = 675;
this.playerNode.x = pierWidth/2 - 80;
this.playerNode.play();
}
setViewport(pos,callBack,pierWidth?){
let tmpPos = 0;
let isSuccess = false;
if(!pierWidth){
tmpPos = pos;
isSuccess = true;
}else{
tmpPos = pierWidth - this.playerNode.x + pos - 60;
}
this.playGoTween(tmpPos,callBack,isSuccess)
}
playGoTween(pos,callBack,isSuccess){
engine.Tween.get(this._container,{loop:false})
.to({x : pos},props.playerMoveSpeed)
.call(()=>{
engine.Tween.removeTweens(this._container);
if(isSuccess){
if(callBack){
callBack();
}
}else{
this.playDropTween(callBack);
}
})
}
playDropTween(callBack){
engine.Tween.get(this._container,{loop:false})
.to({y : 2000},1000)
.call(()=>{
engine.Tween.removeTweens(this._container);
if(callBack){
callBack();
}
})
}
setBackViewport(callBack){
engine.Tween.get(this._container,{loop:false})
.to({x : 0},props.pierMoveTime)
.call(()=>{
engine.Tween.removeTweens(this._container);
if(callBack){
callBack();
}
})
}
}
\ No newline at end of file
import { props } from './../props';
import ObjectPool = engine.ObjectPool;
import {getStage} from "./utils";
import { Pier } from './Pier';
import GameView from './GameView';
export class Road extends engine.Container{
//container: engine.Container;
lastPos;
setup(){
// this.container = new engine.Container();
// this.addChild(this.container);
this.lastPos = 0;
this.addPier();
}
getFristPier(){
return this.getChildAt(0).width;
}
getDistance(){
let distance = [];
let pier1 = this.getChildAt(0);
let pier2 = this.getChildAt(1);
distance.push(pier2.x - pier1.x);
distance.push(pier2.width);
return distance;
}
addPier(){
while(this.children.length < props.pierCount + 1){
let childrenNum = this.children.length;
let randomPos = this.makeRandomFloat(props.pierMaxDistance,props.pierMinDistance);
const pier: Pier = ObjectPool.getObject('pier');
this.addChild(pier);
if(childrenNum == 0){
pier.x = 0;
}else{
pier.x = this.lastPos + randomPos;
}
this.lastPos = pier.x;
}
}
moveAddPier(){
let randomPos = this.makeRandomFloat(props.pierMaxDistance,props.pierMinDistance);
const pier: Pier = ObjectPool.getObject('pier');
let lastChild = this.getChildAt(this.children.length -1);
pier.x = lastChild.x + randomPos;
this.addChild(pier);
}
makeRandomFloat(max: number, min: number = 0): number {
return Math.random() * (max - min) + min;
}
setViewport(){
let tmpMovepos = this.getMovePos();
this.children.forEach((item,index) => {
this.playTween(item,index,tmpMovepos);
})
}
//获得移动位移
getMovePos(){
let movePos:any = this.getChildAt(1);
return movePos.x;
}
playTween(item,index,tmpMovepos){
engine.Tween.get(item,{loop:false})
.to({x : item.x - tmpMovepos},props.pierMoveTime)
.call(()=>{
if(this.getChildIndex(item) == 0){
engine.Tween.removeTweens(item);
this.removeChild(item);
ObjectPool.recycleObject('pier',item);
}
if(index == 0){
this.moveAddPier();
}
})
}
//桥墩是否有金币
getStartGold(index,isClose = true){
let tmpNode:any = this.getChildAt(index);
let haveGold = tmpNode.haveGold;
if(haveGold && isClose){
tmpNode.closeGold();
}
return haveGold;
}
//设置新手引导 第二个桥墩要有金币
setGuide(){
let tmpNode:any = this.getChildAt(1);
if(!tmpNode.haveGold){
tmpNode.children.forEach((item) => {
if(item.name == 'gold'){
item.visible = true;
}
})
tmpNode.haveGold = true;
}
}
}
\ No newline at end of file
/**
* Created by rockyl on 2018/9/10.
*
* 分数标签
*/
export class ScoreLabel extends engine.Label {
_value;
_tmp;
updateScore(score,animation = true) {
this._value = score;
if (animation && this._tmp) {
this.animationUpdate();
} else {
this.updateLocal(score);
}
}
animationUpdate(){
let tmpInterval = setInterval(()=>{
this._tmp += 1;
if(this._tmp <= this._value){
this.text = this._tmp
}else{
this._tmp = this._value;
clearInterval(tmpInterval);
}
},50)
}
updateLocal(v){
this._tmp = v;
this.text = v;
}
}
import { props } from "../props";
export class Strut extends engine.Container{
_strut: engine.Rect;
_distance;
_callBack;
init(){
this._strut = new engine.Rect();
this.addChild(this._strut);
this._strut.width = props.strutWidth;
this._strut.y = 833;
this._strut.fillColor = props.strutColor;
this._strut.rotation = 180;
}
onMouseDown(pierWidth,distance,callBack){
this._strut.x = pierWidth - 60;
this._distance = distance;
this._callBack = callBack;
this._strut.visible = true;
this.addEventListener(engine.Event.ENTER_FRAME,this.frame,this);
}
onMouseUp(){
this.removeEventListener(engine.Event.ENTER_FRAME,this.frame,this);
setTimeout(() => {
this.strutRotation();
}, 200);
}
strutRotation(){
engine.Tween.get(this._strut,{loop:false})
.to({rotation:270},props.strutRotationSpeed)
.call(()=>{
this.judgeResult();
engine.Tween.removeTweens(this._strut);
})
}
judgeResult(){
let isSuccess = false;
if(this._distance[0] - this._distance[1] + 60 <= this._strut.height && this._strut.height <= this._distance[0] + 30){
isSuccess = true;
}
if(this._callBack){
this._callBack(isSuccess);
}
}
frame(){
if(this._strut.height < 1000){
this._strut.height += props.strutUpSpeed;
}
}
rest(){
this._strut.width = props.strutWidth;
this._strut.y = 833;
this._strut.fillColor = props.strutColor;
this._strut.rotation = 180;
this._strut.height = 0;
this._strut.visible = false;
}
getStrutHeight(){
let distance = this._strut.height > 1000 ? 1000 :this._strut.height;
return distance;
}
}
\ No newline at end of file
import { Pier } from './Pier';
/**
* Created by rockyl on 2020-02-03.
*/
import ObjectPool = engine.ObjectPool;
export const PoolName: string = 'pier';
ObjectPool.registerPool(PoolName, function () {
return new Pier();
}, function (item: Pier, data) {
item.init();
});
/**
* 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 getStage(){
return engine.gameStage.stage;
}
export function createSvga(name) {
let inst = new svga.Svga();
inst.source = engine.getAssetByName(name).uuid;
// let anchor = props[(anchorName)];
// if (anchor) {
// inst.x = -anchor.x;
// inst.y = -anchor.y;
// inst.anchorX = anchor.x;
// inst.anchorY = anchor.y;
// }
return inst;
}
/**
* 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);
}
/**
* Created by renjianfeng on 2020-03-13.
*/
/*
event-pickTeaGame-init //游戏初始化
event-getchange-TeaNum //茶叶数量{初始值totalNum,总量nowNum} 改变svga动画
event-getBasket-Type //获得篮子类型 设置篮子类型 纸篮子 布篮子 竹篮子 木篮子 0 1 2 3
event-hand-grasp //手抓去点击
//event-wait-uplevel //待升级
event-add-oneScore //+1
event-pick-tea //采茶叶
event-tea-skyup //茶叶向上飞
event-setchange-TeaNum
event-setBasket-Type //设置篮子类型
*/
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);
this.initView();
this.setPickTeaLevel(1);
this.setTeaNum({ totalNum: 430, nowNum: 0 });
setInterval(function () {
_this.handGrasp();
}, 5000);
};
GameView.prototype.reset = function () {
console.log('111111111reset1');
};
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 () {
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.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 () {
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.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;
var totalNum = 200;
var nowNum = 10;
this.pickTeaCount.text = nowNum + '/' + totalNum;
this.getTeaPercentage(nowNum, totalNum);
var chaju = nowNum - totalNum;
console.log('chaju', chaju);
var width = this.progressbarImg.width;
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))) / chaju;
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;
});
var schedule = setInterval(function () {
if (nowNum == totalNum) {
console.log('达到最大长度');
clearInterval(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++;
}, 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);
}, 500);
};
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\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\tthis.initView();\r\n\t\tthis.setPickTeaLevel(1)\r\n\t\tthis.setTeaNum({ totalNum: 430, nowNum: 0 })\r\n\t\tsetInterval(() => {\r\n\t\t\tthis.handGrasp();\r\n\t\t}, 5000)\r\n\r\n\r\n\t}\r\n\treset() {\r\n\t\tconsole.log('111111111reset1')\r\n\t\t//this.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\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.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\tthis.verseImg.x = props.versePos[0]\r\n\t\tthis.verseImg.y = props.versePos[1]\r\n\r\n\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\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\tlet totalNum = 200 //TeaNums.totalNum;\r\n\t\tlet nowNum = 10//TeaNums.nowNum;\r\n\t\tthis.pickTeaCount.text = nowNum + '/' + totalNum;\r\n\t\tthis.getTeaPercentage(nowNum, totalNum);\r\n\t\tlet chaju = nowNum - totalNum;\r\n\t\tconsole.log('chaju', chaju);\r\n\t\tlet width = this.progressbarImg.width;\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))) / chaju\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\tlet schedule = setInterval(() => {\r\n\t\t\tif (nowNum == totalNum) {\r\n\t\t\t\tconsole.log('达到最大长度');\r\n\t\t\t\tclearInterval(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\r\n\t\t\t//console.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}, 500)\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,UAAg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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 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)
this.setTeaNum({ totalNum: 430, nowNum: 0 })
setInterval(() => {
this.handGrasp();
}, 5000)
}
reset() {
console.log('111111111reset1')
//this.initView()
}
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() {
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.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) {
let totalNum = 200 //TeaNums.totalNum;
let nowNum = 10//TeaNums.nowNum;
this.pickTeaCount.text = nowNum + '/' + totalNum;
this.getTeaPercentage(nowNum, totalNum);
let chaju = nowNum - totalNum;
console.log('chaju', chaju);
let width = this.progressbarImg.width;
//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))) / chaju
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;
})
let schedule = setInterval(() => {
if (nowNum == totalNum) {
console.log('达到最大长度');
clearInterval(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++;
//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);
}, 500)
}
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);
}
......@@ -20,6 +20,7 @@ class AnimationPool extends Pool<PoolFrameAnimation> {
} else {
let anim = new PoolFrameAnimation(key);
this.layer.addChild(anim);
return anim;
}
}
......
/**
* Created by rockyl on 2019-12-16.
*/
const customId = 'walking-cat';
(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('lipstick-turntable-reset', {
// turntableAssetName: '橘色转盘',
// countDown: 5,
// });
engine.globalEvent.dispatchEvent('walking-cat-start');
}, 500);
});
engine.globalEvent.addEventListener('walking-cat-game-end', (e) => {
console.log(e.type, e.data);
});
engine.globalEvent.addEventListener('walking-cat-game-changScore', (e) => {
console.log(e.type, e.data);
});
engine.globalEvent.addEventListener('lipstick-turntable-hit', (e) => {
console.log(e.type, e.data);
});
engine.globalEvent.addEventListener('lipstick-turntable-countdown', (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 src="//yun.duiba.com.cn/editor/zeroing/libs/engine.ebc906f6b50b8da0a669f77027981d5f3cb560ce.js"></script>
<script src="//yun.duiba.com.cn/js-libs/p2.js/0.7.1/p2.min.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/9dfdf39ce4f4693c336cbdd996e05bd392921e0e.png",
"uuid": "b6ed99bc-2da1-4e6d-840e-54371be041aa",
"ext": '.png'
},
{
"name": "蓝色转盘",
"url": "//yun.duiba.com.cn/aurora/assets/088cff75c4035b87ff421c2dd87391c6a7bea607.png",
"uuid": "4d8e2af4-4f8e-4f84-ab05-8ae172bbf8a6",
"ext": '.png'
},
{
"name": "紫色转盘",
"url": "//yun.duiba.com.cn/aurora/assets/e0ac6904227d8e3878ed23be33e58d3ce2180f2d.png",
"uuid": "c3dd14af-1b98-4cb8-b725-fa75cf15e96d",
"ext": '.png'
},
];
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['walking-cat'] = factory(global.tslib));
}(this, (function (tslib) { 'use strict';
function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
}
function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
}
function getStage() {
return engine.gameStage.stage;
}
function getfactor() {
return 10;
}
var props = {};
function prepareProps() {
var metaProps = getProps();
engine.injectProp(props, metaProps);
}
function injectProps(p) {
engine.injectProp(props, p);
}
var ScoreLabel = (function (_super) {
tslib.__extends(ScoreLabel, _super);
function ScoreLabel() {
return _super !== null && _super.apply(this, arguments) || this;
}
ScoreLabel.prototype.updateScore = function (score, formatFun, animation) {
if (formatFun === void 0) { formatFun = null; }
if (animation === void 0) { animation = true; }
this.formatFun = formatFun;
this._value = score;
if (animation) {
engine.Tween.get(this, null, null, true)
.to({ temp: score }, 300);
}
else {
this.updateLocal(score);
}
};
Object.defineProperty(ScoreLabel.prototype, "score", {
get: function () {
return this._value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ScoreLabel.prototype, "temp", {
get: function () {
return this._temp;
},
set: function (v) {
this._temp = v;
this.updateLocal(v);
},
enumerable: true,
configurable: true
});
ScoreLabel.prototype.updateLocal = function (v) {
this.text = this.formatFun && this.formatFun(v) || v;
};
return ScoreLabel;
}(engine.Label));
var PlayGame = (function (_super) {
tslib.__extends(PlayGame, _super);
function PlayGame() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.addlabelScore = null;
_this.formatScore = function (s) {
var t = (Math.ceil(s * 10) / 10).toString();
t += t.indexOf('.') < 0 ? '.0' : '';
return t;
};
return _this;
}
Object.defineProperty(PlayGame, "instance", {
get: function () {
if (this._instance == undefined) {
this._instance = new PlayGame();
}
return this._instance;
},
enumerable: true,
configurable: true
});
PlayGame.prototype.start = function (revive) {
if (revive === void 0) { revive = false; }
if (!revive) {
this.normalScore = 0;
this.rewardScore = 0;
this.lastDialogTs = 0;
this.initTouch();
this.initLabScore();
this.initAddlabel();
this.initDialog();
}
this.registerEvent();
};
PlayGame.prototype.registerEvent = function () {
this.touchLayer.addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onMouseDown, this);
this.touchLayer.addEventListener(engine.MouseEvent.MOUSE_UP, this.onMouseUp, this);
this.GameView.addEventListener(engine.Event.COMPLETE, this.onGameComplete, this);
this.GameView.addEventListener('scoreChange', this.onScoreChange, this);
};
PlayGame.prototype.initTouch = function () {
this.touchLayer = new engine.Rect();
this.addChild(this.touchLayer);
this.touchLayer.width = getStage().width;
this.touchLayer.height = getStage().height;
this.touchLayer.x = 0;
this.touchLayer.y = 0;
this.touchLayer.alpha = 0;
};
PlayGame.prototype.removeListener = function () {
this.touchLayer.removeEventListener(engine.MouseEvent.MOUSE_DOWN, this.onMouseDown, this);
this.touchLayer.removeEventListener(engine.MouseEvent.MOUSE_UP, this.onMouseUp, this);
this.GameView.removeEventListener(engine.Event.COMPLETE, this.onGameComplete, this);
this.GameView.removeEventListener('scoreChange', this.onScoreChange, this);
};
PlayGame.prototype.initLabScore = function () {
this.labScore = new ScoreLabel();
this.labScore.visible = props.showScore;
this.labScore.updateScore(0, this.formatScore, false);
this.labScore.fillColor = 'yellow';
this.labScore.size = 46;
this.labScore.x = 610;
engine.Tween.get(this.labScore, { loop: false })
.set({ y: -100 })
.wait(300)
.to({ y: 40 }, 200, engine.Ease.backOut);
this.addChild(this.labScore);
};
PlayGame.prototype.initAddlabel = function () {
this.addlabelScore = new engine.Label();
this.addlabelScore.fillColor = 'yellow';
this.addlabelScore.size = 40;
this.addlabelScore.text = '';
this.addlabelScore.x = 378;
this.addlabelScore.y = 582;
this.addlabelScore.visible = false;
this.addChild(this.addlabelScore);
};
PlayGame.prototype.initDialog = function () {
this.dialog = new engine.Image();
this.dialog.x = 390;
this.dialog.y = 323;
this.addChild(this.dialog);
};
PlayGame.prototype.onMouseDown = function () {
this.GameView.down();
};
PlayGame.prototype.onMouseUp = function () {
this.GameView.up();
};
PlayGame.prototype.onGameComplete = function () {
console.log('死亡');
this.removeListener();
var score = this.getScore();
engine.globalEvent.dispatchEvent('walking-cat-game-end', { score: score });
};
PlayGame.prototype.getScore = function (round) {
if (round === void 0) { round = false; }
var score = (this.normalScore + this.rewardScore) / 10;
score *= (props.scoreTimes || 1);
if (round) {
return Math.round(score);
}
return score;
};
PlayGame.prototype.onScoreChange = function (event) {
var _a = event.data, score = _a.score, passType = _a.passType, rewardScore = _a.rewardScore;
var scoreAdd;
if (rewardScore) {
this.rewardScore += rewardScore;
scoreAdd = rewardScore;
}
else {
scoreAdd = score - this.normalScore;
this.normalScore = score;
}
var curScore = this.getScore();
this.labScore.updateScore(curScore, this.formatScore);
if (passType > 0 && passType <= 4) {
var now = Date.now();
if (now - this.lastDialogTs > 15000) {
this.play(1);
this.lastDialogTs = now;
}
}
else if (passType == 10) {
this.play(0);
this.lastDialogTs = Date.now();
}
if (scoreAdd > 0) {
var labScoreAdd_1 = this.addlabelScore;
labScoreAdd_1.visible = props.showScore;
labScoreAdd_1.alpha = 0;
labScoreAdd_1.verticalCenter = 0;
labScoreAdd_1.text = '+' + (scoreAdd / 10 * (props.scoreTimes || 1));
engine.Tween.get(labScoreAdd_1, null, null, true)
.to({ verticalCenter: -50, alpha: 1, }, 200, engine.Ease.cubicIn)
.wait(300)
.to({ verticalCenter: -100, alpha: 0, }, 100, engine.Ease.cubicOut)
.call(function () {
labScoreAdd_1.visible = false;
}, this);
}
engine.globalEvent.dispatchEvent('walking-cat-game-changScore', { score: curScore });
};
PlayGame.prototype.play = function (id) {
var img = this.dialog;
img.texture = getTextureByName('dialog_' + id);
img.scaleX = img.scaleY = 0;
img.alpha = 1;
img.visible = true;
engine.Tween.get(img, null, null, true)
.to({
scaleX: 1, scaleY: 1
}, 500, engine.Ease.backOut)
.wait(500)
.to({
alpha: 0,
}, 300)
.call(function () {
img.visible = false;
});
};
PlayGame.prototype.revive = function () {
this.GameView.reset(true);
this.GameView.start(true);
};
return PlayGame;
}(engine.Container));
var LoopComponent = (function (_super) {
tslib.__extends(LoopComponent, _super);
function LoopComponent() {
var _this = _super.call(this) || this;
_this.onceInfo = { width: 0, height: 0, count: 0 };
_this.loopInfo = { width: 0, height: 0, count: 0 };
_this.parts = [];
return _this;
}
LoopComponent.prototype.setup = function (parts, info) {
var _this = this;
parts.forEach(function (item, index) {
var part;
if (typeof item == 'string') {
part = new engine.Sprite(getTextureByName(item));
}
else if (item instanceof engine.Texture) {
part = new engine.Sprite(item);
}
else {
part = item;
}
_this.addChild(part);
_this.parts.push(part);
if (index == 0) {
info.width = part.width;
info.height = part.height;
}
});
info.count = parts.length;
this.setViewport(0, 0);
};
LoopComponent.prototype.setupOnce = function (resArr) {
this.setup(resArr, this.onceInfo);
};
LoopComponent.prototype.setupLoop = function (resArr) {
this.setup(resArr, this.loopInfo);
};
LoopComponent.prototype.setViewport = function (x, y) {
if (y === void 0) { y = 0; }
var sizeField = y == 0 ? 'width' : 'height';
var posField = y == 0 ? 'x' : 'y';
var pos = y == 0 ? x : y;
var index;
var onceSize = this.onceInfo[sizeField];
var onceCount = this.onceInfo.count;
var loopCount = this.loopInfo.count;
var loopSize = this.loopInfo[sizeField];
index = onceSize == 0 ? -1 : Math.floor(pos / onceSize);
if (index < 0 || index >= onceCount) {
var loopIndex = Math.floor((pos - onceCount * onceSize) / this.loopInfo[sizeField]);
index = onceCount + loopIndex;
}
var formerIndex = index < onceCount ? index : (index) % loopCount + onceCount;
var latterIndex = index < onceCount ? index + 1 : (index - onceCount + 1) % loopCount + onceCount;
var former = this.parts[formerIndex];
var latter = this.parts[latterIndex];
if (!former || !latter) {
console.log(formerIndex, latterIndex);
}
former[posField] = -(pos - loopSize * (index < onceCount ? index : index - onceCount) - (index < onceCount ? 0 : onceCount * onceSize));
latter[posField] = former.x + (index < onceCount ? onceSize : loopSize);
};
return LoopComponent;
}(engine.Container));
var Background = (function (_super) {
tslib.__extends(Background, _super);
function Background() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.partRes = ['bg_far', 'bg_mid', 'bg_near'];
_this.speeds = [0.05, 0.5, 1];
return _this;
}
Background.prototype.setup = function () {
var bottomBg = new engine.Rect();
bottomBg.x = 0;
bottomBg.y = 0;
bottomBg.width = getStage().width;
bottomBg.height = 0;
bottomBg.fillColor = 0x75c9f5;
this.addChild(bottomBg);
var parts = [];
for (var i = 0; i < 3; i++) {
var part = new LoopComponent();
part.setupLoop([
this.partRes[i],
this.partRes[i],
]);
parts.push(part);
this.addChild(part);
}
var height = getStage().height;
parts[0].y = (height - parts[0].height) / 2 - 400;
parts[1].y = (height - parts[1].height) / 2 - 120;
parts[2].y = (height - parts[2].height) / 2 + 300;
bottomBg.y = parts[2].y;
bottomBg.height = height - parts[2].y;
var moon = new engine.Sprite(getTextureByName('moon'));
moon.x = 100;
moon.y = 100;
this.addChild(moon);
};
Background.prototype.setViewport = function (pos) {
console.log('移动位移', pos);
for (var i = 0; i < 3; i++) {
var part = this.getChildAt(i + 1);
var speed = this.speeds[i];
part.setViewport(pos * speed);
}
};
Background.prototype.reset = function (revive) {
};
return Background;
}(engine.Container));
var localWave = (function () {
function localWave() {
this._oldProperties = {};
this._t = 0;
}
localWave.prototype.init = function (target, duration, calProps, loop, autoPlay, reverse, delay, offset) {
if (calProps === void 0) { calProps = null; }
if (loop === void 0) { loop = 0; }
if (autoPlay === void 0) { autoPlay = true; }
if (reverse === void 0) { reverse = false; }
if (delay === void 0) { delay = 0; }
if (offset === void 0) { offset = 0; }
this.target = target;
this._calProps = calProps ? calProps : localWave.round;
this.duration = duration;
this.loop = loop;
this.reverse = reverse;
this.delay = delay;
this.offset = offset;
this.updateRegisterPos();
if (autoPlay) {
this.play();
}
};
localWave.prototype.updateRegisterPos = function () {
this._oldProperties.x = this.target.x;
this._oldProperties.y = this.target.y;
this._oldProperties.scaleX = this.target.scaleX;
this._oldProperties.scaleY = this.target.scaleY;
this._oldProperties.skewX = this.target.skewX;
this._oldProperties.skewY = this.target.skewY;
this._oldProperties.rotation = this.target.rotation;
this._oldProperties.alpha = this.target.alpha;
};
localWave.prototype.play = function () {
if (this._tween) {
return this._tween;
}
this._count = 0;
return this._playStep();
};
localWave.prototype._playStep = function () {
if (this.loop > 0 && this._count >= this.loop) {
this.stop();
return;
}
this._count++;
this.t = this.reverse ? Math.PI * 2 : 0;
this._tween = engine.Tween.get(this);
this._tween.wait(this.delay).to({ t: this.reverse ? 0 : Math.PI * 2 }, this.duration).call(this._playStep, this);
return this._tween;
};
Object.defineProperty(localWave.prototype, "t", {
get: function () {
return this._t;
},
set: function (value) {
if (!this.target.stage) {
return;
}
this._t = value;
var props = this._calProps.call(this, this._t + this.offset);
if (props.hasOwnProperty('x')) {
this.target.x = (props.x || 0) + this._oldProperties.x;
}
if (props.hasOwnProperty('y')) {
this.target.y = (props.y || 0) + this._oldProperties.y;
}
if (props.hasOwnProperty('sx')) {
this.target.scaleX = props.sx;
}
if (props.hasOwnProperty('sy')) {
this.target.scaleY = props.sy;
}
if (props.hasOwnProperty('skewX')) {
this.target.skewX = props.skewX;
}
if (props.hasOwnProperty('skewY')) {
this.target.skewY = props.skewY;
}
if (props.hasOwnProperty('r')) {
this.target.rotation = props.r;
}
if (props.hasOwnProperty('alpha')) {
this.target.alpha = props.alpha;
}
},
enumerable: true,
configurable: true
});
localWave.prototype.stop = function (recovery, animation, duration) {
if (recovery === void 0) { recovery = false; }
if (duration === void 0) { duration = 1000; }
if (!this._tween) {
return;
}
engine.Tween.removeTweens(this);
if (recovery) {
engine.Tween.get(this.target).to(this._oldProperties, duration);
}
this._tween = null;
};
Object.defineProperty(localWave.prototype, "playing", {
get: function () {
return this._tween != null;
},
enumerable: true,
configurable: true
});
localWave.round = function (h, t) {
return { x: Math.cos(t) * h, y: Math.sin(t) * h };
};
localWave.cos = function (h, t) {
return { x: Math.cos(t) * h, y: 0 };
};
localWave.sin = function (h, t) {
h = h || 1;
return { x: 0, y: Math.sin(t) * h };
};
localWave.rotate = function (t) {
return { r: 360 * t / Math.PI / 2 };
};
localWave.shake = function (angle, count, t) {
return { r: Math.sin(t * count) * angle };
};
localWave.breath = function (scale, t) {
return { sx: Math.sin(t) * scale + 1, sy: -Math.sin(t + Math.PI / 4) * scale + 1 };
};
localWave.zoom = function (scale, t) {
scale = scale || 0.1;
return { sx: Math.sin(t) * scale + 1, sy: Math.sin(t) * scale + 1 };
};
localWave.fade = function (base, t) {
return { alpha: (Math.sin(t) + 1) * 0.5 + base };
};
return localWave;
}());
var Block = (function (_super) {
tslib.__extends(Block, _super);
function Block() {
var _this = _super.call(this) || this;
_this.bmp = new engine.Sprite();
_this.addChild(_this.bmp = new engine.Sprite());
return _this;
}
Block.prototype.reset = function (_a) {
var type = _a.type;
this.type = type;
var bmp = this.bmp;
bmp.alpha = 1;
bmp.texture = this.getBlock();
var _b = Block.configs[type], width = _b.width, off = _b.off;
bmp.x = -(off + width / 2);
bmp.y = -(bmp.height / 2);
};
Block.prototype.getBlock = function () {
return getTextureByName('block_' + this.type);
};
Block.prototype.playEffect = function () {
};
Block.prototype.playFadeOut = function () {
return this.getTweenPromise(engine.Tween.get(this.bmp)
.to({ alpha: 0 }, 100)
.to({ alpha: 1 }, 100)
.to({ alpha: 0 }, 100));
};
Block.prototype.onEffectComplete = function (event) {
this.effectResolve && this.effectResolve();
this.effectResolve = null;
};
Block.prototype.getTweenPromise = function (tween) {
return new Promise(function (resolve) {
tween.call(resolve);
});
};
Block.configs = [
{ ratio: 0.6, width: 15, off: 32, effect: '', effect_offset: { x: 0, y: 0 } },
{ ratio: 0.1, width: 10, off: 18, effect: '', effect_offset: { x: 0, y: 0 } },
{ ratio: 0.15, width: 30, off: 32, effect: '', effect_offset: { x: 0, y: 0 } },
{ ratio: 0.1, width: 86, off: 28, effect: '', effect_offset: { x: 0, y: 0 } },
{ ratio: 0.5, width: 70, off: 20, effect: '', effect_offset: { x: 0, y: -20 } },
{ ratio: 0, width: 0, off: 0, effect: '', effect_offset: { x: 0, y: 0 } },
{ ratio: 0, width: 0, off: 0, effect: '', effect_offset: { x: 0, y: 0 } },
{ ratio: 0, width: 0, off: 0, effect: '', effect_offset: { x: 0, y: 0 } },
{ ratio: 0, width: 0, off: 0, effect: '', effect_offset: { x: 0, y: 0 } },
{ ratio: 0, width: 0, off: 0, effect: '', effect_offset: { x: 0, y: 0 } },
{ ratio: 0, width: 123, off: 23, effect: '', effect_offset: { x: 0, y: 0 } },
];
return Block;
}(engine.Container));
var ObjectPool = engine.ObjectPool;
var Road = (function (_super) {
tslib.__extends(Road, _super);
function Road() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.dustIndex = 0;
_this.index = 0;
_this.minDistance = parseInt(props.blockMinDistance) || 100;
_this.maxDistance = parseInt(props.blockMaxDistance) || 300;
_this.basePos = getStage().width / 2 - 100;
_this.padding = 500;
return _this;
}
Road.prototype.preSetup = function () {
this.addChild(this.container = new engine.Container());
var flag = this.flag = new engine.Sprite(getTextureByName('flag_record'));
this.anchorRate(flag, 0.5, 1);
flag.y = -230;
flag.x = this.transScoreToFlagPos();
flag.visible = flag.x > 0;
this.addChild(flag);
};
Road.prototype.setup = function () {
this.dustNode = new engine.Container();
this.dustSprite = new engine.Sprite();
this.dustSprite.visible = false;
this.dustNode.y = -1000;
this.dustNode.x = -450;
this.dustNode.addChild(this.dustSprite);
this.addChild(this.dustNode);
var reward = this.reward = new engine.Sprite();
reward.visible = false;
reward.y = -500;
this.addChild(reward);
this.aniReward = new localWave();
this.aniReward.init(reward, 2000, localWave.sin.bind(null, 10));
};
Road.prototype.start = function (revive) {
if (revive === void 0) { revive = false; }
if (revive) ;
else {
this.rewardIndex = 0;
this.showReward();
}
};
Road.prototype.reset = function (revive) {
if (revive === void 0) { revive = false; }
if (!revive) {
this.index = 0;
this.lastPos = 0;
this.clear();
this.fill();
this.flag.x = this.transScoreToFlagPos();
this.flag.visible = this.flag.x > 0;
}
};
Road.prototype.anchorRate = function (target, rx, ry, width, height, resetPos) {
if (width === void 0) { width = 0; }
if (height === void 0) { height = 0; }
if (resetPos === void 0) { resetPos = true; }
if (width == 0) {
width = target.width;
}
if (height == 0) {
height = target.height;
}
if (resetPos) {
if (rx == 0) {
target.x -= target.anchorOffsetX;
}
if (ry == 0) {
target.y -= target.anchorOffsetY;
}
}
target.anchorOffsetX = width * rx;
target.anchorOffsetY = height * ry;
if (resetPos) {
if (rx > 0) {
target.x += target.anchorOffsetX;
}
if (ry > 0) {
target.y += target.anchorOffsetY;
}
}
};
Road.prototype.transScoreToFlagPos = function () {
return -1;
};
Road.prototype.clear = function () {
while (this.container.children.length > 0) {
this.removeBlockAt(0);
}
};
Road.prototype.addBlock = function () {
var type = 0, v;
if (this.index > 10) {
do {
var rv = Math.random();
v = 0;
for (var i = 0; i < 5; i++) {
v += Block.configs[i].ratio;
if (rv < v) {
type = i;
break;
}
}
} while (this.lastBlockType == type);
this.lastBlockType = type;
}
var block = ObjectPool.getObject('block', { type: type });
var width = Block.configs[type].width;
var distance = this.index == 0 ?
this.maxDistance :
this.makeRandomFloat(this.maxDistance, this.minDistance);
var pos = this.lastPos + distance;
block.x = pos;
this.container.addChild(block);
this.lastPos = pos + width;
this.index++;
};
Road.prototype.removeBlockAt = function (index) {
var block = this.container.removeChildAt(index);
ObjectPool.recycleObject('block', block);
};
Road.prototype.removeBlock = function (block) {
this.container.removeChild(block);
ObjectPool.recycleObject('block', block);
};
Road.prototype.fill = function () {
if (isNaN(this.lastPos)) {
return;
}
while (true) {
if (this.lastPos + this.x > getStage().width + this.padding) {
break;
}
this.addBlock();
}
};
Road.prototype.makeRandomFloat = function (max, min) {
if (min === void 0) { min = 0; }
return Math.random() * (max - min) + min;
};
Road.prototype.setViewport = function (pos) {
this.x = this.basePos - pos;
while (this.container.children.length > 0) {
if (this.container.getChildAt(0).x >= pos - this.padding) {
break;
}
this.removeBlockAt(0);
}
this.fill();
};
Road.prototype.showReward = function (type) {
this.rewardIndex++;
var pos = this.rewardIndex * getStage().width * 3;
var reward = this.reward;
reward.visible = true;
reward.alpha = 1;
reward.texture = getTextureByName('menu_block_10');
reward.x = pos;
this.aniReward.updateRegisterPos();
};
Road.prototype.hideReward = function () {
var _this = this;
var reward = this.reward;
this.tweenReward = engine.Tween.get(reward)
.to({ alpha: 0 }, 200)
.call(function () {
_this.tweenReward = null;
_this.showReward();
});
};
Road.prototype.hitReward = function (pos) {
if (this.reward.visible && pos >= this.reward.x && !this.tweenReward) {
this.hideReward();
return true;
}
};
Road.prototype.playDust = function (pos) {
this.dustSprite.x = pos;
this.dustSprite.visible = true;
this.addEventListener(engine.Event.ENTER_FRAME, this.onEnterFrame, this);
};
Road.prototype.onEnterFrame = function () {
if (this.dustIndex < 12) {
this.dustSprite.texture = getTextureByName('dust_' + this.dustIndex);
this.dustIndex++;
}
else {
this.dustIndex = 0;
this.dustSprite.visible = false;
this.removeEventListener(engine.Event.ENTER_FRAME, this.onEnterFrame, this);
}
};
Road.prototype.hitBlock = function (pos) {
var _this = this;
var target, lastTarget;
var foot = { a: pos - 84 / 2, b: pos + 84 / 2 };
this.container.children.some(function (block, i) {
var width = Block.configs[block.type].width;
var line = { a: block.x - width / 2, b: block.x + width / 2 };
if (_this.lineHitTest(foot, line)) {
target = block;
return true;
}
});
if (!target) {
for (var i = this.container.children.length; i > 0; i--) {
var block = this.container.getChildAt(i - 1);
if (block.x < pos) {
lastTarget = block;
break;
}
}
}
return {
target: target,
lastTarget: lastTarget,
};
};
Road.prototype.lineHitTest = function (l0, l1) {
return l0.a < l1.b && l0.b > l1.a;
};
return Road;
}(engine.Container));
var factor = 10;
var Head = (function (_super) {
tslib.__extends(Head, _super);
function Head() {
var _this = _super.call(this) || this;
_this.imgFace = new engine.Sprite(getTextureByName('head_0'));
_this.addChild(_this.imgFace);
_this.imgFace.anchorTexture.set(107 / _this.imgFace.width, 155 / _this.imgFace.height);
_this.imgFace.y = 65;
return _this;
}
Head.prototype.localUpdate = function (x, y, rotation, sleeping) {
this.x = x;
this.y = y;
this.rotation = rotation;
};
Object.defineProperty(Head.prototype, "fWidth", {
get: function () {
return this.width / factor;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Head.prototype, "fHeight", {
get: function () {
return this.height / factor;
},
enumerable: true,
configurable: true
});
Head.prototype.switchFace = function (type, playAni) {
var headName = '';
if (type == 'normal') {
headName = 'head_0';
}
else if (type == 'happy') {
headName = 'head_1';
}
else if (type == 1 || type == 0 || type == 2) {
headName = 'head_2';
}
else if (type == 3) {
headName = 'head_3';
}
else if (type == 4) {
headName = 'head_4';
}
this.imgFace.texture = getTextureByName(headName);
};
return Head;
}(engine.Container));
var PlayerPart = (function (_super) {
tslib.__extends(PlayerPart, _super);
function PlayerPart(name) {
var _this = _super.call(this) || this;
_this.changeRes(name);
return _this;
}
PlayerPart.prototype.changeRes = function (name) {
this.name = name;
this.texture = getTextureByName('body_normal_' + name);
};
PlayerPart.prototype.setSkin = function (name) {
this.texture = getTextureByName('body_' + name + '_' + this.name);
};
PlayerPart.prototype.localUpdate = function (x, y, rotation, sleeping) {
this.x = x;
this.y = y;
this.rotation = rotation;
};
Object.defineProperty(PlayerPart.prototype, "fSize", {
get: function () {
return { width: this.fWidth, height: this.fHeight };
},
enumerable: true,
configurable: true
});
Object.defineProperty(PlayerPart.prototype, "fWidth", {
get: function () {
return this.width / getfactor();
},
enumerable: true,
configurable: true
});
Object.defineProperty(PlayerPart.prototype, "fHeight", {
get: function () {
return this.height / getfactor();
},
enumerable: true,
configurable: true
});
PlayerPart.prototype.reset = function () {
};
return PlayerPart;
}(engine.Sprite));
var PlayerStat;
(function (PlayerStat) {
PlayerStat[PlayerStat["RELEASE"] = 0] = "RELEASE";
PlayerStat[PlayerStat["RISING"] = 1] = "RISING";
PlayerStat[PlayerStat["FALL"] = 2] = "FALL";
})(PlayerStat || (PlayerStat = {}));
var Player = (function (_super) {
tslib.__extends(Player, _super);
function Player() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.partMass = 0.1;
_this.footMass = 0.1;
_this.shouldersDistance = 50 / getfactor();
_this.speed = 30;
_this.skin = '';
_this.originPos = {};
_this.safePos = 0;
_this.onPostStep = function (e) {
var side = _this.currentSide;
var footHang = _this.foots[_this.currentSide];
var footFall = _this.foots[_this.anotherSide];
switch (_this.state) {
case PlayerStat.FALL:
break;
case PlayerStat.RISING:
var footOffset = footHang.position[0] - footFall.position[0];
var speed = _this.speed;
_this.upperLegs[side].angularVelocity = 10;
_this.upperLegs[side].velocity = [
footOffset < 0 ? speed - 10 : speed,
0
];
_this.lowerLegs[side].velocity = [
footOffset < 0 ? speed - 10 : speed,
footOffset < 0 ? 3 : 2
];
_this.head.velocity = [speed * 0.5, 20];
_this.dispatchEvent('move', {
pos: (_this.leftFoot.position[0] + _this.rightFoot.position[0]) / 2 * getfactor(),
bodyPos: _this.body.position[0] * getfactor(),
}, true);
if (footOffset > 50) {
_this.up();
}
break;
case PlayerStat.RELEASE:
_this.head.velocity = [0, 30];
break;
}
};
_this.onFootDown = function () {
var pos = _this.foots[_this.currentSide].position[0] * getfactor();
var mileage = Math.max(_this.foots[0].position[0], _this.foots[1].position[0]) * getfactor();
_this.safePos = _this.foots[_this.currentSide].position[0];
_this.dispatchEvent('foot_down', {
mileage: mileage,
pos: pos,
}, true);
};
return _this;
}
Player.prototype.setup = function (options) {
var collisionGroup = options.collisionGroup, collisionMask = options.collisionMask, world = options.world, ground = options.ground;
this.world = world;
world.on('postStep', this.onPostStep);
var bodyPartShapes = [];
var leftFootDisplay = this.createDisplay('foot');
var lowerLeftLegDisplay = this.createDisplay('lower_left_leg');
var upperLeftLegDisplay = this.createDisplay('upper_left_leg');
var rightFootDisplay = this.createDisplay('foot');
var lowerRightLegDisplay = this.createDisplay('lower_right_leg');
var upperRightLegDisplay = this.createDisplay('upper_right_leg');
var bodyDisplay = this.createDisplay('body', { x: 50, y: 0 });
var headDisplay = new Head();
var upperLeftArmDisplay = this.createDisplay('upper_left_arm');
var lowerLeftArmDisplay = this.createDisplay('lower_left_arm', { x: -20, y: 0 });
var upperRightArmDisplay = this.createDisplay('upper_right_arm');
var lowerRightArmDisplay = this.createDisplay('lower_right_arm', { x: -39, y: 0 });
var leftFootShape = new p2.Box(leftFootDisplay.fSize);
bodyPartShapes.push(leftFootShape);
this.originPos['leftFoot'] = [
-this.shouldersDistance / 2,
leftFootDisplay.fHeight / 2
];
var leftFoot = this.leftFoot = new p2.Body({
allowSleep: false,
mass: this.footMass,
position: this.originPos['leftFoot'],
});
leftFoot.displays = [leftFootDisplay];
leftFoot.addShape(leftFootShape);
var lowerLeftLegShape = new p2.Box(lowerLeftLegDisplay.fSize);
bodyPartShapes.push(lowerLeftLegShape);
this.originPos['lowerLeftLeg'] = [
-this.shouldersDistance / 2,
leftFoot.position[1] + lowerLeftLegDisplay.fHeight / 2 + 5 / getfactor()
];
var lowerLeftLeg = this.lowerLeftLeg = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['lowerLeftLeg'],
});
lowerLeftLeg.displays = [lowerLeftLegDisplay];
lowerLeftLeg.addShape(lowerLeftLegShape);
var leftAnkleJoint = new p2.RevoluteConstraint(lowerLeftLeg, leftFoot, {
localPivotA: [0, -lowerLeftLegDisplay.fHeight / 2 + 5 / getfactor()],
localPivotB: [-leftFootDisplay.fWidth / 2 + 18 / getfactor(), 0],
});
leftAnkleJoint.setLimits(-Math.PI / 3, Math.PI / 3);
var leftFootGroundCons = this.leftFootGroundCons = new p2.RevoluteConstraint(leftFoot, ground, {
localPivotA: [0, -leftFootDisplay.fHeight / 2],
localPivotB: [leftFoot.position[0], 0],
});
leftFootGroundCons.setLimits(0, 0);
var upperLeftLegShape = new p2.Box(upperLeftLegDisplay.fSize);
bodyPartShapes.push(upperLeftLegShape);
this.originPos['upperLeftLeg'] = [
-this.shouldersDistance / 2,
lowerLeftLeg.position[1] + lowerLeftLegDisplay.fHeight / 2 + upperLeftLegDisplay.fHeight / 2 - 40 / getfactor()
];
var upperLeftLeg = this.upperLeftLeg = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['upperLeftLeg'],
});
upperLeftLeg.displays = [upperLeftLegDisplay];
upperLeftLeg.addShape(upperLeftLegShape);
var leftKneeJoint = new p2.RevoluteConstraint(upperLeftLeg, lowerLeftLeg, {
localPivotA: [0, -upperLeftLegDisplay.fHeight / 2 + 20 / getfactor()],
localPivotB: [0, lowerLeftLegDisplay.fHeight / 2 - 20 / getfactor()],
});
leftKneeJoint.setLimits(-Math.PI, 0);
var rightFootShape = new p2.Box(rightFootDisplay.fSize);
bodyPartShapes.push(rightFootShape);
this.originPos['rightFoot'] = [
this.shouldersDistance / 2,
rightFootDisplay.fHeight / 2
];
var rightFoot = this.rightFoot = new p2.Body({
allowSleep: false,
mass: this.footMass,
position: this.originPos['rightFoot'],
});
rightFoot.displays = [rightFootDisplay];
rightFoot.addShape(rightFootShape);
var lowerRightLegShape = new p2.Box(lowerRightLegDisplay.fSize);
bodyPartShapes.push(lowerRightLegShape);
this.originPos['lowerRightLeg'] = [
this.shouldersDistance / 2,
rightFoot.position[1] + lowerRightLegDisplay.fHeight / 2 + 5 / getfactor()
];
var lowerRightLeg = this.lowerRightLeg = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['lowerRightLeg'],
});
lowerRightLeg.displays = [lowerRightLegDisplay];
lowerRightLeg.addShape(lowerRightLegShape);
var rightAnkleJoint = new p2.RevoluteConstraint(lowerRightLeg, rightFoot, {
localPivotA: [0, -lowerRightLegDisplay.fHeight / 2 + 5 / getfactor()],
localPivotB: [-rightFootDisplay.fWidth / 2 + 18 / getfactor(), 0],
});
rightAnkleJoint.setLimits(-Math.PI / 3, Math.PI / 3);
var rightFootGroundCons = this.rightFootGroundCons = new p2.RevoluteConstraint(rightFoot, ground, {
localPivotA: [0, -rightFootDisplay.fHeight / 2],
localPivotB: [rightFoot.position[0], 0],
});
rightFootGroundCons.setLimits(0, 0);
var upperRightLegShape = new p2.Box(upperRightLegDisplay.fSize);
bodyPartShapes.push(upperRightLegShape);
this.originPos['upperRightLeg'] = [
this.shouldersDistance / 2,
lowerRightLeg.position[1] + lowerRightLegDisplay.fHeight / 2 + upperRightLegDisplay.fHeight / 2 - 40 / getfactor()
];
var upperRightLeg = this.upperRightLeg = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['upperRightLeg'],
});
upperRightLeg.displays = [upperRightLegDisplay];
upperRightLeg.addShape(upperRightLegShape);
var rightKneeJoint = new p2.RevoluteConstraint(upperRightLeg, lowerRightLeg, {
localPivotA: [0, -upperRightLegDisplay.fHeight / 2 + 20 / getfactor()],
localPivotB: [0, lowerRightLegDisplay.fHeight / 2 - 20 / getfactor()],
});
rightKneeJoint.setLimits(-Math.PI, 0);
var bodyWidth = 120 / getfactor();
var bodyHeight = 250 / getfactor();
var bodyShape = new p2.Box({ width: bodyWidth, height: bodyHeight });
bodyPartShapes.push(bodyShape);
this.originPos['body'] = [
0,
upperRightLeg.position[1] + upperRightLegDisplay.fHeight / 2 + bodyHeight / 2 - 60 / getfactor()
];
var body = this.body = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['body'],
});
body.displays = [bodyDisplay];
body.addShape(bodyShape);
var leftHipJoint = new p2.RevoluteConstraint(body, upperLeftLeg, {
localPivotA: [-20 / getfactor(), -bodyHeight / 2 + 30 / getfactor()],
localPivotB: [0, upperLeftLegDisplay.fHeight / 2 - 30 / getfactor()],
});
leftHipJoint.setLimits(-Math.PI / 6 * 2, Math.PI / 6 * 2);
var rightHipJoint = new p2.RevoluteConstraint(body, upperRightLeg, {
localPivotA: [-20 / getfactor(), -bodyHeight / 2 + 30 / getfactor()],
localPivotB: [0, upperRightLegDisplay.fHeight / 2 - 30 / getfactor()],
});
rightHipJoint.setLimits(-Math.PI / 6 * 2, Math.PI / 6 * 2);
var headShape = new p2.Circle({ radius: 85 / getfactor() });
bodyPartShapes.push(headShape);
this.originPos['head'] = [
0,
body.position[1] + bodyHeight / 2 + 85 / getfactor()
];
var head = this.head = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['head'],
});
head.addShape(headShape);
head.displays = [headDisplay];
var headJoint = new p2.RevoluteConstraint(body, head, {
localPivotA: [0, bodyHeight / 2 - 10 / getfactor()],
localPivotB: [0, (-85 + 10) / getfactor()],
});
headJoint.setLimits(-Math.PI / 6 * 2, Math.PI / 6 * 2);
var upperLeftArmShape = new p2.Box(upperLeftArmDisplay.fSize);
bodyPartShapes.push(upperLeftArmShape);
this.originPos['upperLeftArm'] = [
-this.shouldersDistance / 2 - 10 / getfactor(),
body.position[1] + bodyHeight / 2 - upperLeftArmDisplay.fHeight / 2
];
var upperLeftArm = this.upperLeftArm = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['upperLeftArm'],
});
upperLeftArm.displays = [upperLeftArmDisplay];
upperLeftArm.addShape(upperLeftArmShape);
var leftShoulderJoint = new p2.RevoluteConstraint(body, upperLeftArm, {
localPivotA: [-this.shouldersDistance / 2 + 10 / getfactor(), bodyHeight / 2],
localPivotB: [0, upperLeftArmDisplay.fHeight / 2],
});
leftShoulderJoint.setLimits(-Math.PI / 2, 0);
var width = 50 / getfactor();
var lowerLeftArmShape = new p2.Box({ width: width, height: lowerLeftArmDisplay.fHeight });
bodyPartShapes.push(lowerLeftArmShape);
this.originPos['lowerLeftArm'] = [
-this.shouldersDistance / 2 - 10 / getfactor() + 10 / getfactor(),
upperLeftArm.position[1] - upperLeftArmDisplay.fHeight / 2 - lowerLeftArmDisplay.fHeight / 2 + 20 / getfactor()
];
var lowerLeftArm = this.lowerLeftArm = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['lowerLeftArm'],
});
lowerLeftArm.displays = [lowerLeftArmDisplay];
lowerLeftArm.addShape(lowerLeftArmShape);
var leftElbowJoint = new p2.RevoluteConstraint(upperLeftArm, lowerLeftArm, {
localPivotA: [0, -upperLeftArmDisplay.fHeight / 2 + 10 / getfactor()],
localPivotB: [-10 / getfactor(), lowerLeftLegDisplay.fHeight / 2 - 10 / getfactor()],
});
leftElbowJoint.setLimits(0, Math.PI * 2 / 3);
var upperRightArmShape = new p2.Box(upperRightArmDisplay.fSize);
bodyPartShapes.push(upperRightArmShape);
this.originPos['upperRightArm'] = [
this.shouldersDistance / 2,
body.position[1] + bodyHeight / 2 - upperRightArmDisplay.fHeight / 2
];
var upperRightArm = this.upperRightArm = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['upperRightArm'],
});
upperRightArm.displays = [upperRightArmDisplay];
upperRightArm.addShape(upperRightArmShape);
var rightShoulderJoint = new p2.RevoluteConstraint(body, upperRightArm, {
localPivotA: [this.shouldersDistance / 2 + 10 / getfactor(), bodyHeight / 2],
localPivotB: [0, upperRightArmDisplay.fHeight / 2],
});
rightShoulderJoint.setLimits(-Math.PI / 2, 0);
var width = 30 / getfactor();
var lowerRightArmShape = new p2.Box({ width: width, height: lowerRightArmDisplay.fHeight });
bodyPartShapes.push(lowerRightArmShape);
this.originPos['lowerRightArm'] = [
this.shouldersDistance / 2,
upperRightArm.position[1] - upperRightArmDisplay.fHeight / 2 - lowerRightArmDisplay.fHeight / 2 + 40 / getfactor()
];
var lowerRightArm = this.lowerRightArm = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['lowerRightArm'],
});
lowerRightArm.displays = [lowerRightArmDisplay];
lowerRightArm.addShape(lowerRightArmShape);
var rightElbowJoint = new p2.RevoluteConstraint(upperRightArm, lowerRightArm, {
localPivotA: [0, -upperRightArmDisplay.fHeight / 2 + 20 / getfactor()],
localPivotB: [0, lowerRightLegDisplay.fHeight / 2 - 20 / getfactor()],
});
rightElbowJoint.setLimits(0, Math.PI * 2 / 3);
var bodies = [
lowerRightArm, upperRightArm,
lowerRightLeg, upperRightLeg, rightFoot,
body,
lowerLeftLeg, upperLeftLeg, leftFoot,
lowerLeftArm, upperLeftArm,
head,
];
bodies.forEach(function (body) {
world.addBody(body);
});
var joints = [
leftAnkleJoint,
leftKneeJoint,
rightAnkleJoint,
rightKneeJoint,
headJoint,
leftHipJoint,
rightHipJoint,
leftShoulderJoint,
leftElbowJoint,
rightShoulderJoint,
rightElbowJoint,
leftFootGroundCons,
rightFootGroundCons,
];
joints.forEach(function (joint) {
world.addConstraint(joint);
});
for (var i = 0; i < bodyPartShapes.length; i++) {
var s = bodyPartShapes[i];
s.collisionGroup = collisionGroup;
s.collisionMask = collisionMask;
}
this.foots = [leftFoot, rightFoot];
this.lowerLegs = [lowerLeftLeg, lowerRightLeg];
this.upperLegs = [upperLeftLeg, upperRightLeg];
this.footGroundCons = [leftFootGroundCons, rightFootGroundCons];
};
Player.prototype.reset = function (revive) {
var _this = this;
if (revive === void 0) { revive = false; }
if (revive) ;
else {
this.step = -1;
this.safePos = 0;
[
'lowerLeftLeg',
'upperLeftLeg',
'lowerRightLeg',
'upperRightLeg',
'body',
'head',
'upperLeftArm',
'lowerLeftArm',
'upperRightArm',
'lowerRightArm',
].forEach(function (partName) {
var part = _this[partName];
part.position[0] = _this.safePos + _this.originPos[partName][0];
});
}
for (var i = 0; i < 2; i++) {
var cons = this.footGroundCons[i];
cons.pivotB[0] = this.foots[i].position[0] = this.safePos + (i == 0 ? -1 : 1) * this.shouldersDistance / 2;
if (this.state == PlayerStat.FALL) {
this.world.addConstraint(cons);
}
}
this.switchFace('normal', false);
this.setSkin('normal');
this.state = PlayerStat.RELEASE;
};
Player.prototype.createDisplay = function (resName, offset) {
if (offset === void 0) { offset = null; }
var bmp = new PlayerPart(resName);
var anchorX = bmp.width / 2 + (offset ? offset.x : 0);
var anchorY = bmp.height / 2 + (offset ? offset.y : 0);
bmp.anchorTexture.set(anchorX / bmp.width, anchorY / bmp.height);
return bmp;
};
Object.defineProperty(Player.prototype, "currentSide", {
get: function () {
return this.step % 2;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Player.prototype, "anotherSide", {
get: function () {
return (this.step + 1) % 2;
},
enumerable: true,
configurable: true
});
Player.prototype.down = function () {
if (this.state == PlayerStat.RISING) {
return;
}
this.step++;
var cons = this.footGroundCons[this.currentSide];
this.world.removeConstraint(cons);
this.state = PlayerStat.RISING;
};
Player.prototype.up = function () {
if (this.state == PlayerStat.RELEASE) {
return;
}
var side = this.currentSide;
this.foots[side].velocity = [0, 0];
this.body.velocity = [0, 0];
var currentFoot = this.foots[side];
var cons = this.footGroundCons[side];
cons.pivotB[0] = currentFoot.position[0];
this.world.addConstraint(cons);
this.state = PlayerStat.RELEASE;
setTimeout(this.onFootDown, 200);
};
Player.prototype.fall = function () {
this.body.velocity = [0, -30];
this.head.velocity = [-50, -50];
this.world.removeConstraint(this.footGroundCons[0]);
this.world.removeConstraint(this.footGroundCons[1]);
this.foots[this.currentSide].velocity[0] = 60;
this.foots[this.anotherSide].velocity[0] = 70;
this.state = PlayerStat.FALL;
};
Player.prototype.switchFace = function (type, playAni) {
if (playAni === void 0) { playAni = true; }
var headDisplay = this.head.displays[0];
headDisplay.switchFace(type, playAni);
};
Player.prototype.setSkin = function (name) {
var _this = this;
if (this.skin == name) {
return;
}
this.skin = name;
[
'leftFoot',
'lowerLeftLeg',
'upperLeftLeg',
'rightFoot',
'lowerRightLeg',
'upperRightLeg',
'body',
'upperLeftArm',
'lowerLeftArm',
'upperRightArm',
'lowerRightArm',
].forEach(function (partName) {
var part = _this[partName];
part.displays[0].setSkin(name);
});
};
Player.prototype.fade = function (alpha, animation) {
var _this = this;
if (animation === void 0) { animation = true; }
[
'leftFoot',
'lowerLeftLeg',
'upperLeftLeg',
'rightFoot',
'lowerRightLeg',
'upperRightLeg',
'body',
'head',
'upperLeftArm',
'lowerLeftArm',
'upperRightArm',
'lowerRightArm',
].forEach(function (partName) {
var display = _this[partName].displays[0];
if (animation) {
engine.Tween.get(display, null, null, true)
.to({ alpha: alpha }, 200);
}
else {
display.alpha = alpha;
}
});
};
return Player;
}(engine.EventDispatcher));
var ObjectPool$1 = engine.ObjectPool;
var PoolName = 'block';
ObjectPool$1.registerPool(PoolName, function () {
return new Block();
}, function (item, data) {
item.reset(data);
});
var GameView = (function (_super) {
tslib.__extends(GameView, _super);
function GameView() {
var _this = _super.call(this) || this;
_this.offset = { x: -100, y: 320 };
_this.worldFPS = 60;
_this._viewport = {
x: 0,
y: 0,
};
return _this;
}
Object.defineProperty(GameView, "instance", {
get: function () {
if (this._instance == undefined) {
this._instance = new GameView();
}
return this._instance;
},
enumerable: true,
configurable: true
});
GameView.prototype.eventStart = function () {
var _this = this;
if (this.hasPreSetup) {
return;
}
this.hasPreSetup = true;
var background = this.background = new Background();
background.setup();
this.addChild(background);
var road = this.road = new Road();
road.y = getStage().height / 2 + 310;
this.addChild(road);
this.road.preSetup();
this.setupWorld();
this.player.fade(0, false);
this.viewport = 0;
this.startWorld();
this.reset();
this.setup();
var playHint = new engine.Label();
playHint.fillColor = 'block';
playHint.size = 30;
playHint.text = '注意不要踩到线和陷阱哦,后果很严重哦~';
playHint.x = (getStage().width - playHint.width) / 2;
playHint.y = getStage().height / 2 + 500;
this.addChild(playHint);
this.playGame = new PlayGame();
setTimeout(function () {
_this.playGame.GameView = _this;
_this.addChild(_this.playGame);
_this.start();
}, 500);
};
GameView.prototype.setup = function () {
if (this.hasSetup) {
return;
}
this.hasSetup = true;
this.road.setup();
};
GameView.prototype.setupWorld = function () {
var OTHER = Math.pow(2, 1), BODYPARTS = Math.pow(2, 2), GROUND = Math.pow(2, 3);
var world = this.world = new p2.World({});
world.sleepMode = p2.World.BODY_SLEEPING;
var planeShape = new p2.Plane();
var ground = new p2.Body({
position: [0, 0],
});
ground.addShape(planeShape);
planeShape.collisionGroup = GROUND;
planeShape.collisionMask = BODYPARTS | OTHER;
world.addBody(ground);
var player = this.player = new Player();
player.setup({
collisionGroup: BODYPARTS,
collisionMask: GROUND | OTHER,
world: world,
ground: ground,
});
player.addEventListener('move', this.onMove, this);
player.addEventListener('foot_down', this.onFootDown, this);
};
GameView.prototype.onTicker = function (dt) {
var world = this.world;
this.world.step(this.worldFPS / 1000);
var l = world.bodies.length;
for (var i = 0; i < l; i++) {
var body = world.bodies[i];
var display = body.displays ? body.displays[0] : null;
if (display) {
if (!this.contains(display)) {
this.addChild(display);
}
display.localUpdate(body.position[0] * getfactor() + getStage().width / 2 + this.offset.x - this.viewport, getStage().height / 2 - body.position[1] * getfactor() + this.offset.y, 360 - (body.angle + body.shapes[0].angle) * 180 / Math.PI, body.sleepState == p2.Body.SLEEPING);
}
}
return false;
};
GameView.prototype.reset = function (revive) {
if (revive === void 0) { revive = false; }
this.background.reset(revive);
this.road.reset(revive);
this.player.reset(revive);
this.player.fade(0);
this.viewport = revive ? this.revivePos : 0;
};
GameView.prototype.start = function (revive) {
if (revive === void 0) { revive = false; }
this.road.start(revive);
this.player.fade(1);
this.playGame.start(revive);
};
GameView.prototype.startWorld = function () {
if (this.playing) {
return;
}
this.playing = true;
engine.gameStage.addEventListener(engine.Event.ENTER_FRAME, this.onTicker, this);
};
GameView.prototype.stopWorld = function () {
if (!this.playing) {
return;
}
this.playing = false;
engine.gameStage.removeEventListener(engine.Event.ENTER_FRAME, this.onTicker, this);
};
Object.defineProperty(GameView.prototype, "viewport", {
get: function () {
return this._viewport.x;
},
set: function (v) {
this._viewport.x = v;
this.updateViewport();
},
enumerable: true,
configurable: true
});
GameView.prototype.updateViewport = function () {
var _a = this._viewport, x = _a.x, y = _a.y;
var pos = Math.max(0, x);
this.background.setViewport(pos);
this.road.setViewport(pos);
};
GameView.prototype.onMove = function (event) {
var _a = event.data, pos = _a.pos, bodyPos = _a.bodyPos;
this.viewport = pos;
if (this.road.hitReward(bodyPos)) {
this.dispatchEvent('scoreChange', {
rewardScore: 100,
passType: 10,
}, true);
}
};
GameView.prototype.down = function () {
if (this.lock) {
return;
}
this.player.down();
};
GameView.prototype.up = function () {
if (this.lock) {
return;
}
this.player.up();
};
GameView.prototype.onFootDown = function (event) {
var _a = event.data, mileage = _a.mileage, pos = _a.pos;
this.revivePos = pos;
var _b = this.road.hitBlock(pos), target = _b.target, lastTarget = _b.lastTarget;
this.road.playDust(pos);
if (target) {
this.lock = true;
this.stopWorld();
this.dispatchEvent(engine.Event.COMPLETE, null, true);
target.playFadeOut();
target.playEffect();
if (target.type == 4) {
this.player.setSkin('gray');
}
this.road.removeBlock(target);
this.player.switchFace(target.type);
if (target.type == 0) {
this.player.fall();
}
this.lock = false;
this.startWorld();
}
else {
var score = Math.floor(mileage / 50 * 5);
this.dispatchEvent('scoreChange', {
score: score,
passType: lastTarget ? lastTarget.type : -1,
}, true);
}
};
return GameView;
}(engine.Container));
var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super);
function GameWrapper() {
var _this = _super.call(this) || this;
engine.globalEvent.addEventListener('walking-cat-start', _this.start, _this);
engine.globalEvent.addEventListener('walking-cat-revive', _this.revive, _this);
engine.globalEvent.addEventListener('walking-cat-showScore', _this.revive, _this);
var gameView = _this._gameView = new GameView();
_this.addChild(gameView);
return _this;
}
GameWrapper.prototype.start = function (event) {
injectProps(event.data);
this._gameView.eventStart();
};
GameWrapper.prototype.revive = function () {
console.log('复活');
this._gameView.reset(true);
this._gameView.start(true);
};
return GameWrapper;
}(engine.Container));
function index (props) {
prepareProps();
injectProps(props);
var instance = new GameWrapper();
return instance;
}
return index;
})));
//# sourceMappingURL=main.js.map
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* Created by rockyl on 2020-01-21.
*/
let customModuleProps = {
};
{
"name": "猫步前行",
"desc": "猫步前行模块",
"props": {
"blockMinDistance": {
"alias": "障碍物最小间距",
"type": "number",
"default": 150
},
"blockMaxDistance": {
"alias": "障碍物最大间距",
"type": "number",
"default": 350
},
"maxScore": {
"alias": "最大分数",
"type": "number",
"default": 100
},
"scoreTimes": {
"alias": "时间倍率",
"type": "number",
"default": 1
},
"showScore": {
"alias": "是否显示分数",
"type": "boolean",
"default": true
}
},
"assets": [
{
"name": "bg_far",
"url": "//yun.duiba.com.cn/aurora/assets/88b99a184b1d91ec207c3899da4e33d204d85849.jpg",
"uuid": "755ce179-ea64-4723-b86f-d75fec134578",
"ext": ".jpg"
},
{
"name": "bg_mid",
"url": "//yun.duiba.com.cn/aurora/assets/8422a19eddca5948b779efe47248db8a742f5714.png",
"uuid": "41c5721d-cb13-4f31-9dce-29c3ff115897",
"ext": ".png"
},
{
"name": "bg_near",
"url": "//yun.duiba.com.cn/aurora/assets/30653d0b47998d7413c5d767dcff605a4174cedd.jpg",
"uuid": "bab097bf-c891-4bda-9c2f-5ee752480841",
"ext": ".jpg"
},
{
"name": "moon",
"url": "//yun.duiba.com.cn/aurora/assets/0361ea50ed4716a99f8a76581edc7223d21bd62a.png",
"uuid": "97d31833-f9f0-4eb0-ab01-d9c8576e0f02",
"ext": ".png"
},
{
"name": "block_0",
"url": "//yun.duiba.com.cn/aurora/assets/e01d62022b585d5255b54f0dad936da4463118d3.png",
"uuid": "0feae6ef-3b0d-484c-be13-2fc10627e2fe",
"ext": ".png"
},
{
"name": "block_1",
"url": "//yun.duiba.com.cn/aurora/assets/5a70669941b6d0f503e8e9aa76e68f95d599ec99.png",
"uuid": "c5e5a381-bbe4-4dc1-8818-f089bb6f9c61",
"ext": ".png"
},
{
"name": "block_2",
"url": "//yun.duiba.com.cn/aurora/assets/24c974c21131b590891c6fb7ec72b9539a864588.png",
"uuid": "585ea53f-fdf3-463f-917e-d6b8cd96c499",
"ext": ".png"
},
{
"name": "block_3",
"url": "//yun.duiba.com.cn/aurora/assets/c2412641cd12f00b033cca5f2dafee7470559b60.png",
"uuid": "74f67ccc-95ec-4580-886d-0b4e187d0774",
"ext": ".png"
},
{
"name": "block_4",
"url": "//yun.duiba.com.cn/aurora/assets/9dbf27eed32fdbfce72eabd0c04aed1e3f42fe22.png",
"uuid": "a169afaa-08fd-4c5a-925b-be382f4ec9dc",
"ext": ".png"
},
{
"name": "flag_record",
"url": "//yun.duiba.com.cn/aurora/assets/53a59eb76dfb45099da4f240b86d15828749f0e8.png",
"uuid": "8c9f66a6-9748-455d-83c6-5ce6a55fbed2",
"ext": ".png"
},
{
"name": "dust_0",
"url": "//yun.duiba.com.cn/aurora/assets/b6719afed81d25b73cb112019d723134ca13df7c.png",
"uuid": "d2a3e515-f4c3-4090-9ec2-10937c5b2cbe",
"ext": ".png"
},
{
"name": "dust_1",
"url": "//yun.duiba.com.cn/aurora/assets/8be3c18b1c1119f6e40b9155aad8b26061cb47b3.png",
"uuid": "fe3b9f95-3df2-4026-9497-67dad642136e",
"ext": ".png"
},
{
"name": "dust_2",
"url": "//yun.duiba.com.cn/aurora/assets/3e98b389b933baa5f50bf2e8d342e000ce575fb7.png",
"uuid": "a07f4696-a682-4729-91e4-02f7141a49c8",
"ext": ".png"
},
{
"name": "dust_3",
"url": "//yun.duiba.com.cn/aurora/assets/0ad9f8a2b2d567d6452903023f7c549fd870d075.png",
"uuid": "3a0254c7-3b74-43a9-9abd-7637fc283dd5",
"ext": ".png"
},
{
"name": "dust_4",
"url": "//yun.duiba.com.cn/aurora/assets/8180658a2ac225d899794c4251b870688dcd1859.png",
"uuid": "0026bd07-8e2a-41d0-8953-1de2f99d7661",
"ext": ".png"
},
{
"name": "dust_5",
"url": "//yun.duiba.com.cn/aurora/assets/db20fa6912a19d65bc958d31f09c0757cf9b806c.png",
"uuid": "761f766b-15b2-4334-a920-1c8de8e25cd0",
"ext": ".png"
},
{
"name": "dust_6",
"url": "//yun.duiba.com.cn/aurora/assets/4ddbc7683055eaa1550ffc753c919fcbd649e08b.png",
"uuid": "36b1721f-659c-4b97-8468-604ea33e27a5",
"ext": ".png"
},
{
"name": "dust_7",
"url": "//yun.duiba.com.cn/aurora/assets/384b4da951496703bf95f007ffcad02203973cc5.png",
"uuid": "5359045c-9e8a-4324-bf15-df793559bfaa",
"ext": ".png"
},
{
"name": "dust_8",
"url": "//yun.duiba.com.cn/aurora/assets/5a0674b72b1932581ce09f993141ecc2ac86e9be.png",
"uuid": "04e0b191-393b-4705-9594-0af37e0e869b",
"ext": ".png"
},
{
"name": "dust_9",
"url": "//yun.duiba.com.cn/aurora/assets/faa629cb99a8c6996919f7c979c111373f0b8920.png",
"uuid": "ca81348a-1a4b-49d9-9e0a-0e19b5d2c887",
"ext": ".png"
},
{
"name": "dust_10",
"url": "//yun.duiba.com.cn/aurora/assets/ea6d57192dc436a50e934548cba53885bcfe5b26.png",
"uuid": "3b57c024-0272-4d4e-a857-16e31ec26c2d",
"ext": ".png"
},
{
"name": "dust_11",
"url": "//yun.duiba.com.cn/aurora/assets/b8bacf81393af61e42fc298e11f27eab4b946881.png",
"uuid": "d751c409-14fb-444e-b352-63244868c43a",
"ext": ".png"
},
{
"name": "menu_block_10",
"url": "//yun.duiba.com.cn/aurora/assets/995c15e67de28088ccc6a5cabf270f8e8ef22415.png",
"uuid": "5b6845de-bd5e-4bfa-b4a4-d2b8f6166ad6",
"ext": ".png"
},
{
"name": "body_normal_body",
"url": "//yun.duiba.com.cn/aurora/assets/2a19cc08e72d78d0287ce30c7dfb4b695371c8ba.png",
"uuid": "20f22f45-d558-4332-a0d5-212ae1a256e5",
"ext": ".png"
},
{
"name": "body_normal_foot",
"url": "//yun.duiba.com.cn/aurora/assets/27716e26f91252735ba1e071f0ced93b9aee4182.png",
"uuid": "34cf1f23-e70c-4c19-9e37-2de4de693fcf",
"ext": ".png"
},
{
"name": "body_normal_lower_left_arm",
"url": "//yun.duiba.com.cn/aurora/assets/4197679b407e24e892f7749488f1b8062d712a35.png",
"uuid": "b62a99b0-bff3-4b44-97bd-fe606502d3e7",
"ext": ".png"
},
{
"name": "body_normal_lower_left_leg",
"url": "//yun.duiba.com.cn/aurora/assets/4abc68dea6205eb070460b31dc289144509cfadd.png",
"uuid": "dceb7805-b91b-44c9-b9d8-eea72565810f",
"ext": ".png"
},
{
"name": "body_normal_lower_right_arm",
"url": "//yun.duiba.com.cn/aurora/assets/4f3a8fb6f567b1d0c425673a6790585fae3372ee.png",
"uuid": "dd3b9db5-14d5-4d8f-831e-d6f854ef97d0",
"ext": ".png"
},
{
"name": "body_normal_lower_right_leg",
"url": "//yun.duiba.com.cn/aurora/assets/0e05af056b9df883e3a281322c16a95e24f2ee51.png",
"uuid": "b6524f1f-8d94-435e-84c9-b9bb7c691119",
"ext": ".png"
},
{
"name": "body_normal_upper_left_arm",
"url": "//yun.duiba.com.cn/aurora/assets/67da6919e38eddf06d8f61ea77a8ca4f264cfe8a.png",
"uuid": "40b913a7-fe43-479d-b796-1bc337ab2f4a",
"ext": ".png"
},
{
"name": "body_normal_upper_left_leg",
"url": "//yun.duiba.com.cn/aurora/assets/2f3b13a48a873161a0d620f761efc830ec3da9e1.png",
"uuid": "e98509e0-704e-4ac3-9770-3bffd7ee0ef4",
"ext": ".png"
},
{
"name": "body_normal_upper_right_arm",
"url": "//yun.duiba.com.cn/aurora/assets/8587e14a8b7d2e57f8b93f8e558d511a5d5e0b54.png",
"uuid": "c58ce0c9-1540-4595-b22a-64f6e48d913a",
"ext": ".png"
},
{
"name": "body_normal_upper_right_leg",
"url": "//yun.duiba.com.cn/aurora/assets/a459a6ea09d0b69b5f85df504df34457b1ec8760.png",
"uuid": "fe81c45d-a4ea-4f11-aa0c-5afa5c1a24dc",
"ext": ".png"
},
{
"name": "head_0",
"url": "//yun.duiba.com.cn/aurora/assets/54f4cabcad3c0d297c1786ea74529cce274bfdce.png",
"uuid": "88bdda7e-9af3-4e98-ae7f-da4d53ab42d2",
"ext": ".png"
},
{
"name": "head_1",
"url": "//yun.duiba.com.cn/aurora/assets/abfe9be652673e7c0bc761b36775e6b3d0c66aff.png",
"uuid": "e7beb90a-13d2-4504-a88b-5aa6c53f5c9b",
"ext": ".png"
},
{
"name": "head_2",
"url": "//yun.duiba.com.cn/aurora/assets/5ea8fe57ab6d1ff0a796431550b49bce3ddd41d2.png",
"uuid": "4975457c-12c2-49c2-893d-fdf40c1fef94",
"ext": ".png"
},
{
"name": "head_3",
"url": "//yun.duiba.com.cn/aurora/assets/0f0850f184c6ca6f7e7add61d43b8adf16dd43f4.png",
"uuid": "47db2073-4f14-43ee-afca-1e98188cd169",
"ext": ".png"
},
{
"name": "head_4",
"url": "//yun.duiba.com.cn/aurora/assets/426a5773e6781c3f287bb0a01561014848055602.png",
"uuid": "7d7dea57-26ee-488e-b928-78c0e4f21baf",
"ext": ".png"
},
{
"name": "head_bird",
"url": "//yun.duiba.com.cn/aurora/assets/022f41d77464df1edeca7fcc4c235ec8c8081743.png",
"uuid": "4d8b2438-0d62-47fd-9971-7766e63a9283",
"ext": ".png"
},
{
"name": "head_heart",
"url": "//yun.duiba.com.cn/aurora/assets/29f401553ae6a1cac70e3eb9f2ced4af4563e6d9.png",
"uuid": "b7918a78-18ee-4a98-8fd2-c5ea1d74f80b",
"ext": ".png"
},
{
"name": "head_smoke",
"url": "//yun.duiba.com.cn/aurora/assets/562d44364589ea6cd6354d15a7ad5e19bf9229e2.png",
"uuid": "8921ea9f-f618-45d2-b2ce-99540a9455f4",
"ext": ".png"
},
{
"name": "dialog_0",
"url": "//yun.duiba.com.cn/aurora/assets/f742f6a3ecd6664059e37aa6ae901b059a6da2b0.png",
"uuid": "5f6ef454-634e-4663-8591-de8a383f629e",
"ext": ".png"
},
{
"name": "dialog_1",
"url": "//yun.duiba.com.cn/aurora/assets/ca5d41083614b91f0a3b0d140ec247f4c7121f1d.png",
"uuid": "c64a2e5a-197c-486a-8d7a-245cf3f3d0c9",
"ext": ".png"
},
{
"name": "body_gray_body",
"url": "//yun.duiba.com.cn/aurora/assets/1a68b3195fd3568d9b31e3ff87a3721c321a0d74.png",
"uuid": "1ad192ec-0412-4120-af19-015134a5dbf1",
"ext": ".png"
},
{
"name": "body_gray_foot",
"url": "//yun.duiba.com.cn/aurora/assets/c4c3584c49d77878fd76b357d9b11aac9a1377e8.png",
"uuid": "2af600c6-4bfb-4870-89b5-27d1cb25088d",
"ext": ".png"
},
{
"name": "body_gray_lower_left_arm",
"url": "//yun.duiba.com.cn/aurora/assets/f188548ec71fc93b62c39d53d374c518b97c4f33.png",
"uuid": "c591459e-781f-4114-b020-66678eb572fe",
"ext": ".png"
},
{
"name": "body_gray_lower_left_leg",
"url": "//yun.duiba.com.cn/aurora/assets/fb085cf0df30bbaa4f615a438a1099fcf8c9e301.png",
"uuid": "1c2153bb-3639-4d89-8cf3-0a88656bf23a",
"ext": ".png"
},
{
"name": "body_gray_lower_right_arm",
"url": "//yun.duiba.com.cn/aurora/assets/4af5042462d46a168704614cd3a4f3b171fc15a3.png",
"uuid": "7c838ff5-d21f-4f10-9967-1d361c6755e0",
"ext": ".png"
},
{
"name": "body_gray_lower_right_leg",
"url": "//yun.duiba.com.cn/aurora/assets/da576541165b14d775f115db3c280737ee9ecf0a.png",
"uuid": "71bf4fb3-6ca0-4738-85f0-4662ea99aa05",
"ext": ".png"
},
{
"name": "body_gray_upper_left_arm",
"url": "//yun.duiba.com.cn/aurora/assets/6680f484a38c27f88978c08c868f400ba9649402.png",
"uuid": "109aedfe-5b12-43ec-b6c8-272f0ad68454",
"ext": ".png"
},
{
"name": "body_gray_upper_left_leg",
"url": "//yun.duiba.com.cn/aurora/assets/29037e47c3d44e656dcb89cca718e91f9689324d.png",
"uuid": "6f8ac4a2-323e-4c8f-98b0-a85ea1c6f3e1",
"ext": ".png"
},
{
"name": "body_gray_upper_right_arm",
"url": "//yun.duiba.com.cn/aurora/assets/ac396f21c9a494e5ed6a5c57417674bd5504ef71.png",
"uuid": "842bd78c-93bb-4500-9445-a55bfe00ae30",
"ext": ".png"
},
{
"name": "body_gray_upper_right_leg",
"url": "//yun.duiba.com.cn/aurora/assets/44ec8f17ec1470d13e78c132e6c5f790d59c93ae.png",
"uuid": "3cc57fd8-bf90-42e9-9149-3b7f5e6bceda",
"ext": ".png"
}
],
"events": {
"in": {
"walking-cat-start": {
"alias": "开始"
},
"walking-cat-revive": {
"alias": "复活"
}
},
"out": {
"walking-cat-game-end": {
"alias": "游戏结束",
"data": {
}
},
"walking-cat-game-changScore": {
"alias": "游戏分数改变",
"data": {
}
}
}
}
}
\ No newline at end of file
import {getTextureByName} from "./utils";
import {LoopComponent} from "./LoopComponent";
import {getStage} from "./utils";
import {props} from "../props";
export class Background extends engine.Container {
//static stageWidth = engine.gameStage.stage.width;
partRes = ['bg_far', 'bg_mid', 'bg_near'];
speeds = [0.05, 0.5, 1];
setup() {
let bottomBg = new engine.Rect();
bottomBg.x = 0;
bottomBg.y = 0;
bottomBg.width = getStage().width;
bottomBg.height = 0;
bottomBg.fillColor = 0x75c9f5;
this.addChild(bottomBg);
const parts = [];
for(let i = 0; i < 3; i++){
let part = new LoopComponent();
part.setupLoop([
this.partRes[i],
this.partRes[i],
]);
parts.push(part);
this.addChild(part);
}
const {height} = getStage();
parts[0].y = (height - parts[0].height) / 2 - 400;
parts[1].y = (height - parts[1].height) / 2 - 120;
parts[2].y = (height - parts[2].height) / 2 + 300;
bottomBg.y = parts[2].y;
bottomBg.height = height - parts[2].y;
const moon = new engine.Sprite(getTextureByName('moon'));
moon.x = 100;
moon.y = 100;
this.addChild(moon);
}
setViewport(pos) {
for (let i = 0; i < 3; i++) {
const part = <LoopComponent>this.getChildAt(i + 1);
const speed = this.speeds[i];
part.setViewport(pos * speed)
}
}
reset(revive = false){
}
}
/**
* 障碍物
*/
import {getStage, getTextureByName} from "./utils";
export class Block extends engine.Container {
static configs = [
{ratio: 0.6, width: 15, off: 32, effect: '', effect_offset: {x: 0, y: 0}},
{ratio: 0.1, width: 10, off: 18, effect: '', effect_offset: {x: 0, y: 0}},
{ratio: 0.15, width: 30, off: 32, effect: '', effect_offset: {x: 0, y: 0}},
{ratio: 0.1, width: 86, off: 28, effect: '', effect_offset: {x: 0, y: 0}},
{ratio: 0.5, width: 70, off: 20, effect: '', effect_offset: {x: 0, y: -20}},
{ratio: 0, width: 0, off: 0, effect: '', effect_offset: {x: 0, y: 0}},
{ratio: 0, width: 0, off: 0, effect: '', effect_offset: {x: 0, y: 0}},
{ratio: 0, width: 0, off: 0, effect: '', effect_offset: {x: 0, y: 0}},
{ratio: 0, width: 0, off: 0, effect: '', effect_offset: {x: 0, y: 0}},
{ratio: 0, width: 0, off: 0, effect: '', effect_offset: {x: 0, y: 0}},
{ratio: 0, width: 123, off: 23, effect: '', effect_offset: {x: 0, y: 0}},
];
type;
bmp;
//effectMC: engine.MovieClip;
effectResolve;
constructor() {
super();
this.bmp = new engine.Sprite();
this.addChild(this.bmp = new engine.Sprite());
}
//
reset({type,}) {
this.type = type;
let bmp = this.bmp;
bmp.alpha = 1;
bmp.texture = this.getBlock();
const {width, off} = Block.configs[type];
bmp.x = -(off + width / 2);
bmp.y = -(bmp.height / 2);
}
getBlock(){
return getTextureByName('block_' + this.type);
}
playEffect() {
//const {effect, effect_offset} = Block.configs[this.type];
// if (effect) {
// if (!this.effectMC) {
// const mc = this.effectMC = Effects.instance.makeMovieClip(effect);
// const {x, y} = effect_offset;
// mc.x = x;
// mc.y = y;
// this.addChild(mc);
// mc.addEventListener(egret.Event.COMPLETE, this.onEffectComplete, this);
// }
// this.effectMC.gotoAndPlay(0, 1);
// return new Promise(resolve => {
// this.effectResolve = resolve;
// })
// } else {
// return Promise.resolve();
// }
}
playFadeOut() {
return this.getTweenPromise(
engine.Tween.get(this.bmp)
.to({alpha: 0}, 100)
.to({alpha: 1}, 100)
.to({alpha: 0}, 100)
)
}
private onEffectComplete(event) {
this.effectResolve && this.effectResolve();
this.effectResolve = null;
}
getTweenPromise(tween: engine.Tween): Promise<any> {
return new Promise((resolve) => {
tween.call(resolve);
});
}
}
import { PlayGame } from './PlayGame';
import { Background } from "./Background";
import {Road} from './Road'
import {Player} from "./player/Player";
import {getStage,getfactor} from "./utils";
import {Block} from "./Block";
import ObjectPool = engine.ObjectPool;
export const PoolName: string = 'block';
ObjectPool.registerPool(PoolName, function () {
return new Block();
}, function (item: Block, data) {
item.reset(data);
});
export default class GameView extends engine.Container {
private static _instance: GameView;
public static get instance(): GameView {
if (this._instance == undefined) {
this._instance = new GameView();
}
return this._instance;
}
offset = {x: -100, y: 320};
background: Background;
road: Road;
playGame:PlayGame;
world: p2.World;
player: Player;
revivePos;
playing;
lock;
worldFPS = 60;
private _block:Block;
_touchEnabled;
_viewport: any = {
x: 0,
y: 0,
};
constructor() {
super();
}
hasPreSetup;
eventStart() {
if(this.hasPreSetup){
return;
}
this.hasPreSetup = true;
let background = this.background = new Background();
background.setup();
this.addChild(background);
let road = this.road = new Road();
road.y = getStage().height / 2 + 310;
this.addChild(road);
this.road.preSetup();
this.setupWorld();
this.player.fade(0, false);
this.viewport = 0;
this.startWorld();
this.reset();
this.setup();
const playHint = new engine.Label();
playHint.fillColor = 'block';
playHint.size = 30;
playHint.text = '注意不要踩到线和陷阱哦,后果很严重哦~';
playHint.x = (getStage().width-playHint.width)/2;
playHint.y = getStage().height / 2 + 500;
this.addChild(playHint);
this.playGame = new PlayGame();
setTimeout(() => {
this.playGame.GameView = this;
this.addChild(this.playGame);
this.start();
}, 500);
}
hasSetup;
setup() {
if(this.hasSetup){
return;
}
this.hasSetup = true;
this.road.setup();
}
setupWorld() {
let OTHER = Math.pow(2, 1),
BODYPARTS = Math.pow(2, 2),
GROUND = Math.pow(2, 3);
const world = this.world = new p2.World({
//gravity: [0, 0],
});
world.sleepMode = p2.World.BODY_SLEEPING;
let planeShape = new p2.Plane();
let ground = new p2.Body({
position: [0, 0],
});
ground.addShape(planeShape);
planeShape.collisionGroup = GROUND;
planeShape.collisionMask = BODYPARTS | OTHER;
world.addBody(ground);
let player = this.player = new Player();
player.setup({
collisionGroup: BODYPARTS,
collisionMask: GROUND | OTHER,
world,
ground,
});
player.addEventListener('move', this.onMove, this);
player.addEventListener('foot_down', this.onFootDown, this);
}
onTicker(dt: number): boolean {
const world = this.world;
this.world.step(this.worldFPS / 1000);
let l = world.bodies.length;
for (let i: number = 0; i < l; i++) {
let body: p2.Body = world.bodies[i];
let display: any = body.displays ? body.displays[0] : null;
if (display) {
if (!this.contains(display)) {
this.addChild(display);
}
display.localUpdate(
body.position[0] * getfactor() + getStage().width / 2 + this.offset.x - this.viewport,
getStage().height / 2 - body.position[1] * getfactor() + this.offset.y,
360 - (body.angle + body.shapes[0].angle) * 180 / Math.PI,
body.sleepState == p2.Body.SLEEPING
)
}
}
return false;
}
reset(revive = false) {
this.background.reset(revive);
this.road.reset(revive);
this.player.reset(revive);
this.player.fade(0);
// if(!revive){
// this.score = 0;
// }
this.viewport = revive ? this.revivePos : 0;
}
start(revive = false){
this.road.start(revive);
this.player.fade(1);
this.playGame.start(revive);
}
startWorld() {
if(this.playing){
return;
}
this.playing = true;
//engine.startTick(this.onTicker, this);
engine.gameStage.addEventListener(engine.Event.ENTER_FRAME,this.onTicker,this)
}
stopWorld() {
if(!this.playing){
return;
}
this.playing = false;
//egret.stopTick(this.onTicker, this);
engine.gameStage.removeEventListener(engine.Event.ENTER_FRAME,this.onTicker,this)
}
get viewport() {
return this._viewport.x;
}
set viewport(v) {
this._viewport.x = v;
this.updateViewport();
}
updateViewport() {
const {x, y} = this._viewport;
const pos = Math.max(0, x);
this.background.setViewport(pos);
this.road.setViewport(pos);
}
private onMove(event) {
const {pos, bodyPos} = event.data;
this.viewport = pos;
if(this.road.hitReward(bodyPos)){
this.dispatchEvent('scoreChange', {
rewardScore: 100,
passType: 10,
}, true);
}
}
down() {
if(this.lock){
return;
}
this.player.down();
}
up() {
if(this.lock){
return;
}
this.player.up();
}
private onFootDown(event){
const {mileage, pos} = event.data;
this.revivePos = pos;
const {target, lastTarget} = this.road.hitBlock(pos);
this.road.playDust(pos);
if(target){
this.lock = true;
this.stopWorld();
this.dispatchEvent(engine.Event.COMPLETE,null,true);
target.playFadeOut();
target.playEffect();
if(target.type == 4){ //explosion
this.player.setSkin('gray');
}
this.road.removeBlock(target);
this.player.switchFace(target.type);
if(target.type == 0){
this.player.fall();
}
this.lock = false;
this.startWorld();
}else{
const score = Math.floor(mileage / 50 * 5);
this.dispatchEvent('scoreChange', {
score,
passType: lastTarget ? lastTarget.type : -1,
}, true);
}
}
}
import { props } from './../props';
/**
* Created by rockyl on 2020-01-09.
*/
import GameView from "./GameView";
import {injectProps} from "../props";
import { PlayGame } from './PlayGame';
export class GameWrapper extends engine.Container {
private _gameView: GameView;
constructor() {
super();
engine.globalEvent.addEventListener('walking-cat-start', this.start, this);
engine.globalEvent.addEventListener('walking-cat-revive', this.revive, this);
engine.globalEvent.addEventListener('walking-cat-showScore', this.revive, this);
let gameView = this._gameView = new GameView();
this.addChild(gameView);
//this.once(engine.Event.ADDED_TO_STAGE, this.start, this);
}
start(event: engine.Event) {
injectProps(event.data);
this._gameView.eventStart();
}
revive() {
console.log('复活');
this._gameView.reset(true);
this._gameView.start(true);
}
}
import {getTextureByName} from "./utils";
export class LoopComponent extends engine.Container{
parts: any[];
onceInfo: any = {width: 0, height: 0, count: 0};
loopInfo: any = {width: 0, height: 0, count: 0};
constructor() {
super();
this.parts = [];
}
private setup(parts, info) {
parts.forEach((item, index) => {
let part;
if(typeof item == 'string'){
part = new engine.Sprite(getTextureByName(item));
}else if(item instanceof engine.Texture){
part = new engine.Sprite(item);
}else {
part = item;
}
this.addChild(part);
this.parts.push(part);
if (index == 0) {
info.width = part.width;
info.height = part.height;
}
});
info.count = parts.length;
this.setViewport(0, 0)
}
setupOnce(resArr) {
this.setup(resArr, this.onceInfo);
}
setupLoop(resArr) {
this.setup(resArr, this.loopInfo);
}
setViewport(x, y = 0) {
const sizeField = y == 0 ? 'width' : 'height';
const posField = y == 0 ? 'x' : 'y';
const pos = y == 0 ? x : y;
let index;
const onceSize = this.onceInfo[sizeField];
const onceCount = this.onceInfo.count;
const loopCount = this.loopInfo.count;
const loopSize = this.loopInfo[sizeField];
index = onceSize == 0 ? -1 : Math.floor(pos / onceSize);
if (index < 0 || index >= onceCount) {
const loopIndex = Math.floor((pos - onceCount * onceSize) / this.loopInfo[sizeField]);
index = onceCount + loopIndex;
}
let formerIndex = index < onceCount ? index : (index) % loopCount + onceCount;
let latterIndex = index < onceCount ? index + 1 : (index - onceCount + 1) % loopCount + onceCount;
let former = this.parts[formerIndex];
let latter = this.parts[latterIndex];
if(!former || !latter){
console.log(formerIndex, latterIndex);
}
former[posField] = -(pos - loopSize * (index < onceCount ? index : index - onceCount) - (index < onceCount ? 0 : onceCount * onceSize));
latter[posField] = former.x + (index < onceCount ? onceSize : loopSize);
}
}
\ No newline at end of file
import GameView from "./GameView";
import { getStage ,getTextureByName} from "./utils";
import { props } from "../props";
import { ScoreLabel } from "./ScoreLabel";
export class PlayGame extends engine.Container{
touchLayer: engine.Rect;
public GameView:GameView;
private addlabelScore: engine.Label = null;
public labScore: ScoreLabel;
private dialog:engine.Image;
normalScore;
rewardScore;
lastDialogTs;
private static _instance: PlayGame;
public static get instance(): PlayGame {
if (this._instance == undefined) {
this._instance = new PlayGame();
}
return this._instance;
}
public start(revive = false) {
if(!revive){
this.normalScore = 0;
this.rewardScore = 0;
this.lastDialogTs = 0;
this.initTouch();
this.initLabScore();
this.initAddlabel();
this.initDialog();
}
this.registerEvent();
}
registerEvent(){
this.touchLayer.addEventListener(engine.MouseEvent.MOUSE_DOWN,this.onMouseDown,this);
this.touchLayer.addEventListener(engine.MouseEvent.MOUSE_UP,this.onMouseUp,this);
this.GameView.addEventListener(engine.Event.COMPLETE, this.onGameComplete, this);
this.GameView.addEventListener('scoreChange', this.onScoreChange, this);
}
initTouch(){
this.touchLayer = new engine.Rect();
this.addChild(this.touchLayer);
this.touchLayer.width = getStage().width;
this.touchLayer.height = getStage().height;
this.touchLayer.x = 0;
this.touchLayer.y = 0;
this.touchLayer.alpha = 0;
}
removeListener(){
this.touchLayer.removeEventListener(engine.MouseEvent.MOUSE_DOWN,this.onMouseDown,this);
this.touchLayer.removeEventListener(engine.MouseEvent.MOUSE_UP,this.onMouseUp,this);
this.GameView.removeEventListener(engine.Event.COMPLETE, this.onGameComplete, this);
this.GameView.removeEventListener('scoreChange', this.onScoreChange, this);
}
initLabScore(){
this.labScore = new ScoreLabel();
this.labScore.visible = props.showScore;
this.labScore.updateScore(0, this.formatScore, false);
this.labScore.fillColor = 'yellow';
this.labScore.size = 46;
this.labScore.x = 610;
engine.Tween.get(this.labScore,{loop:false})
.set({y:-100})
.wait(300)
.to({y:40},200,engine.Ease.backOut)
this.addChild(this.labScore);
}
initAddlabel(){
this.addlabelScore = new engine.Label();
this.addlabelScore.fillColor = 'yellow';
this.addlabelScore.size = 40;
this.addlabelScore.text = '';
this.addlabelScore.x = 378;
this.addlabelScore.y = 582;
this.addlabelScore.visible = false;
this.addChild(this.addlabelScore);
}
initDialog(){
this.dialog = new engine.Image();
this.dialog.x = 390;
this.dialog.y = 323;
this.addChild(this.dialog);
}
onMouseDown(){
this.GameView.down();
}
onMouseUp(){
this.GameView.up();
}
onGameComplete(){
console.log('死亡');
this.removeListener();
let score = this.getScore();
engine.globalEvent.dispatchEvent('walking-cat-game-end',{score:score});
}
getScore(round = false) {
let score = (this.normalScore + this.rewardScore) / 10;
score *= (props.scoreTimes || 1);
if (round) {
return Math.round(score);
}
return score;
}
onScoreChange(event){
const {score, passType, rewardScore} = event.data;
let scoreAdd;
if (rewardScore) {
this.rewardScore += rewardScore;
scoreAdd = rewardScore;
} else {
scoreAdd = score - this.normalScore;
this.normalScore = score;
}
let curScore = this.getScore();
this.labScore.updateScore(curScore, this.formatScore);
if (passType > 0 && passType <= 4) {
const now = Date.now();
if (now - this.lastDialogTs > 15000) {
this.play(1);
this.lastDialogTs = now;
}
} else if (passType == 10) {
this.play(0);
this.lastDialogTs = Date.now();
}
if (scoreAdd > 0) {
const labScoreAdd = this.addlabelScore;
labScoreAdd.visible = props.showScore;
labScoreAdd.alpha = 0;
labScoreAdd.verticalCenter = 0;
labScoreAdd.text = '+' + (scoreAdd / 10 * (props.scoreTimes || 1));
engine.Tween.get(labScoreAdd, null, null, true)
.to({verticalCenter: -50, alpha: 1,}, 200, engine.Ease.cubicIn)
.wait(300)
.to({verticalCenter: -100, alpha: 0,}, 100, engine.Ease.cubicOut)
.call(function () {
labScoreAdd.visible = false;
}, this);
}
engine.globalEvent.dispatchEvent('walking-cat-game-changScore',{score:curScore});
}
formatScore = (s) => {
let t = (Math.ceil(s * 10) / 10).toString();
t += t.indexOf('.') < 0 ? '.0' : '';
return t;
};
play(id){
const img = this.dialog;
img.texture = getTextureByName('dialog_'+id);
img.scaleX = img.scaleY = 0;
img.alpha = 1;
img.visible = true;
engine.Tween.get(img, null, null, true)
.to({
scaleX: 1, scaleY: 1
}, 500, engine.Ease.backOut)
.wait(500)
.to({
alpha: 0,
}, 300)
.call(()=>{
img.visible = false;
});
}
private revive() {
this.GameView.reset(true);
this.GameView.start(true);
}
}
\ No newline at end of file
import { localWave } from './../localWave';
import ObjectPool = engine.ObjectPool;
import {getStage} from "./utils";
import {getTextureByName} from "./utils";
import {props} from "../props";
import { Block } from "./Block";
export class Road extends engine.Container{
container: engine.Container;
dustEffect:[];
dustNode:engine.Container;
dustSprite:engine.Sprite;
dustIndex:number = 0;
flag: engine.Sprite;
reward;
index = 0;
minDistance = parseInt(props.blockMinDistance) || 100;
maxDistance = parseInt(props.blockMaxDistance) || 300;
basePos = getStage().width / 2 - 100;
padding = 500;
lastPos;
rewardIndex;
aniReward:any;
tweenReward;
lastBlockType;
preSetup() {
this.addChild(this.container = new engine.Container());
const flag = this.flag = new engine.Sprite(getTextureByName('flag_record'));
this.anchorRate(flag, 0.5, 1);
flag.y = -230;
flag.x = this.transScoreToFlagPos();
flag.visible = flag.x > 0;
this.addChild(flag);
}
setup(){
this.dustNode = new engine.Container();
this.dustSprite = new engine.Sprite();
this.dustSprite.visible = false;
this.dustNode.y = -1000;
this.dustNode.x = -450;
this.dustNode.addChild(this.dustSprite);
this.addChild(this.dustNode)
const reward = this.reward = new engine.Sprite();
reward.visible = false;
reward.y = -500;
this.addChild(reward);
this.aniReward = new localWave();
this.aniReward.init(reward, 2000, localWave.sin.bind(null, 10));
}
start(revive = false) {
if(revive){
}else{
this.rewardIndex = 0;
this.showReward();
}
}
reset(revive = false) {
if (!revive)
{
this.index = 0;
this.lastPos = 0;
this.clear();
this.fill();
this.flag.x = this.transScoreToFlagPos();
this.flag.visible = this.flag.x > 0;
}
}
anchorRate(target: any, rx: number, ry: number, width: number = 0, height: number = 0, resetPos = true): void {
if (width == 0) {
width = target.width;
}
if (height == 0) {
height = target.height;
}
if (resetPos) {
if (rx == 0) {
target.x -= target.anchorOffsetX;
}
if (ry == 0) {
target.y -= target.anchorOffsetY;
}
}
target.anchorOffsetX = width * rx;
target.anchorOffsetY = height * ry;
if (resetPos) {
if (rx > 0) {
target.x += target.anchorOffsetX;
}
if (ry > 0) {
target.y += target.anchorOffsetY;
}
}
}
transScoreToFlagPos(){
//const maxScore = props.maxScore;
//maxScore * 100
return -1;
}
clear() {
while (this.container.children.length > 0) {
this.removeBlockAt(0);
}
}
//添加障碍
addBlock() {
let type = 0, v;
if (this.index > 10) {
do {
const rv = Math.random();
v = 0;
for (let i = 0; i < 5; i++) {
v += Block.configs[i].ratio;
if (rv < v) {
type = i;
break;
}
}
} while (this.lastBlockType == type);
this.lastBlockType = type;
}
const block: Block = ObjectPool.getObject('block', {type});
const {width} = Block.configs[type];
const distance = this.index == 0 ?
this.maxDistance :
this.makeRandomFloat(this.maxDistance, this.minDistance);
const pos = this.lastPos + distance;
block.x = pos;
this.container.addChild(block);
this.lastPos = pos + width;
this.index++;
}
removeBlockAt(index){
const block = this.container.removeChildAt(index);
ObjectPool.recycleObject('block', block);
}
removeBlock(block) {
this.container.removeChild(block);
ObjectPool.recycleObject('block', block);
}
fill() {
if (isNaN(this.lastPos)) {
return;
}
while (true) {
if (this.lastPos + this.x > getStage().width + this.padding) {
break;
}
this.addBlock();
}
}
makeRandomFloat(max: number, min: number = 0): number {
return Math.random() * (max - min) + min;
}
setViewport(pos) {
this.x = this.basePos - pos;
while (this.container.children.length > 0) {
if (this.container.getChildAt(0).x >= pos - this.padding) {
break;
}
this.removeBlockAt(0);
}
this.fill();
}
showReward(type = 10) {
this.rewardIndex++;
const pos = this.rewardIndex * getStage().width * 3;
const reward = this.reward;
reward.visible = true;
reward.alpha = 1;
reward.texture = getTextureByName('menu_block_10');
reward.x = pos;
this.aniReward.updateRegisterPos();
}
hideReward() {
const reward = this.reward;
this.tweenReward = engine.Tween.get(reward)
.to({alpha: 0}, 200)
.call(() => {
this.tweenReward = null;
this.showReward();
})
}
hitReward(pos) {
if (this.reward.visible && pos >= this.reward.x && !this.tweenReward) {
this.hideReward();
return true;
}
}
playDust(pos) {
this.dustSprite.x = pos;
//播放序列帧
this.dustSprite.visible = true;
this.addEventListener(engine.Event.ENTER_FRAME,this.onEnterFrame,this);
}
onEnterFrame(){
if(this.dustIndex < 12){
this.dustSprite.texture = getTextureByName('dust_'+this.dustIndex);
this.dustIndex ++;
}else{
this.dustIndex = 0;
this.dustSprite.visible = false;
this.removeEventListener(engine.Event.ENTER_FRAME,this.onEnterFrame,this);
}
}
hitBlock(pos) {
let target, lastTarget;
//console.log('*******************');
let foot = {a: pos - 84 / 2, b: pos + 84 / 2};
//console.log(foot);
this.container.children.some((block: Block, i) => {
const {width} = Block.configs[block.type];
const line = {a: block.x - width / 2, b: block.x + width / 2};
//console.log(i, line);
if (this.lineHitTest(foot, line)) {
target = block;
return true;
}
});
//console.log(target ? 'hit on' : 'safe');
if (!target) {
for (let i = this.container.children.length; i > 0; i--) {
const block = this.container.getChildAt(i - 1);
if (block.x < pos) {
lastTarget = block;
break;
}
}
}
return {
target,
lastTarget,
};
}
lineHitTest(l0, l1) {
return l0.a < l1.b && l0.b > l1.a;
}
}
\ No newline at end of file
/**
* Created by rockyl on 2018/9/10.
*
* 分数标签
*/
export class ScoreLabel extends engine.Label {
formatFun: Function;
_value;
_temp;
updateScore(score, formatFun = null, animation = true) {
this.formatFun = formatFun;
this._value = score;
if (animation) {
engine.Tween.get(this, null, null, true)
.to({temp: score}, 300);
} else {
this.updateLocal(score);
}
}
get score() {
return this._value;
}
private get temp() {
return this._temp;
}
private set temp(v) {
this._temp = v;
this.updateLocal(v);
}
updateLocal(v) {
this.text = this.formatFun && this.formatFun(v) || v;
}
}
/**
* Created by rockyl on 2020-02-03.
*/
import {Block} from "./Block";
import ObjectPool = engine.ObjectPool;
export const PoolName: string = 'block';
ObjectPool.registerPool(PoolName, function () {
return new Block();
}, function (item: Block, data) {
item.reset(data);
});
/**
* 头部
*/
import {getTextureByName} from "../utils";
const factor = 10;
export class Head extends engine.Container implements IPlayerPart{
imgFace:engine.Sprite;
constructor(){
super();
this.imgFace = new engine.Sprite(getTextureByName('head_0'));
this.addChild(this.imgFace);
this.imgFace.anchorTexture.set(107/this.imgFace.width,155/this.imgFace.height);
this.imgFace.y = 65;
}
localUpdate(x, y, rotation, sleeping){
this.x = x;
this.y = y;
this.rotation = rotation;
//this.alpha = sleeping ? 0.8 : 1;
}
get fWidth(){
return this.width / factor;
}
get fHeight(){
return this.height / factor;
}
switchFace(type, playAni){
let headName = ''
if(type == 'normal'){
headName = 'head_0';
}else if(type == 'happy'){
headName = 'head_1'
}else if(type == 1 || type == 0 || type == 2){
headName = 'head_2';
}else if(type == 3){
headName = 'head_3';
}else if(type == 4){
headName = 'head_4';
}
this.imgFace.texture = getTextureByName(headName);
// this.currentState = 'face_' + type;
// const ani: egret.tween.TweenGroup = this['ani_face_' + type];
// if(playAni && ani){
// ani.play(0);
// }
}
}
interface IPlayerPart {
localUpdate(x, y, rotation, sleeping);
}
import { Head } from "./Head";
import { PlayerPart } from "./PlayerPart";
import {getfactor} from "../utils"
enum PlayerStat {
RELEASE,
RISING,
FALL,
}
const debug = false;
export class Player extends engine.EventDispatcher{
partMass = 0.1;
footMass = 0.1;
shouldersDistance = 50 / getfactor();
speed = 30;
skin = '';
world: p2.World;
originPos: any = {};
leftFoot: p2.Body;
lowerLeftLeg: p2.Body;
upperLeftLeg: p2.Body;
rightFoot: p2.Body;
lowerRightLeg: p2.Body;
upperRightLeg: p2.Body;
body: p2.Body;
head: p2.Body;
upperLeftArm: p2.Body;
lowerLeftArm: p2.Body;
upperRightArm: p2.Body;
lowerRightArm: p2.Body;
leftFootGroundCons: p2.RevoluteConstraint;
rightFootGroundCons: p2.RevoluteConstraint;
foots: p2.Body[];
lowerLegs: p2.Body[];
upperLegs: p2.Body[];
footGroundCons: p2.RevoluteConstraint[];
state: PlayerStat;
step;
safePos = 0;
setup(options) {
const {collisionGroup, collisionMask, world, ground} = options;
this.world = world;
world.on('postStep', this.onPostStep);
const bodyPartShapes = [];
const leftFootDisplay = this.createDisplay('foot');
const lowerLeftLegDisplay = this.createDisplay('lower_left_leg');
const upperLeftLegDisplay = this.createDisplay('upper_left_leg');
const rightFootDisplay = this.createDisplay('foot');
const lowerRightLegDisplay = this.createDisplay('lower_right_leg');
const upperRightLegDisplay = this.createDisplay('upper_right_leg');
const bodyDisplay = this.createDisplay('body', {x:50, y: 0});
const headDisplay = new Head();
const upperLeftArmDisplay = this.createDisplay('upper_left_arm');
const lowerLeftArmDisplay = this.createDisplay('lower_left_arm', {x: -20, y: 0});
const upperRightArmDisplay = this.createDisplay('upper_right_arm');
const lowerRightArmDisplay = this.createDisplay('lower_right_arm', {x: -39, y: 0});
//left leg
const leftFootShape = new p2.Box(leftFootDisplay.fSize);
bodyPartShapes.push(leftFootShape);
this.originPos['leftFoot'] = [
-this.shouldersDistance / 2,
leftFootDisplay.fHeight / 2
];
const leftFoot = this.leftFoot = new p2.Body({
allowSleep: false,
mass: this.footMass,
position: this.originPos['leftFoot'],
});
if (!debug) leftFoot.displays = [leftFootDisplay];
leftFoot.addShape(leftFootShape);
const lowerLeftLegShape = new p2.Box(lowerLeftLegDisplay.fSize);
bodyPartShapes.push(lowerLeftLegShape);
this.originPos['lowerLeftLeg'] = [
-this.shouldersDistance / 2,
leftFoot.position[1] + lowerLeftLegDisplay.fHeight / 2 + 5 / getfactor()
];
const lowerLeftLeg = this.lowerLeftLeg = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['lowerLeftLeg'],
});
if (!debug) lowerLeftLeg.displays = [lowerLeftLegDisplay];
lowerLeftLeg.addShape(lowerLeftLegShape);
const leftAnkleJoint = new p2.RevoluteConstraint(lowerLeftLeg, leftFoot, {
localPivotA: [0, -lowerLeftLegDisplay.fHeight / 2 + 5 / getfactor()],
localPivotB: [-leftFootDisplay.fWidth / 2 + 18 / getfactor(), 0],
});
leftAnkleJoint.setLimits(-Math.PI / 3, Math.PI / 3);
const leftFootGroundCons = this.leftFootGroundCons = new p2.RevoluteConstraint(leftFoot, ground, {
localPivotA: [0, -leftFootDisplay.fHeight / 2],
localPivotB: [leftFoot.position[0], 0],
});
leftFootGroundCons.setLimits(0, 0);
const upperLeftLegShape = new p2.Box(upperLeftLegDisplay.fSize);
bodyPartShapes.push(upperLeftLegShape);
this.originPos['upperLeftLeg'] = [
-this.shouldersDistance / 2,
lowerLeftLeg.position[1] + lowerLeftLegDisplay.fHeight / 2 + upperLeftLegDisplay.fHeight / 2 - 40 / getfactor()
];
const upperLeftLeg = this.upperLeftLeg = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['upperLeftLeg'],
});
if (!debug) upperLeftLeg.displays = [upperLeftLegDisplay];
upperLeftLeg.addShape(upperLeftLegShape);
const leftKneeJoint = new p2.RevoluteConstraint(upperLeftLeg, lowerLeftLeg, {
localPivotA: [0, -upperLeftLegDisplay.fHeight / 2 + 20 / getfactor()],
localPivotB: [0, lowerLeftLegDisplay.fHeight / 2 - 20 / getfactor()],
});
leftKneeJoint.setLimits(-Math.PI, 0);
//right leg
const rightFootShape = new p2.Box(rightFootDisplay.fSize);
bodyPartShapes.push(rightFootShape);
this.originPos['rightFoot'] = [
this.shouldersDistance / 2,
rightFootDisplay.fHeight / 2
];
const rightFoot = this.rightFoot = new p2.Body({
allowSleep: false,
mass: this.footMass,
position: this.originPos['rightFoot'],
});
if (!debug) rightFoot.displays = [rightFootDisplay];
rightFoot.addShape(rightFootShape);
const lowerRightLegShape = new p2.Box(lowerRightLegDisplay.fSize);
bodyPartShapes.push(lowerRightLegShape);
this.originPos['lowerRightLeg'] = [
this.shouldersDistance / 2,
rightFoot.position[1] + lowerRightLegDisplay.fHeight / 2 + 5 / getfactor()
];
const lowerRightLeg = this.lowerRightLeg = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['lowerRightLeg'],
});
if (!debug) lowerRightLeg.displays = [lowerRightLegDisplay];
lowerRightLeg.addShape(lowerRightLegShape);
const rightAnkleJoint = new p2.RevoluteConstraint(lowerRightLeg, rightFoot, {
localPivotA: [0, -lowerRightLegDisplay.fHeight / 2 + 5 / getfactor()],
localPivotB: [-rightFootDisplay.fWidth / 2 + 18 / getfactor(), 0],
});
rightAnkleJoint.setLimits(-Math.PI / 3, Math.PI / 3);
const rightFootGroundCons = this.rightFootGroundCons = new p2.RevoluteConstraint(rightFoot, ground, {
localPivotA: [0, -rightFootDisplay.fHeight / 2],
localPivotB: [rightFoot.position[0], 0],
});
rightFootGroundCons.setLimits(0, 0);
const upperRightLegShape = new p2.Box(upperRightLegDisplay.fSize);
bodyPartShapes.push(upperRightLegShape);
this.originPos['upperRightLeg'] = [
this.shouldersDistance / 2,
lowerRightLeg.position[1] + lowerRightLegDisplay.fHeight / 2 + upperRightLegDisplay.fHeight / 2 - 40 / getfactor()
];
const upperRightLeg = this.upperRightLeg = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['upperRightLeg'],
});
if (!debug) upperRightLeg.displays = [upperRightLegDisplay];
upperRightLeg.addShape(upperRightLegShape);
const rightKneeJoint = new p2.RevoluteConstraint(upperRightLeg, lowerRightLeg, {
localPivotA: [0, -upperRightLegDisplay.fHeight / 2 + 20 / getfactor()],
localPivotB: [0, lowerRightLegDisplay.fHeight / 2 - 20 / getfactor()],
});
rightKneeJoint.setLimits(-Math.PI, 0);
//body
var bodyWidth = 120 / getfactor();
var bodyHeight = 250 / getfactor();
const bodyShape = new p2.Box({width: bodyWidth, height: bodyHeight});
bodyPartShapes.push(bodyShape);
this.originPos['body'] = [
0,
upperRightLeg.position[1] + upperRightLegDisplay.fHeight / 2 + bodyHeight / 2 - 60 / getfactor()
];
const body = this.body = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['body'],
});
if (!debug) body.displays = [bodyDisplay];
body.addShape(bodyShape);
const leftHipJoint = new p2.RevoluteConstraint(body, upperLeftLeg, {
localPivotA: [-20 / getfactor(), -bodyHeight / 2 + 30 / getfactor()],
localPivotB: [0, upperLeftLegDisplay.fHeight / 2 - 30 / getfactor()],
});
leftHipJoint.setLimits(-Math.PI / 6 * 2, Math.PI / 6 * 2);
const rightHipJoint = new p2.RevoluteConstraint(body, upperRightLeg, {
localPivotA: [-20 / getfactor(), -bodyHeight / 2 + 30 / getfactor()],
localPivotB: [0, upperRightLegDisplay.fHeight / 2 - 30 / getfactor()],
});
rightHipJoint.setLimits(-Math.PI / 6 * 2, Math.PI / 6 * 2);
//head
const headShape = new p2.Circle({radius: 85 / getfactor()});
bodyPartShapes.push(headShape);
//
this.originPos['head'] = [
0,
body.position[1] + bodyHeight / 2 + 85 / getfactor()
];
const head = this.head = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['head'],
});
head.addShape(headShape);
if (!debug) head.displays = [headDisplay];
const headJoint = new p2.RevoluteConstraint(body, head, {
localPivotA: [0, bodyHeight / 2 - 10 / getfactor()],
localPivotB: [0, (-85 + 10) / getfactor()],
});
headJoint.setLimits(-Math.PI / 6 * 2, Math.PI / 6 * 2);
//left arm
const upperLeftArmShape = new p2.Box(upperLeftArmDisplay.fSize);
bodyPartShapes.push(upperLeftArmShape);
this.originPos['upperLeftArm'] = [
-this.shouldersDistance / 2 - 10 / getfactor(),
body.position[1] + bodyHeight / 2 - upperLeftArmDisplay.fHeight / 2
];
const upperLeftArm = this.upperLeftArm = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['upperLeftArm'],
});
if (!debug) upperLeftArm.displays = [upperLeftArmDisplay];
upperLeftArm.addShape(upperLeftArmShape);
const leftShoulderJoint = new p2.RevoluteConstraint(body, upperLeftArm, {
localPivotA: [-this.shouldersDistance / 2 + 10 / getfactor(), bodyHeight / 2],
localPivotB: [0, upperLeftArmDisplay.fHeight / 2],
});
leftShoulderJoint.setLimits(-Math.PI / 2, 0);
var width = 50 / getfactor();
const lowerLeftArmShape = new p2.Box({width, height: lowerLeftArmDisplay.fHeight});
bodyPartShapes.push(lowerLeftArmShape);
this.originPos['lowerLeftArm'] = [
-this.shouldersDistance / 2 - 10 / getfactor() + 10 / getfactor(),
upperLeftArm.position[1] - upperLeftArmDisplay.fHeight / 2 - lowerLeftArmDisplay.fHeight / 2 + 20 / getfactor()
];
const lowerLeftArm = this.lowerLeftArm = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['lowerLeftArm'],
});
if (!debug) lowerLeftArm.displays = [lowerLeftArmDisplay];
lowerLeftArm.addShape(lowerLeftArmShape);
const leftElbowJoint = new p2.RevoluteConstraint(upperLeftArm, lowerLeftArm, {
localPivotA: [0, -upperLeftArmDisplay.fHeight / 2 + 10 / getfactor()],
localPivotB: [-10 / getfactor(), lowerLeftLegDisplay.fHeight / 2 - 10 / getfactor()],
});
leftElbowJoint.setLimits(0, Math.PI * 2 / 3);
//right arm
const upperRightArmShape = new p2.Box(upperRightArmDisplay.fSize);
bodyPartShapes.push(upperRightArmShape);
this.originPos['upperRightArm'] = [
this.shouldersDistance / 2,
body.position[1] + bodyHeight / 2 - upperRightArmDisplay.fHeight / 2
];
const upperRightArm = this.upperRightArm = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['upperRightArm'],
});
if (!debug) upperRightArm.displays = [upperRightArmDisplay];
upperRightArm.addShape(upperRightArmShape);
const rightShoulderJoint = new p2.RevoluteConstraint(body, upperRightArm, {
localPivotA: [this.shouldersDistance / 2 + 10 / getfactor(), bodyHeight / 2],
localPivotB: [0, upperRightArmDisplay.fHeight / 2],
});
rightShoulderJoint.setLimits(-Math.PI / 2, 0);
var width = 30 / getfactor();
const lowerRightArmShape = new p2.Box({width, height: lowerRightArmDisplay.fHeight});
bodyPartShapes.push(lowerRightArmShape);
this.originPos['lowerRightArm'] = [
this.shouldersDistance / 2,
upperRightArm.position[1] - upperRightArmDisplay.fHeight / 2 - lowerRightArmDisplay.fHeight / 2 + 40 / getfactor()
];
const lowerRightArm = this.lowerRightArm = new p2.Body({
allowSleep: false,
mass: this.partMass,
position: this.originPos['lowerRightArm'],
});
if (!debug) lowerRightArm.displays = [lowerRightArmDisplay];
lowerRightArm.addShape(lowerRightArmShape);
const rightElbowJoint = new p2.RevoluteConstraint(upperRightArm, lowerRightArm, {
localPivotA: [0, -upperRightArmDisplay.fHeight / 2 + 20 / getfactor()],
localPivotB: [0, lowerRightLegDisplay.fHeight / 2 - 20 / getfactor()],
});
rightElbowJoint.setLimits(0, Math.PI * 2 / 3);
const bodies = [
lowerRightArm, upperRightArm,
lowerRightLeg, upperRightLeg, rightFoot,
body,
lowerLeftLeg, upperLeftLeg, leftFoot,
lowerLeftArm, upperLeftArm,
head,
];
bodies.forEach(body => {
world.addBody(body);
});
const joints = [
leftAnkleJoint,
leftKneeJoint,
rightAnkleJoint,
rightKneeJoint,
headJoint,
leftHipJoint,
rightHipJoint,
leftShoulderJoint,
leftElbowJoint,
rightShoulderJoint,
rightElbowJoint,
leftFootGroundCons,
rightFootGroundCons,
];
joints.forEach(joint => {
world.addConstraint(joint);
});
for (let i = 0; i < bodyPartShapes.length; i++) {
let s = bodyPartShapes[i];
s.collisionGroup = collisionGroup;
s.collisionMask = collisionMask;
}
this.foots = [leftFoot, rightFoot];
this.lowerLegs = [lowerLeftLeg, lowerRightLeg];
this.upperLegs = [upperLeftLeg, upperRightLeg];
this.footGroundCons = [leftFootGroundCons, rightFootGroundCons];
//this.addEventListener('move',this.moveTest,this);
}
// moveTest(){
// console.log('移动');
// }
reset(revive = false) {
if (revive) {
} else {
this.step = -1;
this.safePos = 0;
[
'lowerLeftLeg',
'upperLeftLeg',
'lowerRightLeg',
'upperRightLeg',
'body',
'head',
'upperLeftArm',
'lowerLeftArm',
'upperRightArm',
'lowerRightArm',
].forEach(partName => {
const part = this[partName];
part.position[0] = this.safePos + this.originPos[partName][0];
})
}
for (let i = 0; i < 2; i++) {
let cons = this.footGroundCons[i];
cons.pivotB[0] = this.foots[i].position[0] = this.safePos + (i == 0 ? -1 : 1) * this.shouldersDistance / 2;
if (this.state == PlayerStat.FALL) {
this.world.addConstraint(cons);
}
}
this.switchFace('normal', false);
this.setSkin('normal');
this.state = PlayerStat.RELEASE;
}
createDisplay(resName, offset = null) {
let bmp = new PlayerPart(resName);
let anchorX = bmp.width / 2 + (offset ? offset.x : 0);
let anchorY = bmp.height / 2 + (offset ? offset.y : 0);
bmp.anchorTexture.set(anchorX/bmp.width,anchorY/bmp.height);
return bmp;
}
get currentSide() {
return this.step % 2;
}
get anotherSide() {
return (this.step + 1) % 2;
}
onPostStep = (e = null) => {
const side = this.currentSide;
let footHang = this.foots[this.currentSide];
let footFall = this.foots[this.anotherSide];
switch (this.state) {
case PlayerStat.FALL:
break;
case PlayerStat.RISING:
let footOffset = footHang.position[0] - footFall.position[0];
let speed = this.speed;
this.upperLegs[side].angularVelocity = 10;
this.upperLegs[side].velocity = [
footOffset < 0 ? speed - 10 : speed,
0
];
this.lowerLegs[side].velocity = [
footOffset < 0 ? speed - 10 : speed,
footOffset < 0 ? 3 : 2
];
this.head.velocity = [speed * 0.5, 20];
this.dispatchEvent('move', {
pos: (this.leftFoot.position[0] + this.rightFoot.position[0]) / 2 * getfactor(),
bodyPos: this.body.position[0] * getfactor(),
},true);
if (footOffset > 50) {
this.up();
}
break;
case PlayerStat.RELEASE:
this.head.velocity = [0, 30];
break;
}
};
onFootDown = () => {
const pos = this.foots[this.currentSide].position[0] * getfactor();
const mileage = Math.max(this.foots[0].position[0], this.foots[1].position[0]) * getfactor();
this.safePos = this.foots[this.currentSide].position[0];
this.dispatchEvent('foot_down', {
mileage,
pos,
//revivePos: this.safePos * factor,
}, true)
};
down() {
if (this.state == PlayerStat.RISING) {
return;
}
this.step++;
const cons = this.footGroundCons[this.currentSide];
this.world.removeConstraint(cons);
this.state = PlayerStat.RISING;
}
up() {
if (this.state == PlayerStat.RELEASE) {
return;
}
const side = this.currentSide;
this.foots[side].velocity = [0, 0];
this.body.velocity = [0, 0];
const currentFoot = this.foots[side];
const cons = this.footGroundCons[side];
cons.pivotB[0] = currentFoot.position[0];
this.world.addConstraint(cons);
this.state = PlayerStat.RELEASE;
setTimeout(this.onFootDown, 200);
}
fall() {
this.body.velocity = [0, -30];
this.head.velocity = [-50, -50];
this.world.removeConstraint(this.footGroundCons[0]);
this.world.removeConstraint(this.footGroundCons[1]);
this.foots[this.currentSide].velocity[0] = 60;
this.foots[this.anotherSide].velocity[0] = 70;
this.state = PlayerStat.FALL;
}
switchFace(type, playAni = true) {
const headDisplay: Head = <Head>this.head.displays[0];
headDisplay.switchFace(type, playAni);
}
setSkin(name) {
if (this.skin == name) {
return;
}
this.skin = name;
[
'leftFoot',
'lowerLeftLeg',
'upperLeftLeg',
'rightFoot',
'lowerRightLeg',
'upperRightLeg',
'body',
'upperLeftArm',
'lowerLeftArm',
'upperRightArm',
'lowerRightArm',
].forEach(partName => {
const part = this[partName];
part.displays[0].setSkin(name);
})
}
fade(alpha, animation = true){
[
'leftFoot',
'lowerLeftLeg',
'upperLeftLeg',
'rightFoot',
'lowerRightLeg',
'upperRightLeg',
'body',
'head',
'upperLeftArm',
'lowerLeftArm',
'upperRightArm',
'lowerRightArm',
].forEach(partName => {
const display = this[partName].displays[0];
if(animation){
engine.Tween.get(display, null, null, true)
.to({alpha}, 200);
}else{
display.alpha = alpha;
}
})
}
}
\ No newline at end of file
/**
* 玩家部件
*/
import {getTextureByName, getfactor} from "../utils";
export class PlayerPart extends engine.Sprite implements IPlayerPart {
constructor(name) {
super();
this.changeRes(name)
}
changeRes(name) {
this.name = name;
this.texture = getTextureByName('body_normal_'+name)
};
setSkin(name) {
this.texture = getTextureByName('body_' + name + '_' + this.name);
}
// update(x, y, rotation, sleeping) {
// this.x = x;
// this.y = y;
// this.rotation = rotation;
// //this.alpha = sleeping ? 0.5 : 1;
// }
localUpdate(x, y, rotation, sleeping){
this.x = x;
this.y = y;
this.rotation = rotation;
//this.alpha = sleeping ? 0.5 : 1;
}
get fSize() {
return {width: this.fWidth, height: this.fHeight}
}
get fWidth() {
return this.width / getfactor();
}
get fHeight() {
return this.height / getfactor();
}
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 getStage(){
return engine.gameStage.stage;
}
export function getfactor(){
return 10;
}
/**
* 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 16/3/9.
*/
export class localWave {
static round:Function = function (h:number, t:number):any {
return {x: Math.cos(t) * h, y: Math.sin(t) * h};
};
static cos:Function = function (h:number, t:number):any {
return {x: Math.cos(t) * h, y: 0};
};
static sin:Function = function (h:number, t:number):any {
h = h || 1;
return {x: 0, y: Math.sin(t) * h};
};
static rotate:Function = function (t:number):any {
return {r: 360 * t / Math.PI / 2};
};
static shake:Function = function(angle:number, count:number, t:number):any{
return { r: Math.sin(t * count) * angle };
};
static breath:Function = function(scale:number, t:number):any{
return {sx: Math.sin(t) * scale + 1, sy: -Math.sin(t + Math.PI / 4) * scale + 1};
};
static zoom:Function = function(scale:number, t:number):any{
scale = scale || 0.1;
return {sx: Math.sin(t) * scale + 1, sy: Math.sin(t) * scale + 1};
};
static fade:Function = function (base, t:number):any {
return {alpha: (Math.sin(t) + 1) * 0.5 + base};
};
_tween:engine.Tween;
target:any;
duration:number;
delay:number;
offset:number;
loop:number;
reverse:boolean;
private _calProps;
private _oldProperties:any = {};
private _count;
init(target:any, duration:number, calProps:Function = null, loop:number = 0, autoPlay:boolean = true, reverse:boolean = false, delay:number = 0, offset:number = 0) {
this.target = target;
this._calProps = calProps ? calProps : localWave.round;
this.duration = duration;
this.loop = loop;
this.reverse = reverse;
this.delay = delay;
this.offset = offset;
this.updateRegisterPos();
if (autoPlay) {
this.play();
}
}
updateRegisterPos():void{
this._oldProperties.x = this.target.x;
this._oldProperties.y = this.target.y;
this._oldProperties.scaleX = this.target.scaleX;
this._oldProperties.scaleY = this.target.scaleY;
this._oldProperties.skewX = this.target.skewX;
this._oldProperties.skewY = this.target.skewY;
this._oldProperties.rotation = this.target.rotation;
this._oldProperties.alpha = this.target.alpha;
}
play() {
if(this._tween){
return this._tween;
}
this._count = 0;
return this._playStep();
}
_playStep(){
if(this.loop > 0 && this._count >= this.loop){
this.stop();
return;
}
this._count ++;
this.t = this.reverse ? Math.PI * 2 : 0;
this._tween = engine.Tween.get(this);
this._tween.wait(this.delay).to({t: this.reverse ? 0 : Math.PI * 2}, this.duration).call(this._playStep, this);
return this._tween;
}
private _t:number = 0;
private get t():number {
return this._t;
}
private set t(value:number) {
if(!this.target.stage){
return;
}
this._t = value;
let props:any = this._calProps.call(this, this._t + this.offset);
if(props.hasOwnProperty('x')){
this.target.x = (props.x || 0) + this._oldProperties.x;
}
if(props.hasOwnProperty('y')){
this.target.y = (props.y || 0) + this._oldProperties.y;
}
if(props.hasOwnProperty('sx')){
this.target.scaleX = props.sx;
}
if(props.hasOwnProperty('sy')){
this.target.scaleY = props.sy;
}
if(props.hasOwnProperty('skewX')){
this.target.skewX = props.skewX;
}
if(props.hasOwnProperty('skewY')){
this.target.skewY = props.skewY;
}
if(props.hasOwnProperty('r')){
this.target.rotation = props.r;
}
if(props.hasOwnProperty('alpha')){
this.target.alpha = props.alpha;
}
}
stop(recovery:boolean = false, animation:boolean = false, duration:number = 1000):void {
if(!this._tween){
return ;
}
engine.Tween.removeTweens(this);
if(recovery){
engine.Tween.get(this.target).to(this._oldProperties, duration);
}
this._tween = null;
}
get playing():boolean{
return this._tween != null;
}
}
//////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014-present, Egret Technology.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Egret nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////////////
declare module p2 {
export class AABB {
upperBound: number[];
lowerBound: number[];
constructor(options?: {
upperBound?: number[];
lowerBound?: number[];
});
containsPoint(point: number[]): boolean;
setFromPoints(points: number[][], position: number[], angle: number, skinSize: number): void;
copy(aabb: AABB): void;
extend(aabb: AABB): void;
overlaps(aabb: AABB): boolean;
overlapsRay(ray:Ray): number;
}
export class Broadphase {
static AABB: number;
static BOUNDING_CIRCLE: number;
static boundingRadiusCheck(bodyA: Body, bodyB: Body): boolean;
static aabbCheck(bodyA: Body, bodyB: Body): boolean;
static canCollide(bodyA: Body, bodyB: Body): boolean;
constructor(type: number);
result: Body[];
world: World;
boundingVolumeType: number;
setWorld(world: World): void;
getCollisionPairs(world: World): Body[];
boundingVolumeCheck(bodyA: Body, bodyB: Body): boolean;
}
export class NaiveBroadphase extends Broadphase {
aabbQuery(world: World, aabb: AABB, result: Body[]): Body[];
}
export class Narrowphase {
static findSeparatingAxis(c1:Convex, offset1:number[], angle1:number, c2:Convex, offset2:number[], angle2:number, sepAxis:number[]): boolean;
static getClosestEdge(c:Convex, angle:number, axis:number[], flip:boolean): number;
static projectConvexOntoAxis(convexShape:Convex, convexOffset:number[], convexAngle:number, worldAxis:number[], result:number[]): void;
contactEquationPool: ContactEquationPool;
contactEquations: ContactEquation[];
contactSkinSize: number;
enabledEquations: boolean;
enableFriction: boolean;
frictionCoefficient: number;
frictionEquationPool: FrictionEquationPool;
frictionEquations: FrictionEquation[];
frictionRelaxation: number;
frictionStiffness: number;
restitution: number;
slipForce: number;
stiffness: number;
surfaceVelocity: number;
//官方不赞成使用的属性
enableFrictionReduction: boolean;
bodiesOverlap(bodyA: Body, bodyB: Body): boolean;
capsuleCapsule(bi: Body, si: Capsule, xi: number[], ai: number, bj: Body, sj: Capsule, xj: number[], aj: number): void;
circleCapsule(bi: Body, si: Circle, xi: number[], ai: number, bj: Body, sj: Line, xj: number[], aj: number): void;
circleCircle(bodyA: Body, shapeA: Circle, offsetA: number[], angleA: number, bodyB: Body, shapeB: Circle, offsetB: number[], angleB: number, justTest: boolean, radiusA?:number, radiusB?:number): void;
circleConvex(circleBody:Body, circleShape:Circle, circleOffset:number[], circleAngle:number, convexBody:Body, convexShape:Convex, convexOffset:number[], convexAngle:number, justTest:boolean, circleRadius:number): void;
circleHeightfield(bi:Body, si:Circle, xi:number[], bj:Body, sj:Heightfield, xj:number[], aj:number): void;
circleLine(circleBody:Body, circleShape:Circle, circleOffset:number[], circleAngle:number, lineBody:Body, lineShape:Line, lineOffset:number[], lineAngle:number, justTest:boolean, lineRadius:number, circleRadius:number): void;
circleParticle(circleBody:Body, circleShape:Circle, circleOffset:number[], circleAngle:number, particleBody:Body, particleShape:Particle, particleOffset:number[], particleAngle:number, justTest:boolean): void;
circlePlane(bi:Body, si:Circle, xi:number[], bj:Body, sj:Plane, xj:number[], aj:number): void;
collidedLastStep(bodyA: Body, bodyB: Body): boolean;
convexCapsule(convexBody:Body, convexShape:Convex, convexPosition:number[], convexAngle:number, capsuleBody:Body, capsuleShape:Capsule, capsulePosition:number[], capsuleAngle:number): void;
convexConvex(bi:Body, si:Convex, xi:number[], ai:number, bj:Body, sj:Convex, xj:number[], aj:number): void;
convexLine(convexBody:Body, convexShape:Convex, convexOffset:number[], convexAngle:number, lineBody:Body, lineShape:Line, lineOffset:number[], lineAngle:number, justTest:boolean): void;
createContactEquation(bodyA: Body, bodyB: Body): ContactEquation;
createFrictionEquation(bodyA: Body,bodyB: Body): FrictionEquation;
createFrictionFromContact(contactEquation: ContactEquation): FrictionEquation;
lineBox(lineBody:Body, lineShape:Line, lineOffset:number[], lineAngle:number, boxBody:Body, boxShape:Box, boxOffset:number[], boxAngle:number, justTest:boolean): void;
lineCapsule(lineBody:Body, lineShape:Line, linePosition:number[], lineAngle:number, capsuleBody:Body, capsuleShape:Capsule, capsulePosition:number[], capsuleAngle:number): void;
lineLine(bodyA:Body, shapeA:Line, positionA:number[], angleA:number, bodyB:Body, shapeB:Line, positionB:number[], angleB:number): void;
particleConvex(particleBody:Body, particleShape:Particle, particleOffset:number[], particleAngle:number, convexBody:Body, convexShape:Convex, convexOffset:number[], convexAngle:number, justTest:boolean): void;
particlePlane(particleBody:Body, particleShape:Particle, particleOffset:number[], particleAngle:number, planeBody:Body, planeShape:Plane, planeOffset:number[], planeAngle:number, justTest:boolean): void;
planeCapsule(planeBody:Body, planeShape:Circle, planeOffset:number[], planeAngle:number, capsuleBody:Body, capsuleShape:Particle, capsuleOffset:number[], capsuleAngle:number, justTest:boolean): void;
planeConvex(planeBody:Body, planeShape:Plane, planeOffset:number[], planeAngle:number, convexBody:Body, convexShape:Convex, convexOffset:number[], convexAngle:number, justTest:boolean): void;
planeLine(planeBody:Body, planeShape:Plane, planeOffset:number[], planeAngle:number, lineBody:Body, lineShape:Line, lineOffset:number[], lineAngle:number): void;
reset(): void;
}
export class SAPBroadphase extends Broadphase {
axisIndex: number;
axisList: Body[];
aabbQuery(world: World, aabb: AABB, result: Body[]): Body[];
sortAxisList(a: Body[], axisIndex: number): Body[];
}
export class Constraint {
static DISTANCE: number;
static GEAR: number;
static LOCK: number;
static PRISMATIC: number;
static REVOLUTE: number;
constructor(bodyA: Body, bodyB: Body, type: number, options?: {
collideConnected?: boolean;
});
type: number;
equations: Equation[];
bodyA: Body;
bodyB: Body;
collideConnected: boolean;
update(): void;
setStiffness(stiffness: number): void;
setRelaxation(relaxation: number): void;
}
export class DistanceConstraint extends Constraint {
constructor(bodyA: Body, bodyB: Body, options?: {
distance?: number;
localAnchorA?: number[];
localAnchorB?: number[];
maxForce?: number;
});
localAnchorA: number[];
localAnchorB: number[];
distance: number;
maxForce: number;
upperLimitEnabled: boolean;
upperLimit: number;
lowerLimitEnabled: boolean;
lowerLimit: number;
position: number;
setMaxForce(maxForce: number): void;
getMaxForce(): number;
}
export class GearConstraint extends Constraint {
constructor(bodyA: Body, bodyB: Body, options?: {
angle?: number;
ratio?: number;
maxTorque?: number;
});
ratio: number;
angle: number;
setMaxTorque(torque: number): void;
getMaxTorque(): number;
}
export class LockConstraint extends Constraint {
constructor(bodyA: Body, bodyB: Body, options?: {
localOffsetB?: number[];
localAngleB?: number;
maxForce?: number;
collideConnected?: boolean;
});
localAngleB: number;
localOffsetB: number[];
setMaxForce(force: number): void;
getMaxForce(): number;
}
export class PrismaticConstraint extends Constraint {
constructor(bodyA: Body, bodyB: Body, options?: {
maxForce?: number;
localAnchorA?: number[];
localAnchorB?: number[];
localAxisA?: number[];
disableRotationalLock?: boolean;
upperLimit?: number;
lowerLimit?: number;
collideConnected?: boolean;
});
localAnchorA: number[];
localAnchorB: number[];
localAxisA: number[];
lowerLimit: number;
lowerLimitEnabled: boolean;
motorEnabled: boolean;
motorEquation: Equation;
motorSpeed: number;
position: number;
upperLimit: number;
upperLimitEnabled: boolean;
disableMotor(): void;
enableMotor(): void;
setLimits(lower: number, upper: number): void;
}
export class RevoluteConstraint extends Constraint {
constructor(bodyA: Body, bodyB: Body, options?: {
worldPivot?: number[];
localPivotA?: number[];
localPivotB?: number[];
maxForce?: number;
collideConnected?: boolean;
});
angle: number;
lowerLimit: number;
lowerLimitEnabled: boolean;
motorEnabled: boolean;
pivotA: number[];
pivotB: number[];
upperLimit: number;
upperLimitEnabled: boolean;
disableMotor(): void;
enableMotor(): void;
getMotorSpeed(): number;
//官方不赞成使用了
motorIsEnabled(): boolean;
setLimits(lower: number, upper: number): void;
setMotorSpeed(speed: number): void;
}
export class AngleLockEquation extends Equation {
constructor(bodyA: Body, bodyB: Body, options?: {
angle?: number;
ratio?: number;
});
computeGq(): number;
setRatio(ratio: number): number;
setMaxTorque(torque: number): number;
}
export class ContactEquation extends Equation {
constructor(bodyA: Body, bodyB: Body);
contactPointA: number[];
contactPointB: number[];
normalA: number[];
restitution: number;
firstImpact: boolean;
shapeA: Shape;
shapeB: Shape;
}
export class Equation {
static DEFAULT_STIFFNESS: number;
static DEFAULT_RELAXATION: number;
constructor(bodyA: Body, bodyB: Body, minForce?: number, maxForce?: number);
minForce: number;
maxForce: number;
bodyA: Body;
bodyB: Body;
stiffness: number;
relaxation: number;
G: number[];
needsUpdate: boolean;
multiplier: number;
relativeVelocity: number;
enabled: boolean;
gmult(): number;
computeB(): number;
computeGq(): number;
computeGW(): number;
computeGWlambda(): number;
computeGiMf(): number;
computeGiMGt(): number;
addToWlambda(deltalambda: number): void;
computeInvC(eps: number): number;
update(): void;
}
export class FrictionEquation extends Equation {
constructor(bodyA: Body, bodyB: Body, slipForce: number);
contactEquations: ContactEquation;
contactPointA: number[];
contactPointB: number[];
t: number[];
shapeA: Shape;
shapeB: Shape;
frictionCoefficient: number;
setSlipForce(slipForce: number): void;
getSlipForce(): number;
}
export class RotationalLockEquation extends Equation {
constructor(bodyA: Body, bodyB: Body, options?: {
angle?: number;
});
angle: number;
}
export class RotationalVelocityEquation extends Equation {
constructor(bodyA: Body, bodyB: Body);
}
export class EventEmitter {
on(type: string, listener: Function, context?: any): EventEmitter;
has(type: string, listener: Function): boolean;
off(type: string, listener: Function): EventEmitter;
emit(event: any): EventEmitter;
}
export class ContactMaterialOptions {
friction?: number;
restitution?: number;
stiffness?: number;
relaxation?: number;
frictionStiffness?: number;
frictionRelaxation?: number;
surfaceVelocity?: number;
}
export class ContactMaterial {
constructor(materialA: Material, materialB: Material, options?: ContactMaterialOptions);
id: number;
materialA: Material;
materialB: Material;
friction: number;
restitution: number;
stiffness: number;
relaxation: number;
frictionStuffness: number;
frictionRelaxation: number;
surfaceVelocity: number;
contactSkinSize: number;
}
export class Material {
constructor(id: number);
id: number;
}
export class vec2 {
static add(out: number[], a: number[], b: number[]): number[];
static centroid(out: number[], a: number[], b: number[], c: number[]): number[];
static clone(a: number[]): number[];
static copy(out: number[], a: number[]): number[];
static create(): number[];
static crossLength(a: number[], b: number[]): number;
static crossVZ(out: number[], vec: number[], zcomp: number): number;
static crossZV(out: number[], zcomp: number, vec: number[]): number;
static dist(a: number[], b: number[]): number;
static distance(a: number[], b: number[]): number;
static div(out: number[], a: number[], b: number[]): number[];
static divide(out: number[], a: number[], b: number[]): number[];
static dot(a: number[], b: number[]): number;
static fromValues(x: number, y: number): number[];
static getLineSegmentsIntersection(out: number[], p0: number[], p1: number[], p2: number[], p3: number[]): boolean;
static getLineSegmentsIntersectionFraction(p0: number[], p1: number[], p2: number[], p3: number[]): number;
static len(a: number[]): number;
static length(a: number[]): number;
static lerp(out: number[], a: number[], b: number[], t: number): void;
static mul(out: number[], a: number[], b: number[]): number[];
static multiply(out: number[], a: number[], b: number[]): number[];
static negate(out: number[], a: number[]): number[];
static normalize(out: number[], a: number[]): number[];
static reflect(out: number[], vector: number[], normal: number[]): void;
static rotate(out: number[], a: number[], angle: number): void;
static rotate90cw(out: number[], a: number[]): void;
static scale(out: number[], a: number[], b: number): number[];
static set(out: number[], x: number, y: number): number[];
static sqrDist(a: number[], b: number[]): number;
static squaredDistance(a: number[], b: number[]): number;
static sqrLen(a: number[]): number;
static squaredLength(a: number[]): number;
static str(vec: number[]): string;
static sub(out: number[], a: number[], b: number[]): number[];
static subtract(out: number[], a: number[], b: number[]): number[];
static toGlobalFrame(out: number[], localPoint: number[], framePosition: number[], frameAngle: number): void;
static toLocalFrame(out: number[], worldPoint: number[], framePosition: number[], frameAngle: number): void;
static vectorToLocalFrame(out: number[], worldVector: number[], frameAngle: number): void;
}
// export class BodyOptions {
//
// mass: number;
// position: number[];
// velocity: number[];
// angle: number;
// angularVelocity: number;
// force: number[];
// angularForce: number;
// fixedRotation: number;
//
// }
/**
* 刚体。有质量、位置、速度等属性以及一组被用于碰撞的形状
*
* @class Body
* @constructor
* @extends EventEmitter
* @param {Array} [options.force]
* @param {Array} [options.position]
* @param {Array} [options.velocity]
* @param {Boolean} [options.allowSleep]
* @param {Boolean} [options.collisionResponse]
* @param {Number} [options.angle=0]
* @param {Number} [options.angularForce=0]
* @param {Number} [options.angularVelocity=0]
* @param {Number} [options.ccdIterations=10]
* @param {Number} [options.ccdSpeedThreshold=-1]
* @param {Number} [options.fixedRotation=false]
* @param {Number} [options.gravityScale]
* @param {Number} [options.id]
* @param {Number} [options.mass=0] 一个大于0的数字。如果设置成0,其type属性将被设置为 Body.STATIC.
* @param {Number} [options.sleepSpeedLimit]
* @param {Number} [options.sleepTimeLimit]
* @param {Object} [options]
*
* @example
* // 创建一个刚体
* var body = new Body({
* mass: 1,
* position: [0, 0],
* angle: 0,
* velocity: [0, 0],
* angularVelocity: 0
* });
*
* // 将一个圆形形状添加到刚体
* body.addShape(new Circle({ radius: 1 }));
*
* // 将刚体加入 world
* world.addBody(body);
*/
export class Body extends EventEmitter {
sleepyEvent: {
type: string;
};
sleepEvent: {
type: string;
};
wakeUpEvent: {
type: string;
};
static DYNAMIC: number;
static STATIC: number;
static KINEMATIC: number;
static AWAKE: number;
static SLEEPY: number;
static SLEEPING: number;
constructor(options?);
/**
* 刚体id
* @property id
* @type {Number}
*/
id: number;
/**
* 刚体被添加到的 world。如果没有被添加到 world 该属性将被设置为 null
* @property world
* @type {World}
*/
world: World;
/**
* 刚体的碰撞形状
*
* @property shapes
* @type {Array}
*/
shapes: Shape[];
/**
* 质量
* @property mass
* @type {number}
*/
mass: number;
/**
* 惯性
* @property inertia
* @type {number}
*/
inertia: number;
/**
* 是否固定旋转
* @property fixedRotation
* @type {Boolean}
*/
fixedRotation: boolean;
/**
* 位置
* @property position
* @type {Array}
*/
position: number[];
/**
* 位置插值
* @property interpolatedPosition
* @type {Array}
*/
interpolatedPosition: number[];
/**
* 角度插值
* @property interpolatedAngle
* @type {Number}
*/
interpolatedAngle: number;
/**
* 速度
* @property velocity
* @type {Array}
*/
velocity: number[];
/**
* 角度
* @property angle
* @type {number}
*/
angle: number;
/**
* 力
* @property force
* @type {Array}
*/
force: number[];
/**
* 角力
* @property angularForce
* @type {number}
*/
angularForce: number;
/**
* 限行阻尼。取值区间[0,1]
* @property damping
* @type {Number}
* @default 0.1
*/
damping: number;
/**
* 角阻尼。取值区间[0,1]
* @property angularDamping
* @type {Number}
* @default 0.1
*/
angularDamping: number;
/**
* 运动类型。 应该是Body.STATIC,Body.DYNAMIC,Body.KINEMATIC之一
*
* * Static 刚体不会动,不响应力或者碰撞
* * Dynamic 刚体会动,响应力和碰撞
* * Kinematic 刚体仅根据自身属性运动,不响应力或者碰撞
*
* @property type
* @type {number}
*
* @example
* // 默认值是STATIC
* var body = new Body();
* console.log(body.type == Body.STATIC); // true
*
* @example
* // 将质量设置为非0的值,会变为DYNAMIC
* var dynamicBody = new Body({
* mass : 1
* });
* console.log(dynamicBody.type == Body.DYNAMIC); // true
*
* @example
* // KINEMATIC刚体只会运动,如果你改变它的速度
* var kinematicBody = new Body({
* type: Body.KINEMATIC
* });
*/
type: number;
/**
* 边界圆半径
* @property boundingRadius
* @type {Number}
*/
boundingRadius: number;
/**
* 边框
* @property aabb
* @type {AABB}
*/
aabb: AABB;
/**
* 设置AABB是否会更新。通过调用 updateAABB 方法更新它
* @property aabbNeedsUpdate
* @type {Boolean}
* @see updateAABB
*
* @example
* body.aabbNeedsUpdate = true;
* body.updateAABB();
* console.log(body.aabbNeedsUpdate); // false
*/
aabbNeedsUpdate: boolean;
/**
* 设置为true,刚体会自动进入睡眠。需要在 World 中允许刚体睡眠
* @property allowSleep
* @type {Boolean}
* @default true
*/
allowSleep: boolean;
/**
* Body.AWAKE,Body.SLEEPY,Body.SLEEPING之一
*
* 默认值是 Body.AWAKE。如果刚体速度低于 sleepSpeedLimit,该属性将变为 Body.SLEEPY。如果持续 Body.SLEEPY 状态 sleepTimeLimit 秒,该属性将变为 Body.SLEEPY。
*
* @property sleepState
* @type {Number}
* @default Body.AWAKE
*/
sleepState: number;
/**
* 如果速度小于该值,sleepState 将变为 Body.SLEEPY 状态
* @property sleepSpeedLimit
* @type {Number}
* @default 0.2
*/
sleepSpeedLimit: number;
/**
* 如果持续 Body.SLEEPY 状态 sleepTimeLimit 秒,sleepState 将变为 Body.SLEEPING
* @property sleepTimeLimit
* @type {Number}
* @default 1
*/
sleepTimeLimit: number;
/**
* 重力缩放因子。如果你想忽略刚体重心,设置为零。如果你想反转重力,将其设置为-1。
* @property {Number} gravityScale
* @default 1
*/
gravityScale: number;
/**
* The angular velocity of the body, in radians per second.
* @property angularVelocity
* @type {number}
*/
angularVelocity: number;
/**
* The inverse inertia of the body.
* @property invInertia
* @type {number}
*/
invInertia: number;
/**
* The inverse mass of the body.
* @property invMass
* @type {number}
*/
invMass: number;
/**
* The previous angle of the body.
* @property previousAngle
* @type {number}
*/
previousAngle: number;
/**
* The previous position of the body.
* @property previousPosition
* @type {Array}
*/
previousPosition: number[];
/**
* Constraint velocity that was added to the body during the last step.
* @property vlambda
* @type {Array}
*/
vlambda: number[];
/**
* Angular constraint velocity that was added to the body during last step.
* @property wlambda
* @type {Array}
*/
wlambda: number[];
/**
* The number of iterations that should be used when searching for the time of impact during CCD. A larger number will assure that there's a small penetration on CCD collision, but a small number will give more performance.
* @property {Number} ccdIterations
* @default 10
*/
ccdIterations: number;
/**
* If the body speed exceeds this threshold, CCD (continuous collision detection) will be enabled. Set it to a negative number to disable CCD completely for this body.
* @property {Number} ccdSpeedThreshold
* @default -1
*/
ccdSpeedThreshold: number;
/**
* Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled. That means that this body will move through other bodies, but it will still trigger contact events, etc.
* @property collisionResponse
* @type {Boolean}
*/
collisionResponse: boolean;
/**
* Set to true if you want to fix the body movement along the X axis. The body will still be able to move along Y.
* @property fixedX
* @type {Boolean}
*/
fixedX: boolean;
/**
* Set to true if you want to fix the body movement along the Y axis. The body will still be able to move along X.
* @property fixedY
* @type {Boolean}
*/
fixedY: boolean;
/**
* How long the body has been sleeping.
* @property idleTime
* @type {Number}
*/
idleTime: number;
/**
* 与每个形状对应的显示对象
*/
displays: engine.DisplayObject[];
/**
* 设置刚体总密度
* @method setDensity
*/
setDensity(density: number): void;
/**
* 得到所有形状的总面积
* @method getArea
* @return {Number}
*/
getArea(): number;
/**
* 获得AABB
* @method getAABB
*/
getAABB(): AABB;
/**
* 更新AABB
* @method updateAABB
*/
updateAABB(): void;
/**
* 更新外边界
* @method updateBoundingRadius
*/
updateBoundingRadius(): void;
/**
* 添加一个形状
*
* @method addShape
* @param {Shape} shape 形状
* @param {Array} [offset] 偏移
* @param {Number} [angle] 角度
*
* @example
* var body = new Body(),
* shape = new Circle();
*
* // 位于中心
* body.addShape(shape);
*
* // 偏移量为x轴一个单位
* body.addShape(shape,[1,0]);
*
* // 偏移量为y轴一个单位,同时逆时针旋转90度
* body.addShape(shape,[0,1],Math.PI/2);
*/
addShape(shape: Shape, offset?: number[], angle?: number): void;
/**
* 移除形状
* @method removeShape
* @param {Shape} shape
* @return {Boolean}
*/
removeShape(shape: Shape): boolean;
/**
* 更新属性,结构或者质量改变时会被调用
*
* @method updateMassProperties
*
* @example
* body.mass += 1;
* body.updateMassProperties();
*/
updateMassProperties(): void;
/**
* 相对于 world 中的一个点施加力
* @method applyForce
* @param {Array} force 力
* @param {Array} relativePoint 以物体中心点为基准的点
*/
applyForce(force: number[], relativePoint: number[]): void;
/**
* Wake the body up. Normally you should not need this, as the body is automatically awoken at events such as collisions.
* Sets the sleepState to {{#crossLink "Body/AWAKE:property"}}Body.AWAKE{{/crossLink}} and emits the wakeUp event if the body wasn't awake before.
* @method wakeUp
*/
wakeUp(): void;
/**
* Force body sleep
* @method sleep
*/
sleep(): void;
/**
* Called every timestep to update internal sleep timer and change sleep state if needed.
* @method sleepTick
* @param {number} time The world time in seconds
* @param {boolean} dontSleep
* @param {number} dt
*/
sleepTick(time: number, dontSleep: boolean, dt: number): void;
/**
* Check if the body is overlapping another body. Note that this method only works if the body was added to a World and if at least one step was taken.
* @method overlaps
* @param {Body} body
* @return {boolean}
*/
overlaps(body: Body): boolean;
/**
* Moves the shape offsets so their center of mass becomes the body center of mass.
* @method adjustCenterOfMass
*/
adjustCenterOfMass(): void;
/**
* Apply damping.
* @method applyDamping
* @param {number} dt Current time step
*/
applyDamping(dt: number): void;
/**
* Reads a polygon shape path, and assembles convex shapes from that and puts them at proper offset points.
* @method fromPolygon
* @param {Array} path An array of 2d vectors, e.g. [[0,0],[0,1],...] that resembles a concave or convex polygon. The shape must be simple and without holes.
* @param {Object} [options]
* @param {Boolean} [options.optimalDecomp=false] Set to true if you need optimal decomposition. Warning: very slow for polygons with more than 10 vertices.
* @param {Boolean} [options.skipSimpleCheck=false] Set to true if you already know that the path is not intersecting itself.
* @param {Boolean|Number} [options.removeCollinearPoints=false] Set to a number (angle threshold value) to remove collinear points, or false to keep all points.
* @return {Boolean} True on success, else false.
*/
fromPolygon(path:number[][], options?: {
optimalDecomp?: boolean;
skipSimpleCheck?: boolean;
removeCollinearPoints?: boolean; // Boolean | Number
}): boolean;
/**
* Sets the force on the body to zero.
* @method setZeroForce
*/
setZeroForce(): void;
/**
* Transform a world point to local body frame.
* @method toLocalFrame
* @param {Array} out The vector to store the result in
* @param {Array} worldPoint The input world point
*/
toLocalFrame(out: number[], worldPoint: number[]): void;
/**
* Transform a local point to world frame.
* @method toWorldFrame
* @param {Array} out The vector to store the result in
* @param {Array} localPoint The input local point
*/
toWorldFrame(out: number[], localPoint: number[]): void;
/**
* Apply force to a body-local point.
* @method applyForceLocal
* @param {Array} localForce The force vector to add, oriented in local body space.
* @param {Array} localPoint A point relative to the body in world space. If not given, it is set to zero and all of the impulse will be excerted on the center of mass.
*/
applyForceLocal(localForce: number[], localPoint: number[]): void;
/**
* Apply impulse to a point relative to the body. This could for example be a point on the Body surface. An impulse is a force added to a body during a short period of time (impulse = force * time). Impulses will be added to Body.velocity and Body.angularVelocity.
* @method applyImpulse
* @param {Array} impulse The impulse vector to add, oriented in world space.
* @param {Array} relativePoint A point relative to the body in world space. If not given, it is set to zero and all of the impulse will be excerted on the center of mass.
*/
applyImpulse(impulse: number[], relativePoint: number[]): void;
/**
* Apply impulse to a point relative to the body. This could for example be a point on the Body surface. An impulse is a force added to a body during a short period of time (impulse = force * time). Impulses will be added to Body.velocity and Body.angularVelocity.
* @method applyImpulseLocal
* @param {Array} impulse The impulse vector to add, oriented in world space.
* @param {Array} relativePoint A point relative to the body in world space. If not given, it is set to zero and all of the impulse will be excerted on the center of mass.
*/
applyImpulseLocal(impulse: number[], relativePoint: number[]): void;
/**
* Get velocity of a point in the body.
* @method getVelocityAtPoint
* @param {Array} result A vector to store the result in
* @param {Array} relativePoint A world oriented vector, indicating the position of the point to get the velocity from
* @return {Array}
*/
getVelocityAtPoint(result: number[], relativePoint: number[]): number[];
/**
* Move the body forward in time given its current velocity.
* @method integrate
* @param {number} dt
*/
integrate(dt: number): void;
/**
* Transform a world point to local body frame.
* @method vectorToLocalFrame
* @param {Array} out The vector to store the result in
* @param {Array} worldVector The input world vector
*/
vectorToLocalFrame(out: number[], worldVector: number[]): void;
/**
* Transform a local point to world frame.
* @method vectorToWorldFrame
* @param {Array} out The vector to store the result in
* @param {Array} localVector The input local vector
*/
vectorToWorldFrame(out: number[], localVector: number[]): void;
}
/**
* Box shape class.
*
* @class Box
* @constructor
* @extends Convex
* @param {Object} [options] (Note that this options object will be passed on to the Shape constructor.)
* @param {Number} [options.width=1] Total width of the box
* @param {Number} [options.height=1] Total height of the box
*/
export class Box extends Convex {
constructor(options?: Object);
width: number;
height: number;
}
export class Pool {
objects: any[];
get(): Object;
release(object: Object): Pool;
resize(size: number): Pool;
}
export class OverlapKeeperRecordPool extends Pool {
}
export class IslandPool extends Pool {
}
export class IslandNodePool extends Pool {
}
export class ContactEquationPool extends Pool {
}
export class FrictionEquationPool extends Pool {
}
export class Ray {
static ALL: number;
static ANY: number;
static CLOSEST: number;
constructor(options?: {
from?: number[];
to?: number[];
checkCollisionResponse?: boolean;
skipBackfaces?: boolean;
collisionMask?: number;
collisionGroup?: number;
mode?: number;
callback?: number;
});
callback: Function;
checkCollisionResponse: boolean;
collisionGroup: number;
collisionMask: number;
direction: number[];
from: number[];
length: number;
mode: number;
skipBackfaces: boolean;
to: number[];
getAABB(aabb: AABB): void;
intersectBodies(bodies: Body[]): void;
update(): void;
}
export class RaycastResult {
body: Body;
faceIndex: number;
fraction: number;
isStopped: boolean;
normal: number[];
shape: Shape;
getHitDistance(ray: Ray): void;
getHitPoint(out:number[], ray: Ray): void;
hasHit():boolean;
reset(): void;
stop(): void;
}
export class TopDownVehicle {
constructor(chassisBody: Body, options?: Object);
chassisBody: Body;
wheels: WheelConstraint[];
addToWorld(world: World): void;
addWheel(wheelOptions?: Object): WheelConstraint;
removeFromWorld(world: World): void;
update(): void;
}
export class WheelConstraint extends Constraint {
constructor(vehicle: TopDownVehicle, options?: {
localForwardVector?: number[];
localPosition?: number[];
sideFriction?: number;
});
engineForce: number;
localForwardVector: number[];
localPosition: number[];
steerValue: number;
getSpeed(): number;
update(): void;
}
export class Spring {
constructor(bodyA: Body, bodyB: Body, options?: {
stiffness?: number;
damping?: number;
localAnchorA?: number[];
localAnchorB?: number[];
worldAnchorA?: number[];
worldAnchorB?: number[];
});
bodyA: Body;
bodyB: Body;
damping: number;
stiffness: number;
applyForce(): void;
}
export class LinearSpring extends Spring {
constructor(bodyA: Body, bodyB: Body, options?: {
restLength?: number;
stiffness?: number;
damping?: number;
worldAnchorA?: number[];
worldAnchorB?: number[];
localAnchorA?: number[];
localAnchorB?: number[];
});
localAnchorA: number[];
localAnchorB: number[];
restLength: number;
setWorldAnchorA(worldAnchorA: number[]): void;
setWorldAnchorB(worldAnchorB: number[]): void;
getWorldAnchorA(result: number[]): void;
getWorldAnchorB(result: number[]): void;
}
export class RotationalSpring extends Spring {
constructor(bodyA: Body, bodyB: Body, options?: {
restAngle?: number;
stiffness?: number;
damping?: number;
});
restAngle: number;
}
/**
* Capsule shape class.
*
* @class Capsule
* @constructor
* @extends Shape
* @param {Object} [options] (Note that this options object will be passed on to the Shape constructor.)
* @param {Number} [options.length=1] The distance between the end points
* @param {Number} [options.radius=1] Radius of the capsule
*/
export class Capsule extends Shape {
constructor(options?: Object);
length: number;
radius: number;
conputeMomentOfInertia(mass: number): number;
}
/**
* Circle shape class.
*
* @class Circle
* @constructor
* @extends Shape
* @param {Object} [options] (Note that this options object will be passed on to the Shape constructor.)
* @param {Number} [options.radius=1] The radius of this circle
* @example
* var circleShape = new Circle({ radius: 1 });
* body.addShape(circleShape);
*/
export class Circle extends Shape {
constructor(options?: Object);
/**
* 半径
* @property radius
* @type {number}
*/
radius: number;
}
/**
* Convex shape class.
*
* @class Convex
* @constructor
* @extends Shape
* @param {Object} [options] (Note that this options object will be passed on to the Shape constructor.)
* @param {Array} [options.vertices] An array of vertices that span this shape. Vertices are given in counter-clockwise (CCW) direction.
* @param {Array} [options.axes] An array of unit length vectors, representing the symmetry axes in the convex.
* @example
* var vertices = [[-1,-1], [1,-1], [1,1], [-1,1]];
* var convexShape = new Convex({ vertices: vertices });
* body.addShape(convexShape);
*/
export class Convex extends Shape {
static projectOntoAxis(offset: number[], localAxis: number[], result: number[]): void;
static triangleArea(a: number[], b: number[], c: number[]): number;
constructor(options?: Object);
vertices: number[][];
axes: number[];
centerOfMass: number[];
triangles: number[];
updateCenterOfMass(): void;
updateTriangles(): void;
}
export class Heightfield extends Shape {
constructor(options?: {
heights?: number[];
minValue?: number;
maxValue?: number;
elementWidth?: number;
});
heights: number[];
maxValue: number;
minValue: number;
elementWidth: number;
getLineSegment(start:number[], end:number[], i:number): void;
updateMaxMinValues(): void;
}
export class Shape {
static BOX: number;
static CAPSULE: number;
static CIRCLE: number;
static CONVEX: number;
static HEIGHTFIELD: number;
static LINE: number;
static PARTICLE: number;
static PLANE: number;
constructor(options?: {
position?: number[];
angle?: number;
collisionGroup?: number;
collisionMask?: number;
sensor?: boolean;
collisionResponse?: boolean;
type?: number;
});
angle: number;
area: number;
body: Body;
boundingRadius: number;
collisionGroup: number;
collisionMask: number;
collisionResponse: boolean;
id: number;
material: Material;
position: number[];
sensor: boolean;
type: number;
computeAABB(out: AABB, position: number[], angle: number): void;
computeMomentOfInertia(mass: number): number;
raycast(result: RaycastResult, ray: Ray, position: number[], angle: number): void;
updateArea(): void;
updateBoundingRadius(): number;
}
export class Line extends Shape {
constructor(options?: {
length?: number;
});
length: number;
}
export class Particle extends Shape {
}
export class Plane extends Shape {
}
export class Solver extends EventEmitter {
constructor();
equations: Equation[];
equationSortFunction: Function; //Function | boolean
addEquation(eq: Equation): void;
addEquations(eqs: Equation[]): void;
removeAllEquations(): void;
removeEquation(eq: Equation): void;
solve(dt: number, world: World): void;
solveIsland(dt: number, island: Island): void;
sortEquations(): void;
}
export class GSSolver extends Solver {
constructor(options?: {
iterations?: number;
tolerance?: number;
});
iterations: number;
tolerance: number;
useZeroRHS: boolean;
frictionIterations: number;
usedIterations: number;
solve(h: number, world: World): void;
}
export class OverlapKeeper {
constructor();
recordPool: OverlapKeeperRecordPool;
tick(): void;
setOverlapping(bodyA: Body, shapeA: Body, bodyB: Body, shapeB: Body): void;
bodiesAreOverlapping(bodyA: Body, bodyB: Body): boolean;
}
export class OverlapKeeperRecord {
constructor(bodyA: Body, shapeA: Shape, bodyB: Body, shapeB: Shape);
bodyA: Body;
bodyB: Body;
shapeA: Shape;
shapeB: Shape;
set(bodyA: Body, shapeA: Shape, bodyB: Body, shapeB: Shape): void;
}
export class TupleDictionary {
data: Object;
keys: number[];
copy(dict: TupleDictionary): void;
get(i: number, j: number): number;
getByKey(key: number): Object;
getKey(i: number, j: number): string;
reset(): void;
set(i: number, j: number, value: number): void;
}
export class Utils {
static appendArray<T>(a: Array<T>, b: Array<T>): Array<T>;
static splice<T>(array: Array<T>, index: number, howMany: number): void;
static extend(a: any, b: any): void;
static defaults(options: any, defaults: any): any;
}
export class Island {
equations: Equation[];
bodies: Body[];
reset(): void;
getBodies(): Body[];
wantsToSleep(): boolean;
sleep(): void;
}
export class IslandManager extends Solver {
static getUnvisitedNode(nodes: Node[]): IslandNode; // IslandNode | boolean
constructor(options?: Object);
islands: Island[];
nodes: IslandNode[];
islandPool: IslandPool;
nodePool: IslandNodePool;
visit(node: IslandNode, bds: Body[], eqs: Equation[]): void;
bfs(root: IslandNode, bds: Body[], eqs: Equation[]): void;
split(world: World): Island[];
}
export class IslandNode {
constructor(body: Body);
body: Body;
neighbors: IslandNode[];
equations: Equation[];
visited: boolean;
reset(): void;
}
/**
* world,包含所有刚体
*
* @class World
* @constructor
* @param {Object} [options]
* @param {Solver} [options.solver] 默认值 GSSolver.
* @param {Array} [options.gravity] 默认值 [0,-9.78]
* @param {Broadphase} [options.broadphase] 默认值 NaiveBroadphase
* @param {Boolean} [options.islandSplit=false]
* @param {Boolean} [options.doProfiling=false]
* @extends EventEmitter
*
* @example
* var world = new World({
* gravity: [0, -9.81],
* broadphase: new SAPBroadphase()
* });
*/
export class World extends EventEmitter {
/**
* step() 执行之后调用
* @event postStep
*/
postStepEvent: {
type: string;
};
/**
* Body 加入时调用
* @event addBody
* @param {Body} body
*/
addBodyEvent: {
type: string;
body: Body;
};
/**
* Body移除时调用
* @event removeBody
* @param {Body} body
*/
removeBodyEvent: {
type: string;
body: Body;
};
/**
* Spring 加入时调用
* @event addSpring
* @param {Spring} spring
*/
addSpringEvent: {
type: string;
spring: Spring;
};
/**
* 当两个刚体第一次碰撞时调用。调用时碰撞步骤已经完成
* @event impact
* @param {Body} bodyA
* @param {Body} bodyB
*/
impactEvent: {
type: string;
bodyA: Body;
bodyB: Body;
shapeA: Shape;
shapeB: Shape;
contactEquation: ContactEquation;
};
/**
* 当 Broadphase 手机对碰之后被调用
* @event postBroadphase
* @param {Array} 对碰数组
*/
postBroadphaseEvent: {
type: string;
pairs: Body[];
};
/**
* 当两个形状重叠时调用
* @event beginContact
* @param {Shape} shapeA
* @param {Shape} shapeB
* @param {Body} bodyA
* @param {Body} bodyB
* @param {Array} contactEquations
*/
beginContactEvent: {
type: string;
shapeA: Shape;
shapeB: Shape;
bodyA: Body;
bodyB: Body;
contactEquations: ContactEquation[];
};
/**
* 当两个形状停止重叠时调用
* @event endContact
* @param {Shape} shapeA
* @param {Shape} shapeB
* @param {Body} bodyA
* @param {Body} bodyB
*/
endContactEvent: {
type: string;
shapeA: Shape;
shapeB: Shape;
bodyA: Body;
bodyB: Body;
};
/**
* Fired just before equations are added to the solver to be solved. Can be used to control what equations goes into the solver.
* @event preSolve
* @param {Array} contactEquations An array of contacts to be solved.
* @param {Array} frictionEquations An array of friction equations to be solved.
*/
preSolveEvent: {
type: string;
contactEquations: ContactEquation[];
frictionEquations: FrictionEquation[];
};
/**
* 从不让刚体睡眠
* @static
* @property {number} NO_SLEEPING
*/
static NO_SLEEPING: number;
/**
* 刚体睡眠
* @static
* @property {number} BODY_SLEEPING
*/
static BODY_SLEEPING: number;
/**
* 取消激活在接触中的刚体,如果所有刚体都接近睡眠。必须设置 World.islandSplit
* @static
* @property {number} ISLAND_SLEEPING
*/
static ISLAND_SLEEPING: number;
constructor(options?: {
solver?: Solver;
gravity?: number[];
broadphase?: Broadphase;
islandSplit?: boolean;
});
/**
* For keeping track of what time step size we used last step
* @property lastTimeStep
* @type {number}
*/
lastTimeStep: number;
overlapKeeper: OverlapKeeper;
/**
* If the length of .gravity is zero, and .useWorldGravityAsFrictionGravity=true, then switch to using .frictionGravity for friction instead. This fallback is useful for gravityless games.
* @property {boolean} useFrictionGravityOnZeroGravity
* @default true
*/
useFrictionGravityOnZeroGravity: boolean;
/**
* 所有 Spring
* @property springs
* @type {Array}
*/
springs: Spring[];
/**
* 所有 Body
* @property {Array} bodies
*/
bodies: Body[];
/**
* 所使用的求解器,以满足约束条件和接触。 默认值是 GSSolver
* @property {Solver} solver
*/
solver: Solver;
/**
* @property narrowphase
* @type {Narrowphase}
*/
narrowphase: Narrowphase;
/**
* The island manager of this world.
* @property {IslandManager} islandManager
*/
islandManager: IslandManager;
/**
* 重力。在每个 step() 开始对所有刚体生效
*
* @property gravity
* @type {Array}
*/
gravity: number[];
/**
* 重力摩擦
* @property {Number} frictionGravity
*/
frictionGravity: number;
/**
* 设置为true,frictionGravity 会被自动设置为 gravity 长度.
* @property {Boolean} useWorldGravityAsFrictionGravity
*/
useWorldGravityAsFrictionGravity: boolean;
/**
* @property broadphase
* @type {Broadphase}
*/
broadphase: Broadphase;
/**
* 用户添加限制
*
* @property constraints
* @type {Array}
*/
constraints: Constraint[];
/**
* 默认材料,defaultContactMaterial 时使用
* @property {Material} defaultMaterial
*/
defaultMaterial: Material;
/**
* 使用的默认接触材料,如果没有接触材料被设置为碰撞的材料
* @property {ContactMaterial} defaultContactMaterial
*/
defaultContactMaterial: ContactMaterial;
/**
* 设置自动使用弹簧力
* @property applySpringForces
* @type {Boolean}
*/
applySpringForces: boolean;
/**
* 设置自动使用阻尼
* @property applyDamping
* @type {Boolean}
*/
applyDamping: boolean;
/**
* 设置自动使用重力
* @property applyGravity
* @type {Boolean}
*/
applyGravity: boolean;
/**
* 使用约束求解
* @property solveConstraints
* @type {Boolean}
*/
solveConstraints: boolean;
/**
* 接触材料
* @property contactMaterials
* @type {Array}
*/
contactMaterials: ContactMaterial[];
/**
* 世界时间
* @property time
* @type {Number}
*/
time: number;
/**
* 是否正在 step 阶段
* @property {Boolean} stepping
*/
stepping: boolean;
/**
* 是否启用岛内分裂
* @property {Boolean} islandSplit
*/
islandSplit: boolean;
/**
* 设置为true,world会派发 impact 事件,关闭可以提高性能
* @property emitImpactEvent
* @type {Boolean}
*/
emitImpactEvent: boolean;
/**
* 刚体睡眠策略。取值是 World.NO_SLEEPING,World.BODY_SLEEPING,World.ISLAND_SLEEPING 之一
* @property sleepMode
* @type {number}
* @default World.NO_SLEEPING
*/
sleepMode: number;
/**
* 添加约束
* @method addConstraint
* @param {Constraint} constraint
*/
addConstraint(constraint: Constraint): void;
/**
* 添加触点材料
* @method addContactMaterial
* @param {ContactMaterial} contactMaterial
*/
addContactMaterial(contactMaterial: ContactMaterial): void;
/**
* 移除触点材料
* @method removeContactMaterial
* @param {ContactMaterial} cm
*/
removeContactMaterial(cm: ContactMaterial): void;
/**
* 通过2个材料获得触点材料
* @method getContactMaterial
* @param {Material} materialA
* @param {Material} materialB
* @return {ContactMaterial} 获得的触点材料或者false
*/
getContactMaterial(materialA: Material, materialB: Material): ContactMaterial;
/**
* 移除约束
* @method removeConstraint
* @param {Constraint} constraint
*/
removeConstraint(constraint: Constraint): void;
/**
* 使物理系统向前经过一定时间
*
* @method step
* @param {Number} dt 时长
* @param {Number} [timeSinceLastCalled=0]
* @param {Number} [maxSubSteps=10]
*
* @example
* var world = new World();
* world.step(0.01);
*/
step(dt: number, timeSinceLastCalled?: number, maxSubSteps?: number): void;
/**
* 添加一个 Spring
*
* @method addSpring
* @param {Spring} spring
*/
addSpring(spring: Spring): void;
/**
* 移除一个 Spring
*
* @method removeSpring
* @param {Spring} spring
*/
removeSpring(spring: Spring): void;
/**
* 添加一个 Body
*
* @method addBody
* @param {Body} body
*
* @example
* var world = new World(),
* body = new Body();
* world.addBody(body);
*/
addBody(body: Body): void;
/**
* 移除一个 Body。如果在 step()阶段调用,将会在阶段之后移除
*
* @method removeBody
* @param {Body} body
*/
removeBody(body: Body): void;
/**
* 通过id获取一个 Body
* @method getBodyById
* @return {Body|Boolean} 得到的刚体或者false
*/
getBodyByID(id: number): Body;
/**
* 两个刚体之间禁用碰撞
* @method disableBodyCollision
* @param {Body} bodyA
* @param {Body} bodyB
*/
disableBodyCollision(bodyA: Body, bodyB: Body): void;
/**
* 两个刚体之间启用碰撞
* @method enableBodyCollision
* @param {Body} bodyA
* @param {Body} bodyB
*/
enableBodyCollision(bodyA: Body, bodyB: Body): void;
/**
* 重置 world
* @method clear
*/
clear(): void;
/**
* Test if a world point overlaps bodies
* @method hitTest
* @param {Array} worldPoint Point to use for intersection tests
* @param {Array} bodies A list of objects to check for intersection
* @param {number} precision Used for matching against particles and lines. Adds some margin to these infinitesimal objects.
* @return {Array} Array of bodies that overlap the point
*/
hitTest(worldPoint: number[], bodies: Body[], precision: number): Body[];
/**
* Ray cast against all bodies in the world.
* @method raycast
* @param {RaycastResult} result
* @param {Ray} ray
* @return {boolean} True if any body was hit.
*/
raycast(result: RaycastResult, ray: Ray): boolean;
/**
* Runs narrowphase for the shape pair i and j.
* @method runNarrowphase
* @param {Narrowphase} np
* @param {Body} bi
* @param {Shape} si
* @param {Array} xi
* @param {number} ai
* @param {Body} bj
* @param {Shape} sj
* @param {Array} xj
* @param {number} aj
* @param {number} mu
*/
runNarrowphase(np:Narrowphase, bi:Body, si:Shape, xi:number[], ai:number, bj:Body, sj:Shape, xj:number[], aj:number, mu:number): void;
/**
* Set the relaxation for all equations and contact materials.
* @method setGlobalRelaxation
* @param {number} relaxation
*/
setGlobalRelaxation(relaxation: number): void;
/**
* Set the stiffness for all equations and contact materials.
* @method setGlobalStiffness
* @param {Number} stiffness
*/
setGlobalStiffness(stiffness: number): void;
}
}
\ No newline at end of file
/**
* 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