Commit 33676a89 authored by zjz1994's avatar zjz1994

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

parents a940764e f3ed9fcd
{
"name": "拼图",
"desc": "拼图模块1.0",
"props": {
"OFFSET_X": {
"alias": "OFFSET_X",
"type": "number",
"default": 0
},
"OFFSET_Y": {
"alias": "OFFSET_Y",
"type": "number",
"default": 0
},
"GAME_TIME": {
"alias": "游戏时间",
"type": "number",
"default": 20
},
"moistPercent": {
"alias": "湿润度",
"type": "number",
"default": 0
}
},
"assets": [
{
"name": "背景",
"url": "//yun.duiba.com.cn/aurora/assets/b7708649be2270379bd764e25ee2e783a7d49f7a.jpg",
"uuid": "a880ee6b-c6d1-4d8f-8734-367f368a1803",
"ext": ".jpg"
},
{
"name": "篮板",
"url": "//yun.duiba.com.cn/aurora/assets/13fd42607d6a79c9a8d0d053962d926fa45fa0c9.png",
"uuid": "a1c6f4d9-8f9a-4267-b701-d2a7e9ff5b1b",
"ext": ".png"
},
{
"name": "球网前",
"url": "//yun.duiba.com.cn/aurora/assets/6c94fab92bc10e8716a4d90666b96d73603b8e59.png",
"uuid": "882618a9-2cc9-498e-a764-268c6cfe6c99",
"ext": ".png"
},
{
"name": "球网后",
"url": "//yun.duiba.com.cn/aurora/assets/2a3596dd0291a20fcee55445752dc38634074c59.png",
"uuid": "0680dba9-757b-443b-8d0f-0d5811254c7d",
"ext": ".png"
},
{
"name": "篮球",
"url": "//yun.duiba.com.cn/aurora/assets/3dc11f2d91659b7e7e1d06a9853cbc9f818e1ea2.png",
"uuid": "270bbac6-b59e-4692-80c9-a95aa0b03c17",
"ext": ".png"
}
],
"events": {
"in": {
"game-reset": {
"alias": "重置"
},
"game-start": {
"alias": "开始",
"data": {
"picUrl": "图片路径",
"blockUrl": "blockUrl",
"GAME_TIME": "每局的游戏时间",
"MAX_ROW": "行",
"MAX_COL": "列",
"W": "宽",
"H": "高",
"GAP": "图片间隙",
"OFFSET_X": "OFFSET_X",
"OFFSET_Y": "OFFSET_Y"
}
},
"game-stop": {
"alias": "停止"
}
},
"out": {
"cloud-time-update": {
"alias": "倒计时更新",
"data": {
"time": "剩余时间"
}
},
"cloud-game-fail": {
"alias": "游戏结束",
"data": {
"reason": "结束原因(1:时间到了)"
}
},
"cloud-game-success": {
"alias": "游戏成功",
"data": {
"time": "游戏消耗时间"
}
}
}
},
"id": "basket",
"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.basket = factory(global.tslib));\n}(this, (function (tslib) { 'use strict';\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\t//# sourceMappingURL=utils.js.map\n\n\tvar GameTest = (function (_super) {\r\n\t tslib.__extends(GameTest, _super);\r\n\t function GameTest() {\r\n\t var _this = _super.call(this) || this;\r\n\t _this.isDebug = true;\r\n\t _this.factor = 10;\r\n\t _this.isRight = false;\r\n\t _this.saleX = _this.isRight ? 1 : -1;\r\n\t _this.ballAddSpeedX = -10;\r\n\t _this.ballAddSpeedY = 30;\r\n\t _this.addEventListener(engine.Event.ADDED_TO_STAGE, _this.setup, _this);\r\n\t return _this;\r\n\t }\r\n\t GameTest.prototype.start = function () {\r\n\t console.log(\"starting\");\r\n\t this.stage.addEventListener(engine.MouseEvent.CLICK, this.clickball, this);\r\n\t };\r\n\t GameTest.prototype.onClick = function (e) {\r\n\t var _a = this, world = _a.world, factor = _a.factor;\r\n\t var positionX = e.stageX / factor;\r\n\t var positionY = (engine.gameStage.stage.height - e.stageY) / factor;\r\n\t var display;\r\n\t if (Math.random() > 0.5) {\r\n\t var boxShape = new p2.Box({\r\n\t width: 200 / factor,\r\n\t height: 100 / factor,\r\n\t });\r\n\t var boxBody = new p2.Body({\r\n\t mass: 1,\r\n\t position: [positionX, positionY],\r\n\t angularVelocity: 1,\r\n\t });\r\n\t boxBody.addShape(boxShape);\r\n\t world.addBody(boxBody);\r\n\t {\r\n\t display = this.createBox(boxShape.width * factor, boxShape.height * factor);\r\n\t }\r\n\t }\r\n\t else {\r\n\t var boxShape = new p2.Circle({\r\n\t radius: 60 / factor,\r\n\t });\r\n\t var boxBody = new p2.Body({\r\n\t mass: 1,\r\n\t position: [positionX, positionY],\r\n\t });\r\n\t boxBody.addShape(boxShape);\r\n\t world.addBody(boxBody);\r\n\t {\r\n\t display = this.createBitmapByName(\"篮球\");\r\n\t }\r\n\t }\r\n\t boxBody.displays = [display];\r\n\t this.addChild(display);\r\n\t };\r\n\t GameTest.prototype.setup = function () {\r\n\t console.log(\"setup\");\r\n\t var world = new p2.World({});\r\n\t world.sleepMode = p2.World.BODY_SLEEPING;\r\n\t world.defaultContactMaterial.friction = 0.3;\r\n\t world.defaultContactMaterial.restitution = 0.7;\r\n\t var planeShape = new p2.Plane();\r\n\t var planeBody = new p2.Body({\r\n\t type: p2.Body.STATIC\r\n\t });\r\n\t planeBody.addShape(planeShape);\r\n\t planeBody.displays = [];\r\n\t world.addBody(planeBody);\r\n\t this.world = world;\r\n\t this.stage.addEventListener(engine.Event.ENTER_FRAME, this.onEnterFrame, this);\r\n\t var gameBg = new engine.Sprite(getTextureByName(\"背景\"));\r\n\t this.addChild(gameBg);\r\n\t var boardShape = new p2.Box({\r\n\t width: 20 / this.factor,\r\n\t height: 200 / this.factor\r\n\t });\r\n\t var boardBody = new p2.Body({\r\n\t position: [80 / this.factor, 1000 / this.factor]\r\n\t });\r\n\t boardBody.addShape(boardShape);\r\n\t var board = this.createBitmapByName('篮板');\r\n\t this.addChild(board);\r\n\t boardBody.displays = [board];\r\n\t this.world.addBody(boardBody);\r\n\t var boardPoint = new p2.Circle({\r\n\t radius: 1 / this.factor,\r\n\t });\r\n\t var boardPointBody = new p2.Body({\r\n\t position: [100 / this.factor,]\r\n\t });\r\n\t var boxShape = new p2.Circle({ radius: 60 / this.factor });\r\n\t this.boxBody = new p2.Body({\r\n\t mass: 0.1,\r\n\t position: [300 / this.factor, 900 / this.factor],\r\n\t velocity: [-5, -10],\r\n\t angularVelocity: -1\r\n\t });\r\n\t var balldisplay = this.createBitmapByName(\"篮球\");\r\n\t this.addChild(balldisplay);\r\n\t this.boxBody.displays = [balldisplay];\r\n\t this.boxBody.addShape(boxShape);\r\n\t this.world.addBody(this.boxBody);\r\n\t };\r\n\t GameTest.prototype.onEnterFrame = function () {\r\n\t this.world.step(60 / 1000);\r\n\t var len = this.world.bodies.length;\r\n\t for (var i = 0; i < len; i++) {\r\n\t var body = this.world.bodies[i];\r\n\t var display = body.displays[0];\r\n\t var stageHeight = engine.gameStage.stage.height;\r\n\t if (display) {\r\n\t display.x = body.position[0] * this.factor;\r\n\t display.y = stageHeight - body.position[1] * this.factor;\r\n\t display.rotation =\r\n\t ((body.angle + body.shapes[0].angle) * 180) / Math.PI;\r\n\t if (body.sleepState == p2.Body.SLEEPING) {\r\n\t display.alpha = 0.5;\r\n\t }\r\n\t else {\r\n\t display.alpha = 1;\r\n\t }\r\n\t }\r\n\t }\r\n\t if (this.boxBody.position[0] < -120 / this.factor) {\r\n\t this.boxBody.position[0] = (750 + 120) / this.factor;\r\n\t }\r\n\t if (this.boxBody.position[0] > (750 + 120) / this.factor) {\r\n\t this.boxBody.position[0] = -120 / this.factor;\r\n\t }\r\n\t };\r\n\t GameTest.prototype.clickball = function () {\r\n\t var direction = this.isRight ? -1 : 1;\r\n\t this.boxBody.velocity[0] = this.ballAddSpeedX * direction;\r\n\t this.boxBody.velocity[1] = this.ballAddSpeedY;\r\n\t this.boxBody.angularVelocity = -2 * direction;\r\n\t };\r\n\t GameTest.prototype.createPlane = function (x, y, w, h) {\r\n\t var sp = new engine.Shape();\r\n\t sp.beginFill(0x0000ff, 1);\r\n\t sp.drawRect(x, y, w, h);\r\n\t sp.endFill();\r\n\t this.addChild(sp);\r\n\t return sp;\r\n\t };\r\n\t GameTest.prototype.createBall = function (r) {\r\n\t var sp = new engine.Shape();\r\n\t sp.beginFill(0xff0000, 0.4);\r\n\t sp.drawCircle(0, 0, r);\r\n\t sp.endFill();\r\n\t return sp;\r\n\t };\r\n\t GameTest.prototype.createBox = function (width, height) {\r\n\t var sp = new engine.Shape();\r\n\t sp.beginFill(0xf0f0f0, 1);\r\n\t sp.drawRect(-width / 2, -height / 2, width, height);\r\n\t sp.endFill();\r\n\t return sp;\r\n\t };\r\n\t GameTest.prototype.createBitmapByName = function (name) {\r\n\t var imgContainer = new engine.Sprite();\r\n\t var img = new engine.Sprite(getTextureByName(name));\r\n\t img.anchorX = img.width / 2;\r\n\t img.anchorY = img.height / 2;\r\n\t img.x = -img.width / 2;\r\n\t img.y = -img.height / 2;\r\n\t imgContainer.addChild(img);\r\n\t return imgContainer;\r\n\t };\r\n\t GameTest.prototype.stop = function () { };\r\n\t return GameTest;\r\n\t}(engine.Container));\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\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('game-start', _this.start, _this);\r\n\t engine.globalEvent.addEventListener('game-stop', _this.stop, _this);\r\n\t var gameTest = _this._gameTest = new GameTest();\r\n\t _this.addChild(gameTest);\r\n\t return _this;\r\n\t }\r\n\t GameWrapper.prototype.start = function (event) {\r\n\t injectProps(event.data);\r\n\t this._gameTest.start();\r\n\t };\r\n\t GameWrapper.prototype.stop = function (event) {\r\n\t this._gameTest.stop();\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"
}
......@@ -10,7 +10,7 @@
"MAX_ROW": {
"alias": "图片分成几行",
"type": "number",
"default": 4
"default": 3
},
"W": {
"alias": "图片的宽度",
......@@ -40,7 +40,7 @@
"GAME_TIME": {
"alias": "游戏时间",
"type": "number",
"default": 10
"default": 100
}
},
"assets": [
......@@ -89,5 +89,5 @@
}
},
"id": "pictures",
"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.pictures = 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}\n\n\tvar picMap = {};\r\n\tvar posMap = {};\r\n\tvar qietu = (function (parent, url, MAX_COL, MAX_ROW) {\r\n\t if (picMap[url]) {\r\n\t var pics = picMap[url];\r\n\t for (var _i = 0, pics_1 = pics; _i < pics_1.length; _i++) {\r\n\t var pic = pics_1[_i];\r\n\t parent.addChild(pic);\r\n\t }\r\n\t return [picMap[url], posMap[url]];\r\n\t }\r\n\t var W = props.W;\r\n\t var H = props.H;\r\n\t var GAP = props.GAP;\r\n\t var spr = [];\r\n\t var pos = [];\r\n\t var _loop_1 = function (row) {\r\n\t var _loop_2 = function (col) {\r\n\t var child = engine.Sprite.fromImage(url);\r\n\t spr.push(child);\r\n\t child.scaleX = 1 / MAX_COL;\r\n\t child.scaleY = 1 / MAX_ROW;\r\n\t parent.addChild(child);\r\n\t child.x = col * (W / MAX_COL + GAP);\r\n\t child.y = row * (H / MAX_ROW + GAP);\r\n\t pos.push([child.x, child.y]);\r\n\t child.addEventListener(engine.Event.COMPLETE, function () {\r\n\t var uvs = new Float32Array([\r\n\t col / MAX_COL,\r\n\t row / MAX_ROW,\r\n\t (col + 1) / MAX_COL,\r\n\t row / MAX_ROW,\r\n\t (col + 1) / MAX_COL,\r\n\t (row + 1) / MAX_ROW,\r\n\t col / MAX_COL,\r\n\t (row + 1) / MAX_ROW,\r\n\t ]);\r\n\t child.uvs = uvs;\r\n\t });\r\n\t };\r\n\t for (var col = 0; col < MAX_COL; col++) {\r\n\t _loop_2(col);\r\n\t }\r\n\t };\r\n\t for (var row = 0; row < MAX_ROW; row++) {\r\n\t _loop_1(row);\r\n\t }\r\n\t picMap[url] = spr.concat([]);\r\n\t posMap[url] = pos.concat([]);\r\n\t return [spr, pos];\r\n\t});\n\n\tfunction getIndexFromRC(row, col, maxCol) {\r\n\t var index;\r\n\t index = row * maxCol + col;\r\n\t return index;\r\n\t}\r\n\tfunction getRandomArray(array) {\r\n\t array.sort(function () {\r\n\t return .5 - Math.random();\r\n\t });\r\n\t}\n\n\tvar MAX_COL;\r\n\tvar MAX_ROW;\r\n\tvar W;\r\n\tvar H;\r\n\tvar GAP;\r\n\tvar GAME_TIME;\r\n\tvar w;\r\n\tvar h;\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._timeCounter = 0;\r\n\t _this.listenStageOn = 1;\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.start = function () {\r\n\t var _this = this;\r\n\t MAX_COL = props.column || props.MAX_COL;\r\n\t MAX_ROW = props.row || props.MAX_ROW;\r\n\t GAME_TIME = props.gameTime || props.GAME_TIME;\r\n\t console.log('start', props.column, props.row, props.gameTime);\r\n\t if (!this.guideHole) {\r\n\t this.guideHole = new engine.Image();\r\n\t this.guideHole.source = 'asset://' + props.blockUrl;\r\n\t this.guideHole.mouseChildren = this.guideHole.mouseEnabled = false;\r\n\t }\r\n\t if (this.pictures) {\r\n\t for (var _i = 0, _a = this.pictures; _i < _a.length; _i++) {\r\n\t var pic = _a[_i];\r\n\t if (pic && pic.wrapper)\r\n\t pic.wrapper.removeChild(pic);\r\n\t }\r\n\t }\r\n\t console.log('on start');\r\n\t engine.globalEvent.dispatchEvent('pictures-time-update', {\r\n\t second: this.getSecond(),\r\n\t });\r\n\t var result = qietu(this.picturesWrapper, props.picUrl, MAX_COL, MAX_ROW);\r\n\t this.picturesWrapper.addChild(this.guideHole);\r\n\t console.log(this.picturesWrapper);\r\n\t this.pictures = result[0];\r\n\t this.rightList = this.pictures.concat([]);\r\n\t var posList = result[1];\r\n\t getRandomArray(this.pictures);\r\n\t var i = 0;\r\n\t var len;\r\n\t len = this.pictures.length;\r\n\t for (; i < len; i++) {\r\n\t this.dragPic = this.pictures[i];\r\n\t this.pictures[i].addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDown, this);\r\n\t var _b = posList[i], x = _b[0], y = _b[1];\r\n\t this.dragPic.x = x;\r\n\t this.dragPic.y = y;\r\n\t }\r\n\t this._timer = setInterval(function () {\r\n\t _this.onTimer();\r\n\t }, 10);\r\n\t this.date = new Date().getTime();\r\n\t };\r\n\t GameView.prototype.onTimer = function () {\r\n\t var date = new Date().getTime();\r\n\t var gap = ((date - this.date) / 1000);\r\n\t this.date = date;\r\n\t console.log(gap, \"gap\");\r\n\t GAME_TIME -= gap;\r\n\t if (GAME_TIME < 0) {\r\n\t GAME_TIME = 0;\r\n\t }\r\n\t GAME_TIME = this.afterPointTwo(GAME_TIME);\r\n\t GAME_TIME = GAME_TIME.toFixed(2);\r\n\t if (GAME_TIME < 10) {\r\n\t GAME_TIME = '0' + GAME_TIME;\r\n\t }\r\n\t console.log(GAME_TIME);\r\n\t engine.globalEvent.dispatchEvent('pictures-time-update', {\r\n\t second: this.getSecond(),\r\n\t });\r\n\t if (this.getSecond() == 0) {\r\n\t this.stop();\r\n\t engine.globalEvent.dispatchEvent('pictures-game-fail', {\r\n\t reason: 1\r\n\t });\r\n\t }\r\n\t };\r\n\t GameView.prototype.afterPointTwo = function (n) {\r\n\t var floatN = parseFloat(n);\r\n\t if (isNaN(floatN)) {\r\n\t return;\r\n\t }\r\n\t floatN = Math.round(floatN * 100) / 100;\r\n\t return floatN;\r\n\t };\r\n\t GameView.prototype.getSecond = function () {\r\n\t return GAME_TIME;\r\n\t };\r\n\t GameView.prototype.stop = function () {\r\n\t GAME_TIME = props.GAME_TIME;\r\n\t clearInterval(this._timer);\r\n\t var len = this.pictures.length;\r\n\t for (var i = 0; i < len; i++) {\r\n\t this.pictures[i].removeAllEventListener();\r\n\t }\r\n\t this.stage.removeEventListener(engine.MouseEvent.MOUSE_UP, this.stageOnUp, this);\r\n\t };\r\n\t GameView.prototype.createRects = function () { };\r\n\t GameView.prototype.setup = function () {\r\n\t MAX_COL = props.MAX_COL;\r\n\t MAX_ROW = props.MAX_ROW;\r\n\t GAME_TIME = props.GAME_TIME;\r\n\t W = props.W;\r\n\t H = props.H;\r\n\t GAP = props.GAP;\r\n\t w = W / MAX_COL;\r\n\t h = H / MAX_ROW;\r\n\t console.log('onSteup', props);\r\n\t var parent = new engine.Sprite();\r\n\t this.picturesWrapper = parent;\r\n\t this.addChild(parent);\r\n\t };\r\n\t GameView.prototype.onDown = function (e) {\r\n\t var stageLeft = (750 - props.W) / 2;\r\n\t var stageTop = (this.stage.height - props.H) / 2;\r\n\t this.dragPic = e.target;\r\n\t this.picturesWrapper.addChild(this.dragPic);\r\n\t this.localPicX = e.localX / MAX_COL;\r\n\t this.localPicY = e.localY / MAX_ROW;\r\n\t this.distanceX = this.dragPic.x;\r\n\t this.distanceY = this.dragPic.y;\r\n\t this.indexJ = Math.floor((this.distanceX) / (w + GAP));\r\n\t this.indexI = Math.floor((this.distanceY) / (h + GAP));\r\n\t this.index = (this.indexI) * MAX_COL + this.indexJ;\r\n\t this.centerX = Math.floor((e.clientX - stageLeft) / w) * w + w / 2;\r\n\t this.centerY = Math.floor((e.clientY - stageTop) / h) * h + h / 2;\r\n\t this.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE, this.onMove, this);\r\n\t this.stage.addEventListener(engine.MouseEvent.MOUSE_UP, this.stageOnUp, this);\r\n\t };\r\n\t GameView.prototype.stageOnUp = function (e) {\r\n\t var stageLeft = (750 - props.W) / 2;\r\n\t var stageTop = (this.stage.height - props.H) / 2;\r\n\t this.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE, this.onMove, this);\r\n\t this.stage.removeEventListener(engine.MouseEvent.MOUSE_UP, this.stageOnUp, this);\r\n\t if (this.centerY < stageTop || this.centerX < stageLeft) {\r\n\t this.dragPic.x = this.distanceX;\r\n\t this.dragPic.y = this.distanceY;\r\n\t }\r\n\t var curJ = Math.floor(this.centerX / (w + GAP));\r\n\t var curI = Math.floor(this.centerY / (h + GAP));\r\n\t this.picturesWrapper.addChild(this.guideHole);\r\n\t if (0 <= curJ && curJ < (MAX_COL) && 0 <= curI && curI < (MAX_ROW)) {\r\n\t var index = getIndexFromRC(curI, curJ, MAX_COL);\r\n\t var dropPic = this.pictures[index];\r\n\t var dropPicX = dropPic.x + stageLeft;\r\n\t var dropPicy = dropPic.y + stageTop;\r\n\t dropPic.x = this.distanceX;\r\n\t dropPic.y = this.distanceY;\r\n\t this.dragPic.x = dropPicX - stageLeft;\r\n\t this.dragPic.y = dropPicy - stageTop;\r\n\t var dropPicIndex = this.pictures.indexOf(dropPic);\r\n\t var dragPicIndex = this.pictures.indexOf(this.dragPic);\r\n\t this.pictures[dropPicIndex] = this.dragPic;\r\n\t this.pictures[dragPicIndex] = dropPic;\r\n\t if (dragPicIndex === dropPicIndex) {\r\n\t this.dragPic.x = this.distanceX;\r\n\t this.dragPic.y = this.distanceY;\r\n\t }\r\n\t var result = true;\r\n\t for (var j = 0; j < this.rightList.length; j++) {\r\n\t if (this.rightList[j] != this.pictures[j]) {\r\n\t result = false;\r\n\t break;\r\n\t }\r\n\t }\r\n\t if (result) {\r\n\t this.onSuccess();\r\n\t }\r\n\t }\r\n\t else {\r\n\t this.dragPic.x = this.distanceX;\r\n\t this.dragPic.y = this.distanceY;\r\n\t }\r\n\t };\r\n\t GameView.prototype.onSuccess = function () {\r\n\t console.log('拼图成功!');\r\n\t engine.globalEvent.dispatchEvent('pictures-game-success', { time: GAME_TIME });\r\n\t this.stop();\r\n\t };\r\n\t GameView.prototype.onMove = function (e) {\r\n\t this.dragPic.x = e.stageX - this.localPicX - (750 - props.W) / 2;\r\n\t this.dragPic.y = e.stageY - this.localPicY - (this.stage.height - props.H) / 2;\r\n\t this.centerX = this.dragPic.x + w / 2;\r\n\t this.centerY = this.dragPic.y + h / 2;\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('pictures-start', _this.start, _this);\r\n\t engine.globalEvent.addEventListener('pictures-stop', _this.stop, _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.start = function (event) {\r\n\t injectProps(event.data);\r\n\t this._gameView.start();\r\n\t };\r\n\t GameWrapper.prototype.stop = function (event) {\r\n\t this._gameView.stop();\r\n\t };\r\n\t return GameWrapper;\r\n\t}(engine.Container));\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}\n\n\treturn index;\n\n})));\n"
"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.pictures = 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\tvar picMap = {};\r\n\tvar posMap = {};\r\n\tvar qietu = (function (parent, url, MAX_COL, MAX_ROW) {\r\n\t if (picMap[url]) {\r\n\t var pics = picMap[url];\r\n\t for (var _i = 0, pics_1 = pics; _i < pics_1.length; _i++) {\r\n\t var pic = pics_1[_i];\r\n\t parent.addChild(pic);\r\n\t }\r\n\t return [picMap[url], posMap[url]];\r\n\t }\r\n\t var W = props.W;\r\n\t var H = props.H;\r\n\t var GAP = props.GAP;\r\n\t var spr = [];\r\n\t var pos = [];\r\n\t var _loop_1 = function (row) {\r\n\t var _loop_2 = function (col) {\r\n\t var child = engine.Sprite.fromImage(url);\r\n\t spr.push(child);\r\n\t child.scaleX = 1 / MAX_COL;\r\n\t child.scaleY = 1 / MAX_ROW;\r\n\t parent.addChild(child);\r\n\t child.x = col * (W / MAX_COL + GAP);\r\n\t child.y = row * (H / MAX_ROW + GAP);\r\n\t pos.push([child.x, child.y]);\r\n\t child.addEventListener(engine.Event.COMPLETE, function () {\r\n\t var uvs = new Float32Array([\r\n\t col / MAX_COL,\r\n\t row / MAX_ROW,\r\n\t (col + 1) / MAX_COL,\r\n\t row / MAX_ROW,\r\n\t (col + 1) / MAX_COL,\r\n\t (row + 1) / MAX_ROW,\r\n\t col / MAX_COL,\r\n\t (row + 1) / MAX_ROW,\r\n\t ]);\r\n\t child.uvs = uvs;\r\n\t });\r\n\t };\r\n\t for (var col = 0; col < MAX_COL; col++) {\r\n\t _loop_2(col);\r\n\t }\r\n\t };\r\n\t for (var row = 0; row < MAX_ROW; row++) {\r\n\t _loop_1(row);\r\n\t }\r\n\t picMap[url] = spr.concat([]);\r\n\t posMap[url] = pos.concat([]);\r\n\t return [spr, pos];\r\n\t});\r\n\t//# sourceMappingURL=qietu.js.map\n\n\tfunction getIndexFromRC(row, col, maxCol) {\r\n\t var index;\r\n\t index = row * maxCol + col;\r\n\t return index;\r\n\t}\r\n\tfunction getRandomArray(array) {\r\n\t array.sort(function () {\r\n\t return .5 - Math.random();\r\n\t });\r\n\t}\r\n\t//# sourceMappingURL=utils.js.map\n\n\tvar MAX_COL;\r\n\tvar MAX_ROW;\r\n\tvar W;\r\n\tvar H;\r\n\tvar GAP;\r\n\tvar GAME_TIME;\r\n\tvar w;\r\n\tvar h;\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._timeCounter = 0;\r\n\t _this.listenStageOn = 1;\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.start = function () {\r\n\t var _this = this;\r\n\t MAX_COL = props.MAX_COL;\r\n\t MAX_ROW = props.MAX_ROW;\r\n\t GAME_TIME = props.GAME_TIME;\r\n\t console.log('start', props.column, props.row, props.gameTime);\r\n\t if (!this.guideHole) {\r\n\t this.guideHole = new engine.Image();\r\n\t this.guideHole.source = 'asset://' + props.blockUrl;\r\n\t this.guideHole.mouseChildren = this.guideHole.mouseEnabled = false;\r\n\t }\r\n\t if (this.pictures) {\r\n\t for (var _i = 0, _a = this.pictures; _i < _a.length; _i++) {\r\n\t var pic = _a[_i];\r\n\t if (pic && pic.wrapper)\r\n\t pic.wrapper.removeChild(pic);\r\n\t }\r\n\t }\r\n\t console.log('on start');\r\n\t engine.globalEvent.dispatchEvent('pictures-time-update', {\r\n\t second: this.getSecond(),\r\n\t });\r\n\t var result = qietu(this.picturesWrapper, props.picUrl, MAX_COL, MAX_ROW);\r\n\t this.picturesWrapper.addChild(this.guideHole);\r\n\t console.log(this.picturesWrapper);\r\n\t this.pictures = result[0];\r\n\t this.rightList = this.pictures.concat([]);\r\n\t var posList = result[1];\r\n\t getRandomArray(this.pictures);\r\n\t var i = 0;\r\n\t var len;\r\n\t len = this.pictures.length;\r\n\t for (; i < len; i++) {\r\n\t this.dragPic = this.pictures[i];\r\n\t this.pictures[i].addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDown, this);\r\n\t var _b = posList[i], x = _b[0], y = _b[1];\r\n\t this.dragPic.x = x;\r\n\t this.dragPic.y = y;\r\n\t }\r\n\t this._timer = setInterval(function () {\r\n\t _this.onTimer();\r\n\t }, 10);\r\n\t this.date = new Date().getTime();\r\n\t };\r\n\t GameView.prototype.onTimer = function () {\r\n\t var date = new Date().getTime();\r\n\t var gap = ((date - this.date) / 1000);\r\n\t this.date = date;\r\n\t console.log(gap, \"gap\");\r\n\t GAME_TIME -= gap;\r\n\t if (GAME_TIME < 0) {\r\n\t GAME_TIME = 0;\r\n\t }\r\n\t GAME_TIME = this.afterPointTwo(GAME_TIME);\r\n\t GAME_TIME = GAME_TIME.toFixed(2);\r\n\t if (GAME_TIME < 10) {\r\n\t GAME_TIME = '0' + GAME_TIME;\r\n\t }\r\n\t console.log(GAME_TIME, \"gametime1\");\r\n\t engine.globalEvent.dispatchEvent('pictures-time-update', {\r\n\t second: this.getSecond(),\r\n\t });\r\n\t if (this.getSecond() == 0) {\r\n\t this.stop();\r\n\t engine.globalEvent.dispatchEvent('pictures-game-fail', {\r\n\t reason: 1\r\n\t });\r\n\t }\r\n\t };\r\n\t GameView.prototype.afterPointTwo = function (n) {\r\n\t var floatN = parseFloat(n);\r\n\t if (isNaN(floatN)) {\r\n\t return;\r\n\t }\r\n\t floatN = Math.round(floatN * 100) / 100;\r\n\t return floatN;\r\n\t };\r\n\t GameView.prototype.getSecond = function () {\r\n\t return GAME_TIME;\r\n\t };\r\n\t GameView.prototype.stop = function () {\r\n\t GAME_TIME = props.GAME_TIME;\r\n\t clearInterval(this._timer);\r\n\t var len = this.pictures.length;\r\n\t for (var i = 0; i < len; i++) {\r\n\t this.pictures[i].removeAllEventListener();\r\n\t }\r\n\t this.stage.removeEventListener(engine.MouseEvent.MOUSE_UP, this.stageOnUp, this);\r\n\t };\r\n\t GameView.prototype.createRects = function () { };\r\n\t GameView.prototype.setup = function () {\r\n\t MAX_COL = props.MAX_COL;\r\n\t MAX_ROW = props.MAX_ROW;\r\n\t GAME_TIME = props.GAME_TIME;\r\n\t console.log(GAME_TIME, 'setuptime');\r\n\t W = props.W;\r\n\t H = props.H;\r\n\t GAP = props.GAP;\r\n\t w = W / MAX_COL;\r\n\t h = H / MAX_ROW;\r\n\t console.log('onSteup', props);\r\n\t var parent = new engine.Sprite();\r\n\t this.picturesWrapper = parent;\r\n\t this.addChild(parent);\r\n\t };\r\n\t GameView.prototype.onDown = function (e) {\r\n\t var stageLeft = (750 - props.W) / 2;\r\n\t var stageTop = (this.stage.height - props.H) / 2;\r\n\t this.dragPic = e.target;\r\n\t this.picturesWrapper.addChild(this.dragPic);\r\n\t this.localPicX = e.localX / MAX_COL;\r\n\t this.localPicY = e.localY / MAX_ROW;\r\n\t this.distanceX = this.dragPic.x;\r\n\t this.distanceY = this.dragPic.y;\r\n\t this.indexJ = Math.floor((this.distanceX) / (w + GAP));\r\n\t this.indexI = Math.floor((this.distanceY) / (h + GAP));\r\n\t this.index = (this.indexI) * MAX_COL + this.indexJ;\r\n\t this.centerX = Math.floor((e.clientX - stageLeft) / w) * w + w / 2;\r\n\t this.centerY = Math.floor((e.clientY - stageTop) / h) * h + h / 2;\r\n\t this.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE, this.onMove, this);\r\n\t this.stage.addEventListener(engine.MouseEvent.MOUSE_UP, this.stageOnUp, this);\r\n\t };\r\n\t GameView.prototype.stageOnUp = function (e) {\r\n\t var stageLeft = (750 - props.W) / 2;\r\n\t var stageTop = (this.stage.height - props.H) / 2;\r\n\t this.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE, this.onMove, this);\r\n\t this.stage.removeEventListener(engine.MouseEvent.MOUSE_UP, this.stageOnUp, this);\r\n\t if (this.centerY < stageTop || this.centerX < stageLeft) {\r\n\t this.dragPic.x = this.distanceX;\r\n\t this.dragPic.y = this.distanceY;\r\n\t }\r\n\t var curJ = Math.floor(this.centerX / (w + GAP));\r\n\t var curI = Math.floor(this.centerY / (h + GAP));\r\n\t this.picturesWrapper.addChild(this.guideHole);\r\n\t if (0 <= curJ && curJ < (MAX_COL) && 0 <= curI && curI < (MAX_ROW)) {\r\n\t var index = getIndexFromRC(curI, curJ, MAX_COL);\r\n\t var dropPic = this.pictures[index];\r\n\t var dropPicX = dropPic.x + stageLeft;\r\n\t var dropPicy = dropPic.y + stageTop;\r\n\t dropPic.x = this.distanceX;\r\n\t dropPic.y = this.distanceY;\r\n\t this.dragPic.x = dropPicX - stageLeft;\r\n\t this.dragPic.y = dropPicy - stageTop;\r\n\t var dropPicIndex = this.pictures.indexOf(dropPic);\r\n\t var dragPicIndex = this.pictures.indexOf(this.dragPic);\r\n\t this.pictures[dropPicIndex] = this.dragPic;\r\n\t this.pictures[dragPicIndex] = dropPic;\r\n\t if (dragPicIndex === dropPicIndex) {\r\n\t this.dragPic.x = this.distanceX;\r\n\t this.dragPic.y = this.distanceY;\r\n\t }\r\n\t var result = true;\r\n\t for (var j = 0; j < this.rightList.length; j++) {\r\n\t if (this.rightList[j] != this.pictures[j]) {\r\n\t result = false;\r\n\t break;\r\n\t }\r\n\t }\r\n\t if (result) {\r\n\t this.onSuccess();\r\n\t }\r\n\t }\r\n\t else {\r\n\t this.dragPic.x = this.distanceX;\r\n\t this.dragPic.y = this.distanceY;\r\n\t }\r\n\t };\r\n\t GameView.prototype.onSuccess = function () {\r\n\t console.log('拼图成功!');\r\n\t engine.globalEvent.dispatchEvent('pictures-game-success', { time: GAME_TIME });\r\n\t this.stop();\r\n\t };\r\n\t GameView.prototype.onMove = function (e) {\r\n\t this.dragPic.x = e.stageX - this.localPicX - (750 - props.W) / 2;\r\n\t this.dragPic.y = e.stageY - this.localPicY - (this.stage.height - props.H) / 2;\r\n\t this.centerX = this.dragPic.x + w / 2;\r\n\t this.centerY = this.dragPic.y + h / 2;\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('pictures-start', _this.start, _this);\r\n\t engine.globalEvent.addEventListener('pictures-stop', _this.stop, _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.start = function (event) {\r\n\t injectProps(event.data);\r\n\t this._gameView.start();\r\n\t };\r\n\t GameWrapper.prototype.stop = function (event) {\r\n\t this._gameView.stop();\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"
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -44,7 +44,18 @@ function launchWithCustomModule(customModule) {
setTimeout(() => {
engine.addCustomModule(customId, engine.gameStage.sceneContainer.getChildAt(0));
}, 100);
setTimeout(() => {
engine.globalEvent.dispatchEvent('game-start', {
picUrl: "http://yun.duiba.com.cn/aurora/assets/e1593b97c27077b85b92f7eaaeae1ed64a1eb79a.png",
blockUrl: "888",
column:"2",
row:"2",
gameTime:"50"
});
const d = engine.gameStage.sceneContainer.getChildAt(0);
}, 100);
// setTimeout(() => {
// engine.globalEvent.dispatchEvent('cloud-game-reset', {
......
......@@ -12,314 +12,176 @@
}
//# sourceMappingURL=utils.js.map
var BasketBoard = (function (_super) {
tslib.__extends(BasketBoard, _super);
function BasketBoard() {
var GameTest = (function (_super) {
tslib.__extends(GameTest, _super);
function GameTest() {
var _this = _super.call(this) || this;
_this.board = new engine.Sprite(getTextureByName('篮板'));
_this.netFront = new engine.Sprite(getTextureByName('球网前'));
_this.netBack = new engine.Sprite(getTextureByName('球网后'));
_this.config = {
boardBody: {
x: 0,
y: 0,
width: 0.3,
height: 2
},
insidePointBody: {
x: 15,
y: 65,
radius: 0.07
},
outsidePointBody: {
x: 180,
y: 65,
radius: 0.05
},
upSensorBody: {
x: 100,
y: 65,
radius: 0.05
},
downSensorBody: {
x: 100,
y: 65 + 80,
radius: 0.05
}
};
_this.addChild(_this.board);
var shape = new engine.Shape();
shape.beginFill(0xff0000, 0.5);
shape.drawEllipse(50, 150, 200, 80);
shape.endFill();
_this.board.addChild(shape);
return _this;
}
BasketBoard.prototype.setPosition = function (x, y) {
this.x = x;
this.y = y;
};
return BasketBoard;
}(engine.Container));
//# sourceMappingURL=basketBoard.js.map
var GameView = (function (_super) {
tslib.__extends(GameView, _super);
function GameView() {
var _this = _super.call(this) || this;
_this.basketBoard = new BasketBoard();
_this.pool = {};
_this.horizontal = [74, 676];
_this.verticalArea = [200, 600];
_this.verticalInit = 462 - 45;
_this.positionInitBall = {
x: 551,
y: 805,
};
_this.vertical = _this.verticalInit;
_this.isDebug = true;
_this.factor = 10;
_this.isRight = false;
_this.saleX = _this.isRight ? 1 : -1;
_this.config = {
net: {
x: 9.5,
y: 19 + 45,
},
insidePointBody: {
x: 15,
y: 65,
radius: 0.07,
},
outsidePointBody: {
x: 180,
y: 65,
radius: 0.05,
},
boardBody: {
x: 0,
y: 0,
width: 0.3,
height: 2,
},
upSensorBody: {
x: 100,
y: 65,
radius: 0.05,
},
downSensorBody: {
x: 100,
y: 65 + 80,
radius: 0.05,
},
};
_this.toRo = 180 / Math.PI;
_this.loopMark = false;
_this.guideMark = false;
_this.inPointMark = false;
_this.outPointMark = false;
_this.boardMark = false;
_this.pointMark = false;
_this.planeMark = false;
_this.stringMark = "";
_this.ballAddSpeedX = -40;
_this.ballAddSpeedY = -80;
_this.gravity = -5;
_this.stepSpeed = [0.5, 3.5];
_this.detaTimeEf = _this.stepSpeed[1];
_this.ballSpeedLimitX = 3;
_this.planeHeight = 1100;
_this.brokeMark = false;
_this.doubleHit = 0;
_this.timeLimit = window["timeLimit"] ? window["timeLimit"] : 5;
_this.timeMark = false;
_this.timeCount = _this.timeLimit;
_this.timeSpeed = 1 / 60;
_this.clickMark = false;
_this.once(engine.Event.ADDED_TO_STAGE, _this.start, _this);
var p2 = window["p2"];
_this.world = new p2.World();
_this.world.sleepMode = p2.World.BODY_SLEEPING;
_this.world.gravity = [0, 10];
var box = new p2.Box({
width: 20,
height: 200,
material: materialBoard,
});
_this.boxBody = new p2.Body({
mass: 0,
type: p2.Body.STATIC,
position: [20, 400],
_this.ballAddSpeedX = -10;
_this.ballAddSpeedY = 30;
_this.addEventListener(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
return _this;
}
GameTest.prototype.start = function () {
console.log("starting");
this.stage.addEventListener(engine.MouseEvent.CLICK, this.clickball, this);
};
GameTest.prototype.onClick = function (e) {
var _a = this, world = _a.world, factor = _a.factor;
var positionX = e.stageX / factor;
var positionY = (engine.gameStage.stage.height - e.stageY) / factor;
var display;
if (Math.random() > 0.5) {
var boxShape = new p2.Box({
width: 200 / factor,
height: 100 / factor,
});
_this.boxBody.addShape(box);
_this.box = _this.createBox(0, -100, 20, 200);
_this.boxBody.displays = [_this.box];
_this.world.addBody(_this.boxBody);
_this.world.defaultContactMaterial.friction = 0.1;
_this.world.defaultContactMaterial.restitution = 1;
_this.world.setGlobalStiffness(1e5);
var materialBall = new p2.Material(2);
var materialPoint = new p2.Material(2);
var materialBoard = new p2.Material(2);
var materialPlane = new p2.Material(2);
var contactMaterialBallPoint = new p2.ContactMaterial(materialBall, materialPoint, {
friction: 0.3,
restitution: 0.5,
var boxBody = new p2.Body({
mass: 1,
position: [positionX, positionY],
angularVelocity: 1,
});
var contactMaterialBallBoard = new p2.ContactMaterial(materialBall, materialBoard, {
friction: 0.1,
restitution: 1,
boxBody.addShape(boxShape);
world.addBody(boxBody);
{
display = this.createBox(boxShape.width * factor, boxShape.height * factor);
}
}
else {
var boxShape = new p2.Circle({
radius: 60 / factor,
});
var contactMaterialBallPlane = new p2.ContactMaterial(materialBall, materialPlane, {
friction: 0.1,
restitution: 1,
var boxBody = new p2.Body({
mass: 1,
position: [positionX, positionY],
});
_this.world.addContactMaterial(contactMaterialBallPoint);
_this.world.addContactMaterial(contactMaterialBallBoard);
_this.world.addContactMaterial(contactMaterialBallPlane);
var circleShape = new p2.Circle({
radius: 1,
material: materialPoint,
boxBody.addShape(boxShape);
world.addBody(boxBody);
{
display = this.createBitmapByName("篮球");
}
}
boxBody.displays = [display];
this.addChild(display);
};
GameTest.prototype.setup = function () {
console.log("setup");
var world = new p2.World({});
world.sleepMode = p2.World.BODY_SLEEPING;
world.defaultContactMaterial.friction = 0.3;
world.defaultContactMaterial.restitution = 0.7;
var planeShape = new p2.Plane();
var planeBody = new p2.Body({
type: p2.Body.STATIC
});
var circleBody = _this.circleBody = new p2.Body({
mass: 0,
position: [60, 500],
type: p2.Body.STATIC,
planeBody.addShape(planeShape);
planeBody.displays = [];
world.addBody(planeBody);
this.world = world;
this.stage.addEventListener(engine.Event.ENTER_FRAME, this.onEnterFrame, this);
var gameBg = new engine.Sprite(getTextureByName("背景"));
this.addChild(gameBg);
var boardShape = new p2.Box({
width: 20 / this.factor,
height: 200 / this.factor
});
circleBody.addShape(circleShape);
_this.world.addBody(circleBody);
var ellipse = _this.createBox(0, 0, 20, 20);
circleBody.displays = [ellipse];
var circleShape1 = new p2.Circle({
radius: 1,
material: materialPoint,
var boardBody = new p2.Body({
position: [80 / this.factor, 1000 / this.factor]
});
var circleBody1 = _this.circleBody1 = new p2.Body({
mass: 0,
position: [200, 500],
type: p2.Body.STATIC,
boardBody.addShape(boardShape);
var board = this.createBitmapByName('篮板');
this.addChild(board);
boardBody.displays = [board];
this.world.addBody(boardBody);
var boardPoint = new p2.Circle({
radius: 1 / this.factor,
});
circleBody1.addShape(circleShape1);
_this.world.addBody(circleBody1);
var ellipse2 = _this.createBox(0, 0, 20, 20);
circleBody1.displays = [ellipse2];
var ball = new p2.Circle({ radius: 60 });
var basketball = _this.basketball = new p2.Body({
mass: 1,
position: [300, 250],
velocity: [0, 40],
material: materialBall,
var boardPointBody = new p2.Body({
position: [100 / this.factor,]
});
_this.basketball.addShape(ball);
_this.world.addBody(_this.basketball);
_this.ball = _this.createCircle();
_this.basketball.displays = [_this.ball];
var stringMark = _this.stringMark;
var self = _this;
var plane = new p2.Plane();
_this.planeBody = new p2.Body({
position: [engine.gameStage.width, engine.gameStage.height - 200],
material: materialPlane,
var boxShape = new p2.Circle({ radius: 60 / this.factor });
this.boxBody = new p2.Body({
mass: 0.1,
position: [300 / this.factor, 900 / this.factor],
velocity: [-5, -10],
angularVelocity: -1
});
_this.planeBody.angle = Math.PI;
_this.planeBody.addShape(plane);
_this.world.addBody(_this.planeBody);
_this.plane = _this.createPlane();
_this.planeBody.displays = [_this.plane];
_this.world.on('beginContact', function (e) {
if (e.bodyA == circleBody || e.bodyA == circleBody1) {
if (basketball.position[0] > circleBody.position[0] &&
basketball.position[0] < circleBody1.position[0]) {
if (basketball.position[1] > circleBody.position[1] || basketball.position[1] > circleBody1.position[1]) {
console.log("上往下");
self.isRight = !self.isRight;
self.changePosition();
}
}
}
});
_this.addEventListener(engine.Event.ENTER_FRAME, _this.onEnterFrame, _this);
return _this;
}
GameView.prototype.onEnterFrame = function () {
var balldisplay = this.createBitmapByName("篮球");
this.addChild(balldisplay);
this.boxBody.displays = [balldisplay];
this.boxBody.addShape(boxShape);
this.world.addBody(this.boxBody);
};
GameTest.prototype.onEnterFrame = function () {
this.world.step(60 / 1000);
var len = this.world.bodies.length;
for (var i = 0; i < len; i++) {
var body = this.world.bodies[i];
var display = body.displays[0];
display.x = body.position[0];
display.y = body.position[1];
display.rotation = (body.angle * 180) / Math.PI;
var stageHeight = engine.gameStage.stage.height;
if (display) {
display.x = body.position[0] * this.factor;
display.y = stageHeight - body.position[1] * this.factor;
display.rotation =
((body.angle + body.shapes[0].angle) * 180) / Math.PI;
if (body.sleepState == p2.Body.SLEEPING) {
display.alpha = 0.5;
}
else {
display.alpha = 1;
}
}
if (this.basketball.position[0] < -120) {
this.basketball.position[0] = 750;
}
if (this.basketball.position[0] > 750 + 120) {
this.basketball.position[0] = -120;
if (this.boxBody.position[0] < -120 / this.factor) {
this.boxBody.position[0] = (750 + 120) / this.factor;
}
if (this.boxBody.position[0] > (750 + 120) / this.factor) {
this.boxBody.position[0] = -120 / this.factor;
}
};
GameView.prototype.createBox = function (x, y, w, h) {
var sp = new engine.Shape();
sp.beginFill(0x0000ff);
sp.drawRect(x, y, w, h);
sp.endFill();
sp.anchorX = sp.width / 2;
sp.anchorY = sp.height / 2;
this.addChild(sp);
return sp;
GameTest.prototype.clickball = function () {
var direction = this.isRight ? -1 : 1;
this.boxBody.velocity[0] = this.ballAddSpeedX * direction;
this.boxBody.velocity[1] = this.ballAddSpeedY;
this.boxBody.angularVelocity = -2 * direction;
};
GameView.prototype.createPlane = function () {
GameTest.prototype.createPlane = function (x, y, w, h) {
var sp = new engine.Shape();
sp.beginFill(0x0000ff, 1);
sp.drawRect(0, -10, engine.gameStage.width, 10);
sp.drawRect(x, y, w, h);
sp.endFill();
sp.anchorX = sp.width / 2;
sp.anchorY = sp.height / 2;
this.addChild(sp);
return sp;
};
GameView.prototype.createCircle = function () {
GameTest.prototype.createBall = function (r) {
var sp = new engine.Shape();
sp.beginFill(0xff0000, 0.7);
sp.drawCircle(0, 0, 60);
sp.beginFill(0xff0000, 0.4);
sp.drawCircle(0, 0, r);
sp.endFill();
sp.anchorX = sp.width / 2;
sp.anchorY = sp.height / 2;
this.addChild(sp);
return sp;
};
GameView.prototype.createEclipse = function () {
GameTest.prototype.createBox = function (width, height) {
var sp = new engine.Shape();
sp.beginFill(0x00ff00, 0.4);
sp.drawEllipse(0, 0, 200, 80);
sp.beginFill(0xf0f0f0, 1);
sp.drawRect(-width / 2, -height / 2, width, height);
sp.endFill();
this.addChild(sp);
return sp;
};
GameView.prototype.changePosition = function () {
this.boxBody.position[0] = 740;
this.boxBody.position[1] = 400;
this.circleBody.position[0] = 540;
this.circleBody.position[1] = 400;
this.circleBody1.position[0] = 700;
this.circleBody1.position[1] = 400;
};
GameView.prototype.onMouseDown = function (e) {
var direction = this.isRight ? -1 : 1;
this.basketball.velocity[0] = this.ballAddSpeedX * direction;
this.basketball.velocity[1] = this.ballAddSpeedY;
this.basketball.angularVelocity = -2 * direction;
};
GameView.prototype.addEvent = function () {
this.addEventListener(engine.Event.ENTER_FRAME, (this.onEnterFrameBind = this.onEnterFrame.bind(this)));
};
GameView.prototype.removeEvent = function () {
this.removeEventListener(engine.Event.ENTER_FRAME, this.onEnterFrameBind);
};
GameView.prototype.start = function () {
this.stage.addEventListener(engine.MouseEvent.CLICK, this.onMouseDown, this);
console.log(this.world);
};
GameView.prototype.stop = function () { };
return GameView;
GameTest.prototype.createBitmapByName = function (name) {
var imgContainer = new engine.Sprite();
var img = new engine.Sprite(getTextureByName(name));
img.anchorX = img.width / 2;
img.anchorY = img.height / 2;
img.x = -img.width / 2;
img.y = -img.height / 2;
imgContainer.addChild(img);
return imgContainer;
};
GameTest.prototype.stop = function () { };
return GameTest;
}(engine.Container));
var props = {};
......@@ -338,16 +200,16 @@
var _this = _super.call(this) || this;
engine.globalEvent.addEventListener('game-start', _this.start, _this);
engine.globalEvent.addEventListener('game-stop', _this.stop, _this);
var gameView = _this._gameView = new GameView();
_this.addChild(gameView);
var gameTest = _this._gameTest = new GameTest();
_this.addChild(gameTest);
return _this;
}
GameWrapper.prototype.start = function (event) {
injectProps(event.data);
this._gameView.start();
this._gameTest.start();
};
GameWrapper.prototype.stop = function (event) {
this._gameView.stop();
this._gameTest.stop();
};
return GameWrapper;
}(engine.Container));
......
{"version":3,"file":"index.js","sources":["src/custom/basket/src/game/utils.ts","src/custom/basket/src/game/basketBoard.ts","src/custom/basket/src/game/GameView.ts","src/custom/basket/src/props.ts","src/custom/basket/src/game/GameWrapper.ts","src/custom/basket/src/index.ts"],"sourcesContent":["/**\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\r\n\r\n\r\nexport function getIndexFromRC(row,col,maxCol){\r\n\tlet index;\r\n\tindex = row * maxCol + col ;\r\n\treturn index\r\n}\r\n\r\n\r\n\r\n\r\nexport function getRandomArray(array){\r\n\tarray.sort(function() {\r\n\t\treturn .5 - Math.random();\r\n\t});\r\n}","import {getTextureByName} from './utils'\r\n\r\nexport default class BasketBoard extends engine.Container{\r\n board:engine.Sprite = new engine.Sprite(getTextureByName('篮板'));\r\n netFront:engine.Sprite = new engine.Sprite(getTextureByName('球网前'));\r\n netBack:engine.Sprite = new engine.Sprite(getTextureByName('球网后'));\r\n\r\n // 篮筐传感,圆环\r\n private config = {\r\n boardBody:{\r\n x:0,\r\n y:0,\r\n width:0.3,\r\n height:2\r\n },\r\n insidePointBody: {\r\n x: 15,\r\n y: 65,\r\n radius: 0.07\r\n },\r\n outsidePointBody: {\r\n x: 180,\r\n y: 65,\r\n radius: 0.05\r\n },\r\n upSensorBody: {\r\n x: 100,\r\n y: 65,\r\n radius: 0.05\r\n },\r\n downSensorBody: {\r\n x: 100,\r\n y: 65 + 80,\r\n radius: 0.05\r\n }\r\n }\r\n\r\n \r\n\r\n constructor(){\r\n super();\r\n this.addChild(this.board);\r\n\r\n // 椭圆\r\n let shape = new engine.Shape();\r\n shape.beginFill(0xff0000,0.5);\r\n shape.drawEllipse(50,150,200,80);\r\n shape.endFill();\r\n\r\n this.board.addChild(shape)\r\n\r\n\r\n \r\n }\r\n\r\n setPosition(x,y){\r\n this.x = x;\r\n this.y = y;\r\n }\r\n\r\n}","import { getTextureByName, getTexture } from \"./utils\";\r\nimport BasketBoard from \"./basketBoard\";\r\nimport Basketball from \"./Basketball\";\r\nexport default class GameView extends engine.Container {\r\n private world: p2.World;\r\n private boxBody: p2.Body;\r\n private planeBody: p2.Body;\r\n private basketball: p2.Body;\r\n private ball: engine.Sprite;\r\n private plane: engine.Sprite;\r\n private box: engine.Sprite;\r\n\r\n private circleBody:p2.Body;\r\n private circleBody1:p2.Body;\r\n\r\n basketBoard: BasketBoard = new BasketBoard();\r\n\r\n private pool = {};\r\n private horizontal = [74, 676]; //二值\r\n private verticalArea = [200, 600]; //范围\r\n\r\n private verticalInit = 462 - 45;\r\n private positionInitBall = {\r\n x: 551,\r\n y: 805,\r\n };\r\n private vertical = this.verticalInit;\r\n private isRight = false;\r\n private saleX = this.isRight ? 1 : -1;\r\n\r\n private config = {\r\n net: {\r\n x: 9.5,\r\n y: 19 + 45,\r\n },\r\n insidePointBody: {\r\n x: 15,\r\n y: 65,\r\n radius: 0.07,\r\n },\r\n outsidePointBody: {\r\n x: 180,\r\n y: 65,\r\n radius: 0.05,\r\n },\r\n boardBody: {\r\n x: 0,\r\n y: 0,\r\n // length: 2,\r\n // radius: 0.1,\r\n width: 0.3,\r\n height: 2,\r\n },\r\n upSensorBody: {\r\n x: 100,\r\n y: 65,\r\n radius: 0.05,\r\n },\r\n downSensorBody: {\r\n x: 100,\r\n y: 65 + 80,\r\n radius: 0.05,\r\n },\r\n };\r\n private onEnterFrameBind: Function;\r\n\r\n private view;\r\n // private basketball;\r\n private direction;\r\n private toRo = 180 / Math.PI;\r\n private loopMark = false;\r\n private guideMark = false;\r\n\r\n //碰撞标志位\r\n private inPointMark = false;\r\n private outPointMark = false;\r\n private boardMark = false;\r\n private pointMark = false;\r\n private planeMark = false;\r\n private stringMark = \"\";\r\n\r\n private ballAddSpeedX = -40;\r\n private ballAddSpeedY = -80;\r\n private gravity = -5;\r\n private stepSpeed = [0.5, 3.5]; //3.5正常速度,2慢速播放\r\n private detaTimeEf = this.stepSpeed[1];\r\n private ballSpeedLimitX = 3;\r\n private planeHeight = 1100;\r\n\r\n private brokeMark = false;\r\n private doubleHit = 0;\r\n private timeLimit = window[\"timeLimit\"] ? window[\"timeLimit\"] : 5;\r\n private timeMark = false;\r\n private timeCount = this.timeLimit;\r\n private timeSpeed = 1 / 60;\r\n\r\n private clickMark = false;\r\n\r\n constructor() {\r\n super();\r\n this.once(engine.Event.ADDED_TO_STAGE, this.start, this);\r\n\r\n var p2 = window[\"p2\"];\r\n\r\n this.world = new p2.World();\r\n this.world.sleepMode = p2.World.BODY_SLEEPING;\r\n\r\n this.world.gravity = [0, 10];\r\n // this.world.gravity = [0,-5];\r\n //创建box\r\n var box: p2.Box = new p2.Box({\r\n width: 20,\r\n height: 200,\r\n material: materialBoard,\r\n });\r\n // var box:p2.Box = new p2.Box({width:this.config.boardBody.width, height:this.config.boardBody.height,material:materialBoard});\r\n // this.boxBody = new p2.Body({mass:10, angularVelocity:1, position:[200,200]});\r\n\r\n this.boxBody = new p2.Body({\r\n mass: 0,\r\n type: p2.Body.STATIC,\r\n position: [20, 400],\r\n });\r\n this.boxBody.addShape(box);\r\n // 添加图片\r\n this.box = this.createBox(0, -100, 20, 200);\r\n this.boxBody.displays = [this.box];\r\n\r\n // let display = new engine.Texture(getTextureByName('篮板'));\r\n // let displays = new engine.Sprite(display)\r\n // this.addChild(displays)\r\n // this.boxBody.displays = [displays];\r\n\r\n this.world.addBody(this.boxBody);\r\n // 设置摩擦和回弹系数\r\n this.world.defaultContactMaterial.friction = 0.1;\r\n this.world.defaultContactMaterial.restitution = 1;\r\n this.world.setGlobalStiffness(1e5);\r\n\r\n // material\r\n var materialBall = new p2.Material(2); //参数id:number\r\n var materialPoint = new p2.Material(2);\r\n var materialBoard = new p2.Material(2);\r\n var materialPlane = new p2.Material(2);\r\n\r\n // 不同material碰撞系数\r\n var contactMaterialBallPoint = new p2.ContactMaterial(\r\n materialBall,\r\n materialPoint,\r\n {\r\n friction: 0.3,\r\n restitution: 0.5,\r\n }\r\n );\r\n var contactMaterialBallBoard = new p2.ContactMaterial(\r\n materialBall,\r\n materialBoard,\r\n {\r\n friction: 0.1,\r\n restitution: 1,\r\n }\r\n );\r\n var contactMaterialBallPlane = new p2.ContactMaterial(\r\n materialBall,\r\n materialPlane,\r\n {\r\n friction: 0.1,\r\n restitution: 1,\r\n }\r\n );\r\n this.world.addContactMaterial(contactMaterialBallPoint);\r\n this.world.addContactMaterial(contactMaterialBallBoard);\r\n this.world.addContactMaterial(contactMaterialBallPlane);\r\n\r\n // 框点\r\n var circleShape = new p2.Circle({\r\n // radius: this.config.outsidePointBody.radius,\r\n radius: 1,\r\n material: materialPoint,\r\n });\r\n var circleBody = this.circleBody = new p2.Body({\r\n mass: 0,\r\n // position: [5.65, -5.5],\r\n position: [60, 500],\r\n type: p2.Body.STATIC,\r\n });\r\n circleBody.addShape(circleShape);\r\n this.world.addBody(circleBody);\r\n var ellipse = this.createBox(0, 0, 20, 20);\r\n circleBody.displays = [ellipse];\r\n\r\n var circleShape1 = new p2.Circle({\r\n // radius: this.config.insidePointBody.radius,\r\n radius: 1,\r\n material: materialPoint,\r\n });\r\n var circleBody1 = this.circleBody1 = new p2.Body({\r\n mass: 0,\r\n // position: [5.65, -5.5],\r\n position: [200, 500],\r\n type: p2.Body.STATIC,\r\n });\r\n circleBody1.addShape(circleShape1);\r\n this.world.addBody(circleBody1);\r\n var ellipse2 = this.createBox(0, 0, 20, 20);\r\n circleBody1.displays = [ellipse2];\r\n\r\n // 球体\r\n var ball = new p2.Circle({ radius: 60 });\r\n var basketball = this.basketball = new p2.Body({\r\n mass: 1,\r\n position: [300, 250],\r\n velocity: [0, 40],\r\n // type:p2.Body.DYNAMIC,\r\n material: materialBall,\r\n });\r\n this.basketball.addShape(ball);\r\n this.world.addBody(this.basketball);\r\n\r\n this.ball = this.createCircle();\r\n this.basketball.displays = [this.ball];\r\n\r\n // let balldisplay = new engine.Texture(getTextureByName('篮球'));\r\n // let balldisplays = new engine.Sprite(balldisplay);\r\n // balldisplays.width = 120;\r\n // balldisplays.height = 120\r\n // this.addChild(balldisplays)\r\n // this.basketball.displays = [balldisplays];\r\n\r\n //进球感应区域\r\n // var sensorShape = new p2.Circle({\r\n // radius: this.config.upSensorBody.radius\r\n // });\r\n // sensorShape.sensor = true;\r\n // var sensorBody = new p2.Body({\r\n // position: [this.config.upSensorBody.x, this.config.upSensorBody.y]\r\n // });\r\n // sensorBody.damping = 0;\r\n // sensorBody.addShape(sensorShape);\r\n // this.world.addBody(sensorBody);\r\n\r\n // var sensorShape1 = new p2.Circle({\r\n // radius: this.config.downSensorBody.radius\r\n // });\r\n // sensorShape1.sensor = true;\r\n // var sensorBody1 = new p2.Body({\r\n // position: [this.config.downSensorBody.x, this.config.downSensorBody.y]\r\n // });\r\n // sensorBody1.damping = 0;\r\n // sensorBody1.addShape(sensorShape1);\r\n // this.world.addBody(sensorBody1);\r\n\r\n //contactPointA 相对于bodyA的碰撞点位置,\r\n //contactPointB 相对于bodyB的碰撞点位置,\r\n\r\n let stringMark = this.stringMark;\r\n let self = this;\r\n let boardMarkSetTime;\r\n let pointMarkSetTime;\r\n\r\n //创建plane Plane shape class. The plane is facing in the Y direction.\r\n var plane: p2.Plane = new p2.Plane();\r\n this.planeBody = new p2.Body({\r\n position: [engine.gameStage.width, engine.gameStage.height - 200],\r\n material: materialPlane,\r\n }); //GameConst.stage保存全局静态变量stage\r\n this.planeBody.angle = Math.PI;\r\n\r\n this.planeBody.addShape(plane);\r\n\r\n this.world.addBody(this.planeBody);\r\n this.plane = this.createPlane();\r\n this.planeBody.displays = [this.plane];\r\n\r\n // 碰撞\r\n this.world.on('beginContact',function(e){\r\n // let direction = self.isRight ? 1 : -1;\r\n \r\n if(e.bodyA == circleBody || e.bodyA == circleBody1){\r\n if (\r\n basketball.position[0] > circleBody.position[0] &&\r\n basketball.position[0] < circleBody1.position[0]\r\n ) {\r\n if (basketball.position[1] > circleBody.position[1] || basketball.position[1] > circleBody1.position[1]) {\r\n console.log(\"上往下\");\r\n self.isRight = !self.isRight;\r\n // 移动刚体\r\n self.changePosition()\r\n }\r\n }\r\n }\r\n \r\n\r\n })\r\n\r\n //每帧更新\r\n this.addEventListener(\r\n engine.Event.ENTER_FRAME,\r\n this.onEnterFrame,\r\n this\r\n );\r\n }\r\n\r\n private onEnterFrame() {\r\n // this.basketball.position[0] = this.basketball.interpolatedPosition[0] * 100;\r\n // this.basketball.position[1] = -this.basketball.interpolatedPosition[1] * 100;\r\n // this.basketball.rotation = -this.basketball.interpolatedAngle * this.toRo;\r\n\r\n //更新物理世界\r\n this.world.step(60 / 1000);\r\n var len: number = this.world.bodies.length;\r\n for (var i: number = 0; i < len; i++) {\r\n var body: p2.Body = this.world.bodies[i];\r\n var display: engine.DisplayObject = body.displays[0];\r\n display.x = body.position[0]; //同步刚体和egret显示对象的位置和旋转角度\r\n display.y = body.position[1];\r\n display.rotation = (body.angle * 180) / Math.PI;\r\n }\r\n\r\n if (this.basketball.position[0] < -120) {\r\n this.basketball.position[0] = 750;\r\n }\r\n if (this.basketball.position[0] > 750 + 120) {\r\n this.basketball.position[0] = - 120;\r\n }\r\n\r\n }\r\n private createBox(x, y, w, h) {\r\n // var sp:engine.Sprite = new engine.Sprite();\r\n var sp = new engine.Shape();\r\n sp.beginFill(0x0000ff);\r\n sp.drawRect(x, y, w, h);\r\n sp.endFill();\r\n sp.anchorX = sp.width / 2;\r\n sp.anchorY = sp.height / 2;\r\n this.addChild(sp);\r\n return sp;\r\n }\r\n private createPlane() {\r\n // var sp:engine.Sprite = new engine.Sprite();\r\n var sp = new engine.Shape();\r\n // sp.lineStyle(10, 0x00ff00);\r\n sp.beginFill(0x0000ff, 1);\r\n // sp.moveTo(0, 0);\r\n // sp.lineTo(engine.gameStage.width,0);\r\n sp.drawRect(0, -10, engine.gameStage.width, 10);\r\n sp.endFill();\r\n sp.anchorX = sp.width / 2;\r\n sp.anchorY = sp.height / 2;\r\n this.addChild(sp);\r\n return sp;\r\n }\r\n\r\n private createCircle() {\r\n var sp = new engine.Shape();\r\n sp.beginFill(0xff0000, 0.7);\r\n sp.drawCircle(0, 0, 60);\r\n sp.endFill();\r\n sp.anchorX = sp.width / 2;\r\n sp.anchorY = sp.height / 2;\r\n this.addChild(sp);\r\n return sp;\r\n }\r\n\r\n private createEclipse() {\r\n var sp = new engine.Shape();\r\n sp.beginFill(0x00ff00, 0.4);\r\n sp.drawEllipse(0, 0, 200, 80);\r\n sp.endFill();\r\n this.addChild(sp);\r\n return sp;\r\n }\r\n\r\n changePosition(){\r\n this.boxBody.position[0] = 740;\r\n this.boxBody.position[1] = 400;\r\n\r\n this.circleBody.position[0] = 540;\r\n this.circleBody.position[1] = 400;\r\n this.circleBody1.position[0] = 700;\r\n this.circleBody1.position[1] = 400;\r\n\r\n }\r\n\r\n onMouseDown(e: engine.MouseEvent) {\r\n var direction = this.isRight ? -1 : 1;\r\n this.basketball.velocity[0] = this.ballAddSpeedX * direction;\r\n this.basketball.velocity[1] = this.ballAddSpeedY;\r\n this.basketball.angularVelocity = -2 * direction;\r\n }\r\n\r\n addEvent() {\r\n this.addEventListener(\r\n engine.Event.ENTER_FRAME,\r\n (this.onEnterFrameBind = this.onEnterFrame.bind(this))\r\n );\r\n }\r\n removeEvent() {\r\n this.removeEventListener(\r\n engine.Event.ENTER_FRAME,\r\n this.onEnterFrameBind\r\n );\r\n }\r\n\r\n start() {\r\n // let gameBg = new engine.Sprite(\r\n // getTexture(\"a880ee6b-c6d1-4d8f-8734-367f368a1803\")\r\n // );\r\n // this.addChild(gameBg);\r\n\r\n this.stage.addEventListener(\r\n engine.MouseEvent.CLICK,\r\n this.onMouseDown,\r\n this\r\n );\r\n\r\n console.log(this.world);\r\n\r\n // this.basketBoard.setPosition(0,100);\r\n // this.addChild(this.basketBoard)\r\n // console.log('1')\r\n\r\n // this.basketball.initPos(400,200);\r\n // this.addChild(this.basketball);\r\n }\r\n\r\n stop() {}\r\n}\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\nimport GameView from \"./GameView\";\r\n\r\nimport { injectProps } from \"../props\";\r\n\r\n\r\nexport class GameWrapper extends engine.Container {\r\n\t// private _status;\r\n\tprivate _gameView: GameView;\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tengine.globalEvent.addEventListener('game-start', this.start, this);\r\n\t\tengine.globalEvent.addEventListener('game-stop', this.stop, this);\r\n\r\n\t\t//创建实例\r\n\t\tlet gameView = this._gameView = new GameView();\r\n\t\tthis.addChild(gameView);\r\n\r\n\t}\r\n\r\n\tstart(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\r\n\t\t// this._status = 1;\r\n\r\n\t\tthis._gameView.start();\r\n\t}\r\n\tstop(event: engine.Event) {\r\n\t\t\r\n\t\tthis._gameView.stop();\r\n\t}\r\n\r\n\t// reset(event:engine.Event){\r\n\t// \tthis._gameView.reset();\r\n\t// }\r\n}\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\t\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;UAIgB,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;UAEe,gBAAgB,CAAC,IAAI;KACpC,OAAO,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACrD,CAAC;;;CCRD;KAAyCA,qCAAgB;KAqCrD;SAAA,YACI,iBAA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ASP;SAPA,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,YAAY,EAAE,KAAI,CAAC,KAAK,EAAE,KAAI,CAAC,CAAC;SACpE,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,WAAW,EAAE,KAAI,CAAC,IAAI,EAAE,KAAI,CAAC,CAAC;SAGlE,IAAI,QAAQ,GAAG,KAAI,CAAC,SAAS,GAAG,IAAI,QAAQ,EAAE,CAAC;SAC/C,KAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;;MAExB;KAED,2BAAK,GAAL,UAAM,KAAmB;SACxB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAIxB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KACD,0BAAI,GAAJ,UAAK,KAAmB;SAEvB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;MACtB;KAKF,kBAAC;CAAD,CAAC,CA/BgC,MAAM,CAAC,SAAS,GA+BhD;;;iBChCwB,KAAK;KAC7B,YAAY,EAAE,CAAC;KACf,WAAW,CAAC,KAAK,CAAC,CAAC;KAEnB,IAAI,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;KAEjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;;"}
\ No newline at end of file
{"version":3,"file":"index.js","sources":["src/custom/basket/src/game/utils.ts","src/custom/basket/src/game/GameTest.ts","src/custom/basket/src/props.ts","src/custom/basket/src/game/GameWrapper.ts","src/custom/basket/src/index.ts"],"sourcesContent":["/**\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\r\n\r\n\r\nexport function getIndexFromRC(row,col,maxCol){\r\n\tlet index;\r\n\tindex = row * maxCol + col ;\r\n\treturn index\r\n}\r\n\r\n\r\n\r\n\r\nexport function getRandomArray(array){\r\n\tarray.sort(function() {\r\n\t\treturn .5 - Math.random();\r\n\t});\r\n}","import { getTextureByName, getTexture } from \"./utils\";\r\n\r\nexport default class GameTest extends engine.Container {\r\n world: p2.World;\r\n planeBody: p2.Body;\r\n isDebug = true;\r\n private plane;\r\n private boxBody: p2.Body;\r\n factor = 10;\r\n\r\n private isRight = false;\r\n private saleX = this.isRight ? 1 : -1;\r\n\r\n private ballAddSpeedX = -10;\r\n private ballAddSpeedY = 30;\r\n\r\n constructor() {\r\n super();\r\n this.addEventListener(engine.Event.ADDED_TO_STAGE, this.setup, this);\r\n }\r\n start() {\r\n console.log(\"starting\");\r\n\r\n // this.stage.addEventListener(\r\n // engine.MouseEvent.CLICK,\r\n // this.onClick,\r\n // this\r\n // );\r\n\r\n this.stage.addEventListener(\r\n engine.MouseEvent.CLICK,\r\n this.clickball,\r\n this\r\n );\r\n }\r\n\r\n onClick(e: engine.MouseEvent) {\r\n const { world, factor } = this;\r\n\r\n var positionX: number = e.stageX / factor;\r\n var positionY: number =\r\n (engine.gameStage.stage.height - e.stageY) / factor;\r\n var display: engine.DisplayObject;\r\n var self = this;\r\n if (Math.random() > 0.5) {\r\n //添加方形刚体\r\n var boxShape: p2.Shape = new p2.Box({\r\n width: 200 / factor,\r\n height: 100 / factor,\r\n });\r\n var boxBody: p2.Body = new p2.Body({\r\n mass: 1,\r\n position: [positionX, positionY],\r\n angularVelocity: 1,\r\n });\r\n boxBody.addShape(boxShape);\r\n world.addBody(boxBody);\r\n\r\n // if (this.isDebug) {\r\n if (true) {\r\n display = this.createBox(\r\n (<p2.Box>boxShape).width * factor,\r\n (<p2.Box>boxShape).height * factor\r\n );\r\n } else {\r\n // display = self.createBitmapByName(\"rect\");\r\n // display.width = (<p2.Box>boxShape).width * factor;\r\n // display.height = (<p2.Box>boxShape).height * factor;\r\n }\r\n } else {\r\n //添加圆形刚体\r\n var boxShape: p2.Shape = new p2.Circle({\r\n radius: 60 / factor,\r\n });\r\n var boxBody: p2.Body = new p2.Body({\r\n mass: 1,\r\n position: [positionX, positionY],\r\n });\r\n boxBody.addShape(boxShape);\r\n world.addBody(boxBody);\r\n\r\n // if (this.isDebug) {\r\n if (false) {\r\n display = this.createBall(\r\n (<p2.Circle>boxShape).radius * factor\r\n );\r\n } else {\r\n display = this.createBitmapByName(\"篮球\");\r\n // display.width = (<p2.Circle>boxShape).radius * 2 * this.factor;\r\n // display.height = (<p2.Circle>boxShape).radius * 2 * this.factor;\r\n }\r\n\r\n // display.width = (<p2.Circle>boxShape).radius * 2 * factor;\r\n // display.height = (<p2.Circle>boxShape).radius * 2 * factor;\r\n }\r\n\r\n // display.anchorX = display.width / 2;\r\n // display.anchorY = display.height / 2;\r\n\r\n boxBody.displays = [display];\r\n\r\n this.addChild(display);\r\n }\r\n\r\n setup() {\r\n // // 创建地平面\r\n // var plane: p2.Plane = new p2.Plane();\r\n // this.planeBody = new p2.Body({\r\n // position: [0, 100 / this.factor],\r\n // type:p2.Body.STATIC\r\n // });\r\n\r\n // // this.planeBody.angle = Math.PI;\r\n\r\n // this.planeBody.addShape(plane);\r\n\r\n // this.world.addBody(this.planeBody);\r\n // this.plane = this.createPlane(\r\n // 0,\r\n // 100,\r\n // engine.gameStage.width,\r\n // 20\r\n // );\r\n\r\n // this.planeBody.displays = [this.plane];\r\n\r\n console.log(\"setup\");\r\n\r\n //创建world\r\n var world: p2.World = new p2.World({\r\n // gravity: [0, -1],\r\n });\r\n\r\n world.sleepMode = p2.World.BODY_SLEEPING;\r\n world.defaultContactMaterial.friction = 0.3;\r\n world.defaultContactMaterial.restitution = 0.7;\r\n //创建plane\r\n var planeShape: p2.Plane = new p2.Plane();\r\n var planeBody: p2.Body = new p2.Body({\r\n type:p2.Body.STATIC\r\n });\r\n planeBody.addShape(planeShape);\r\n planeBody.displays = [];\r\n world.addBody(planeBody);\r\n this.world = world;\r\n\r\n this.stage.addEventListener(\r\n engine.Event.ENTER_FRAME,\r\n this.onEnterFrame,\r\n this\r\n );\r\n\r\n\r\n var display: engine.DisplayObject;\r\n\r\n // 背景\r\n let gameBg = new engine.Sprite(getTextureByName(\"背景\"));\r\n this.addChild(gameBg);\r\n \r\n\r\n // 篮板\r\n var boardShape:p2.Shape = new p2.Box({\r\n width:20/this.factor,\r\n height:200/this.factor\r\n });\r\n var boardBody = new p2.Body({\r\n position:[80/this.factor,1000/this.factor]\r\n })\r\n boardBody.addShape(boardShape);\r\n let board = this.createBitmapByName('篮板');\r\n this.addChild(board)\r\n boardBody.displays = [board];\r\n this.world.addBody(boardBody)\r\n\r\n // 框点\r\n var boardPoint:p2.Shape = new p2.Circle({\r\n radius:1/this.factor,\r\n })\r\n var boardPointBody:p2.Body = new p2.Body({\r\n position:[100/this.factor,]\r\n })\r\n\r\n // 篮球\r\n var boxShape: p2.Shape = new p2.Circle({radius: 60 / this.factor});\r\n this.boxBody = new p2.Body({\r\n mass: 0.1,\r\n position: [300/this.factor, 900/this.factor],\r\n velocity:[-5,-10],\r\n angularVelocity:-1\r\n });\r\n let balldisplay = this.createBitmapByName(\"篮球\");\r\n this.addChild(balldisplay)\r\n this.boxBody.displays = [balldisplay]\r\n this.boxBody.addShape(boxShape);\r\n this.world.addBody(this.boxBody);\r\n\r\n\r\n }\r\n\r\n onEnterFrame() {\r\n this.world.step(60 / 1000);\r\n var len: number = this.world.bodies.length;\r\n for (var i: number = 0; i < len; i++) {\r\n var body: p2.Body = this.world.bodies[i];\r\n var display: engine.DisplayObject = body.displays[0];\r\n const stageHeight = engine.gameStage.stage.height;\r\n if (display) {\r\n display.x = body.position[0] * this.factor; //同步刚体和egret显示对象的位置和旋转角度\r\n display.y = stageHeight - body.position[1] * this.factor;\r\n\r\n display.rotation =\r\n ((body.angle + body.shapes[0].angle) * 180) / Math.PI;\r\n if (body.sleepState == p2.Body.SLEEPING) {\r\n display.alpha = 0.5;\r\n } else {\r\n display.alpha = 1;\r\n }\r\n }\r\n // display.rotation = (body.angle * 180) / Math.PI;\r\n }\r\n if(this.boxBody.position[0] < -120/this.factor){\r\n this.boxBody.position[0] = (750 + 120) / this.factor;\r\n }\r\n if(this.boxBody.position[0] > (750 +120) / this.factor){\r\n this.boxBody.position[0] = -120 /this.factor\r\n }\r\n\r\n }\r\n clickball(){\r\n var direction = this.isRight ? -1 : 1;\r\n this.boxBody.velocity[0] = this.ballAddSpeedX * direction;\r\n this.boxBody.velocity[1] = this.ballAddSpeedY;\r\n this.boxBody.angularVelocity = -2 * direction;\r\n }\r\n\r\n private createPlane(x, y, w, h) {\r\n var sp = new engine.Shape();\r\n sp.beginFill(0x0000ff, 1);\r\n sp.drawRect(x, y, w, h);\r\n sp.endFill();\r\n // sp.anchorX = sp.width / 2;\r\n // sp.anchorY = sp.height / 2;\r\n this.addChild(sp);\r\n return sp;\r\n }\r\n\r\n private createBall(r) {\r\n var sp = new engine.Shape();\r\n sp.beginFill(0xff0000, 0.4);\r\n sp.drawCircle(0, 0, r);\r\n sp.endFill();\r\n // this.addChild(sp);\r\n return sp;\r\n }\r\n\r\n private createBox(width, height) {\r\n var sp = new engine.Shape();\r\n sp.beginFill(0xf0f0f0, 1);\r\n sp.drawRect(-width / 2, -height / 2, width, height);\r\n sp.endFill();\r\n // sp.anchorX = w / 2;\r\n // sp.anchorY = h / 2;\r\n return sp;\r\n }\r\n\r\n // 图片的中心点位置\r\n private createBitmapByName(name) {\r\n const imgContainer = new engine.Sprite();\r\n const img = new engine.Sprite(getTextureByName(name));\r\n img.anchorX = img.width / 2;\r\n img.anchorY = img.height / 2;\r\n img.x = -img.width / 2;\r\n img.y = -img.height / 2;\r\n imgContainer.addChild(img);\r\n return imgContainer;\r\n }\r\n\r\n stop() {}\r\n}\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\nimport GameView from \"./GameView\";\r\nimport GameTest from './GameTest'\r\n\r\nimport { injectProps } from \"../props\";\r\n\r\n\r\nexport class GameWrapper extends engine.Container {\r\n\t// private _status;\r\n\tprivate _gameView: GameView;\r\n\tprivate _gameTest: GameTest;\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tengine.globalEvent.addEventListener('game-start', this.start, this);\r\n\t\tengine.globalEvent.addEventListener('game-stop', this.stop, this);\r\n\r\n\t\t//创建实例\r\n\t\t// let gameView = this._gameView = new GameView();\r\n\t\t// this.addChild(gameView);\r\n\t\tlet gameTest = this._gameTest = new GameTest();\r\n\t\tthis.addChild(gameTest);\r\n\r\n\t}\r\n\r\n\tstart(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\r\n\t\t// this._status = 1;\r\n\r\n\t\t// this._gameView.start();\r\n\t\tthis._gameTest.start();\r\n\t}\r\n\tstop(event: engine.Event) {\r\n\t\t\r\n\t\t// this._gameView.stop();\r\n\t\tthis._gameTest.stop();\r\n\t}\r\n\r\n\t// reset(event:engine.Event){\r\n\t// \tthis._gameView.reset();\r\n\t// }\r\n}\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\t\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;UAIgB,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;UAEe,gBAAgB,CAAC,IAAI;KACpC,O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hD;SAAA,YACC,iBAAO,SAWP;SATA,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,YAAY,EAAE,KAAI,CAAC,KAAK,EAAE,KAAI,CAAC,CAAC;SACpE,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,WAAW,EAAE,KAAI,CAAC,IAAI,EAAE,KAAI,CAAC,CAAC;SAKlE,IAAI,QAAQ,GAAG,KAAI,CAAC,SAAS,GAAG,IAAI,QAAQ,EAAE,CAAC;SAC/C,KAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;;MAExB;KAED,2BAAK,GAAL,UAAM,KAAmB;SACxB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAKxB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KACD,0BAAI,GAAJ,UAAK,KAAmB;SAGvB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;MACtB;KAKF,kBAAC;CAAD,CAAC,CApCgC,MAAM,CAAC,SAAS,GAoChD;;;iBCtCwB,KAAK;KAC7B,YAAY,EAAE,CAAC;KACf,WAAW,CAAC,KAAK,CAAC,CAAC;KAEnB,IAAI,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;KAEjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;;"}
\ No newline at end of file
import { getTextureByName, getTexture } from "./utils";
export default class GameTest extends engine.Container {
world: p2.World;
planeBody: p2.Body;
isDebug = true;
private plane;
private boxBody: p2.Body;
factor = 10;
private isRight = false;
private saleX = this.isRight ? 1 : -1;
private ballAddSpeedX = -10;
private ballAddSpeedY = 30;
constructor() {
super();
this.addEventListener(engine.Event.ADDED_TO_STAGE, this.setup, this);
}
start() {
console.log("starting");
// this.stage.addEventListener(
// engine.MouseEvent.CLICK,
// this.onClick,
// this
// );
this.stage.addEventListener(
engine.MouseEvent.CLICK,
this.clickball,
this
);
}
onClick(e: engine.MouseEvent) {
const { world, factor } = this;
var positionX: number = e.stageX / factor;
var positionY: number =
(engine.gameStage.stage.height - e.stageY) / factor;
var display: engine.DisplayObject;
var self = this;
if (Math.random() > 0.5) {
//添加方形刚体
var boxShape: p2.Shape = new p2.Box({
width: 200 / factor,
height: 100 / factor,
});
var boxBody: p2.Body = new p2.Body({
mass: 1,
position: [positionX, positionY],
angularVelocity: 1,
});
boxBody.addShape(boxShape);
world.addBody(boxBody);
// if (this.isDebug) {
if (true) {
display = this.createBox(
(<p2.Box>boxShape).width * factor,
(<p2.Box>boxShape).height * factor
);
} else {
// display = self.createBitmapByName("rect");
// display.width = (<p2.Box>boxShape).width * factor;
// display.height = (<p2.Box>boxShape).height * factor;
}
} else {
//添加圆形刚体
var boxShape: p2.Shape = new p2.Circle({
radius: 60 / factor,
});
var boxBody: p2.Body = new p2.Body({
mass: 1,
position: [positionX, positionY],
});
boxBody.addShape(boxShape);
world.addBody(boxBody);
// if (this.isDebug) {
if (false) {
display = this.createBall(
(<p2.Circle>boxShape).radius * factor
);
} else {
display = this.createBitmapByName("篮球");
// display.width = (<p2.Circle>boxShape).radius * 2 * this.factor;
// display.height = (<p2.Circle>boxShape).radius * 2 * this.factor;
}
// display.width = (<p2.Circle>boxShape).radius * 2 * factor;
// display.height = (<p2.Circle>boxShape).radius * 2 * factor;
}
// display.anchorX = display.width / 2;
// display.anchorY = display.height / 2;
boxBody.displays = [display];
this.addChild(display);
}
setup() {
// // 创建地平面
// var plane: p2.Plane = new p2.Plane();
// this.planeBody = new p2.Body({
// position: [0, 100 / this.factor],
// type:p2.Body.STATIC
// });
// // this.planeBody.angle = Math.PI;
// this.planeBody.addShape(plane);
// this.world.addBody(this.planeBody);
// this.plane = this.createPlane(
// 0,
// 100,
// engine.gameStage.width,
// 20
// );
// this.planeBody.displays = [this.plane];
console.log("setup");
//创建world
var world: p2.World = new p2.World({
// gravity: [0, -1],
});
world.sleepMode = p2.World.BODY_SLEEPING;
world.defaultContactMaterial.friction = 0.3;
world.defaultContactMaterial.restitution = 0.7;
//创建plane
var planeShape: p2.Plane = new p2.Plane();
var planeBody: p2.Body = new p2.Body({
type:p2.Body.STATIC
});
planeBody.addShape(planeShape);
planeBody.displays = [];
world.addBody(planeBody);
this.world = world;
this.stage.addEventListener(
engine.Event.ENTER_FRAME,
this.onEnterFrame,
this
);
var display: engine.DisplayObject;
// 背景
let gameBg = new engine.Sprite(getTextureByName("背景"));
this.addChild(gameBg);
// 篮板
var boardShape:p2.Shape = new p2.Box({
width:20/this.factor,
height:200/this.factor
});
var boardBody = new p2.Body({
position:[80/this.factor,1000/this.factor]
})
boardBody.addShape(boardShape);
let board = this.createBitmapByName('篮板');
this.addChild(board)
boardBody.displays = [board];
this.world.addBody(boardBody)
// 框点
var boardPoint:p2.Shape = new p2.Circle({
radius:1/this.factor,
})
var boardPointBody:p2.Body = new p2.Body({
position:[100/this.factor,800/this.factor]
})
boardPointBody.addShape(boardPoint);
boardPointBody.displays = []
// 篮球
var boxShape: p2.Shape = new p2.Circle({radius: 60 / this.factor});
this.boxBody = new p2.Body({
mass: 0.1,
position: [300/this.factor, 900/this.factor],
velocity:[-5,-10],
angularVelocity:-1
});
let balldisplay = this.createBitmapByName("篮球");
this.addChild(balldisplay)
this.boxBody.displays = [balldisplay]
this.boxBody.addShape(boxShape);
this.world.addBody(this.boxBody);
}
onEnterFrame() {
this.world.step(60 / 1000);
var len: number = this.world.bodies.length;
for (var i: number = 0; i < len; i++) {
var body: p2.Body = this.world.bodies[i];
var display: engine.DisplayObject = body.displays[0];
const stageHeight = engine.gameStage.stage.height;
if (display) {
display.x = body.position[0] * this.factor; //同步刚体和egret显示对象的位置和旋转角度
display.y = stageHeight - body.position[1] * this.factor;
display.rotation =
((body.angle + body.shapes[0].angle) * 180) / Math.PI;
if (body.sleepState == p2.Body.SLEEPING) {
display.alpha = 0.5;
} else {
display.alpha = 1;
}
}
// display.rotation = (body.angle * 180) / Math.PI;
}
if(this.boxBody.position[0] < -120/this.factor){
this.boxBody.position[0] = (750 + 120) / this.factor;
}
if(this.boxBody.position[0] > (750 +120) / this.factor){
this.boxBody.position[0] = -120 /this.factor
}
}
clickball(){
var direction = this.isRight ? -1 : 1;
this.boxBody.velocity[0] = this.ballAddSpeedX * direction;
this.boxBody.velocity[1] = this.ballAddSpeedY;
this.boxBody.angularVelocity = -2 * direction;
}
private createPlane(x, y, w, h) {
var sp = new engine.Shape();
sp.beginFill(0x0000ff, 1);
sp.drawRect(x, y, w, h);
sp.endFill();
// sp.anchorX = sp.width / 2;
// sp.anchorY = sp.height / 2;
this.addChild(sp);
return sp;
}
private createBall(r) {
var sp = new engine.Shape();
sp.beginFill(0xff0000, 0.4);
sp.drawCircle(0, 0, r);
sp.endFill();
// this.addChild(sp);
return sp;
}
private createBox(width, height) {
var sp = new engine.Shape();
sp.beginFill(0xf0f0f0, 1);
sp.drawRect(-width / 2, -height / 2, width, height);
sp.endFill();
// sp.anchorX = w / 2;
// sp.anchorY = h / 2;
return sp;
}
// 图片的中心点位置
private createBitmapByName(name) {
const imgContainer = new engine.Sprite();
const img = new engine.Sprite(getTextureByName(name));
img.anchorX = img.width / 2;
img.anchorY = img.height / 2;
img.x = -img.width / 2;
img.y = -img.height / 2;
imgContainer.addChild(img);
return imgContainer;
}
stop() {}
}
import GameView from "./GameView";
import GameTest from './GameTest'
import { injectProps } from "../props";
......@@ -7,6 +8,7 @@ import { injectProps } from "../props";
export class GameWrapper extends engine.Container {
// private _status;
private _gameView: GameView;
private _gameTest: GameTest;
constructor() {
super();
......@@ -15,8 +17,10 @@ export class GameWrapper extends engine.Container {
engine.globalEvent.addEventListener('game-stop', this.stop, this);
//创建实例
let gameView = this._gameView = new GameView();
this.addChild(gameView);
// let gameView = this._gameView = new GameView();
// this.addChild(gameView);
let gameTest = this._gameTest = new GameTest();
this.addChild(gameTest);
}
......@@ -25,11 +29,13 @@ export class GameWrapper extends engine.Container {
// this._status = 1;
this._gameView.start();
// this._gameView.start();
this._gameTest.start();
}
stop(event: engine.Event) {
this._gameView.stop();
// this._gameView.stop();
this._gameTest.stop();
}
// reset(event:engine.Event){
......
export class Particle {
public view;
private x;
private y;
private vx;
private vy;
private life;
private maxLife;
public dieMark = false;
public gravity = 1;
public alphaSpeed = 0.01
public scaleSpeed = 0;
constructor(x, y, vx, vy, maxLife, view) {
this.x = x;
this.y = y;
this.vx = vx;
this.vy = vy;
this.life = 0;
this.maxLife = maxLife;
this.view = view;
// this.view.alpha=this.randomT(0.5,1)
}
public update() {
if (this.dieMark) return
this.x += this.vx;
this.y += this.vy;
this.vy += this.gravity;
this.life++;
if (this.life >= this.maxLife) {
this.dieMark = true;
}
this.view.x = this.x;
this.view.y = this.y;
if (this.view.alpha > 0) this.view.alpha -= this.alphaSpeed;
if (this.view.scaleX > 0.2) {
this.view.scaleX -= this.scaleSpeed;
this.view.scaleY -= this.scaleSpeed;
}
};
public init(x, y, vx, vy, maxLife) {
this.dieMark = false;
this.life = 0;
// this.view.alpha=this.randomT(0.5,1);
this.x = x;
this.y = y;
this.vx = vx;
this.vy = vy;
this.maxLife = maxLife;
}
private randomT(e, n?) {
return e && "number" == typeof e.length && e.length ? e[Math.floor(Math.random() * e.length)] : ("number" != typeof n && (n = e || 1, e = 0), e + Math.random() * (n - e))
}
}
\ No newline at end of file
......@@ -46,6 +46,9 @@ function launchWithCustomModule(customModule) {
}, 100);
setTimeout(() => {
engine.globalEvent.dispatchEvent('cloud-game-reset', {
});
engine.globalEvent.dispatchEvent('pictures-start', {
});
......@@ -55,6 +58,15 @@ function launchWithCustomModule(customModule) {
// engine.gameStage.sceneContainer.getChildAt(0).y = (d.stage.height-props.H)/2;
}, 1000);
setTimeout(() => {
engine.globalEvent.dispatchEvent('cloud-game-reset', {
});
engine.globalEvent.dispatchEvent('pictures-start', {
});
}, 20*1000);
// setTimeout(() => {
// engine.globalEvent.dispatchEvent('pictures-start', {
// picUrl: "http://yun.duiba.com.cn/aurora/assets/e1593b97c27077b85b92f7eaaeae1ed64a1eb79a.png",
......@@ -73,6 +85,9 @@ function launchWithCustomModule(customModule) {
engine.globalEvent.addEventListener('cloud-game-success', (e) => {
console.log(e.type, e.data);
});
engine.globalEvent.addEventListener('cloud-game-reset', (e) => {
console.log(e.type, e.data);
});
}
function getAssetByUUID(uuid) {
......
(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.getAwayFromCloud = factory(global.tslib));
}(this, (function (tslib) { 'use strict';
function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
}
function createSvga(name, anchorName) {
var inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
return inst;
}
//# sourceMappingURL=utils.js.map
var Human = (function (_super) {
tslib.__extends(Human, _super);
function Human() {
var _this = _super.call(this) || this;
_this.humanArray = [
'487c1ca7-dea5-4732-b4b6-acb5406ee3a4',
'71e07cee-fd6d-40bb-ac0b-5bb28c87276e',
'2cd9f1bb-d0d8-42ea-941b-dcd0428e474d'
];
_this.human = new engine.Sprite(getTexture(_this.humanArray[0]));
_this.addChild(_this.human);
_this.width = _this.human.width;
_this.height = _this.human.height;
return _this;
}
Human.prototype.facialChange = function (num) {
var face = new engine.Sprite(getTexture(this.humanArray[num]));
this.human.addChild(face);
return face;
};
Human.prototype.removeFace = function (face) {
this.human.removeChild(face);
};
Human.prototype.scaleEffect = function () {
var _this = this;
var aaa = 0;
var pt = Date.now();
this.addEventListener(engine.Event.ENTER_FRAME, function () {
var dt = Date.now() - pt;
aaa += dt;
_this.anchorX = _this.width + _this.width / 2;
_this.anchorY = _this.height;
if (aaa > 90 && aaa <= 100) {
_this.scaleY = 0.99;
_this.scaleX = 1.01;
}
if (aaa > 190 && aaa < 200) {
_this.scaleX = 1;
_this.scaleY = 1;
aaa = 0;
}
pt = Date.now();
});
};
return Human;
}(engine.Container));
//# sourceMappingURL=Human.js.map
var Moist = (function (_super) {
tslib.__extends(Moist, _super);
function Moist() {
var _this = _super.call(this) || this;
_this.moistBg = new engine.Sprite(getTexture('8a8e79b6-2c6f-441b-81ae-c441465abfb0'));
_this.moist = new engine.Sprite(getTexture('024d67e9-ed7f-4481-94ca-a15bd5226cad'));
_this.moistCover = new engine.Sprite(getTexture('024d67e9-ed7f-4481-94ca-a15bd5226cad'));
_this.txt = new engine.TextInput();
_this.hintpic = new engine.Sprite(getTexture('ed0e8931-2557-4527-bcfc-9071f90d5737'));
_this.percent = 0;
_this.addChild(_this.moistBg);
_this.moistBg.addChild(_this.moist);
_this.moist.mask = _this.moistCover;
_this.txt.text = _this.percent * 100 + '%';
_this.txt.size = 30;
_this.txt.fillColor = '#7A83C5';
_this.addChild(_this.txt);
_this.txt.x = 0;
_this.txt.y = -50;
_this.hintpic.x = -10;
_this.hintpic.y = 440;
_this.addChild(_this.hintpic);
return _this;
}
Moist.prototype.cover = function (percent) {
this.moistCover.anchorY = 416;
this.moistBg.addChild(this.moistCover);
this.moistCover.scaleY = percent;
var t = engine.Tween.get(this.moistCover);
};
Moist.prototype.stopScale = function () {
this.moistCover.scaleY = 1;
this.txt.text = '100%';
};
Moist.prototype.updateText = function (percent) {
var a = percent * 100;
if (a <= 90) {
this.txt.text = a.toPrecision(2) + '%';
}
else {
this.txt.text = a.toPrecision(3) + '%';
}
};
Moist.prototype.updatePercent = function (percent) {
this.percent = percent;
};
return Moist;
}(engine.Container));
//# sourceMappingURL=Moist.js.map
var TimeCounter = (function (_super) {
tslib.__extends(TimeCounter, _super);
function TimeCounter() {
var _this = _super.call(this) || this;
_this.timeCounter = new engine.Sprite(getTexture('b7d2a60a-9e60-4eca-be80-a991abea47c9'));
_this.time = 20;
_this.addChild(_this.timeCounter);
_this.timeCounter.x = 256;
_this.timeCounter.y = 50;
_this.timeText = new engine.TextInput();
_this.timeText.text = _this.time + 's';
_this.timeText.size = 48;
_this.timeText.fillColor = '#7A83C5';
_this.timeCounter.addChild(_this.timeText);
_this.timeText.x = 100;
_this.timeText.y = 15;
return _this;
}
TimeCounter.prototype.updateTime = function (time) {
this.time = time;
this.timeText.text = this.time + 's';
};
return TimeCounter;
}(engine.Container));
//# sourceMappingURL=TimeCounter.js.map
var CloudRain = (function (_super) {
tslib.__extends(CloudRain, _super);
function CloudRain() {
var _this = _super.call(this) || this;
_this.clound1 = new engine.Sprite(getTexture('1e1a6993-9da0-4813-b1bd-00f2dbae2af2'));
_this.clound2 = new engine.Sprite(getTexture('6ed0e2e7-3ba3-4967-8fe0-39667792e343'));
_this.sun = new engine.Sprite(getTexture("0f05aaae-338a-439a-82b0-20efcee5cca4"));
_this.sun.x = 90;
_this.sun.y = 120;
_this.addChild(_this.sun);
_this.addChild(_this.clound1);
_this.addChild(_this.clound2);
_this.clound1.x = 100;
_this.clound1.y = 220;
_this.clound2.x = 150;
_this.clound2.y = 220;
return _this;
}
CloudRain.prototype.succeed = function () {
var _this = this;
var a = 0;
var ld = Date.now();
this.addEventListener(engine.Event.ENTER_FRAME, function () {
var dt = Date.now() - ld;
a += dt;
if (a > 100) {
_this.clound1.x -= (800 * dt) / 1000;
_this.clound2.x += (820 * dt) / 1000;
if (_this.clound1.x <= -380) {
_this.clound1.x = -380;
}
if (_this.clound2.x >= 750) {
_this.clound2.x = 750;
}
_this.sun.y -= (150 * dt) / 1000;
if (_this.sun.y <= 60) {
_this.sun.y = 60;
}
}
ld = Date.now();
});
};
return CloudRain;
}(engine.Container));
//# sourceMappingURL=CloudRain.js.map
var GameTest = (function (_super) {
tslib.__extends(GameTest, _super);
function GameTest() {
var _this = _super.call(this) || this;
_this.timeArray = [];
_this.container = new engine.Container();
_this.dripArray = [];
_this.clicknum = 0;
_this.R = 250;
_this.D = 340;
_this.con = new engine.Sprite();
_this.t1 = new engine.Sprite(getTexture('a163b74f-32bc-43d2-8015-7cf1eac71501'));
_this.t2 = new engine.Sprite(getTexture('22de82d1-97ec-4195-a32c-f4fc1656e2de'));
_this.t3 = new engine.Sprite(getTexture('cc952365-a990-4912-98af-50905559b9d5'));
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
return _this;
}
GameTest.prototype.setup = function () {
var playBg = new engine.Sprite(getTexture("5ab43bdc-a6ce-46fb-99c2-a806f57f7484"));
this.addChild(playBg);
this.humanbeing = new Human();
this.humanbeing.x = 290;
this.humanbeing.y = 750;
this.addChild(this.humanbeing);
console.log("xxxxxx", this.stage.width, this.stage.height, this.width, this.height);
this.rightHand = new engine.Sprite(getTexture("c7129f77-92a6-479e-9994-7d4b39040a15"));
this.rightHand.x = -70;
this.rightHand.y = -65;
this.rightHand.anchorX = 196;
this.rightHand.anchorY = 253;
this.humanbeing.addChild(this.rightHand);
this.playBtn = new engine.Sprite(getTexture("9e347bef-6e91-4c92-ba5f-f9a52e656207"));
this.playBtn.x = 138;
this.playBtn.y = 1150;
this.playBtn.anchorX = this.playBtn.x + this.playBtn.width / 2;
this.playBtn.anchorY = this.playBtn.y + this.playBtn.height / 2;
this.addChild(this.playBtn);
this.moists = new Moist();
this.moists.x = 20;
this.moists.y = 450;
this.addChild(this.moists);
this.cloud = new CloudRain();
this.addChild(this.cloud);
this.timeArray.push(this.t3, this.t2, this.t1);
};
GameTest.prototype.start = function () {
var _this = this;
var middleX = this.humanbeing.x + this.humanbeing.width / 2;
var validX1 = this.humanbeing.x;
var validX2 = this.humanbeing.x + this.humanbeing.width;
var point1 = new engine.Graphics();
point1.beginFill(0xff0000);
point1.drawRect(0, 0, 10, 10);
point1.x = 0;
point1.y = 100;
point1.endFill();
this.rightHand.addChild(point1);
var point2 = new engine.Graphics();
point2.beginFill(0xff0000);
point2.drawRect(0, 0, 10, 10);
point2.x = 170;
point2.y = 0;
point2.endFill();
this.rightHand.addChild(point2);
var point3 = new engine.Graphics();
point3.beginFill(0xff0000);
point3.drawRect(0, 0, 10, 10);
point3.x = 330;
point3.y = 100;
point3.endFill();
this.rightHand.addChild(point3);
window['p1'] = point1;
window['p2'] = point2;
window['p3'] = point3;
this.timeCounter = new TimeCounter();
this.addChild(this.timeCounter);
var ld = Date.now();
var a = 0;
var b = 0;
var timer = 0;
var succeedFlag = false;
var failFlag = false;
for (var i = 0; i < this.timeArray.length; i++) {
var t = this.timeArray[i];
t.anchorTexture.set(0.5, 0.5);
t.x = 750 / 2;
t.y = 1624 / 2;
t.alpha = 0;
this.container.addChild(t);
this.addChild(this.container);
}
for (var i = 0; i < this.timeArray.length; i++) {
var img = this.timeArray[i];
var delta = i * 1000;
var t = engine.Tween.get(img);
t.wait(delta).set({ alpha: 0.2, scaleX: 2, scaleY: 2 })
.to({ alpha: 1, scaleX: 1, scaleY: 1 }, 300)
.to({ alpha: 0 }, 200)
.wait(500);
if (i === this.timeArray.length - 1) {
t.call(function () {
engine.Tween.get(_this.container).to({ alpha: 0 }, 200).call(function () {
_this.removeChild(_this.container);
});
_this.winds = createSvga("wind");
_this.addChild(_this.winds);
_this.winds.visible = true;
_this.winds.play(true, true);
_this.winds.once(engine.Event.END_FRAME, function () {
_this.removeChild(_this.winds);
}, _this);
});
}
}
this.rainEffect = createSvga("雨滴动效");
this.addEventListener(engine.Event.ENTER_FRAME, function addFrame() {
var _this = this;
var dt = Date.now() - ld;
b += dt;
timer += dt;
if (timer >= 3000) {
a += dt;
if (a > 10) {
a = 0;
if (this.moists.percent < 1 && this.timeCounter.time > 0) {
var drip = new engine.Sprite(getTexture("07f74bf6-416f-445e-98d5-021efe4c9fdc"));
drip.x = Math.random() * (this.humanbeing.x + 160) + (this.humanbeing.x - 160);
drip.y = Math.random() * 100 + 300;
this.dripArray.push(drip);
this.addChild(drip);
}
}
var _loop_1 = function (drip) {
drip.y += (300 * dt) / 1000;
if (drip.y > this_1.stage.height) {
var index_1 = this_1.dripArray.indexOf(drip);
this_1.removeChild(drip);
this_1.dripArray = this_1.dripArray.filter(function (ele, i) { return i != index_1; });
}
};
var this_1 = this;
for (var _i = 0, _a = this.dripArray; _i < _a.length; _i++) {
var drip = _a[_i];
_loop_1(drip);
}
if (b >= 1000) {
b = 0;
if (this.moists.percent < 1) {
this.timeCounter.time -= 1;
if (this.timeCounter.time <= 0) {
this.timeCounter.time = 0;
}
this.timeCounter.updateTime(this.timeCounter.time);
}
if (this.timeCounter.time <= 0 && !succeedFlag) {
this.timeCounter.time = 0;
succeedFlag = true;
console.log("游戏成功!");
this.success();
}
}
var wind = -40;
this.rightHand.rotation += wind / 60;
if (this.rightHand.rotation <= -90) {
this.rightHand.rotation = -90;
}
else if (this.rightHand.rotation >= 90) {
this.rightHand.rotation = 90;
}
if (this.rightHand.rotation <= -60) {
var face_1 = this.humanbeing.facialChange(1);
face_1.x = 7;
face_1.y = 22;
setTimeout(function () {
_this.humanbeing.removeFace(face_1);
}, 100);
}
this.angle = Math.asin(this.D / 2 / this.R) * 57.18;
this.rightHand.name = "aaa";
var sa = this.worldMatrix.a;
var sd = this.worldMatrix.d;
var p1x = point1.worldMatrix.tx / sa;
var p2x = point2.worldMatrix.tx / sa;
var p3x = point3.worldMatrix.tx / sa;
var p1y = point1.worldMatrix.ty / sd;
var p2y = point2.worldMatrix.ty / sd;
var p3y = point3.worldMatrix.ty / sd;
var k12 = (p1y - p2y) / (p1x - p2x);
var k23 = (p2y - p3y) / (p2x - p3x);
var px1 = p1x;
var px2 = p2x;
var px3 = p3x;
var maxX = px1 >= px2 ? (px1 >= px3 ? px1 : px3) : px2 >= px3 ? px2 : px3;
var minX = px1 >= px2 ? (px2 >= px3 ? px3 : px2) : px1 >= px3 ? px3 : px1;
var x2 = (middleX + this.R) < maxX ? (middleX + this.R) : maxX;
var _loop_2 = function (drip) {
var dx = drip.worldMatrix.tx / sa;
var dy = drip.worldMatrix.ty / sd;
var b12 = p1y - p1x * k12 - 50;
var b23 = p2y - p2x * k23 - 50;
var y12 = k12 * dx + b12;
var y23 = k23 * dx + b23;
if (dx >= minX && dx < maxX) {
if (dx < px2) {
if (dy >= y12) {
var index_2 = this_2.dripArray.indexOf(drip);
this_2.removeChild(drip);
this_2.dripArray = this_2.dripArray.filter(function (ele, i) { return i != index_2; });
}
}
if (dx >= px2) {
if (dy >= y23) {
var index_3 = this_2.dripArray.indexOf(drip);
this_2.removeChild(drip);
this_2.dripArray = this_2.dripArray.filter(function (ele, i) { return i != index_3; });
}
}
}
if (drip.x > this_2.humanbeing.x &&
drip.x < this_2.humanbeing.x + this_2.humanbeing.width) {
if (drip.y >= this_2.humanbeing.y) {
this_2.moists.percent += 0.1;
this_2.moists.cover(this_2.moists.percent);
this_2.moists.updateText(this_2.moists.percent);
this_2.addChild(this_2.rainEffect);
this_2.rainEffect.visible = true;
this_2.rainEffect.play(true, true);
this_2.rainEffect.x = drip.x - drip.width * 2;
this_2.rainEffect.y = drip.y;
this_2.rainEffect.once(engine.Event.END_FRAME, function () {
_this.rainEffect.visible = false;
});
if (this_2.moists.percent >= 1 && !failFlag) {
this_2.moists.stopScale();
failFlag = true;
console.log("游戏结束!");
this_2.stop();
}
this_2.removeChild(drip);
var face_2 = this_2.humanbeing.facialChange(2);
face_2.x = 7;
face_2.y = 22;
setTimeout(function () {
_this.humanbeing.removeFace(face_2);
}, 500);
console.log("人");
var index_4 = this_2.dripArray.indexOf(drip);
this_2.dripArray = this_2.dripArray.filter(function (ele, i) { return i != index_4; });
this_2.humanbeing.scaleEffect();
}
}
};
var this_2 = this;
for (var _b = 0, _c = this.dripArray; _b < _c.length; _b++) {
var drip = _c[_b];
_loop_2(drip);
}
}
ld = Date.now();
});
this.playBtn.addEventListener(engine.MouseEvent.CLICK, this.onClick, this);
this.rightHand.rotation = 0;
};
GameTest.prototype.onClick = function () {
this.clicknum += 1;
this.rightHand.rotation += 10 * this.clicknum;
this.clicknum = 0;
};
GameTest.prototype.stop = function () {
engine.globalEvent.dispatchEvent("cloud-game-fail", { reason: 1 });
};
GameTest.prototype.success = function () {
this.cloud.succeed();
engine.globalEvent.dispatchEvent("cloud-game-success", {
moist: this.moists.percent,
});
};
return GameTest;
}(engine.Container));
var props = {};
function prepareProps() {
var metaProps = getProps();
engine.injectProp(props, metaProps);
}
function injectProps(p) {
engine.injectProp(props, p);
}
//# sourceMappingURL=props.js.map
var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super);
function GameWrapper() {
var _this = _super.call(this) || this;
engine.globalEvent.addEventListener('pictures-start', _this.start, _this);
engine.globalEvent.addEventListener('pictures-stop', _this.stop, _this);
var gameTest = _this._gameTest = new GameTest();
_this.addChild(gameTest);
return _this;
}
GameWrapper.prototype.start = function (event) {
injectProps(event.data);
this._gameTest.start();
};
GameWrapper.prototype.stop = function (event) {
this._gameTest.stop();
};
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
"use strict";var tslib=require("tslib");function getTexture(e){return engine.Texture.from(getAssetByUUID(e).uuid)}function createSvga(e,t){var i=new svga.Svga;return i.source="asset://"+engine.getAssetByName(e).uuid,i}var Human=function(t){function e(){var e=t.call(this)||this;return e.humanArray=["487c1ca7-dea5-4732-b4b6-acb5406ee3a4","71e07cee-fd6d-40bb-ac0b-5bb28c87276e","2cd9f1bb-d0d8-42ea-941b-dcd0428e474d"],e.human=new engine.Sprite(getTexture(e.humanArray[0])),e.addChild(e.human),e.width=e.human.width,e.height=e.human.height,e}return tslib.__extends(e,t),e.prototype.facialChange=function(e){var t=new engine.Sprite(getTexture(this.humanArray[e]));return this.human.addChild(t),t},e.prototype.removeFace=function(e){this.human.removeChild(e)},e.prototype.scaleEffect=function(){this.anchorX=this.width+this.width/2,this.anchorY=this.height,engine.Tween.get(this).set({scaleX:1,scaleY:1}).to({scaleX:1.01,scaleY:.99},100).to({scaleX:1,scaleY:1},100)},e}(engine.Container),Moist=function(t){function e(){var e=t.call(this)||this;return e.moistBg=new engine.Sprite(getTexture("8a8e79b6-2c6f-441b-81ae-c441465abfb0")),e.moist=new engine.Sprite(getTexture("024d67e9-ed7f-4481-94ca-a15bd5226cad")),e.moistCover=new engine.Sprite(getTexture("024d67e9-ed7f-4481-94ca-a15bd5226cad")),e.txt=new engine.TextInput,e.hintpic=new engine.Sprite(getTexture("ed0e8931-2557-4527-bcfc-9071f90d5737")),e.moveImg1=new engine.Sprite(getTexture("9be94bf5-5dd9-470b-a251-705d9c0ff1b0")),e.moveImg2=new engine.Sprite(getTexture("9be94bf5-5dd9-470b-a251-705d9c0ff1b0")),e.moveImgContainer=new engine.Container,e.percent=0,e.addChild(e.moistBg),e.moistBg.addChild(e.moist),e.moist.mask=e.moistCover,e.txt.text=100*e.percent+"%",e.txt.size=30,e.txt.fillColor="#7A83C5",e.addChild(e.txt),e.txt.x=0,e.txt.y=-50,e.hintpic.x=-10,e.hintpic.y=440,e.addChild(e.hintpic),e}return tslib.__extends(e,t),e.prototype.cover=function(e){e=e.toPrecision(2),this.moistCover.anchorY=416,this.moistBg.addChild(this.moistCover),this.moistCover.scaleY=e;engine.Tween.get(this.moistCover)},e.prototype.stopScale=function(){this.moistCover.scaleY=1,this.txt.text="100%"},e.prototype.updateText=function(e){var t=100*e;this.txt.text=t<=90?t.toPrecision(2)+"%":t.toPrecision(3)+"%"},e.prototype.updatePercent=function(e){this.percent=e},e}(engine.Container),props={};function prepareProps(){var e=getProps();engine.injectProp(props,e)}function injectProps(e){engine.injectProp(props,e)}var TimeCounter=function(t){function e(){var e=t.call(this)||this;return e.timeCounter=new engine.Sprite(getTexture("b7d2a60a-9e60-4eca-be80-a991abea47c9")),e.time=props.GAME_TIME,e.addChild(e.timeCounter),e.timeCounter.x=256,e.timeCounter.y=50,e.timeText=new engine.TextInput,e.timeText.text=e.time+"s",e.timeText.size=48,e.timeText.fillColor="#7A83C5",e.timeCounter.addChild(e.timeText),e.timeText.x=100,e.timeText.y=15,e}return tslib.__extends(e,t),e.prototype.updateTime=function(e){this.time=e,this.timeText.text=this.time+"s"},e}(engine.Container),CloudRain=function(t){function e(){var e=t.call(this)||this;return e.clound1=new engine.Sprite(getTexture("1e1a6993-9da0-4813-b1bd-00f2dbae2af2")),e.clound2=new engine.Sprite(getTexture("6ed0e2e7-3ba3-4967-8fe0-39667792e343")),e.sun=new engine.Sprite(getTexture("0f05aaae-338a-439a-82b0-20efcee5cca4")),e.sun.x=90,e.sun.y=120,e.addChild(e.sun),e.addChild(e.clound1),e.addChild(e.clound2),e.clound1.x=100,e.clound1.y=220,e.clound2.x=150,e.clound2.y=220,e}return tslib.__extends(e,t),e.prototype.succeed=function(){var t=this,i=0,n=Date.now();this.addEventListener(engine.Event.ENTER_FRAME,function(){var e=Date.now()-n;100<(i+=e)&&(t.clound1.x-=800*e/1e3,t.clound2.x+=820*e/1e3,t.clound1.x<=-380&&(t.clound1.x=-380),750<=t.clound2.x&&(t.clound2.x=750),t.sun.y-=150*e/1e3,t.sun.y<=60&&(t.sun.y=60)),n=Date.now()})},e}(engine.Container),GameTest=function(t){function e(){var e=t.call(this)||this;return e.timeArray=[],e.container=new engine.Container,e.dripArray=[],e.clicknum=0,e.R=250,e.D=340,e.con=new engine.Sprite,e.t1=new engine.Sprite(getTexture("a163b74f-32bc-43d2-8015-7cf1eac71501")),e.t2=new engine.Sprite(getTexture("22de82d1-97ec-4195-a32c-f4fc1656e2de")),e.t3=new engine.Sprite(getTexture("cc952365-a990-4912-98af-50905559b9d5")),e.faceFlag=!1,e.succeedFlag=!1,e.failFlag=!1,e.once(engine.Event.ADDED_TO_STAGE,e.setup,e),e}return tslib.__extends(e,t),e.prototype.setup=function(){var e=new engine.Sprite(getTexture("ad720818-ce72-48a1-9494-5bd2b64136da"));e.x=0,e.y=(engine.gameStage.height-1624)/2,this.addChild(e),this.humanbeing=new Human,this.humanbeing.x=290,this.humanbeing.y=engine.gameStage.height-this.humanbeing.height-104-40,this.addChild(this.humanbeing),console.log("xxxxxx",this.stage.width,this.stage.height,this.width,this.height),this.rightHand=new engine.Sprite(getTexture("c7129f77-92a6-479e-9994-7d4b39040a15")),this.rightHand.x=-70,this.rightHand.y=-65,this.rightHand.anchorX=196,this.rightHand.anchorY=253,this.humanbeing.addChild(this.rightHand),this.playBtn=new engine.Sprite(getTexture("9e347bef-6e91-4c92-ba5f-f9a52e656207")),this.playBtn.x=138,this.playBtn.y=engine.gameStage.height-this.playBtn.height-20,this.addChild(this.playBtn),this.moists=new Moist,this.moists.x=20,this.moists.y=500,this.addChild(this.moists),this.timeArray.push(this.t3,this.t2,this.t1)},e.prototype.start=function(){var e=this,A=this.humanbeing.x+this.humanbeing.width/2,S=(this.humanbeing.x,this.humanbeing.x,this.humanbeing.width,new engine.Graphics);S.beginFill("",0),S.drawRect(0,0,10,10),S.x=0,S.y=100,S.endFill(),this.rightHand.addChild(S);var F=new engine.Graphics;F.beginFill("",0),F.drawRect(0,0,10,10),F.x=170,F.y=0,F.endFill(),this.rightHand.addChild(F);var M=new engine.Graphics;M.beginFill("",0),M.drawRect(0,0,10,10),M.x=330,M.y=100,M.endFill(),this.rightHand.addChild(M),window.p1=S,window.p2=F,window.p3=M,this.timeCounter=new TimeCounter,this.addChild(this.timeCounter);var _=Date.now(),H=0,R=0,D=0;this.cloud=new CloudRain,this.addChild(this.cloud);for(var t=0;t<this.timeArray.length;t++){(i=this.timeArray[t]).anchorTexture.set(.5,.5),i.x=375,i.y=812,i.alpha=0,this.container.addChild(i),this.addChild(this.container)}for(t=0;t<this.timeArray.length;t++){var i,n=this.timeArray[t],r=1e3*t;(i=engine.Tween.get(n)).wait(r).set({alpha:.2,scaleX:2,scaleY:2}).to({alpha:1,scaleX:1,scaleY:1},300).to({alpha:0},200).wait(500),t===this.timeArray.length-1&&i.call(function(){engine.Tween.get(e.container).to({alpha:0},200).call(function(){e.removeChild(e.container)}),e.winds=createSvga("wind"),e.winds.mouseEnabled=!1,e.winds.mouseChildren=!1,e.addChild(e.winds),e.winds.visible=!0,e.winds.play(!0,!0),e.winds.once(engine.Event.END_FRAME,function(){e.removeChild(e.winds)},e)})}this.rainEffect=createSvga("雨滴动效"),this.addEventListener(engine.Event.ENTER_FRAME,function(){var d=this,t=Date.now()-_;if(R+=t,3e3<=(D+=t)){100<(H+=t)&&(H=0,this.moists.percent<1&&0<this.timeCounter.time&&((w=new engine.Sprite(getTexture("07f74bf6-416f-445e-98d5-021efe4c9fdc"))).x=Math.random()*(this.humanbeing.x+160)+(this.humanbeing.x-160),w.y=100*Math.random()+300,this.dripArray.push(w),this.addChild(w)));for(var n=this,e=0,i=this.dripArray;e<i.length;e++){!function(e){var i;e.y+=300*t/1e3,e.y>n.stage.height&&(i=n.dripArray.indexOf(e),n.removeChild(e),n.dripArray=n.dripArray.filter(function(e,t){return t!=i}))}(w=i[e])}1e3<=R&&(R=0,this.moists.percent<1&&(--this.timeCounter.time,this.timeCounter.time<=0&&(this.timeCounter.time=0),this.timeCounter.updateTime(this.timeCounter.time)),this.timeCounter.time<=0&&!this.succeedFlag&&(this.timeCounter.time=0,this.succeedFlag=!0,this.gameOver=!0,console.log("游戏成功!"),this.success()));var r;this.rightHand.rotation+=-50/60,this.rightHand.rotation<=-90?this.rightHand.rotation=-90:90<=this.rightHand.rotation&&(this.rightHand.rotation=90),this.rightHand.rotation<=-60&&!this.faceFlag&&(this.rightHand.rotation+=-10/60,(r=this.humanbeing.facialChange(1)).x=7,r.y=22,setTimeout(function(){d.humanbeing.removeFace(r)},100)),this.angle=57.18*Math.asin(this.D/2/this.R),this.rightHand.name="aaa";var c=this.worldMatrix.a,u=this.worldMatrix.d,l=S.worldMatrix.tx/c,g=F.worldMatrix.tx/c,a=M.worldMatrix.tx/c,m=S.worldMatrix.ty/u,p=F.worldMatrix.ty/u,s=M.worldMatrix.ty/u,f=(m-p)/(l-g),x=(p-s)/(g-a),v=g,y=v<=l?a<=l?l:a:a<=v?v:a,b=v<=l?a<=v?a:v:a<=l?a:l;A+this.R<y&&this.R;if(0!==this.dripArray.length)for(var C=this,o=0,h=this.dripArray;o<h.length;o++){!function(e){var i,n,t,r,a=e.worldMatrix.tx/c,s=e.worldMatrix.ty/u,o=f*a+(m-l*f-50),h=x*a+(p-g*x-50);b<=a&&a<y&&(a<v&&Math.abs(o-s)<=50&&o<=s&&(i=C.dripArray.indexOf(e),C.removeChild(e),C.dripArray=C.dripArray.filter(function(e,t){return t!=i})),v<=a&&Math.abs(h-s)<=50&&h<=s&&(n=C.dripArray.indexOf(e),C.removeChild(e),C.dripArray=C.dripArray.filter(function(e,t){return t!=n}))),e.x>C.humanbeing.x&&e.x<C.humanbeing.x+C.humanbeing.width&&e.y>=C.humanbeing.y&&(C.failFlag||(C.moists.percent+=.1,C.moists.percent=Math.round(100*C.moists.percent)/100,console.log(C.moists.percent),C.moists.cover(C.moists.percent),C.moists.percent<1&&C.moists.updateText(C.moists.percent),C.humanbeing.scaleEffect(),C.addChild(C.rainEffect),C.rainEffect.visible=!0,C.rainEffect.play(!0,!1),C.rainEffect.x=e.x-2*e.width,C.rainEffect.y=e.y,C.rainEffect.once(engine.Event.END_FRAME,function(){d.rainEffect.visible=!1}),C.faceFlag=!0,(t=C.humanbeing.facialChange(2)).x=7,t.y=22,setTimeout(function(){d.humanbeing.removeFace(t),d.faceFlag=!1},500)),C.removeChild(e),r=C.dripArray.indexOf(e),C.dripArray=C.dripArray.filter(function(e,t){return t!=r}),1<=C.moists.percent&&!C.failFlag&&(C.moists.stopScale(),C.failFlag=!0,C.gameOver=!0,console.log("游戏结束!"),C.stop()))}(w=h[o])}if(this.playBtn.addEventListener(engine.MouseEvent.CLICK,this.onClick,this),this.gameOver)for(var w,T=0,E=this.dripArray;T<E.length;T++){(w=E[T]).x=0,w.y=0,w.visible=!1,this.removeChild(w)}}_=Date.now()})},e.prototype.onClick=function(){this.clicknum+=1,this.rightHand.rotation+=10*this.clicknum,this.clicknum=0},e.prototype.stop=function(){engine.globalEvent.dispatchEvent("cloud-game-fail",{reason:1})},e.prototype.success=function(){this.cloud.succeed(),engine.globalEvent.dispatchEvent("cloud-game-success",{moist:this.moists.percent})},e.prototype.reset=function(){this.removeAllEventListener(),this.moists.percent=0,this.moists.moistCover.scaleY=0,this.moists.txt.text="0%",this.rightHand.rotation=0,this.container=new engine.Container,this.cloud&&this.cloud.parent.removeChild(this.cloud),this.succeedFlag=!1,this.failFlag=!1,this.gameOver=!1},e.prototype.again=function(){this.reset()},e}(engine.Container),GameWrapper=function(i){function e(){var e=i.call(this)||this;engine.globalEvent.addEventListener("cloud-game-reset",e.reset,e),engine.globalEvent.addEventListener("pictures-start",e.start,e),engine.globalEvent.addEventListener("pictures-stop",e.stop,e);var t=e._gameTest=new GameTest;return e.addChild(t),e}return tslib.__extends(e,i),e.prototype.start=function(e){injectProps(e.data),this._gameTest.start()},e.prototype.stop=function(e){this._gameTest.stop()},e.prototype.reset=function(e){this._gameTest.again()},e}(engine.Container);function index(e){return prepareProps(),injectProps(e),new GameWrapper}module.exports=index;
{"version":3,"file":"index.js","sources":["src/custom/getAwayFromCloud/src/game/utils.ts","src/custom/getAwayFromCloud/src/game/Human.ts","src/custom/getAwayFromCloud/src/game/Moist.ts","src/custom/getAwayFromCloud/src/game/TimeCounter.ts","src/custom/getAwayFromCloud/src/game/CloudRain.ts","src/custom/getAwayFromCloud/src/game/GameTest.ts","src/custom/getAwayFromCloud/src/props.ts","src/custom/getAwayFromCloud/src/game/GameWrapper.ts","src/custom/getAwayFromCloud/src/index.ts"],"sourcesContent":["/**\n * Created by rockyl on 2020-01-21.\n */\n\nexport function getTexture(uuid) {\n\treturn engine.Texture.from(getAssetByUUID(uuid).uuid);\n}\n\nexport function getTextureByName(name) {\n\treturn getTexture(engine.getAssetByName(name).uuid);\n}\n\nexport function playSound(name) {\n\tengine.playSound(engine.getAssetByName(name).uuid, {keep: true});\n}\nexport function createSvga(name, anchorName?) {\n\tlet inst = new svga.Svga();\n\tinst.source = 'asset://' + engine.getAssetByName(name).uuid;\n\treturn inst;\n}\n\n\n\nexport function getIndexFromRC(row,col,maxCol){\n\tlet index;\n\tindex = row * maxCol + col ;\n\treturn index\n}\n\n\n\n\nexport function getRandomArray(array){\n\tarray.sort(function() {\n\t\treturn .5 - Math.random();\n\t});\n}","import {getTexture} from './utils'\n\nexport default class Human extends engine.Container{\n \n //常态,吃力,沮丧\n humanArray = [\n '487c1ca7-dea5-4732-b4b6-acb5406ee3a4',\n '71e07cee-fd6d-40bb-ac0b-5bb28c87276e',\n '2cd9f1bb-d0d8-42ea-941b-dcd0428e474d'\n ]\n //三张面部表情\n human:engine.Sprite = new engine.Sprite(getTexture(this.humanArray[0]))\n\n constructor(){\n super();\n this.addChild(this.human)\n this.width = this.human.width;\n this.height = this.human.height;\n }\n\n facialChange(num){\n let face = new engine.Sprite(getTexture(this.humanArray[num]));\n this.human.addChild(face);\n return face;\n }\n\n removeFace(face){\n this.human.removeChild(face);\n }\n\n scaleEffect(){\n let aaa = 0;\n let pt = Date.now();\n this.addEventListener(engine.Event.ENTER_FRAME,()=>{\n let dt = Date.now() -pt;\n aaa += dt;\n this.anchorX = this.width + this.width / 2\n this.anchorY = this.height;\n if(aaa > 90 && aaa<=100 ){\n this.scaleY = 0.99;\n this.scaleX = 1.01;\n }\n\n if(aaa >190 && aaa < 200){\n this.scaleX = 1;\n this.scaleY = 1;\n aaa = 0;\n }\n\n pt = Date.now();\n })\n }\n}","import {getTexture} from './utils'\n\nexport default class Moist extends engine.Container{\n\n percent:number\n moistBg:engine.Sprite = new engine.Sprite(getTexture('8a8e79b6-2c6f-441b-81ae-c441465abfb0'))\n moist:engine.Sprite = new engine.Sprite(getTexture('024d67e9-ed7f-4481-94ca-a15bd5226cad'))\n moistCover:any = new engine.Sprite(getTexture('024d67e9-ed7f-4481-94ca-a15bd5226cad'))\n txt = new engine.TextInput();\n hintpic:engine.Sprite = new engine.Sprite(getTexture('ed0e8931-2557-4527-bcfc-9071f90d5737'))\n\n addPercent:number\n constructor(){\n super();\n this.percent = 0;\n this.addChild(this.moistBg)\n this.moistBg.addChild(this.moist)\n this.moist.mask = this.moistCover;\n\n\n this.txt.text = this.percent*100+'%';\n this.txt.size = 30;\n this.txt.fillColor = '#7A83C5';\n this.addChild(this.txt)\n this.txt.x = 0;\n this.txt.y = -50;\n\n this.hintpic.x = -10;\n this.hintpic.y = 440;\n this.addChild(this.hintpic)\n }\n\n cover(percent){\n this.moistCover.anchorY = 416;\n this.moistBg.addChild(this.moistCover)\n this.moistCover.scaleY = percent;\n let ld = Date.now();\n // let time\n // this.addEventListener(engine.Event.ENTER_FRAME,()=>{\n // let dt = Date.now() - ld;\n // time += dt;\n // if(time >= 100){\n // // this.moistCover.scaleY =\n // }\n // })\n let t = engine.Tween.get(this.moistCover);\n // t.set({alpha:1,scaleY:this.percent})\n // .to({alpha:1,scaleY:percent - 0.08},100)\n // .to({alpha:1,scaleY:percent - 0.06},100)\n // .to({alpha:1,scaleY:percent - 0.04},100)\n // .to({alpha:1,scaleY:percent - 0.02},100)\n // .to({alpha:1,scaleY:percent},100)\n\n }\n\n stopScale(){\n this.moistCover.scaleY = 1;\n this.txt.text = '100%';\n }\n\n updateText(percent){\n let a = percent * 100;\n if(a <=90){\n this.txt.text = a.toPrecision(2)+'%';\n }else{\n this.txt.text = a.toPrecision(3)+'%';\n }\n }\n\n updatePercent(percent){\n this.percent = percent;\n }\n}","import {getTexture} from './utils'\n\nexport default class TimeCounter extends engine.Container{\n timeCounter:engine.Sprite = new engine.Sprite(getTexture('b7d2a60a-9e60-4eca-be80-a991abea47c9'));\n timeText:any;\n time:number\n\n \n constructor(){\n super()\n this.time = 20\n this.addChild(this.timeCounter)\n\n this.timeCounter.x = 256;\n this.timeCounter.y = 50;\n // 计时文本\n this.timeText = new engine.TextInput();\n this.timeText.text = this.time +'s';\n this.timeText.size = 48;\n this.timeText.fillColor = '#7A83C5';\n this.timeCounter.addChild(this.timeText);\n this.timeText.x = 100;\n this.timeText.y = 15;\n\n }\n\n updateTime(time){\n this.time = time;\n this.timeText.text = this.time + 's'\n }\n\n\n}","import {getTexture} from './utils'\n\nexport default class CloudRain extends engine.Container{\n\n clound1:engine.Sprite = new engine.Sprite(getTexture('1e1a6993-9da0-4813-b1bd-00f2dbae2af2'))\n clound2:engine.Sprite = new engine.Sprite(getTexture('6ed0e2e7-3ba3-4967-8fe0-39667792e343'))\n sun = new engine.Sprite(getTexture(\"0f05aaae-338a-439a-82b0-20efcee5cca4\"));\n \n constructor(){\n super()\n this.sun.x = 90;\n this.sun.y = 120;\n this.addChild(this.sun)\n\n this.addChild(this.clound1);\n this.addChild(this.clound2);\n\n this.clound1.x = 100;\n this.clound1.y = 220;\n this.clound2.x = 150;\n this.clound2.y = 220;\n\n }\n\n succeed(){\n // 380 580\n let a = 0\n let ld = Date.now();\n this.addEventListener(engine.Event.ENTER_FRAME,()=>{\n let dt = Date.now() - ld;\n a += dt;\n if(a>100){\n this.clound1.x -= (800 * dt) / 1000;\n this.clound2.x += (820*dt)/1000;\n if(this.clound1.x <= -380){\n this.clound1.x = -380;\n }\n if(this.clound2.x >= 750){\n this.clound2.x = 750;\n }\n\n this.sun.y -= (150 * dt) / 1000;\n if(this.sun.y <= 60){\n this.sun.y = 60;\n }\n }\n ld = Date.now();\n })\n }\n\n\n \n\n\n\n}","import { getTexture, createSvga } from \"./utils\";\n\nimport Human from \"./Human\";\nimport Moist from \"./Moist\";\nimport TimeCounter from \"./TimeCounter\";\nimport CloudRain from \"./CloudRain\";\nimport gameStage = engine.gameStage;\n\nexport default class GameTest extends engine.Container {\n constructor() {\n super();\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\n }\n\n rightHand: engine.Sprite;\n // ambrella: engine.Sprite;\n playBtn: engine.Sprite;\n human: engine.Sprite;\n\n humanbeing: Human;\n moists: Moist;\n contain: any;\n timeCounter: TimeCounter;\n cloudRain: CloudRain;\n cloud: CloudRain;\n winds\n rainEffect\n timeArray: any[] = []\n container: engine.Container = new engine.Container()\n\n setup() {\n let playBg = new engine.Sprite(\n getTexture(\"5ab43bdc-a6ce-46fb-99c2-a806f57f7484\")\n );\n this.addChild(playBg);\n\n // this.human = new engine.Sprite(\n // getTexture(\"487c1ca7-dea5-4732-b4b6-acb5406ee3a4\")\n // );\n // this.human.x = 290;\n // this.human.y = 900;\n // 人\n this.humanbeing = new Human();\n this.humanbeing.x = 290;\n // this.humanbeing.y = 900;\n this.humanbeing.y = 750;\n this.addChild(this.humanbeing);\n\n // this.contain = new engine.Sprite()\n console.log(\n \"xxxxxx\",\n this.stage.width,\n this.stage.height,\n this.width,\n this.height\n );\n\n // 手和伞为一个整体\n this.rightHand = new engine.Sprite(\n getTexture(\"c7129f77-92a6-479e-9994-7d4b39040a15\")\n );\n this.rightHand.x = -70;\n this.rightHand.y = -65;\n this.rightHand.anchorX = 196;\n this.rightHand.anchorY = 253;\n\n this.humanbeing.addChild(this.rightHand);\n\n // this.addChild(this.human);\n // this.human.addChild(this.rightHand);\n\n this.playBtn = new engine.Sprite(\n getTexture(\"9e347bef-6e91-4c92-ba5f-f9a52e656207\")\n );\n this.playBtn.x = 138;\n this.playBtn.y = 1150;\n this.playBtn.anchorX = this.playBtn.x + this.playBtn.width / 2;\n this.playBtn.anchorY = this.playBtn.y + this.playBtn.height / 2;\n this.addChild(this.playBtn);\n // 湿润度\n this.moists = new Moist();\n this.moists.x = 20;\n this.moists.y = 450;\n this.addChild(this.moists);\n\n // 云\n this.cloud = new CloudRain();\n this.addChild(this.cloud);\n\n this.timeArray.push(this.t3, this.t2, this.t1);\n }\n\n dripArray: any[] = [];\n clicknum: number = 0;\n R: number = 250;\n D: number = 340;\n angle: number;\n\n con: engine.Sprite = new engine.Sprite();\n\n // 游戏开始前倒计时三张图\n t1 = new engine.Sprite(getTexture('a163b74f-32bc-43d2-8015-7cf1eac71501'));\n t2 = new engine.Sprite(getTexture('22de82d1-97ec-4195-a32c-f4fc1656e2de'));\n t3 = new engine.Sprite(getTexture('cc952365-a990-4912-98af-50905559b9d5'));\n\n\n start() {\n const middleX = this.humanbeing.x + this.humanbeing.width / 2;\n const validX1 = this.humanbeing.x;\n const validX2 = this.humanbeing.x + this.humanbeing.width;\n\n let point1 = new engine.Graphics();\n point1.beginFill(0xff0000);\n point1.drawRect(0, 0, 10, 10);\n point1.x = 0;\n point1.y = 100;\n point1.endFill();\n // this.addChild(point1)\n this.rightHand.addChild(point1);\n\n let point2 = new engine.Graphics();\n point2.beginFill(0xff0000);\n point2.drawRect(0, 0, 10, 10);\n point2.x = 170;\n point2.y = 0;\n point2.endFill();\n // this.addChild(point2)\n this.rightHand.addChild(point2);\n\n let point3 = new engine.Graphics();\n point3.beginFill(0xff0000);\n point3.drawRect(0, 0, 10, 10);\n point3.x = 330;\n point3.y = 100;\n point3.endFill();\n // this.addChild(point3)\n this.rightHand.addChild(point3);\n\n window['p1'] = point1;\n // @ts-ignore\n window['p2'] = point2;\n window['p3'] = point3;\n\n //计时器\n this.timeCounter = new TimeCounter();\n this.addChild(this.timeCounter);\n\n let ld = Date.now();\n\n let a = 0;\n let b = 0;\n\n let timer = 0;\n\n let succeedFlag = false;\n let failFlag = false;\n\n\n // 倒计时\n for (let i = 0; i < this.timeArray.length; i++) {\n let t = this.timeArray[i]\n t.anchorTexture.set(0.5, 0.5);\n t.x = 750 / 2;\n t.y = 1624 / 2;\n t.alpha = 0;\n this.container.addChild(t);\n this.addChild(this.container)\n }\n for (let i = 0; i < this.timeArray.length; i++) {\n let img = this.timeArray[i];\n let delta = i * 1000;\n let t = engine.Tween.get(img);\n t.wait(delta).set({alpha: 0.2, scaleX: 2, scaleY: 2})\n .to({alpha: 1, scaleX: 1, scaleY: 1}, 300)\n .to({alpha: 0}, 200)\n .wait(500);\n if (i === this.timeArray.length - 1) {\n t.call(() => {\n engine.Tween.get(this.container).to({alpha: 0}, 200).call(() => {\n this.removeChild(this.container)\n })\n\n // 风吹动效\n this.winds = createSvga(\"wind\");\n this.addChild(this.winds);\n this.winds.visible = true;\n this.winds.play(true, true)\n this.winds.once(engine.Event.END_FRAME, () => {\n this.removeChild(this.winds);\n }, this)\n })\n\n }\n }\n\n // 雨滴动效\n this.rainEffect = createSvga(\"雨滴动效\");\n\n this.addEventListener(engine.Event.ENTER_FRAME, function addFrame() {\n let dt = Date.now() - ld;\n\n b += dt;\n timer += dt;\n\n // 延迟三秒执行\n if (timer >= 3000) {\n a += dt;\n if (a > 10) {\n a = 0;\n if (this.moists.percent < 1 && this.timeCounter.time > 0) {\n let drip = new engine.Sprite(getTexture(\"07f74bf6-416f-445e-98d5-021efe4c9fdc\"));\n drip.x = Math.random() * (this.humanbeing.x + 160) + (this.humanbeing.x - 160);\n drip.y = Math.random() * 100 + 300;\n this.dripArray.push(drip);\n this.addChild(drip);\n }\n\n }\n\n // 雨滴下落\n for (let drip of this.dripArray) {\n drip.y += (300 * dt) / 1000;\n if (drip.y > this.stage.height) {\n let index = this.dripArray.indexOf(drip);\n this.removeChild(drip);\n this.dripArray = this.dripArray.filter(\n (ele, i) => i != index\n );\n }\n }\n\n\n //计时器\n if (b >= 1000) {\n b = 0;\n if (this.moists.percent < 1) {\n this.timeCounter.time -= 1;\n if (this.timeCounter.time <= 0) {\n this.timeCounter.time = 0;\n }\n this.timeCounter.updateTime(this.timeCounter.time);\n }\n\n if (this.timeCounter.time <= 0 && !succeedFlag) {\n this.timeCounter.time = 0;\n succeedFlag = true;\n console.log(\"游戏成功!\");\n // 云动画\n // 雨水结束\n // 太阳出来\n this.success();\n // this.removeEventListener(engine.Event.END_FRAME,()=>{})\n // if(succeedFlag){\n // }\n }\n }\n\n // 伞的旋转\n let wind = -40;\n this.rightHand.rotation += wind / 60;\n\n if (this.rightHand.rotation <= -90) {\n this.rightHand.rotation = -90;\n } else if (this.rightHand.rotation >= 90) {\n this.rightHand.rotation = 90;\n }\n\n // 吃力表情\n if (this.rightHand.rotation <= -60) {\n let face = this.humanbeing.facialChange(1);\n face.x = 7;\n face.y = 22;\n setTimeout(() => {\n this.humanbeing.removeFace(face);\n }, 100);\n }\n\n // ld = Date.now();\n\n // return;\n // 扇形的角度\n this.angle = Math.asin(this.D / 2 / this.R) * 57.18;\n\n // 伞的偏移角度距离水平位置\n let validMaxX;\n let validMinX;\n // 伞的圆函数\n let ambrellaFuncY;\n\n this.rightHand.name = \"aaa\";\n\n // a.worldMatrix.tx\n\n // point1,2线性方程斜率\n\n const sa = this.worldMatrix.a;\n const sd = this.worldMatrix.d;\n\n const p1x = point1.worldMatrix.tx / sa;\n const p2x = point2.worldMatrix.tx / sa;\n const p3x = point3.worldMatrix.tx / sa;\n const p1y = point1.worldMatrix.ty / sd;\n const p2y = point2.worldMatrix.ty / sd;\n const p3y = point3.worldMatrix.ty / sd;\n\n let k12 = (p1y - p2y) / (p1x - p2x);\n let k23 = (p2y - p3y) / (p2x - p3x);\n\n let px1 = p1x;\n let px2 = p2x;\n let px3 = p3x;\n\n let maxX = px1 >= px2 ? (px1 >= px3 ? px1 : px3) : px2 >= px3 ? px2 : px3;\n let minX = px1 >= px2 ? (px2 >= px3 ? px3 : px2) : px1 >= px3 ? px3 : px1;\n\n let x2 = (middleX + this.R) < maxX ? (middleX + this.R) : maxX;\n\n for (let drip of this.dripArray) {\n\n const dx = drip.worldMatrix.tx / sa;\n const dy = drip.worldMatrix.ty / sd;\n\n // point1,2线性方程\n let b12 = p1y - p1x * k12 - 50;\n let b23 = p2y - p2x * k23 - 50;\n let y12 = k12 * dx + b12;\n let y23 = k23 * dx + b23;\n if (dx >= minX && dx < maxX) {\n // 伞碰撞12\n if (dx < px2) {\n // if (Math.abs(y12 -drip.worldMatrix.ty) <= 20) {\n if (dy >= y12) {\n let index = this.dripArray.indexOf(drip);\n this.removeChild(drip);\n this.dripArray = this.dripArray.filter(\n (ele, i) => i != index\n );\n }\n // }\n }\n // 23\n if (dx >= px2) {\n // if (Math.abs(y23 -drip.worldMatrix.ty) <= 20) {\n if (dy >= y23) {\n let index = this.dripArray.indexOf(drip);\n this.removeChild(drip);\n this.dripArray = this.dripArray.filter(\n (ele, i) => i != index\n );\n }\n // }\n }\n }\n\n // 碰人\n if (drip.x > this.humanbeing.x &&\n drip.x < this.humanbeing.x + this.humanbeing.width) {\n if (drip.y >= this.humanbeing.y) {\n // 湿润度增加\n this.moists.percent += 0.1;\n this.moists.cover(this.moists.percent);\n this.moists.updateText(this.moists.percent);\n // this.moists.updatePercent(this.moists.percent);\n\n\n // 雨滴动效\n this.addChild(this.rainEffect);\n this.rainEffect.visible = true;\n this.rainEffect.play(true, true);\n this.rainEffect.x = drip.x - drip.width * 2;\n this.rainEffect.y = drip.y;\n this.rainEffect.once(engine.Event.END_FRAME, () => {\n this.rainEffect.visible = false;\n })\n\n if (this.moists.percent >= 1 && !failFlag) {\n // 游戏结束\n this.moists.stopScale();\n failFlag = true;\n console.log(\"游戏结束!\");\n // 清除事件\n this.stop();\n // this.timeCounter.updateTime(this.timeCounter.time);\n }\n\n this.removeChild(drip);\n // 表情改变\n let face = this.humanbeing.facialChange(2);\n face.x = 7;\n face.y = 22;\n setTimeout(() => {\n this.humanbeing.removeFace(face);\n }, 500);\n console.log(\"人\");\n\n let index = this.dripArray.indexOf(drip);\n this.dripArray = this.dripArray.filter(\n (ele, i) => i != index\n );\n\n // 动效\n this.humanbeing.scaleEffect();\n }\n }\n }\n }\n\n\n ld = Date.now();\n });\n\n this.playBtn.addEventListener(\n engine.MouseEvent.CLICK,\n this.onClick,\n this\n );\n this.rightHand.rotation = 0;\n }\n\n onClick() {\n this.clicknum += 1;\n this.rightHand.rotation += 10 * this.clicknum;\n this.clicknum = 0;\n // engine.Tween.get(this.playBtn)\n // .set({scaleX:1,scaleY:1})\n // .to({scaleX:1.1,scaleY:1.1},100)\n // .to({scaleX:1,scaleY:1},100)\n\n\n }\n\n stop() {\n // this.removeAllEventListener();\n // this.playBtn.removeAllEventListener();\n engine.globalEvent.dispatchEvent(\"cloud-game-fail\", {reason: 1});\n\n }\n\n success() {\n this.cloud.succeed();\n engine.globalEvent.dispatchEvent(\"cloud-game-success\", {\n moist: this.moists.percent,\n });\n }\n}\n// }\n\n","\n\nexport let props: any = {};\n\nexport function prepareProps() {\n\tlet metaProps = getProps();\n\n\tengine.injectProp(props, metaProps);\n}\n\nexport function injectProps(p) {\n\tengine.injectProp(props, p);\n}\n","\nimport GameView from \"./GameView\";\nimport GameTest from \"./GameTest\";\n\nimport { injectProps } from \"../props\";\n\n\nexport class GameWrapper extends engine.Container {\n\t// private _status;\n\tprivate _gameView: GameView;\n\tprivate _gameTest: GameTest;\n\n\n\n\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tengine.globalEvent.addEventListener('pictures-start', this.start, this);\n\t\tengine.globalEvent.addEventListener('pictures-stop', this.stop, this);\n\n\t\t//创建实例\n\t\t// let gameView = this._gameView = new GameView();\n\t\tlet gameTest = this._gameTest = new GameTest();\n\t\tthis.addChild(gameTest);\n\n\t}\n\n\tstart(event: engine.Event) {\n\t\tinjectProps(event.data);\n\n\t\t// this._status = 1;\n\n\t\t// this._gameView.start();\n\t\tthis._gameTest.start();\n\t}\n\tstop(event: engine.Event) {\n\t\t\n\t\t// this._gameView.stop();\n\t\tthis._gameTest.stop();\n\t}\n}\n","\n\nimport {GameWrapper} from \"./game/GameWrapper\";\nimport {injectProps, prepareProps} from \"./props\";\n\nexport default function (props) {\n\tprepareProps();\n\tinjectProps(props);\n\n\tlet instance = new GameWrapper();\n\t\n\treturn instance;\n}\n"],"names":["__extends"],"mappings":";;;;;;UAIgB,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;UASe,UAAU,CAAC,IAAI,EAAE,UAAW;KAC3C,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;KAC3B,IAAI,CAAC,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;KAC5D,OAAO,IAAI,CAAC;CACb,CAAC;;;CCjBD;KAAmCA,+BAAgB;KAW/C;SAAA,YACI,iBAAO,SAIV;SAbD,gBAAU,GAAG;aACT,sCAAsC;aACtC,sCAAsC;aACtC,sCAAsC;UACzC,CAAA;SAED,WAAK,GAAiB,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,KAAI,CAAC,UAAU,CAAC,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;SACxB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAKxB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KACD,0BAAI,GAAJ,UAAK,KAAmB;SAGvB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;MACtB;KACF,kBAAC;CAAD,CAAC,CAnCgC,MAAM,CAAC,SAAS,GAmChD;;;iBCrCwB,KAAK;KAC7B,YAAY,EAAE,CAAC;KACf,WAAW,CAAC,KAAK,CAAC,CAAC;KAEnB,IAAI,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;KAEjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;;"}
\ No newline at end of file
{"version":3,"file":"index.js","sources":["src/custom/getAwayFromCloud/src/game/utils.ts","src/custom/getAwayFromCloud/src/game/Human.ts","src/custom/getAwayFromCloud/src/game/Moist.ts","src/custom/getAwayFromCloud/src/props.ts","src/custom/getAwayFromCloud/src/game/TimeCounter.ts","src/custom/getAwayFromCloud/src/game/CloudRain.ts","src/custom/getAwayFromCloud/src/game/GameTest.ts","src/custom/getAwayFromCloud/src/game/GameWrapper.ts","src/custom/getAwayFromCloud/src/index.ts"],"sourcesContent":["/**\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\r\n\r\n\r\nexport function getIndexFromRC(row,col,maxCol){\r\n\tlet index;\r\n\tindex = row * maxCol + col ;\r\n\treturn index\r\n}\r\n\r\n\r\n\r\n\r\nexport function getRandomArray(array){\r\n\tarray.sort(function() {\r\n\t\treturn .5 - Math.random();\r\n\t});\r\n}","import {getTexture} from './utils'\r\n\r\nexport default class Human extends engine.Container{\r\n \r\n //常态,吃力,沮丧\r\n humanArray = [\r\n '487c1ca7-dea5-4732-b4b6-acb5406ee3a4',\r\n '71e07cee-fd6d-40bb-ac0b-5bb28c87276e',\r\n '2cd9f1bb-d0d8-42ea-941b-dcd0428e474d'\r\n ]\r\n //三张面部表情\r\n human:engine.Sprite = new engine.Sprite(getTexture(this.humanArray[0]))\r\n\r\n constructor(){\r\n super();\r\n this.addChild(this.human)\r\n this.width = this.human.width;\r\n this.height = this.human.height;\r\n }\r\n\r\n facialChange(num){\r\n let face = new engine.Sprite(getTexture(this.humanArray[num]));\r\n this.human.addChild(face);\r\n return face;\r\n }\r\n\r\n removeFace(face){\r\n this.human.removeChild(face);\r\n }\r\n\r\n scaleEffect(){\r\n // let aaa = 0;\r\n // let pt = Date.now();\r\n // this.addEventListener(engine.Event.ENTER_FRAME,()=>{\r\n // let dt = Date.now() -pt;\r\n // aaa += dt;\r\n // this.anchorX = this.width + this.width / 2\r\n // this.anchorY = this.height;\r\n // if(aaa > 90 && aaa<=100 ){\r\n // this.scaleY = 0.99;\r\n // this.scaleX = 1.01;\r\n // }\r\n\r\n // if(aaa >190 && aaa < 200){\r\n // this.scaleX = 1;\r\n // this.scaleY = 1;\r\n // aaa = 0;\r\n // }\r\n\r\n // pt = Date.now();\r\n // })\r\n this.anchorX = this.width + this.width / 2\r\n this.anchorY = this.height;\r\n engine.Tween.get(this)\r\n .set({scaleX:1,scaleY:1})\r\n .to({scaleX:1.01,scaleY:0.99},100)\r\n .to({scaleX:1,scaleY:1},100)\r\n }\r\n}","import {getTexture} from './utils'\r\n\r\nexport default class Moist extends engine.Container{\r\n\r\n percent:number\r\n moistBg:engine.Sprite = new engine.Sprite(getTexture('8a8e79b6-2c6f-441b-81ae-c441465abfb0'))\r\n moist:engine.Sprite = new engine.Sprite(getTexture('024d67e9-ed7f-4481-94ca-a15bd5226cad'))\r\n moistCover:any = new engine.Sprite(getTexture('024d67e9-ed7f-4481-94ca-a15bd5226cad'))\r\n txt = new engine.TextInput();\r\n hintpic:engine.Sprite = new engine.Sprite(getTexture('ed0e8931-2557-4527-bcfc-9071f90d5737'))\r\n\r\n moveImg1:any = new engine.Sprite(getTexture('9be94bf5-5dd9-470b-a251-705d9c0ff1b0'))\r\n moveImg2:any = new engine.Sprite(getTexture('9be94bf5-5dd9-470b-a251-705d9c0ff1b0'))\r\n\r\n addPercent:number\r\n\r\n moveImgContainer:any = new engine.Container();\r\n constructor(){\r\n super();\r\n this.percent = 0;\r\n this.addChild(this.moistBg)\r\n this.moistBg.addChild(this.moist)\r\n this.moist.mask = this.moistCover;\r\n\r\n this.txt.text = this.percent*100+'%';\r\n this.txt.size = 30;\r\n this.txt.fillColor = '#7A83C5';\r\n this.addChild(this.txt)\r\n this.txt.x = 0;\r\n this.txt.y = -50;\r\n\r\n this.hintpic.x = -10;\r\n this.hintpic.y = 440;\r\n this.addChild(this.hintpic)\r\n\r\n\r\n }\r\n\r\n // move(x,y){\r\n // engine.Tween.get(this.moveImg1) \r\n // .set({x:x,y:80})\r\n // .to({x:x-this.moveImg1.width * 2,y:80},500)\r\n // engine.Tween.get(this.moveImg2) \r\n // .set({x:x + this.moveImg1.width - 5,y:80})\r\n // .to({x:(x - this.moveImg1.width*2 - 5),y:80},500)\r\n\r\n // }\r\n\r\n cover(percent){\r\n\r\n percent = percent.toPrecision(2);\r\n\r\n this.moistCover.anchorY = 416;\r\n this.moistBg.addChild(this.moistCover)\r\n this.moistCover.scaleY = percent;\r\n let ld = Date.now();\r\n // let time\r\n // this.addEventListener(engine.Event.ENTER_FRAME,()=>{\r\n // let dt = Date.now() - ld;\r\n // time += dt;\r\n // if(time >= 100){\r\n // // this.moistCover.scaleY =\r\n // }\r\n // })\r\n let t = engine.Tween.get(this.moistCover);\r\n // t.set({alpha:1,scaleY:this.percent})\r\n // .to({alpha:1,scaleY:percent - 0.08},100)\r\n // .to({alpha:1,scaleY:percent - 0.06},100)\r\n // .to({alpha:1,scaleY:percent - 0.04},100)\r\n // .to({alpha:1,scaleY:percent - 0.02},100)\r\n // .to({alpha:1,scaleY:percent},100)\r\n\r\n }\r\n\r\n stopScale(){\r\n this.moistCover.scaleY = 1;\r\n this.txt.text = '100%';\r\n }\r\n\r\n updateText(percent){\r\n let a = percent * 100;\r\n if(a <=90){\r\n this.txt.text = a.toPrecision(2)+'%';\r\n }else{\r\n this.txt.text = a.toPrecision(3)+'%';\r\n }\r\n }\r\n\r\n updatePercent(percent){\r\n this.percent = percent;\r\n }\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","import {getTexture} from './utils'\r\nimport {props} from '../props'\r\n\r\nexport default class TimeCounter extends engine.Container{\r\n timeCounter:engine.Sprite = new engine.Sprite(getTexture('b7d2a60a-9e60-4eca-be80-a991abea47c9'));\r\n timeText:any;\r\n time:number\r\n\r\n \r\n constructor(){\r\n super()\r\n this.time = props.GAME_TIME;\r\n this.addChild(this.timeCounter)\r\n\r\n this.timeCounter.x = 256;\r\n this.timeCounter.y = 50;\r\n // 计时文本\r\n this.timeText = new engine.TextInput();\r\n this.timeText.text = this.time +'s';\r\n this.timeText.size = 48;\r\n this.timeText.fillColor = '#7A83C5';\r\n this.timeCounter.addChild(this.timeText);\r\n this.timeText.x = 100;\r\n this.timeText.y = 15;\r\n\r\n }\r\n\r\n updateTime(time){\r\n this.time = time;\r\n this.timeText.text = this.time + 's'\r\n }\r\n\r\n\r\n}","import {getTexture} from './utils'\r\n\r\nexport default class CloudRain extends engine.Container{\r\n\r\n clound1:engine.Sprite = new engine.Sprite(getTexture('1e1a6993-9da0-4813-b1bd-00f2dbae2af2'))\r\n clound2:engine.Sprite = new engine.Sprite(getTexture('6ed0e2e7-3ba3-4967-8fe0-39667792e343'))\r\n sun = new engine.Sprite(getTexture(\"0f05aaae-338a-439a-82b0-20efcee5cca4\"));\r\n \r\n constructor(){\r\n super()\r\n this.sun.x = 90;\r\n this.sun.y = 120;\r\n this.addChild(this.sun)\r\n\r\n this.addChild(this.clound1);\r\n this.addChild(this.clound2);\r\n\r\n this.clound1.x = 100;\r\n this.clound1.y = 220;\r\n this.clound2.x = 150;\r\n this.clound2.y = 220;\r\n\r\n }\r\n\r\n succeed(){\r\n // 380 580\r\n let a = 0\r\n let ld = Date.now();\r\n this.addEventListener(engine.Event.ENTER_FRAME,()=>{\r\n let dt = Date.now() - ld;\r\n // console.log(111)\r\n a += dt;\r\n if(a>100){\r\n this.clound1.x -= (800 * dt) / 1000;\r\n this.clound2.x += (820*dt)/1000;\r\n if(this.clound1.x <= -380){\r\n this.clound1.x = -380;\r\n }\r\n if(this.clound2.x >= 750){\r\n this.clound2.x = 750;\r\n }\r\n\r\n this.sun.y -= (150 * dt) / 1000;\r\n if(this.sun.y <= 60){\r\n this.sun.y = 60;\r\n }\r\n }\r\n ld = Date.now();\r\n })\r\n }\r\n\r\n\r\n\r\n}","import { getTexture, createSvga } from \"./utils\";\r\n\r\nimport Human from \"./Human\";\r\nimport Moist from \"./Moist\";\r\nimport TimeCounter from \"./TimeCounter\";\r\nimport CloudRain from \"./CloudRain\";\r\nimport {props} from '../props'\r\nimport gameStage = engine.gameStage;\r\n\r\nexport default class GameTest extends engine.Container {\r\n constructor() {\r\n super();\r\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\r\n // this.once(engine.Event.ADDED_TO_STAGE, this.start, this);\r\n }\r\n\r\n rightHand: engine.Sprite;\r\n // ambrella: engine.Sprite;\r\n playBtn: engine.Sprite;\r\n human: engine.Sprite;\r\n\r\n humanbeing: Human;\r\n moists: Moist;\r\n contain: any;\r\n timeCounter: TimeCounter;\r\n // cloudRain: CloudRain;\r\n cloud: CloudRain;\r\n winds\r\n rainEffect\r\n timeArray: any[] = []\r\n container: engine.Container = new engine.Container()\r\n\r\n\r\n\r\n setup() {\r\n let playBg = new engine.Sprite(\r\n getTexture(\"ad720818-ce72-48a1-9494-5bd2b64136da\")\r\n );\r\n playBg.x = 0;\r\n playBg.y = (engine.gameStage.height - 1624) / 2;\r\n this.addChild(playBg);\r\n\r\n // this.human = new engine.Sprite(\r\n // getTexture(\"487c1ca7-dea5-4732-b4b6-acb5406ee3a4\")\r\n // );\r\n // this.human.x = 290;\r\n // this.human.y = 900;\r\n // 人\r\n this.humanbeing = new Human();\r\n this.humanbeing.x = 290;\r\n // this.humanbeing.x = 280;\r\n // this.humanbeing.y = 750;\r\n this.humanbeing.y = engine.gameStage.height - this.humanbeing.height - 104 - 40 ;\r\n this.addChild(this.humanbeing);\r\n\r\n // this.contain = new engine.Sprite()\r\n console.log(\r\n \"xxxxxx\",\r\n this.stage.width,\r\n this.stage.height,\r\n this.width,\r\n this.height\r\n );\r\n\r\n // 手和伞为一个整体\r\n this.rightHand = new engine.Sprite(\r\n getTexture(\"c7129f77-92a6-479e-9994-7d4b39040a15\")\r\n );\r\n this.rightHand.x = -70;\r\n this.rightHand.y = -65;\r\n\r\n // this.rightHand.x = -0;\r\n // this.rightHand.y = -65;\r\n this.rightHand.anchorX = 196;\r\n this.rightHand.anchorY = 253;\r\n\r\n this.humanbeing.addChild(this.rightHand);\r\n\r\n // this.addChild(this.human);\r\n // this.human.addChild(this.rightHand);\r\n\r\n this.playBtn = new engine.Sprite(\r\n getTexture(\"9e347bef-6e91-4c92-ba5f-f9a52e656207\")\r\n );\r\n // this.playBtn.x = (engine.gameStage.width - this.playBtn.width) / 2;\r\n this.playBtn.x = 138 ;\r\n this.playBtn.y = engine.gameStage.height - this.playBtn.height - 20;\r\n // this.playBtn.anchorX = this.playBtn.x + this.playBtn.width / 2;\r\n // this.playBtn.anchorY = this.playBtn.y + this.playBtn.height ;\r\n \r\n // this.playBtn.anchorTexture.set(0.5, 0.1);\r\n\r\n this.addChild(this.playBtn);\r\n // 湿润度\r\n this.moists = new Moist();\r\n this.moists.x = 20;\r\n this.moists.y = 500;\r\n this.addChild(this.moists);\r\n\r\n // 云\r\n // this.cloud = new CloudRain();\r\n // this.addChild(this.cloud);\r\n\r\n this.timeArray.push(this.t3, this.t2, this.t1);\r\n }\r\n\r\n dripArray: any[] = [];\r\n clicknum: number = 0;\r\n R: number = 250;\r\n D: number = 340;\r\n angle: number;\r\n\r\n con: engine.Sprite = new engine.Sprite();\r\n\r\n // 游戏开始前倒计时三张图\r\n t1 = new engine.Sprite(getTexture('a163b74f-32bc-43d2-8015-7cf1eac71501'));\r\n t2 = new engine.Sprite(getTexture('22de82d1-97ec-4195-a32c-f4fc1656e2de'));\r\n t3 = new engine.Sprite(getTexture('cc952365-a990-4912-98af-50905559b9d5'));\r\n\r\n // playAgain:engine.Sprite = new engine.Sprite(getTexture('f06bd053-7b8a-4177-ab4f-36557761205a'));\r\n\r\n face\r\n faceFlag:boolean = false\r\n succeedFlag = false;\r\n failFlag = false;\r\n gameOver:false\r\n\r\n start() {\r\n // engine.globalEvent.dispatchEvent(\"cloud-game-reset\");\r\n\r\n const middleX = this.humanbeing.x + this.humanbeing.width / 2;\r\n const validX1 = this.humanbeing.x;\r\n const validX2 = this.humanbeing.x + this.humanbeing.width;\r\n\r\n let point1 = new engine.Graphics();\r\n point1.beginFill('',0);\r\n point1.drawRect(0, 0, 10, 10);\r\n point1.x = 0;\r\n point1.y = 100;\r\n point1.endFill();\r\n // this.addChild(point1)\r\n this.rightHand.addChild(point1);\r\n\r\n let point2 = new engine.Graphics();\r\n point2.beginFill('',0);\r\n point2.drawRect(0, 0, 10, 10);\r\n point2.x = 170;\r\n point2.y = 0;\r\n point2.endFill();\r\n // this.addChild(point2)\r\n this.rightHand.addChild(point2);\r\n\r\n let point3 = new engine.Graphics();\r\n point3.beginFill('',0);\r\n point3.drawRect(0, 0, 10, 10);\r\n point3.x = 330;\r\n point3.y = 100;\r\n point3.endFill();\r\n // this.addChild(point3)\r\n this.rightHand.addChild(point3);\r\n\r\n window['p1'] = point1;\r\n // @ts-ignore\r\n window['p2'] = point2;\r\n window['p3'] = point3;\r\n\r\n //计时器\r\n this.timeCounter = new TimeCounter();\r\n this.addChild(this.timeCounter);\r\n\r\n let ld = Date.now();\r\n\r\n let a = 0;\r\n let b = 0;\r\n\r\n let timer = 0;\r\n\r\n \r\n this.cloud = new CloudRain();\r\n this.addChild(this.cloud);\r\n\r\n\r\n // 倒计时\r\n for (let i = 0; i < this.timeArray.length; i++) {\r\n let t = this.timeArray[i]\r\n t.anchorTexture.set(0.5, 0.5);\r\n t.x = 750 / 2;\r\n t.y = 1624 / 2;\r\n t.alpha = 0;\r\n this.container.addChild(t);\r\n this.addChild(this.container)\r\n }\r\n for (let i = 0; i < this.timeArray.length; i++) {\r\n let img = this.timeArray[i];\r\n let delta = i * 1000;\r\n let t = engine.Tween.get(img);\r\n t.wait(delta).set({alpha: 0.2, scaleX: 2, scaleY: 2})\r\n .to({alpha: 1, scaleX: 1, scaleY: 1}, 300)\r\n .to({alpha: 0}, 200)\r\n .wait(500);\r\n if (i === this.timeArray.length - 1) {\r\n t.call(() => {\r\n engine.Tween.get(this.container).to({alpha: 0}, 200).call(() => {\r\n this.removeChild(this.container)\r\n })\r\n\r\n // 风吹动效\r\n this.winds = createSvga(\"wind\");\r\n this.winds.mouseEnabled = false\r\n this.winds.mouseChildren = false;\r\n this.addChild(this.winds);\r\n this.winds.visible = true;\r\n this.winds.play(true, true)\r\n this.winds.once(engine.Event.END_FRAME, () => {\r\n this.removeChild(this.winds);\r\n }, this)\r\n })\r\n \r\n }\r\n }\r\n\r\n // 雨滴动效\r\n this.rainEffect = createSvga(\"雨滴动效\");\r\n // this.rightHand.rotation = 0;\r\n\r\n\r\n\r\n \r\n\r\n this.addEventListener(engine.Event.ENTER_FRAME, function addFrame() {\r\n \r\n \r\n\r\n let dt = Date.now() - ld;\r\n\r\n b += dt;\r\n timer += dt;\r\n\r\n // 延迟三秒执行\r\n if (timer >= 3000) {\r\n a += dt;\r\n if (a > 100) {\r\n a = 0;\r\n if (this.moists.percent < 1 && this.timeCounter.time > 0) {\r\n let drip = new engine.Sprite(getTexture(\"07f74bf6-416f-445e-98d5-021efe4c9fdc\"));\r\n drip.x = Math.random() * (this.humanbeing.x + 160) + (this.humanbeing.x - 160);\r\n drip.y = Math.random() * 100 + 300;\r\n this.dripArray.push(drip);\r\n this.addChild(drip);\r\n }\r\n\r\n }\r\n\r\n // 雨滴下落\r\n for (let drip of this.dripArray) {\r\n drip.y += (300 * dt) / 1000;\r\n if (drip.y > this.stage.height) {\r\n let index = this.dripArray.indexOf(drip);\r\n this.removeChild(drip);\r\n this.dripArray = this.dripArray.filter(\r\n (ele, i) => i != index\r\n );\r\n }\r\n }\r\n\r\n\r\n //计时器\r\n if (b >= 1000) {\r\n b = 0;\r\n if (this.moists.percent < 1) {\r\n this.timeCounter.time -= 1;\r\n if (this.timeCounter.time <= 0) {\r\n \r\n this.timeCounter.time = 0;\r\n }\r\n this.timeCounter.updateTime(this.timeCounter.time);\r\n }\r\n\r\n if (this.timeCounter.time <= 0 && !this.succeedFlag) {\r\n this.timeCounter.time = 0;\r\n this.succeedFlag = true;\r\n this.gameOver = true;\r\n\r\n console.log(\"游戏成功!\");\r\n // 云动画\r\n // 雨水结束\r\n // 太阳出来\r\n this.success();\r\n // this.removeEventListener(engine.Event.END_FRAME,()=>{})\r\n \r\n // 上局的雨滴未清除\r\n \r\n\r\n }\r\n\r\n \r\n\r\n // 湿润条动效\r\n // this.moists.move(this.moists.x,80);\r\n \r\n \r\n }\r\n \r\n\r\n \r\n\r\n // 伞的旋转\r\n let wind = -50;\r\n this.rightHand.rotation += wind / 60;\r\n\r\n\r\n if (this.rightHand.rotation <= -90) {\r\n this.rightHand.rotation = -90;\r\n } else if (this.rightHand.rotation >= 90) {\r\n this.rightHand.rotation = 90;\r\n }\r\n\r\n // 吃力表情\r\n if (this.rightHand.rotation <= -60 && !this.faceFlag) {\r\n this.rightHand.rotation += -10 / 60;\r\n let face = this.humanbeing.facialChange(1);\r\n face.x = 7;\r\n face.y = 22;\r\n setTimeout(() => {\r\n this.humanbeing.removeFace(face);\r\n }, 100);\r\n }\r\n\r\n \r\n\r\n\r\n // 扇形的角度\r\n this.angle = Math.asin(this.D / 2 / this.R) * 57.18;\r\n\r\n // 伞的偏移角度距离水平位置\r\n let validMaxX;\r\n let validMinX;\r\n // 伞的圆函数\r\n let ambrellaFuncY;\r\n\r\n this.rightHand.name = \"aaa\";\r\n\r\n // a.worldMatrix.tx\r\n\r\n // point1,2线性方程斜率\r\n\r\n const sa = this.worldMatrix.a;\r\n const sd = this.worldMatrix.d;\r\n\r\n const p1x = point1.worldMatrix.tx / sa;\r\n const p2x = point2.worldMatrix.tx / sa;\r\n const p3x = point3.worldMatrix.tx / sa;\r\n const p1y = point1.worldMatrix.ty / sd;\r\n const p2y = point2.worldMatrix.ty / sd;\r\n const p3y = point3.worldMatrix.ty / sd;\r\n\r\n let k12 = (p1y - p2y) / (p1x - p2x);\r\n let k23 = (p2y - p3y) / (p2x - p3x);\r\n\r\n let px1 = p1x;\r\n let px2 = p2x;\r\n let px3 = p3x;\r\n\r\n let maxX = px1 >= px2 ? (px1 >= px3 ? px1 : px3) : px2 >= px3 ? px2 : px3;\r\n let minX = px1 >= px2 ? (px2 >= px3 ? px3 : px2) : px1 >= px3 ? px3 : px1;\r\n\r\n let x2 = (middleX + this.R) < maxX ? (middleX + this.R) : maxX;\r\n\r\n if(this.dripArray.length !== 0){\r\n for (let drip of this.dripArray) {\r\n\r\n const dx = drip.worldMatrix.tx / sa;\r\n const dy = drip.worldMatrix.ty / sd;\r\n\r\n // point1,2线性方程\r\n let b12 = p1y - p1x * k12 - 50;\r\n let b23 = p2y - p2x * k23 - 50;\r\n let y12 = k12 * dx + b12;\r\n let y23 = k23 * dx + b23;\r\n if (dx >= minX && dx < maxX) {\r\n // 伞碰撞12\r\n if (dx < px2) {\r\n if (Math.abs(y12 -dy) <= 50) {\r\n if (dy >= y12) {\r\n let index = this.dripArray.indexOf(drip);\r\n this.removeChild(drip);\r\n this.dripArray = this.dripArray.filter(\r\n (ele, i) => i != index\r\n );\r\n }\r\n }\r\n }\r\n // 23\r\n if (dx >= px2) {\r\n if (Math.abs(y23 -dy) <= 50) {\r\n if (dy >= y23) {\r\n let index = this.dripArray.indexOf(drip);\r\n this.removeChild(drip);\r\n this.dripArray = this.dripArray.filter(\r\n (ele, i) => i != index\r\n );\r\n }\r\n }\r\n }\r\n }\r\n\r\n // 碰人\r\n if (drip.x > this.humanbeing.x &&\r\n drip.x < this.humanbeing.x + this.humanbeing.width) {\r\n if (drip.y >= this.humanbeing.y ) {\r\n\r\n if(!this.failFlag){\r\n // 湿润度增加\r\n this.moists.percent += 0.1;\r\n this.moists.percent = Math.round(this.moists.percent *100) / 100;\r\n console.log(this.moists.percent)\r\n this.moists.cover(this.moists.percent);\r\n if(this.moists.percent < 1){\r\n this.moists.updateText(this.moists.percent);\r\n }\r\n // 动效\r\n this.humanbeing.scaleEffect();\r\n \r\n \r\n // 雨滴动效\r\n this.addChild(this.rainEffect);\r\n this.rainEffect.visible = true;\r\n this.rainEffect.play(true, false);\r\n this.rainEffect.x = drip.x - drip.width * 2;\r\n this.rainEffect.y = drip.y;\r\n this.rainEffect.once(engine.Event.END_FRAME, () => {\r\n this.rainEffect.visible = false;\r\n })\r\n // 表情改变\r\n this.faceFlag = true;\r\n let face = this.humanbeing.facialChange(2);\r\n face.x = 7;\r\n face.y = 22;\r\n setTimeout(() => {\r\n this.humanbeing.removeFace(face);\r\n this.faceFlag = false;\r\n }, 500);\r\n // console.log(\"人\");\r\n }\r\n\r\n this.removeChild(drip);\r\n\r\n\r\n let index = this.dripArray.indexOf(drip);\r\n this.dripArray = this.dripArray.filter(\r\n (ele, i) => i != index\r\n );\r\n\r\n \r\n \r\n if (this.moists.percent >= 1 && !this.failFlag) {\r\n // 游戏结束\r\n this.moists.stopScale();\r\n this.failFlag = true;\r\n this.gameOver = true;\r\n console.log(\"游戏结束!\");\r\n \r\n // 清除事件\r\n this.stop();\r\n // this.timeCounter.updateTime(this.timeCounter.time);\r\n // this.removeAllEventListener();\r\n // this.reset();\r\n }\r\n \r\n }\r\n }\r\n }\r\n }\r\n\r\n this.playBtn.addEventListener(\r\n engine.MouseEvent.CLICK,\r\n this.onClick,\r\n this\r\n );\r\n if(this.gameOver){\r\n for(let drip of this.dripArray){\r\n drip.x= 0;\r\n drip.y= 0;\r\n drip.visible = false;\r\n this.removeChild(drip)\r\n }\r\n }\r\n }\r\n\r\n ld = Date.now();\r\n });\r\n\r\n // this.playAgain.x = 138;\r\n // this.playAgain.y = 1000;\r\n // this.addChild(this.playAgain)\r\n // this.playAgain.addEventListener(engine.MouseEvent.CLICK,this.again,this)\r\n\r\n \r\n // this.rightHand.rotation = 0;\r\n }\r\n\r\n onClick() {\r\n this.clicknum += 1;\r\n this.rightHand.rotation += 10 * this.clicknum;\r\n this.clicknum = 0;\r\n\r\n // engine.Tween.get(this.playBtn)\r\n // .set({scaleX:1,scaleY:1})\r\n // .to({scaleX:1.1,scaleY:1.1},100)\r\n // .to({scaleX:1,scaleY:1},100)\r\n\r\n\r\n }\r\n\r\n stop() {\r\n // this.removeAllEventListener();\r\n // this.playBtn.removeAllEventListener();\r\n engine.globalEvent.dispatchEvent(\"cloud-game-fail\", {reason: 1});\r\n\r\n }\r\n\r\n success() {\r\n this.cloud.succeed();\r\n engine.globalEvent.dispatchEvent(\"cloud-game-success\", {\r\n moist: this.moists.percent,\r\n });\r\n }\r\n\r\n reset(){ \r\n // this.removeChildren();\r\n this.removeAllEventListener();\r\n this.moists.percent = 0;\r\n this.moists.moistCover.scaleY = 0;\r\n this.moists.txt.text = 0 + \"%\";\r\n this.rightHand.rotation = 0;\r\n this.container = new engine.Container();\r\n if(this.cloud){\r\n this.cloud.parent.removeChild(this.cloud)\r\n }\r\n this.succeedFlag = false;\r\n this.failFlag = false;\r\n this.gameOver = false;\r\n\r\n }\r\n\r\n again(){\r\n this.reset();\r\n // this.start();\r\n }\r\n}\r\n// }\r\n\r\n","\r\nimport GameView from \"./GameView\";\r\nimport GameTest from \"./GameTest\";\r\n\r\nimport { injectProps } from \"../props\";\r\n\r\n\r\nexport class GameWrapper extends engine.Container {\r\n\t// private _status;\r\n\tprivate _gameView: GameView;\r\n\tprivate _gameTest: GameTest;\r\n\r\n\r\n\r\n\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tengine.globalEvent.addEventListener('cloud-game-reset', this.reset, this);\r\n\t\tengine.globalEvent.addEventListener('pictures-start', this.start, this);\r\n\t\tengine.globalEvent.addEventListener('pictures-stop', this.stop, this);\r\n\r\n\t\t//创建实例\r\n\t\t// let gameView = this._gameView = new GameView();\r\n\t\tlet gameTest = this._gameTest = new GameTest();\r\n\t\tthis.addChild(gameTest);\r\n\r\n\t}\r\n\r\n\tstart(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\r\n\t\t// this._status = 1;\r\n\r\n\t\t// this._gameView.start();\r\n\t\tthis._gameTest.start();\r\n\t}\r\n\tstop(event: engine.Event) {\r\n\t\t\r\n\t\t// this._gameView.stop();\r\n\t\tthis._gameTest.stop();\r\n\t}\r\n\r\n\treset(event:engine.Event){\r\n\t\tthis._gameTest.again();\r\n\t}\r\n}\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\t\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;UAIgB,UAAU,CAAC,IAAI;KAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;UASe,UAAU,CAAC,IAAI,EAAE,UAAW;KAC3C,IAAI,IAAI,GAA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,CAAC,IAAI,CAAC,CAAC;SAKxB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KACD,0BAAI,GAAJ,UAAK,KAAmB;SAGvB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;MACtB;KAED,2BAAK,GAAL,UAAM,KAAkB;SACvB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KACF,kBAAC;CAAD,CAAC,CAxCgC,MAAM,CAAC,SAAS,GAwChD;;;iBC1CwB,KAAK;KAC7B,YAAY,EAAE,CAAC;KACf,WAAW,CAAC,KAAK,CAAC,CAAC;KAEnB,IAAI,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;KAEjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;;"}
\ No newline at end of file
......@@ -16,7 +16,7 @@
"GAME_TIME": {
"alias": "游戏时间",
"type": "number",
"default": 30
"default": 20
},
"moistPercent": {
"alias": "湿润度",
......@@ -43,6 +43,12 @@
"uuid":"ed0e8931-2557-4527-bcfc-9071f90d5737",
"ext":".png"
},
{
"name":"湿润度动效处理",
"url":"//yun.duiba.com.cn/aurora/assets/d02e290b34ca4b3254f705bd04f02d231003f05d.png",
"uuid":"9be94bf5-5dd9-470b-a251-705d9c0ff1b0",
"ext":".png"
},
{
"name":"wind",
"url":"//yun.duiba.com.cn/aurora/assets/15fc1dabf22baedd8bf5e5b418e57cfc81686072.svga",
......@@ -57,9 +63,9 @@
},
{
"name":"背景",
"url":"//yun.duiba.com.cn/aurora/assets/d0e22ae58b6e8519b969ed207197a31820790349.png",
"uuid":"5ab43bdc-a6ce-46fb-99c2-a806f57f7484",
"ext":".png"
"url":"//yun.duiba.com.cn/aurora/assets/ecc97b17c9865468e95709b8211d74d636e443d9.jpg",
"uuid":"ad720818-ce72-48a1-9494-5bd2b64136da",
"ext":".jpg"
},
{
"name":"倒计时",
......@@ -110,17 +116,12 @@
"ext":".png"
},
{
"name":"吃力1",
"url":"//yun.duiba.com.cn/aurora/assets/40f906478c4fe90f9b68392df0031d382502f8d9.png",
"uuid":"b876771a-a5d1-47f4-bd45-5978519c521a",
"ext":".png"
},
{
"name":"沮丧1",
"url":"//yun.duiba.com.cn/aurora/assets/f76eb798d2ccff84f53780c37d802830c5f6071c.png",
"uuid":"ff43517a-27bb-4f73-948c-d7a4fa7b4c69",
"name":"手无问题的常态",
"url":"//yun.duiba.com.cn/aurora/assets/7b0c9452e2cd4d9cb0d76b69b808642fd43a62f8.png",
"uuid":"e55ba5c2-ddbc-4392-b507-c2e7df91076f",
"ext":".png"
},
{
"name":"常态2",
"url":"//yun.duiba.com.cn/aurora/assets/875fd6ba38735682fe27d010338277238672f310.png",
......@@ -158,28 +159,13 @@
"url":"//yun.duiba.com.cn/aurora/assets/a1bf1b1622759aabec29e857e325039c147bac54.png",
"uuid":"07f74bf6-416f-445e-98d5-021efe4c9fdc",
"ext":".png"
},
{
"name":"",
"url":"//yun.duiba.com.cn/aurora/assets/1cded0d917c44d22ddce058f239e1cfac1b506c2.png",
"uuid":"57d4067e-c32f-4b12-a8fc-185753726fc6",
"ext":".png"
},
{
"name":"击中",
"url":"//yun.duiba.com.cn/aurora/assets/251402a1991ef00a124ddd91f519a30147285e00.png",
"uuid":"38ec6627-efa8-4f7a-9bdc-3c73cea717f1",
"ext":".png"
},
{
"name":"关闭",
"url":"//yun.duiba.com.cn/aurora/assets/6900f3a3b592c1b9cd3925fb9b66b6ec673a8c43.png",
"uuid":"e4a82aee-4472-4b06-bd75-02fb64f1c8c8",
"ext":".png"
}
],
"events": {
"in": {
"cloud-game-reset":{
"alias": "重置"
},
"pictures-start": {
"alias": "开始",
"data": {
......
......@@ -28,6 +28,7 @@ export default class CloudRain extends engine.Container{
let ld = Date.now();
this.addEventListener(engine.Event.ENTER_FRAME,()=>{
let dt = Date.now() - ld;
// console.log(111)
a += dt;
if(a>100){
this.clound1.x -= (800 * dt) / 1000;
......@@ -50,7 +51,4 @@ export default class CloudRain extends engine.Container{
}
\ No newline at end of file
......@@ -4,12 +4,14 @@ import Human from "./Human";
import Moist from "./Moist";
import TimeCounter from "./TimeCounter";
import CloudRain from "./CloudRain";
import {props} from '../props'
import gameStage = engine.gameStage;
export default class GameTest extends engine.Container {
constructor() {
super();
this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);
// this.once(engine.Event.ADDED_TO_STAGE, this.start, this);
}
rightHand: engine.Sprite;
......@@ -21,17 +23,21 @@ export default class GameTest extends engine.Container {
moists: Moist;
contain: any;
timeCounter: TimeCounter;
cloudRain: CloudRain;
// cloudRain: CloudRain;
cloud: CloudRain;
winds
rainEffect
timeArray: any[] = []
container: engine.Container = new engine.Container()
setup() {
let playBg = new engine.Sprite(
getTexture("5ab43bdc-a6ce-46fb-99c2-a806f57f7484")
getTexture("ad720818-ce72-48a1-9494-5bd2b64136da")
);
playBg.x = 0;
playBg.y = (engine.gameStage.height - 1624) / 2;
this.addChild(playBg);
// this.human = new engine.Sprite(
......@@ -42,8 +48,9 @@ export default class GameTest extends engine.Container {
// 人
this.humanbeing = new Human();
this.humanbeing.x = 290;
// this.humanbeing.y = 900;
this.humanbeing.y = 750;
// this.humanbeing.x = 280;
// this.humanbeing.y = 750;
this.humanbeing.y = engine.gameStage.height - this.humanbeing.height - 104 - 40 ;
this.addChild(this.humanbeing);
// this.contain = new engine.Sprite()
......@@ -61,6 +68,9 @@ export default class GameTest extends engine.Container {
);
this.rightHand.x = -70;
this.rightHand.y = -65;
// this.rightHand.x = -0;
// this.rightHand.y = -65;
this.rightHand.anchorX = 196;
this.rightHand.anchorY = 253;
......@@ -72,20 +82,24 @@ export default class GameTest extends engine.Container {
this.playBtn = new engine.Sprite(
getTexture("9e347bef-6e91-4c92-ba5f-f9a52e656207")
);
this.playBtn.x = 138;
this.playBtn.y = 1150;
this.playBtn.anchorX = this.playBtn.x + this.playBtn.width / 2;
this.playBtn.anchorY = this.playBtn.y + this.playBtn.height / 2;
// this.playBtn.x = (engine.gameStage.width - this.playBtn.width) / 2;
this.playBtn.x = 138 ;
this.playBtn.y = engine.gameStage.height - this.playBtn.height - 20;
// this.playBtn.anchorX = this.playBtn.x + this.playBtn.width / 2;
// this.playBtn.anchorY = this.playBtn.y + this.playBtn.height ;
// this.playBtn.anchorTexture.set(0.5, 0.1);
this.addChild(this.playBtn);
// 湿润度
this.moists = new Moist();
this.moists.x = 20;
this.moists.y = 450;
this.moists.y = 500;
this.addChild(this.moists);
// 云
this.cloud = new CloudRain();
this.addChild(this.cloud);
// this.cloud = new CloudRain();
// this.addChild(this.cloud);
this.timeArray.push(this.t3, this.t2, this.t1);
}
......@@ -103,14 +117,23 @@ export default class GameTest extends engine.Container {
t2 = new engine.Sprite(getTexture('22de82d1-97ec-4195-a32c-f4fc1656e2de'));
t3 = new engine.Sprite(getTexture('cc952365-a990-4912-98af-50905559b9d5'));
// playAgain:engine.Sprite = new engine.Sprite(getTexture('f06bd053-7b8a-4177-ab4f-36557761205a'));
face
faceFlag:boolean = false
succeedFlag = false;
failFlag = false;
gameOver:false
start() {
// engine.globalEvent.dispatchEvent("cloud-game-reset");
const middleX = this.humanbeing.x + this.humanbeing.width / 2;
const validX1 = this.humanbeing.x;
const validX2 = this.humanbeing.x + this.humanbeing.width;
let point1 = new engine.Graphics();
point1.beginFill(0xff0000);
point1.beginFill('',0);
point1.drawRect(0, 0, 10, 10);
point1.x = 0;
point1.y = 100;
......@@ -119,7 +142,7 @@ export default class GameTest extends engine.Container {
this.rightHand.addChild(point1);
let point2 = new engine.Graphics();
point2.beginFill(0xff0000);
point2.beginFill('',0);
point2.drawRect(0, 0, 10, 10);
point2.x = 170;
point2.y = 0;
......@@ -128,7 +151,7 @@ export default class GameTest extends engine.Container {
this.rightHand.addChild(point2);
let point3 = new engine.Graphics();
point3.beginFill(0xff0000);
point3.beginFill('',0);
point3.drawRect(0, 0, 10, 10);
point3.x = 330;
point3.y = 100;
......@@ -152,8 +175,9 @@ export default class GameTest extends engine.Container {
let timer = 0;
let succeedFlag = false;
let failFlag = false;
this.cloud = new CloudRain();
this.addChild(this.cloud);
// 倒计时
......@@ -182,6 +206,8 @@ export default class GameTest extends engine.Container {
// 风吹动效
this.winds = createSvga("wind");
this.winds.mouseEnabled = false
this.winds.mouseChildren = false;
this.addChild(this.winds);
this.winds.visible = true;
this.winds.play(true, true)
......@@ -195,8 +221,16 @@ export default class GameTest extends engine.Container {
// 雨滴动效
this.rainEffect = createSvga("雨滴动效");
// this.rightHand.rotation = 0;
this.addEventListener(engine.Event.ENTER_FRAME, function addFrame() {
let dt = Date.now() - ld;
b += dt;
......@@ -205,7 +239,7 @@ export default class GameTest extends engine.Container {
// 延迟三秒执行
if (timer >= 3000) {
a += dt;
if (a > 10) {
if (a > 100) {
a = 0;
if (this.moists.percent < 1 && this.timeCounter.time > 0) {
let drip = new engine.Sprite(getTexture("07f74bf6-416f-445e-98d5-021efe4c9fdc"));
......@@ -236,29 +270,45 @@ export default class GameTest extends engine.Container {
if (this.moists.percent < 1) {
this.timeCounter.time -= 1;
if (this.timeCounter.time <= 0) {
this.timeCounter.time = 0;
}
this.timeCounter.updateTime(this.timeCounter.time);
}
if (this.timeCounter.time <= 0 && !succeedFlag) {
if (this.timeCounter.time <= 0 && !this.succeedFlag) {
this.timeCounter.time = 0;
succeedFlag = true;
this.succeedFlag = true;
this.gameOver = true;
console.log("游戏成功!");
// 云动画
// 雨水结束
// 太阳出来
this.success();
// this.removeEventListener(engine.Event.END_FRAME,()=>{})
// if(succeedFlag){
// }
// 上局的雨滴未清除
}
// 湿润条动效
// this.moists.move(this.moists.x,80);
}
// 伞的旋转
let wind = -40;
let wind = -50;
this.rightHand.rotation += wind / 60;
if (this.rightHand.rotation <= -90) {
this.rightHand.rotation = -90;
} else if (this.rightHand.rotation >= 90) {
......@@ -266,7 +316,8 @@ export default class GameTest extends engine.Container {
}
// 吃力表情
if (this.rightHand.rotation <= -60) {
if (this.rightHand.rotation <= -60 && !this.faceFlag) {
this.rightHand.rotation += -10 / 60;
let face = this.humanbeing.facialChange(1);
face.x = 7;
face.y = 22;
......@@ -275,9 +326,9 @@ export default class GameTest extends engine.Container {
}, 100);
}
// ld = Date.now();
// return;
// 扇形的角度
this.angle = Math.asin(this.D / 2 / this.R) * 57.18;
......@@ -315,6 +366,7 @@ export default class GameTest extends engine.Container {
let x2 = (middleX + this.R) < maxX ? (middleX + this.R) : maxX;
if(this.dripArray.length !== 0){
for (let drip of this.dripArray) {
const dx = drip.worldMatrix.tx / sa;
......@@ -328,7 +380,7 @@ export default class GameTest extends engine.Container {
if (dx >= minX && dx < maxX) {
// 伞碰撞12
if (dx < px2) {
// if (Math.abs(y12 -drip.worldMatrix.ty) <= 20) {
if (Math.abs(y12 -dy) <= 50) {
if (dy >= y12) {
let index = this.dripArray.indexOf(drip);
this.removeChild(drip);
......@@ -336,11 +388,11 @@ export default class GameTest extends engine.Container {
(ele, i) => i != index
);
}
// }
}
}
// 23
if (dx >= px2) {
// if (Math.abs(y23 -drip.worldMatrix.ty) <= 20) {
if (Math.abs(y23 -dy) <= 50) {
if (dy >= y23) {
let index = this.dripArray.indexOf(drip);
this.removeChild(drip);
......@@ -348,79 +400,110 @@ export default class GameTest extends engine.Container {
(ele, i) => i != index
);
}
// }
}
}
}
// 碰人
if (drip.x > this.humanbeing.x &&
drip.x < this.humanbeing.x + this.humanbeing.width) {
if (drip.y >= this.humanbeing.y) {
if (drip.y >= this.humanbeing.y ) {
if(!this.failFlag){
// 湿润度增加
this.moists.percent += 0.1;
this.moists.percent = Math.round(this.moists.percent *100) / 100;
console.log(this.moists.percent)
this.moists.cover(this.moists.percent);
if(this.moists.percent < 1){
this.moists.updateText(this.moists.percent);
// this.moists.updatePercent(this.moists.percent);
}
// 动效
this.humanbeing.scaleEffect();
// 雨滴动效
this.addChild(this.rainEffect);
this.rainEffect.visible = true;
this.rainEffect.play(true, true);
this.rainEffect.play(true, false);
this.rainEffect.x = drip.x - drip.width * 2;
this.rainEffect.y = drip.y;
this.rainEffect.once(engine.Event.END_FRAME, () => {
this.rainEffect.visible = false;
})
if (this.moists.percent >= 1 && !failFlag) {
// 游戏结束
this.moists.stopScale();
failFlag = true;
console.log("游戏结束!");
// 清除事件
this.stop();
// this.timeCounter.updateTime(this.timeCounter.time);
}
this.removeChild(drip);
// 表情改变
this.faceFlag = true;
let face = this.humanbeing.facialChange(2);
face.x = 7;
face.y = 22;
setTimeout(() => {
this.humanbeing.removeFace(face);
this.faceFlag = false;
}, 500);
console.log("人");
// console.log("人");
}
this.removeChild(drip);
let index = this.dripArray.indexOf(drip);
this.dripArray = this.dripArray.filter(
(ele, i) => i != index
);
// 动效
this.humanbeing.scaleEffect();
if (this.moists.percent >= 1 && !this.failFlag) {
// 游戏结束
this.moists.stopScale();
this.failFlag = true;
this.gameOver = true;
console.log("游戏结束!");
// 清除事件
this.stop();
// this.timeCounter.updateTime(this.timeCounter.time);
// this.removeAllEventListener();
// this.reset();
}
}
}
}
}
ld = Date.now();
});
this.playBtn.addEventListener(
engine.MouseEvent.CLICK,
this.onClick,
this
);
this.rightHand.rotation = 0;
if(this.gameOver){
for(let drip of this.dripArray){
drip.x= 0;
drip.y= 0;
drip.visible = false;
this.removeChild(drip)
}
}
}
ld = Date.now();
});
// this.playAgain.x = 138;
// this.playAgain.y = 1000;
// this.addChild(this.playAgain)
// this.playAgain.addEventListener(engine.MouseEvent.CLICK,this.again,this)
// this.rightHand.rotation = 0;
}
onClick() {
this.clicknum += 1;
this.rightHand.rotation += 10 * this.clicknum;
this.clicknum = 0;
// engine.Tween.get(this.playBtn)
// .set({scaleX:1,scaleY:1})
// .to({scaleX:1.1,scaleY:1.1},100)
......@@ -442,6 +525,28 @@ export default class GameTest extends engine.Container {
moist: this.moists.percent,
});
}
reset(){
// this.removeChildren();
this.removeAllEventListener();
this.moists.percent = 0;
this.moists.moistCover.scaleY = 0;
this.moists.txt.text = 0 + "%";
this.rightHand.rotation = 0;
this.container = new engine.Container();
if(this.cloud){
this.cloud.parent.removeChild(this.cloud)
}
this.succeedFlag = false;
this.failFlag = false;
this.gameOver = false;
}
again(){
this.reset();
// this.start();
}
}
// }
......@@ -17,6 +17,7 @@ export class GameWrapper extends engine.Container {
constructor() {
super();
engine.globalEvent.addEventListener('cloud-game-reset', this.reset, this);
engine.globalEvent.addEventListener('pictures-start', this.start, this);
engine.globalEvent.addEventListener('pictures-stop', this.stop, this);
......@@ -40,4 +41,8 @@ export class GameWrapper extends engine.Container {
// this._gameView.stop();
this._gameTest.stop();
}
reset(event:engine.Event){
this._gameTest.again();
}
}
......@@ -29,25 +29,31 @@ export default class Human extends engine.Container{
}
scaleEffect(){
let aaa = 0;
let pt = Date.now();
this.addEventListener(engine.Event.ENTER_FRAME,()=>{
let dt = Date.now() -pt;
aaa += dt;
// let aaa = 0;
// let pt = Date.now();
// this.addEventListener(engine.Event.ENTER_FRAME,()=>{
// let dt = Date.now() -pt;
// aaa += dt;
// this.anchorX = this.width + this.width / 2
// this.anchorY = this.height;
// if(aaa > 90 && aaa<=100 ){
// this.scaleY = 0.99;
// this.scaleX = 1.01;
// }
// if(aaa >190 && aaa < 200){
// this.scaleX = 1;
// this.scaleY = 1;
// aaa = 0;
// }
// pt = Date.now();
// })
this.anchorX = this.width + this.width / 2
this.anchorY = this.height;
if(aaa > 90 && aaa<=100 ){
this.scaleY = 0.99;
this.scaleX = 1.01;
}
if(aaa >190 && aaa < 200){
this.scaleX = 1;
this.scaleY = 1;
aaa = 0;
}
pt = Date.now();
})
engine.Tween.get(this)
.set({scaleX:1,scaleY:1})
.to({scaleX:1.01,scaleY:0.99},100)
.to({scaleX:1,scaleY:1},100)
}
}
\ No newline at end of file
......@@ -9,7 +9,12 @@ export default class Moist extends engine.Container{
txt = new engine.TextInput();
hintpic:engine.Sprite = new engine.Sprite(getTexture('ed0e8931-2557-4527-bcfc-9071f90d5737'))
moveImg1:any = new engine.Sprite(getTexture('9be94bf5-5dd9-470b-a251-705d9c0ff1b0'))
moveImg2:any = new engine.Sprite(getTexture('9be94bf5-5dd9-470b-a251-705d9c0ff1b0'))
addPercent:number
moveImgContainer:any = new engine.Container();
constructor(){
super();
this.percent = 0;
......@@ -17,7 +22,6 @@ export default class Moist extends engine.Container{
this.moistBg.addChild(this.moist)
this.moist.mask = this.moistCover;
this.txt.text = this.percent*100+'%';
this.txt.size = 30;
this.txt.fillColor = '#7A83C5';
......@@ -28,9 +32,24 @@ export default class Moist extends engine.Container{
this.hintpic.x = -10;
this.hintpic.y = 440;
this.addChild(this.hintpic)
}
// move(x,y){
// engine.Tween.get(this.moveImg1)
// .set({x:x,y:80})
// .to({x:x-this.moveImg1.width * 2,y:80},500)
// engine.Tween.get(this.moveImg2)
// .set({x:x + this.moveImg1.width - 5,y:80})
// .to({x:(x - this.moveImg1.width*2 - 5),y:80},500)
// }
cover(percent){
percent = percent.toPrecision(2);
this.moistCover.anchorY = 416;
this.moistBg.addChild(this.moistCover)
this.moistCover.scaleY = percent;
......
import {getTexture} from './utils'
import {props} from '../props'
export default class TimeCounter extends engine.Container{
timeCounter:engine.Sprite = new engine.Sprite(getTexture('b7d2a60a-9e60-4eca-be80-a991abea47c9'));
......@@ -8,7 +9,7 @@ export default class TimeCounter extends engine.Container{
constructor(){
super()
this.time = 20
this.time = props.GAME_TIME;
this.addChild(this.timeCounter)
this.timeCounter.x = 256;
......
......@@ -17,7 +17,10 @@ function launchWithCustomModule(customModule) {
//engine.registerCustomCodeModule(customModule);
engine.registerCustomModule(customId, window[customId]);
const { props: propsOption, assets } = customModule;
const {
props: propsOption,
assets
} = customModule;
let props = engine.computeProps(customModuleProps, propsOption);
const customModuleIns = {
id: customId,
......@@ -55,8 +58,8 @@ function launchWithCustomModule(customModule) {
});
const d = engine.gameStage.sceneContainer.getChildAt(0);
engine.gameStage.sceneContainer.getChildAt(0).x = (d.stage.width-props.W)/2;
engine.gameStage.sceneContainer.getChildAt(0).y = (d.stage.height-props.H)/2;
engine.gameStage.sceneContainer.getChildAt(0).x = (d.stage.width - props.W) / 2;
engine.gameStage.sceneContainer.getChildAt(0).y = (d.stage.height - props.H) / 2;
}, 1000);
// setTimeout(() => {
......
......@@ -12,6 +12,7 @@
function injectProps(p) {
engine.injectProp(props, p);
}
//# sourceMappingURL=props.js.map
var picMap = {};
var posMap = {};
......@@ -64,6 +65,7 @@
posMap[url] = pos.concat([]);
return [spr, pos];
});
//# sourceMappingURL=qietu.js.map
function getIndexFromRC(row, col, maxCol) {
var index;
......@@ -75,6 +77,7 @@
return .5 - Math.random();
});
}
//# sourceMappingURL=utils.js.map
var MAX_COL;
var MAX_ROW;
......@@ -95,9 +98,9 @@
}
GameView.prototype.start = function () {
var _this = this;
MAX_COL = props.column || props.MAX_COL;
MAX_ROW = props.row || props.MAX_ROW;
GAME_TIME = props.gameTime || props.GAME_TIME;
MAX_COL = props.MAX_COL;
MAX_ROW = props.MAX_ROW;
GAME_TIME = props.GAME_TIME;
console.log('start', props.column, props.row, props.gameTime);
if (!this.guideHole) {
this.guideHole = new engine.Image();
......@@ -151,7 +154,7 @@
if (GAME_TIME < 10) {
GAME_TIME = '0' + GAME_TIME;
}
console.log(GAME_TIME);
console.log(GAME_TIME, "gametime1");
engine.globalEvent.dispatchEvent('pictures-time-update', {
second: this.getSecond(),
});
......@@ -187,6 +190,7 @@
MAX_COL = props.MAX_COL;
MAX_ROW = props.MAX_ROW;
GAME_TIME = props.GAME_TIME;
console.log(GAME_TIME, 'setuptime');
W = props.W;
H = props.H;
GAP = props.GAP;
......@@ -292,6 +296,7 @@
};
return GameWrapper;
}(engine.Container));
//# sourceMappingURL=GameWrapper.js.map
function index (props) {
prepareProps();
......@@ -299,6 +304,7 @@
var instance = new GameWrapper();
return instance;
}
//# sourceMappingURL=index.js.map
return index;
......
{"version":3,"file":"index.js","sources":["src/custom/pictures/src/props.ts","src/custom/pictures/src/game/qietu.ts","src/custom/pictures/src/game/utils.ts","src/custom/pictures/src/game/GameView.ts","src/custom/pictures/src/game/GameWrapper.ts","src/custom/pictures/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","import { props } from \"../props\";\r\nconst urls = [];\r\nconst picMap = {};\r\nconst posMap = {};\r\nexport default (parent, url, MAX_COL, MAX_ROW) => {\r\n if (picMap[url]) {\r\n const pics:any[] = picMap[url];\r\n for (const pic of pics) {\r\n parent.addChild(pic);\r\n }\r\n return [picMap[url], posMap[url]]\r\n }\r\n\r\n const W = props.W;\r\n const H = props.H;\r\n const GAP = props.GAP;\r\n\r\n const spr = [];\r\n const pos = []\r\n\r\n for (let row = 0; row < MAX_ROW; row++) {\r\n for (let col = 0; col < MAX_COL; col++) {\r\n\r\n const child = engine.Sprite.fromImage(url);\r\n spr.push(child);\r\n\r\n child.scaleX = 1 / MAX_COL;\r\n child.scaleY = 1 / MAX_ROW;\r\n parent.addChild(child);\r\n child.x = col * (W / MAX_COL + GAP);\r\n child.y = row * (H / MAX_ROW + GAP);\r\n pos.push([child.x, child.y]);\r\n // child.texture.addEventListener('update', () => {\r\n child.addEventListener(engine.Event.COMPLETE, () => {\r\n const uvs = new Float32Array([\r\n col / MAX_COL,\r\n row / MAX_ROW,\r\n (col + 1) / MAX_COL,\r\n row / MAX_ROW,\r\n (col + 1) / MAX_COL,\r\n (row + 1) / MAX_ROW,\r\n col / MAX_COL,\r\n (row + 1) / MAX_ROW,\r\n ]);\r\n\r\n child.uvs = uvs;\r\n // spr.push(child);\r\n });\r\n }\r\n }\r\n picMap[url] = spr.concat([]);\r\n posMap[url] = pos.concat([]);;\r\n // console.log(spr);\r\n return [spr, pos];\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\r\nexport function getIndexFromRC(row,col,maxCol){\r\n\tlet index;\r\n\tindex = row * maxCol + col ;\r\n\treturn index\r\n}\r\n\r\n\r\n\r\n\r\nexport function getRandomArray(array){\r\n\tarray.sort(function() {\r\n\t\treturn .5 - Math.random();\r\n\t});\r\n}","/**\r\n * Created by rockyl on 2018/8/16.\r\n */\r\n\r\nimport { props } from \"../props\";\r\nimport qietu from \"./qietu\";\r\nimport { getIndexFromRC, getRandomArray, getTexture } from \"./utils\";\r\nimport ObjectPool = engine.ObjectPool;\r\n\r\n// let OFFSET_X;\r\n// let OFFSET_Y;\r\nlet MAX_COL;\r\nlet MAX_ROW;\r\nlet W;\r\nlet H;\r\nlet GAP;\r\nlet GAME_TIME;\r\n// 每张图片宽\r\nlet w;\r\n// 每张图片高\r\nlet h;\r\n\r\nexport default class GameView extends engine.Container {\r\n private _timer;\r\n private _timeCounter = 0;\r\n\r\n private date\r\n\r\n start() {\r\n //优先获取start事件接收到的参数\r\n MAX_COL = props.column || props.MAX_COL;\r\n MAX_ROW = props.row || props.MAX_ROW;\r\n GAME_TIME = props.gameTime || props.GAME_TIME;\r\n console.log('start',props.column,props.row,props.gameTime)\r\n\r\n if (!this.guideHole) {\r\n this.guideHole = new engine.Image();\r\n this.guideHole.source = 'asset://' + props.blockUrl;\r\n this.guideHole.mouseChildren = this.guideHole.mouseEnabled = false;\r\n }\r\n\r\n if (this.pictures) {\r\n for (const pic of this.pictures) {\r\n if (pic && pic.wrapper)\r\n pic.wrapper.removeChild(pic);\r\n }\r\n }\r\n\r\n console.log('on start')\r\n engine.globalEvent.dispatchEvent('pictures-time-update', {\r\n second: this.getSecond(),\r\n });\r\n\r\n // 图片一维数组\r\n const result = qietu(this.picturesWrapper, props.picUrl, MAX_COL, MAX_ROW);\r\n this.picturesWrapper.addChild(this.guideHole);\r\n\r\n console.log(this.picturesWrapper)\r\n\r\n this.pictures = result[0];\r\n this.rightList = this.pictures.concat([]);\r\n const posList = result[1];\r\n getRandomArray(this.pictures);\r\n\r\n let i = 0;\r\n let len;\r\n len = this.pictures.length;\r\n\r\n\r\n for (; i < len; i++) {\r\n this.dragPic = this.pictures[i];\r\n this.pictures[i].addEventListener(\r\n engine.MouseEvent.MOUSE_DOWN,\r\n this.onDown,\r\n this\r\n );\r\n const [x, y] = posList[i];\r\n this.dragPic.x = x;\r\n this.dragPic.y = y;\r\n\r\n }\r\n\r\n this._timer = setInterval(() => {\r\n this.onTimer();\r\n }, 10)\r\n\r\n this.date = new Date().getTime();\r\n\r\n }\r\n\r\n onTimer() {\r\n\r\n let date = new Date().getTime();\r\n\r\n let gap = ((date - this.date) / 1000);\r\n this.date = date;\r\n console.log(gap,\"gap\");\r\n\r\n // 以GAME_TIME为标准\r\n GAME_TIME -= gap;\r\n if(GAME_TIME < 0){\r\n GAME_TIME = 0;\r\n }\r\n GAME_TIME = this.afterPointTwo(GAME_TIME);\r\n GAME_TIME = GAME_TIME.toFixed(2)\r\n if (GAME_TIME < 10) {\r\n GAME_TIME = '0' + GAME_TIME\r\n }\r\n console.log(GAME_TIME);\r\n\r\n\r\n engine.globalEvent.dispatchEvent('pictures-time-update', {\r\n second: this.getSecond(),\r\n });\r\n\r\n if (this.getSecond() == 0) {\r\n this.stop();\r\n engine.globalEvent.dispatchEvent('pictures-game-fail', {\r\n reason: 1\r\n });\r\n }\r\n }\r\n\r\n afterPointTwo(n) {\r\n\r\n var floatN = parseFloat(n);\r\n if (isNaN(floatN)) {\r\n return;\r\n }\r\n floatN = Math.round(floatN * 100) / 100;\r\n return floatN;\r\n\r\n }\r\n\r\n getSecond() {\r\n return GAME_TIME\r\n }\r\n\r\n stop() {\r\n \r\n GAME_TIME = props.GAME_TIME\r\n clearInterval(this._timer);\r\n let len = this.pictures.length;\r\n for(let i=0;i<len;i++){\r\n this.pictures[i].removeAllEventListener();\r\n }\r\n\r\n this.stage.removeEventListener(\r\n engine.MouseEvent.MOUSE_UP,\r\n this.stageOnUp,\r\n this\r\n );\r\n \r\n }\r\n\r\n constructor() {\r\n super();\r\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\r\n }\r\n\r\n //当前图片对象\r\n dragPic;\r\n // 鼠标在当前图片上的位置\r\n localPicX;\r\n localPicY;\r\n // 拖动的图片最开始的位置(左上角为准)\r\n distanceX;\r\n distanceY;\r\n // 图片中心的位置\r\n centerX: number;\r\n centerY: number;\r\n\r\n pictures: engine.Sprite[];\r\n\r\n // 点击图片时的一维数组索引\r\n index;\r\n // 计算目标图片行和列的位置\r\n indexI: number;\r\n indexJ: number;\r\n rightList: engine.Sprite[];\r\n\r\n private picturesWrapper: engine.Sprite;\r\n private guideHole: engine.Image;\r\n\r\n createRects() { }\r\n setup() {\r\n\r\n MAX_COL = props.MAX_COL;\r\n MAX_ROW = props.MAX_ROW;\r\n GAME_TIME = props.GAME_TIME;\r\n // OFFSET_X = props.OFFSET_X;\r\n // OFFSET_Y = props.OFFSET_Y;\r\n W = props.W;\r\n H = props.H;\r\n GAP = props.GAP;\r\n // 每张图片宽\r\n w = W / MAX_COL;\r\n // 每张图片高\r\n h = H / MAX_ROW;\r\n\r\n console.log('onSteup', props);\r\n\r\n const parent = new engine.Sprite();\r\n this.picturesWrapper = parent;\r\n this.addChild(parent);\r\n\r\n // this.picturesWrapper.x = OFFSET_X;\r\n // this.picturesWrapper.y = OFFSET_Y;\r\n\r\n // 添加按钮\r\n // const btn = new engine.Rect();\r\n // btn.width = 200;\r\n // btn.height = 100;\r\n // btn.stage.top = 1000;\r\n // btn.stage.left = 350;\r\n // btn.fillColor = 'cyan';\r\n // this.addChild(btn)\r\n\r\n // btn.addEventListener(engine.MouseEvent.CLICK,this.onClk,this)\r\n\r\n }\r\n\r\n onDown(e: engine.MouseEvent) {\r\n // console.log(e);\r\n\r\n let stageLeft = (750 - props.W) / 2\r\n let stageTop = (this.stage.height - props.H) / 2;\r\n\r\n // 创建一个图片对象接收当前位置信息\r\n this.dragPic = e.target;\r\n this.picturesWrapper.addChild(this.dragPic);\r\n\r\n\r\n // 鼠标的偏移量\r\n this.localPicX = e.localX / MAX_COL;\r\n this.localPicY = e.localY / MAX_ROW;\r\n\r\n // 最开始图片的位置\r\n this.distanceX = this.dragPic.x ;\r\n this.distanceY = this.dragPic.y;\r\n\r\n // 最开始点击的图片的索引值\r\n\r\n this.indexJ = Math.floor((this.distanceX) / (w + GAP));\r\n this.indexI = Math.floor((this.distanceY) / (h + GAP));\r\n this.index = (this.indexI) * MAX_COL + this.indexJ;\r\n\r\n\r\n // this.centerX = Math.floor(e.clientX / w) * w + w / 2;\r\n // this.centerY = Math.floor(e.clientY / h) * h + h / 2;\r\n\r\n this.centerX = Math.floor((e.clientX - stageLeft) / w) * w + w / 2;\r\n this.centerY = Math.floor((e.clientY - stageTop) / h) * h + h / 2;\r\n\r\n this.stage.addEventListener(\r\n engine.MouseEvent.MOUSE_MOVE,\r\n this.onMove,\r\n this\r\n );\r\n this.stage.addEventListener(\r\n engine.MouseEvent.MOUSE_UP,\r\n this.stageOnUp,\r\n this\r\n );\r\n\r\n }\r\n\r\n listenStageOn = 1;\r\n\r\n stageOnUp(e) {\r\n\r\n let stageLeft = (750 - props.W) / 2\r\n let stageTop = (this.stage.height - props.H) / 2;\r\n\r\n this.stage.removeEventListener(\r\n engine.MouseEvent.MOUSE_MOVE,\r\n this.onMove,\r\n this\r\n );\r\n\r\n this.stage.removeEventListener(\r\n engine.MouseEvent.MOUSE_UP,\r\n this.stageOnUp,\r\n this\r\n );\r\n\r\n // 拖动的图片的中心位置在图片之外,回到原来的位置\r\n if (this.centerY < stageTop || this.centerX < stageLeft) {\r\n this.dragPic.x = this.distanceX ;\r\n this.dragPic.y = this.distanceY ;\r\n }\r\n\r\n // 判断图片是否进入另一张图片的范围内\r\n // 要交换的图片第几行第几列\r\n let curJ = Math.floor(this.centerX / (w + GAP));\r\n let curI = Math.floor(this.centerY / (h + GAP));\r\n\r\n this.picturesWrapper.addChild(this.guideHole);\r\n\r\n\r\n // 点击图片的位置\r\n\r\n if ( 0 <= curJ && curJ < (MAX_COL) && 0 <= curI && curI < (MAX_ROW)) {\r\n\r\n // 获取交互图片的索引值\r\n let index = getIndexFromRC(curI, curJ, MAX_COL);\r\n // console.log(index);\r\n\r\n //要交换的图片\r\n let dropPic = this.pictures[index];\r\n\r\n let dropPicX = dropPic.x + stageLeft;\r\n let dropPicy = dropPic.y + stageTop;\r\n\r\n dropPic.x = this.distanceX;\r\n dropPic.y = this.distanceY;\r\n\r\n this.dragPic.x = dropPicX - stageLeft;\r\n this.dragPic.y = dropPicy - stageTop;\r\n\r\n // 交换之后索引也需要交换\r\n\r\n const dropPicIndex = this.pictures.indexOf(dropPic);\r\n const dragPicIndex = this.pictures.indexOf(this.dragPic);\r\n\r\n this.pictures[dropPicIndex] = this.dragPic;\r\n this.pictures[dragPicIndex] = dropPic;\r\n\r\n // 图片中心还是在原来的位置\r\n if (dragPicIndex === dropPicIndex) {\r\n this.dragPic.x = this.distanceX\r\n this.dragPic.y = this.distanceY\r\n }\r\n\r\n let result = true;\r\n for (let j = 0; j < this.rightList.length; j++) {\r\n if (this.rightList[j] != this.pictures[j]) {\r\n result = false;\r\n break;\r\n }\r\n }\r\n\r\n if (result) {\r\n this.onSuccess();\r\n\r\n }\r\n } else {\r\n this.dragPic.x = this.distanceX\r\n this.dragPic.y = this.distanceY\r\n }\r\n\r\n\r\n }\r\n\r\n private onSuccess() {\r\n console.log('拼图成功!');\r\n engine.globalEvent.dispatchEvent('pictures-game-success', { time: GAME_TIME });\r\n this.stop();\r\n\r\n }\r\n\r\n onMove(e: engine.MouseEvent) {\r\n // 当前图片的位置\r\n this.dragPic.x = e.stageX - this.localPicX - (750 - props.W) / 2;\r\n this.dragPic.y = e.stageY - this.localPicY - (this.stage.height - props.H) / 2;\r\n\r\n // 当前图片的中心位置\r\n this.centerX = this.dragPic.x + w / 2;\r\n this.centerY = this.dragPic.y + h / 2;\r\n }\r\n\r\n // onClk(e){\r\n // // 重置时间\r\n // this._timeCounter = 0;\r\n // //重置图片顺序\r\n\r\n\r\n // }\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\n\r\nexport class GameWrapper extends engine.Container {\r\n\t// private _status;\r\n\tprivate _gameView: GameView;\r\n\r\n\r\n\r\n\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tengine.globalEvent.addEventListener('pictures-start', this.start, this);\r\n\t\tengine.globalEvent.addEventListener('pictures-stop', this.stop, this);\r\n\r\n\t\t//创建实例\r\n\t\tlet gameView = this._gameView = new GameView();\r\n\t\tthis.addChild(gameView);\r\n\r\n\t}\r\n\r\n\tstart(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\r\n\t\t// this._status = 1;\r\n\r\n\t\tthis._gameView.start();\r\n\t}\r\n\tstop(event: engine.Event) {\r\n\t\t\r\n\t\tthis._gameView.stop();\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\t\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;CAIO,IAAI,KAAK,GAAQ,EAAE,CAAC;UAEX,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;UAEe,WAAW,CAAC,CAAC;KAC5B,MA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O,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SACtC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;MACvC;KAWH,eAAC;CAAD,CAAC,CAtWqC,MAAM,CAAC,SAAS,GAsWrD;;CCpXD;KAAiCA,qCAAgB;KAQhD;SAAA,YACC,iBAAO,SASP;SAPA,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,KAAI,CAAC,KAAK,EAAE,KAAI,CAAC,CAAC;SACxE,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,eAAe,EAAE,KAAI,CAAC,IAAI,EAAE,KAAI,CAAC,CAAC;SAGtE,IAAI,QAAQ,GAAG,KAAI,CAAC,SAAS,GAAG,IAAI,QAAQ,EAAE,CAAC;SAC/C,KAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;;MAExB;KAED,2BAAK,GAAL,UAAM,KAAmB;SACxB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAIxB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KACD,0BAAI,GAAJ,UAAK,KAAmB;SAEvB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;MACtB;KACF,kBAAC;CAAD,CAAC,CA/BgC,MAAM,CAAC,SAAS,GA+BhD;;iBChCwB,KAAK;KAC7B,YAAY,EAAE,CAAC;KACf,WAAW,CAAC,KAAK,CAAC,CAAC;KAEnB,IAAI,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;KAEjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;"}
\ No newline at end of file
{"version":3,"file":"index.js","sources":["src/custom/pictures/src/props.ts","src/custom/pictures/src/game/qietu.ts","src/custom/pictures/src/game/utils.ts","src/custom/pictures/src/game/GameView.ts","src/custom/pictures/src/game/GameWrapper.ts","src/custom/pictures/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","import { props } from \"../props\";\r\nconst urls = [];\r\nconst picMap = {};\r\nconst posMap = {};\r\nexport default (parent, url, MAX_COL, MAX_ROW) => {\r\n if (picMap[url]) {\r\n const pics:any[] = picMap[url];\r\n for (const pic of pics) {\r\n parent.addChild(pic);\r\n }\r\n return [picMap[url], posMap[url]]\r\n }\r\n\r\n const W = props.W;\r\n const H = props.H;\r\n const GAP = props.GAP;\r\n\r\n const spr = [];\r\n const pos = []\r\n\r\n for (let row = 0; row < MAX_ROW; row++) {\r\n for (let col = 0; col < MAX_COL; col++) {\r\n\r\n const child = engine.Sprite.fromImage(url);\r\n spr.push(child);\r\n\r\n child.scaleX = 1 / MAX_COL;\r\n child.scaleY = 1 / MAX_ROW;\r\n parent.addChild(child);\r\n child.x = col * (W / MAX_COL + GAP);\r\n child.y = row * (H / MAX_ROW + GAP);\r\n pos.push([child.x, child.y]);\r\n // child.texture.addEventListener('update', () => {\r\n child.addEventListener(engine.Event.COMPLETE, () => {\r\n const uvs = new Float32Array([\r\n col / MAX_COL,\r\n row / MAX_ROW,\r\n (col + 1) / MAX_COL,\r\n row / MAX_ROW,\r\n (col + 1) / MAX_COL,\r\n (row + 1) / MAX_ROW,\r\n col / MAX_COL,\r\n (row + 1) / MAX_ROW,\r\n ]);\r\n\r\n child.uvs = uvs;\r\n // spr.push(child);\r\n });\r\n }\r\n }\r\n picMap[url] = spr.concat([]);\r\n posMap[url] = pos.concat([]);;\r\n // console.log(spr);\r\n return [spr, pos];\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\r\nexport function getIndexFromRC(row,col,maxCol){\r\n\tlet index;\r\n\tindex = row * maxCol + col ;\r\n\treturn index\r\n}\r\n\r\n\r\n\r\n\r\nexport function getRandomArray(array){\r\n\tarray.sort(function() {\r\n\t\treturn .5 - Math.random();\r\n\t});\r\n}","//Created by rockyl on 2018/8/16.\r\nimport qietu from \"./qietu\";\r\nimport { getIndexFromRC, getRandomArray, getTexture } from \"./utils\";\r\nimport {props} from '../props'\r\nimport ObjectPool = engine.ObjectPool;\r\n\r\n// let OFFSET_X;\r\n// let OFFSET_Y;\r\nlet MAX_COL;\r\nlet MAX_ROW;\r\nlet W;\r\nlet H;\r\nlet GAP;\r\nlet GAME_TIME;\r\n// 每张图片宽\r\nlet w;\r\n// 每张图片高\r\nlet h;\r\n\r\nexport default class GameView extends engine.Container {\r\n private _timer;\r\n private _timeCounter = 0;\r\n\r\n private date\r\n\r\n start() {\r\n\r\n //优先获取start事件接收到的参数\r\n\r\n // MAX_COL = props.column || props.MAX_COL;\r\n // MAX_ROW = props.row || props.MAX_ROW;\r\n // GAME_TIME = props.gameTime || props.GAME_TIME;\r\n MAX_COL = props.MAX_COL;\r\n MAX_ROW = props.MAX_ROW;\r\n GAME_TIME = props.GAME_TIME;\r\n console.log('start',props.column,props.row,props.gameTime)\r\n if (!this.guideHole) {\r\n this.guideHole = new engine.Image();\r\n this.guideHole.source = 'asset://' + props.blockUrl;\r\n this.guideHole.mouseChildren = this.guideHole.mouseEnabled = false;\r\n }\r\n\r\n if (this.pictures) {\r\n for (const pic of this.pictures) {\r\n if (pic && pic.wrapper)\r\n pic.wrapper.removeChild(pic);\r\n }\r\n }\r\n\r\n console.log('on start')\r\n engine.globalEvent.dispatchEvent('pictures-time-update', {\r\n second: this.getSecond(),\r\n });\r\n\r\n // 图片一维数组\r\n const result = qietu(this.picturesWrapper, props.picUrl, MAX_COL, MAX_ROW);\r\n this.picturesWrapper.addChild(this.guideHole);\r\n\r\n console.log(this.picturesWrapper)\r\n\r\n this.pictures = result[0];\r\n this.rightList = this.pictures.concat([]);\r\n const posList = result[1];\r\n getRandomArray(this.pictures);\r\n\r\n let i = 0;\r\n let len;\r\n len = this.pictures.length;\r\n\r\n\r\n for (; i < len; i++) {\r\n this.dragPic = this.pictures[i];\r\n this.pictures[i].addEventListener(\r\n engine.MouseEvent.MOUSE_DOWN,\r\n this.onDown,\r\n this\r\n );\r\n const [x, y] = posList[i];\r\n this.dragPic.x = x;\r\n this.dragPic.y = y;\r\n\r\n }\r\n\r\n this._timer = setInterval(() => {\r\n this.onTimer();\r\n }, 10)\r\n\r\n this.date = new Date().getTime();\r\n\r\n }\r\n\r\n onTimer() {\r\n\r\n let date = new Date().getTime();\r\n\r\n let gap = ((date - this.date) / 1000);\r\n this.date = date;\r\n console.log(gap,\"gap\");\r\n\r\n // 以GAME_TIME为标准\r\n GAME_TIME -= gap;\r\n if(GAME_TIME < 0){\r\n GAME_TIME = 0;\r\n }\r\n GAME_TIME = this.afterPointTwo(GAME_TIME);\r\n GAME_TIME = GAME_TIME.toFixed(2)\r\n if (GAME_TIME < 10) {\r\n GAME_TIME = '0' + GAME_TIME\r\n }\r\n console.log(GAME_TIME,\"gametime1\");\r\n\r\n\r\n engine.globalEvent.dispatchEvent('pictures-time-update', {\r\n second: this.getSecond(),\r\n });\r\n\r\n if (this.getSecond() == 0) {\r\n this.stop();\r\n engine.globalEvent.dispatchEvent('pictures-game-fail', {\r\n reason: 1\r\n });\r\n }\r\n }\r\n\r\n afterPointTwo(n) {\r\n\r\n var floatN = parseFloat(n);\r\n if (isNaN(floatN)) {\r\n return;\r\n }\r\n floatN = Math.round(floatN * 100) / 100;\r\n return floatN;\r\n\r\n }\r\n\r\n getSecond() {\r\n return GAME_TIME\r\n }\r\n\r\n stop() {\r\n \r\n GAME_TIME = props.GAME_TIME\r\n clearInterval(this._timer);\r\n let len = this.pictures.length;\r\n for(let i=0;i<len;i++){\r\n this.pictures[i].removeAllEventListener();\r\n }\r\n\r\n this.stage.removeEventListener(\r\n engine.MouseEvent.MOUSE_UP,\r\n this.stageOnUp,\r\n this\r\n );\r\n \r\n }\r\n\r\n constructor() {\r\n super();\r\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\r\n }\r\n\r\n //当前图片对象\r\n dragPic;\r\n // 鼠标在当前图片上的位置\r\n localPicX;\r\n localPicY;\r\n // 拖动的图片最开始的位置(左上角为准)\r\n distanceX;\r\n distanceY;\r\n // 图片中心的位置\r\n centerX: number;\r\n centerY: number;\r\n\r\n pictures: engine.Sprite[];\r\n\r\n // 点击图片时的一维数组索引\r\n index;\r\n // 计算目标图片行和列的位置\r\n indexI: number;\r\n indexJ: number;\r\n rightList: engine.Sprite[];\r\n\r\n private picturesWrapper: engine.Sprite;\r\n private guideHole: engine.Image;\r\n\r\n createRects() { }\r\n setup() {\r\n\r\n MAX_COL = props.MAX_COL;\r\n MAX_ROW = props.MAX_ROW;\r\n GAME_TIME = props.GAME_TIME;\r\n // OFFSET_X = props.OFFSET_X;\r\n // OFFSET_Y = props.OFFSET_Y;\r\n console.log(GAME_TIME,'setuptime')\r\n W = props.W;\r\n H = props.H;\r\n GAP = props.GAP;\r\n // 每张图片宽\r\n w = W / MAX_COL;\r\n // 每张图片高\r\n h = H / MAX_ROW;\r\n\r\n console.log('onSteup', props);\r\n\r\n const parent = new engine.Sprite();\r\n this.picturesWrapper = parent;\r\n this.addChild(parent);\r\n\r\n // this.picturesWrapper.x = OFFSET_X;\r\n // this.picturesWrapper.y = OFFSET_Y;\r\n\r\n // 添加按钮\r\n // const btn = new engine.Rect();\r\n // btn.width = 200;\r\n // btn.height = 100;\r\n // btn.stage.top = 1000;\r\n // btn.stage.left = 350;\r\n // btn.fillColor = 'cyan';\r\n // this.addChild(btn)\r\n\r\n // btn.addEventListener(engine.MouseEvent.CLICK,this.onClk,this)\r\n\r\n }\r\n\r\n onDown(e: engine.MouseEvent) {\r\n // console.log(e);\r\n\r\n let stageLeft = (750 - props.W) / 2\r\n let stageTop = (this.stage.height - props.H) / 2;\r\n\r\n // 创建一个图片对象接收当前位置信息\r\n this.dragPic = e.target;\r\n this.picturesWrapper.addChild(this.dragPic);\r\n\r\n\r\n // 鼠标的偏移量\r\n this.localPicX = e.localX / MAX_COL;\r\n this.localPicY = e.localY / MAX_ROW;\r\n\r\n // 最开始图片的位置\r\n this.distanceX = this.dragPic.x ;\r\n this.distanceY = this.dragPic.y;\r\n\r\n // 最开始点击的图片的索引值\r\n\r\n this.indexJ = Math.floor((this.distanceX) / (w + GAP));\r\n this.indexI = Math.floor((this.distanceY) / (h + GAP));\r\n this.index = (this.indexI) * MAX_COL + this.indexJ;\r\n\r\n\r\n // this.centerX = Math.floor(e.clientX / w) * w + w / 2;\r\n // this.centerY = Math.floor(e.clientY / h) * h + h / 2;\r\n\r\n this.centerX = Math.floor((e.clientX - stageLeft) / w) * w + w / 2;\r\n this.centerY = Math.floor((e.clientY - stageTop) / h) * h + h / 2;\r\n\r\n this.stage.addEventListener(\r\n engine.MouseEvent.MOUSE_MOVE,\r\n this.onMove,\r\n this\r\n );\r\n this.stage.addEventListener(\r\n engine.MouseEvent.MOUSE_UP,\r\n this.stageOnUp,\r\n this\r\n );\r\n\r\n }\r\n\r\n listenStageOn = 1;\r\n\r\n stageOnUp(e) {\r\n\r\n let stageLeft = (750 - props.W) / 2\r\n let stageTop = (this.stage.height - props.H) / 2;\r\n\r\n this.stage.removeEventListener(\r\n engine.MouseEvent.MOUSE_MOVE,\r\n this.onMove,\r\n this\r\n );\r\n\r\n this.stage.removeEventListener(\r\n engine.MouseEvent.MOUSE_UP,\r\n this.stageOnUp,\r\n this\r\n );\r\n\r\n // 拖动的图片的中心位置在图片之外,回到原来的位置\r\n if (this.centerY < stageTop || this.centerX < stageLeft) {\r\n this.dragPic.x = this.distanceX ;\r\n this.dragPic.y = this.distanceY ;\r\n }\r\n\r\n // 判断图片是否进入另一张图片的范围内\r\n // 要交换的图片第几行第几列\r\n let curJ = Math.floor(this.centerX / (w + GAP));\r\n let curI = Math.floor(this.centerY / (h + GAP));\r\n\r\n this.picturesWrapper.addChild(this.guideHole);\r\n\r\n\r\n // 点击图片的位置\r\n\r\n if ( 0 <= curJ && curJ < (MAX_COL) && 0 <= curI && curI < (MAX_ROW)) {\r\n\r\n // 获取交互图片的索引值\r\n let index = getIndexFromRC(curI, curJ, MAX_COL);\r\n // console.log(index);\r\n\r\n //要交换的图片\r\n let dropPic = this.pictures[index];\r\n\r\n let dropPicX = dropPic.x + stageLeft;\r\n let dropPicy = dropPic.y + stageTop;\r\n\r\n dropPic.x = this.distanceX;\r\n dropPic.y = this.distanceY;\r\n\r\n this.dragPic.x = dropPicX - stageLeft;\r\n this.dragPic.y = dropPicy - stageTop;\r\n\r\n // 交换之后索引也需要交换\r\n\r\n const dropPicIndex = this.pictures.indexOf(dropPic);\r\n const dragPicIndex = this.pictures.indexOf(this.dragPic);\r\n\r\n this.pictures[dropPicIndex] = this.dragPic;\r\n this.pictures[dragPicIndex] = dropPic;\r\n\r\n // 图片中心还是在原来的位置\r\n if (dragPicIndex === dropPicIndex) {\r\n this.dragPic.x = this.distanceX\r\n this.dragPic.y = this.distanceY\r\n }\r\n\r\n let result = true;\r\n for (let j = 0; j < this.rightList.length; j++) {\r\n if (this.rightList[j] != this.pictures[j]) {\r\n result = false;\r\n break;\r\n }\r\n }\r\n\r\n if (result) {\r\n this.onSuccess();\r\n\r\n }\r\n } else {\r\n this.dragPic.x = this.distanceX\r\n this.dragPic.y = this.distanceY\r\n }\r\n\r\n\r\n }\r\n\r\n private onSuccess() {\r\n console.log('拼图成功!');\r\n engine.globalEvent.dispatchEvent('pictures-game-success', { time: GAME_TIME });\r\n this.stop();\r\n\r\n }\r\n\r\n onMove(e: engine.MouseEvent) {\r\n // 当前图片的位置\r\n this.dragPic.x = e.stageX - this.localPicX - (750 - props.W) / 2;\r\n this.dragPic.y = e.stageY - this.localPicY - (this.stage.height - props.H) / 2;\r\n\r\n // 当前图片的中心位置\r\n this.centerX = this.dragPic.x + w / 2;\r\n this.centerY = this.dragPic.y + h / 2;\r\n }\r\n\r\n // onClk(e){\r\n // // 重置时间\r\n // this._timeCounter = 0;\r\n // //重置图片顺序\r\n\r\n\r\n // }\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\n\r\nexport class GameWrapper extends engine.Container {\r\n\t// private _status;\r\n\tprivate _gameView: GameView;\r\n\r\n\r\n\r\n\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tengine.globalEvent.addEventListener('pictures-start', this.start, this);\r\n\t\tengine.globalEvent.addEventListener('pictures-stop', this.stop, this);\r\n\r\n\t\t//创建实例\r\n\t\tlet gameView = this._gameView = new GameView();\r\n\t\tthis.addChild(gameView);\r\n\r\n\t}\r\n\r\n\tstart(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\r\n\t\t// this._status = 1;\r\n\r\n\t\tthis._gameView.start();\r\n\t}\r\n\tstop(event: engine.Event) {\r\n\t\t\r\n\t\tthis._gameView.stop();\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\t\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;CAIO,IAAI,KAAK,GAAQ,EAAE,CAAC;UA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;;;;;;;"}
\ No newline at end of file
......@@ -10,7 +10,7 @@
"MAX_ROW": {
"alias": "图片分成几行",
"type": "number",
"default": 4
"default": 3
},
"W": {
"alias": "图片的宽度",
......@@ -40,18 +40,16 @@
"GAME_TIME": {
"alias": "游戏时间",
"type": "number",
"default": 10
"default": 100
}
},
"assets": [
{
"assets": [{
"name": "遮罩",
"url": "//yun.duiba.com.cn/aurora/assets/5b3e30496b2d9fdafb0cf3835fd6704ce10e45b4.png",
"uuid": "888",
"ext": ".png"
}
],
}],
"events": {
"in": {
......@@ -73,7 +71,7 @@
"pictures-time-update": {
"alias": "倒计时更新",
"data": {
"time":"剩余时间"
"time": "剩余时间"
}
},
"pictures-game-fail": {
......
/**
* Created by rockyl on 2018/8/16.
*/
import { props } from "../props";
//Created by rockyl on 2018/8/16.
import qietu from "./qietu";
import { getIndexFromRC, getRandomArray, getTexture } from "./utils";
import {props} from '../props'
import ObjectPool = engine.ObjectPool;
// let OFFSET_X;
......@@ -27,12 +24,16 @@ export default class GameView extends engine.Container {
private date
start() {
//优先获取start事件接收到的参数
MAX_COL = props.column || props.MAX_COL;
MAX_ROW = props.row || props.MAX_ROW;
GAME_TIME = props.gameTime || props.GAME_TIME;
console.log('start',props.column,props.row,props.gameTime)
// MAX_COL = props.column || props.MAX_COL;
// MAX_ROW = props.row || props.MAX_ROW;
// GAME_TIME = props.gameTime || props.GAME_TIME;
MAX_COL = props.MAX_COL;
MAX_ROW = props.MAX_ROW;
GAME_TIME = props.GAME_TIME;
console.log('start',props.column,props.row,props.gameTime)
if (!this.guideHole) {
this.guideHole = new engine.Image();
this.guideHole.source = 'asset://' + props.blockUrl;
......@@ -106,7 +107,7 @@ export default class GameView extends engine.Container {
if (GAME_TIME < 10) {
GAME_TIME = '0' + GAME_TIME
}
console.log(GAME_TIME);
console.log(GAME_TIME,"gametime1");
engine.globalEvent.dispatchEvent('pictures-time-update', {
......@@ -190,6 +191,7 @@ export default class GameView extends engine.Container {
GAME_TIME = props.GAME_TIME;
// OFFSET_X = props.OFFSET_X;
// OFFSET_Y = props.OFFSET_Y;
console.log(GAME_TIME,'setuptime')
W = props.W;
H = props.H;
GAP = props.GAP;
......
......@@ -19,14 +19,16 @@ export default class TestView extends engine.Container{
this.stageBg = new engine.Sprite(getTexture('308742a0-0ea2-4610-b34a-a230add82021'))
this.addChild(this.stageBg)
this.gameBg = new engine.Sprite(getTexture('76820072-df5a-4ab7-8cb7-10c8cd8605c8'))
/* this.gameBg = new engine.Sprite(getTexture('76820072-df5a-4ab7-8cb7-10c8cd8605c8'))
// 开始按钮
this.startBtn = new engine.Sprite(getTexture('855e3d77-ffff-443d-b884-4f67a2ebe458'))
this.startBtn.x = (750 - this.startBtn.width) / 2;
this.startBtn.y = (this.stage.height - this.startBtn.height) / 2 + 300;
this.stageBg.addChild(this.startBtn)
this.startBtn.addEventListener(engine.MouseEvent.CLICK,this.onClick,this)
this.startBtn.addEventListener(engine.MouseEvent.CLICK,this.onClick,this) */
}
smallBall:SmallPlane
......@@ -63,7 +65,7 @@ export default class TestView extends engine.Container{
score:number = 0;
start(){
// 炮车
this.planeModel = new engine.Sprite(getTexture('32ec481a-3f75-4c36-95ed-ee97aa936517'))
/* this.planeModel = new engine.Sprite(getTexture('32ec481a-3f75-4c36-95ed-ee97aa936517'))
this.planeModel.x = (750 - this.planeModel.width) / 2;
this.planeModel.y = (this.stage.height - this.planeModel.height)
this.planeModel.addEventListener(engine.MouseEvent.MOUSE_DOWN,this.onDown,this)
......@@ -173,13 +175,13 @@ export default class TestView extends engine.Container{
},16)
*/
}
onClick(){
/* onClick(){
this.addChild(this.gameBg);
this.gameBg.addChild(this.planeModel)
}
......@@ -215,6 +217,6 @@ export default class TestView extends engine.Container{
stop(){
}
} */
}
\ No newline at end of file
......@@ -12,7 +12,6 @@
function injectProps(p) {
engine.injectProp(props, p);
}
//# sourceMappingURL=props.js.map
var qietu = (function (parent, url, MAX_COL, MAX_ROW) {
var W = props.W;
......@@ -55,7 +54,6 @@
console.log(spr);
return [spr, pos];
});
//# sourceMappingURL=qietu.js.map
function getIndexFromRC(row, col, maxCol) {
var index;
......@@ -255,7 +253,6 @@
};
return GameView;
}(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super);
......@@ -276,7 +273,6 @@
};
return GameWrapper;
}(engine.Container));
//# sourceMappingURL=GameWrapper.js.map
function index (props) {
prepareProps();
......@@ -284,7 +280,6 @@
var instance = new GameWrapper();
return instance;
}
//# sourceMappingURL=index.js.map
return index;
......
{"version":3,"file":"index.js","sources":["src/custom/rounds-pic/src/props.ts","src/custom/rounds-pic/src/game/qietu.ts","src/custom/rounds-pic/src/game/utils.ts","src/custom/rounds-pic/src/game/GameView.ts","src/custom/rounds-pic/src/game/GameWrapper.ts","src/custom/rounds-pic/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","import { props } from \"../props\";\r\nconst urls = [];\r\nconst picMap = {};\r\nconst posMap = {};\r\nexport default (parent, url, MAX_COL, MAX_ROW) => {\r\n // if (picMap[url]) {\r\n // const pics:any[] = picMap[url];\r\n // for (const pic of pics) {\r\n // parent.addChild(pic);\r\n // }\r\n // return [picMap[url], posMap[url]]\r\n // }\r\n\r\n const W = props.W;\r\n const H = props.H;\r\n const GAP = props.GAP;\r\n\r\n const spr = [];\r\n const pos = []\r\n\r\n for (let row = 0; row < MAX_ROW; row++) {\r\n for (let col = 0; col < MAX_COL; col++) {\r\n\r\n const child = new engine.Sprite(); \r\n // spr.push(child);\r\n\r\n child.scaleX = 1 / MAX_COL;\r\n child.scaleY = 1 / MAX_ROW;\r\n parent.addChild(child);\r\n child.x = col * (W / MAX_COL + GAP);\r\n child.y = row * (H / MAX_ROW + GAP);\r\n pos.push([child.x, child.y]);\r\n spr.push(child);\r\n child.addEventListener(engine.Event.COMPLETE, () => {\r\n const uvs = new Float32Array([\r\n col / MAX_COL,\r\n row / MAX_ROW,\r\n (col + 1) / MAX_COL,\r\n row / MAX_ROW,\r\n (col + 1) / MAX_COL,\r\n (row + 1) / MAX_ROW,\r\n col / MAX_COL,\r\n (row + 1) / MAX_ROW,\r\n ]);\r\n\r\n child.uvs = uvs;\r\n });\r\n\r\n child.texture = engine.Texture.fromImage(url);\r\n }\r\n }\r\n // picMap[url] = spr.concat([]);\r\n // posMap[url] = pos.concat([]);\r\n console.log(spr);\r\n return [spr, pos];\r\n};\r\n","/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\nimport {props} from '../props'\r\nexport function getTexture(uuid) {\r\n return engine.Texture.from(getAssetByUUID(uuid).uuid);\r\n}\r\n\r\nexport function getTextureByName(name) {\r\n return getTexture(engine.getAssetByName(name).uuid);\r\n}\r\n\r\nexport function playSound(name) {\r\n engine.playSound(engine.getAssetByName(name).uuid, { keep: true });\r\n}\r\nexport function createSvga(name, anchorName?) {\r\n let inst = new svga.Svga();\r\n inst.source = \"asset://\" + engine.getAssetByName(name).uuid;\r\n return inst;\r\n}\r\n\r\nexport function getIndexFromRC(row, col, maxCol) {\r\n let index;\r\n index = row * maxCol + col;\r\n return index;\r\n}\r\n\r\nexport function getRandomArray(array) {\r\n array.sort(function () {\r\n return 0.5 - Math.random();\r\n });\r\n}\r\n\r\n","/**\r\n * Created by rockyl on 2018/8/16.\r\n */\r\n\r\nimport { props } from \"../props\";\r\nimport qietu from \"./qietu\";\r\nimport { getIndexFromRC, getRandomArray, getTexture } from \"./utils\";\r\nimport ObjectPool = engine.ObjectPool;\r\n\r\n// let OFFSET_X;\r\n// let OFFSET_Y;\r\nlet MAX_COL;\r\nlet MAX_ROW;\r\nlet W;\r\nlet H;\r\nlet GAP;\r\nlet GAME_TIME;\r\n// 每张图片宽\r\nlet w;\r\n// 每张图片高\r\nlet h;\r\n// 图片\r\nlet picUrl\r\n\r\nexport default class GameView extends engine.Container {\r\n private _timer;\r\n private _timeCounter = 0;\r\n private _result = []\r\n private date\r\n\r\n \r\n\r\n start() {\r\n picUrl = props.picUrl;\r\n MAX_COL = props.MAX_COL;\r\n MAX_ROW = props.MAX_ROW;\r\n GAME_TIME = props.GAME_TIME;\r\n // OFFSET_X = props.OFFSET_X;\r\n // OFFSET_Y = props.OFFSET_Y;\r\n W = props.W;\r\n H = props.H;\r\n GAP = props.GAP;\r\n // 每张图片宽\r\n w = W / MAX_COL;\r\n // 每张图片高\r\n h = H / MAX_ROW;\r\n\r\n \r\n // if (!this.guideHole) {\r\n // this.guideHole = new engine.Image();\r\n // this.guideHole.source = 'asset://' + props.blockUrl;\r\n // this.guideHole.mouseChildren = this.guideHole.mouseEnabled = false;\r\n // }\r\n\r\n // if (this.pictures) {\r\n // for (const pic of this.pictures) {\r\n // if (pic && pic.parent)\r\n // pic.parent.removeChild(pic);\r\n // }\r\n // }\r\n\r\n console.log('on start')\r\n engine.globalEvent.dispatchEvent('pictures-time-update', {\r\n second: this.getSecond(),\r\n });\r\n\r\n // 图片一维数组\r\n if(this._result.length !==0){\r\n this._result = []\r\n }\r\n\r\n this._result = qietu(this.picturesWrapper, picUrl, MAX_COL, MAX_ROW);\r\n // this.picturesWrapper.addChild(this.guideHole);\r\n\r\n // console.log(this.picturesWrapper)\r\n\r\n this.pictures = this._result[0];\r\n if(this.rightList !== null){\r\n this.rightList = []\r\n }\r\n this.rightList = this.pictures.concat([]);\r\n const posList = this._result[1];\r\n getRandomArray(this.pictures);\r\n\r\n let i = 0;\r\n let len;\r\n len = this.pictures.length;\r\n\r\n\r\n for (; i < len; i++) {\r\n this.dragPic = this.pictures[i];\r\n this.pictures[i].addEventListener(\r\n engine.MouseEvent.MOUSE_DOWN,\r\n this.onDown,\r\n this\r\n );\r\n const [x, y] = posList[i];\r\n this.dragPic.x = x;\r\n this.dragPic.y = y;\r\n\r\n }\r\n\r\n this._timer = setInterval(() => {\r\n this.onTimer();\r\n }, 10)\r\n\r\n this.date = new Date().getTime();\r\n\r\n }\r\n\r\n onTimer() {\r\n\r\n let date = new Date().getTime();\r\n\r\n let gap = ((date - this.date) / 1000);\r\n this.date = date;\r\n // console.log(gap,\"gap\");\r\n\r\n // 以GAME_TIME为标准\r\n GAME_TIME -= gap;\r\n if(GAME_TIME < 0){\r\n GAME_TIME = 0;\r\n }\r\n GAME_TIME = this.afterPointTwo(GAME_TIME);\r\n GAME_TIME = GAME_TIME.toFixed(2);\r\n if (GAME_TIME < 10) {\r\n GAME_TIME = '0' + GAME_TIME\r\n }\r\n // console.log(GAME_TIME);\r\n\r\n\r\n engine.globalEvent.dispatchEvent('pictures-time-update', {\r\n second: this.getSecond(),\r\n });\r\n\r\n if (this.getSecond() == 0) {\r\n this.stop();\r\n engine.globalEvent.dispatchEvent('pictures-game-fail', {\r\n reason: 1\r\n });\r\n\r\n this.stage.removeEventListener(\r\n engine.MouseEvent.MOUSE_UP,\r\n this.stageOnUp,\r\n this\r\n );\r\n\r\n }\r\n }\r\n\r\n afterPointTwo(n) {\r\n\r\n var floatN = parseFloat(n);\r\n if (isNaN(floatN)) {\r\n return;\r\n }\r\n floatN = Math.round(floatN * 100) / 100;\r\n return floatN;\r\n\r\n }\r\n\r\n getSecond() {\r\n return GAME_TIME\r\n }\r\n\r\n stop() {\r\n \r\n GAME_TIME = props.GAME_TIME\r\n clearInterval(this._timer);\r\n let len = this.pictures.length;\r\n for(let i=0;i<len;i++){\r\n this.pictures[i].removeAllEventListener();\r\n }\r\n }\r\n\r\n constructor() {\r\n super();\r\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\r\n }\r\n\r\n //当前图片对象\r\n dragPic;\r\n // 鼠标在当前图片上的位置\r\n localPicX;\r\n localPicY;\r\n // 拖动的图片最开始的位置(左上角为准)\r\n distanceX;\r\n distanceY;\r\n // 图片中心的位置\r\n centerX: number;\r\n centerY: number;\r\n\r\n pictures: engine.Sprite[];\r\n\r\n // 点击图片时的一维数组索引\r\n index;\r\n // 计算目标图片行和列的位置\r\n indexI: number;\r\n indexJ: number;\r\n rightList: engine.Sprite[];\r\n\r\n private picturesWrapper: engine.Sprite;\r\n private guideHole: engine.Image;\r\n\r\n createRects() { }\r\n setup() {\r\n\r\n \r\n\r\n console.log('onSteup', props);\r\n\r\n const parent = new engine.Sprite();\r\n this.picturesWrapper = parent;\r\n this.addChild(parent);\r\n\r\n // this.picturesWrapper.x = OFFSET_X;\r\n // this.picturesWrapper.y = OFFSET_Y;\r\n\r\n // 添加按钮\r\n // const btn = new engine.Rect();\r\n // btn.width = 200;\r\n // btn.height = 100;\r\n // btn.stage.top = 1000;\r\n // btn.stage.left = 350;\r\n // btn.fillColor = 'cyan';\r\n // this.addChild(btn)\r\n\r\n // btn.addEventListener(engine.MouseEvent.CLICK,this.onClk,this)\r\n\r\n }\r\n\r\n onDown(e: engine.MouseEvent) {\r\n // console.log(e);\r\n\r\n let stageLeft = (750 - props.W) / 2\r\n let stageTop = (this.stage.height - props.H) / 2;\r\n\r\n // 创建一个图片对象接收当前位置信息\r\n this.dragPic = e.target;\r\n this.picturesWrapper.addChild(this.dragPic);\r\n\r\n\r\n // 鼠标的偏移量\r\n this.localPicX = e.localX / MAX_COL;\r\n this.localPicY = e.localY / MAX_ROW;\r\n\r\n // 最开始图片的位置\r\n this.distanceX = this.dragPic.x ;\r\n this.distanceY = this.dragPic.y;\r\n\r\n // 最开始点击的图片的索引值\r\n\r\n this.indexJ = Math.floor((this.distanceX) / (w + GAP));\r\n this.indexI = Math.floor((this.distanceY) / (h + GAP));\r\n this.index = (this.indexI) * MAX_COL + this.indexJ;\r\n\r\n\r\n // this.centerX = Math.floor(e.clientX / w) * w + w / 2;\r\n // this.centerY = Math.floor(e.clientY / h) * h + h / 2;\r\n\r\n this.centerX = Math.floor((e.clientX - stageLeft) / w) * w + w / 2;\r\n this.centerY = Math.floor((e.clientY - stageTop) / h) * h + h / 2;\r\n\r\n this.stage.addEventListener(\r\n engine.MouseEvent.MOUSE_MOVE,\r\n this.onMove,\r\n this\r\n );\r\n this.stage.addEventListener(\r\n engine.MouseEvent.MOUSE_UP,\r\n this.stageOnUp,\r\n this\r\n );\r\n\r\n }\r\n\r\n listenStageOn = 1;\r\n\r\n stageOnUp(e) {\r\n\r\n let stageLeft = (750 - props.W) / 2\r\n let stageTop = (this.stage.height - props.H) / 2;\r\n\r\n this.stage.removeEventListener(\r\n engine.MouseEvent.MOUSE_MOVE,\r\n this.onMove,\r\n this\r\n );\r\n\r\n this.stage.removeEventListener(\r\n engine.MouseEvent.MOUSE_UP,\r\n this.stageOnUp,\r\n this\r\n );\r\n\r\n // 拖动的图片的中心位置在图片之外,回到原来的位置\r\n if (this.centerY < stageTop || this.centerX < stageLeft) {\r\n this.dragPic.x = this.distanceX ;\r\n this.dragPic.y = this.distanceY ;\r\n }\r\n\r\n // 判断图片是否进入另一张图片的范围内\r\n // 要交换的图片第几行第几列\r\n let curJ = Math.floor(this.centerX / (w + GAP));\r\n let curI = Math.floor(this.centerY / (h + GAP));\r\n\r\n // this.picturesWrapper.addChild(this.guideHole);\r\n\r\n\r\n\r\n // 点击图片的位置\r\n\r\n if ( 0 <= curJ && curJ < (MAX_COL) && 0 <= curI && curI < (MAX_ROW)) {\r\n\r\n // 获取交互图片的索引值\r\n let index = getIndexFromRC(curI, curJ, MAX_COL);\r\n // console.log(index);\r\n\r\n //要交换的图片\r\n let dropPic = this.pictures[index];\r\n\r\n let dropPicX = dropPic.x + stageLeft;\r\n let dropPicy = dropPic.y + stageTop;\r\n\r\n dropPic.x = this.distanceX;\r\n dropPic.y = this.distanceY;\r\n\r\n this.dragPic.x = dropPicX - stageLeft;\r\n this.dragPic.y = dropPicy - stageTop;\r\n\r\n // 交换之后索引也需要交换\r\n\r\n const dropPicIndex = this.pictures.indexOf(dropPic);\r\n const dragPicIndex = this.pictures.indexOf(this.dragPic);\r\n\r\n this.pictures[dropPicIndex] = this.dragPic;\r\n this.pictures[dragPicIndex] = dropPic;\r\n\r\n // 图片中心还是在原来的位置\r\n if (dragPicIndex === dropPicIndex) {\r\n this.dragPic.x = this.distanceX\r\n this.dragPic.y = this.distanceY\r\n }\r\n\r\n let result = true;\r\n for (let j = 0; j < this.rightList.length; j++) {\r\n if (this.rightList[j] != this.pictures[j]) {\r\n result = false;\r\n break;\r\n }\r\n }\r\n\r\n if (result) {\r\n this.onSuccess();\r\n\r\n }\r\n } else {\r\n this.dragPic.x = this.distanceX\r\n this.dragPic.y = this.distanceY\r\n }\r\n\r\n }\r\n\r\n private onSuccess() {\r\n console.log('拼图成功!');\r\n engine.globalEvent.dispatchEvent('pictures-game-success', { time: GAME_TIME });\r\n this.stop();\r\n props.GAME_TIME *= 0.9;\r\n ++props.MAX_ROW ;\r\n ++props.MAX_COL ;\r\n\r\n }\r\n\r\n onMove(e: engine.MouseEvent) {\r\n // 当前图片的位置\r\n this.dragPic.x = e.stageX - this.localPicX - (750 - props.W) / 2;\r\n this.dragPic.y = e.stageY - this.localPicY - (this.stage.height - props.H) / 2;\r\n\r\n // 当前图片的中心位置\r\n this.centerX = this.dragPic.x + w / 2;\r\n this.centerY = this.dragPic.y + h / 2;\r\n }\r\n\r\n // onClk(e){\r\n // // 重置时间\r\n // this._timeCounter = 0;\r\n // //重置图片顺序\r\n // }\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\n\r\nexport class GameWrapper extends engine.Container {\r\n\t// private _status;\r\n\tprivate _gameView: GameView;\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tengine.globalEvent.addEventListener('pictures-start', this.start, this);\r\n\t\tengine.globalEvent.addEventListener('pictures-stop', this.stop, this);\r\n\r\n\t\t//创建实例\r\n\t\tlet gameView = this._gameView = new GameView();\r\n\t\tthis.addChild(gameView);\r\n\r\n\t}\r\n\r\n\tstart(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\r\n\t\t\r\n\t\t// this._status = 1;\r\n\r\n\t\tthis._gameView.start();\r\n\t}\r\n\tstop(event: engine.Event) {\r\n\t\t\r\n\t\tthis._gameView.stop();\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\t\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;CAIO,IAAI,KAAK,GAAQ,EAAE,CAAC;UAEX,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;UAEe,WAAW,CAAC,CAAC;KAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC7B,CAAC;;;ACVD,cAAe,UAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO;KAS3C,IAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;KAClB,IAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;KAClB,IAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;KAEtB,IAAM,GAAG,GAAG,EAAE,CAAC;KACf,IAAM,GAAG,GAAG,EAAE,CAAA;6BAEL,GAAG;iCACD,GAAG;aAEV,IAAM,KAAK,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;aAGlC,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC;aAC3B,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC;aAC3B,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aACvB,KAAK,CAAC,CAAC,GAAG,GAA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AAQ,CAAC,CAAC;;MAExB;KAED,2BAAK,GAAL,UAAM,KAAmB;SACxB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAKxB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KACD,0BAAI,GAAJ,UAAK,KAAmB;SAEvB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;MACtB;KACF,kBAAC;CAAD,CAAC,CA5BgC,MAAM,CAAC,SAAS,GA4BhD;;;iBC7BwB,KAAK;KAC7B,YAAY,EAAE,CAAC;KACf,WAAW,CAAC,KAAK,CAAC,CAAC;KAEnB,IAAI,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;KAEjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;;"}
\ No newline at end of file
{"version":3,"file":"index.js","sources":["src/custom/rounds-pic/src/props.ts","src/custom/rounds-pic/src/game/qietu.ts","src/custom/rounds-pic/src/game/utils.ts","src/custom/rounds-pic/src/game/GameView.ts","src/custom/rounds-pic/src/game/GameWrapper.ts","src/custom/rounds-pic/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","import { props } from \"../props\";\r\nconst urls = [];\r\nconst picMap = {};\r\nconst posMap = {};\r\nexport default (parent, url, MAX_COL, MAX_ROW) => {\r\n // if (picMap[url]) {\r\n // const pics:any[] = picMap[url];\r\n // for (const pic of pics) {\r\n // parent.addChild(pic);\r\n // }\r\n // return [picMap[url], posMap[url]]\r\n // }\r\n\r\n const W = props.W;\r\n const H = props.H;\r\n const GAP = props.GAP;\r\n\r\n const spr = [];\r\n const pos = []\r\n\r\n for (let row = 0; row < MAX_ROW; row++) {\r\n for (let col = 0; col < MAX_COL; col++) {\r\n\r\n const child = new engine.Sprite(); \r\n // spr.push(child);\r\n\r\n child.scaleX = 1 / MAX_COL;\r\n child.scaleY = 1 / MAX_ROW;\r\n parent.addChild(child);\r\n child.x = col * (W / MAX_COL + GAP);\r\n child.y = row * (H / MAX_ROW + GAP);\r\n pos.push([child.x, child.y]);\r\n spr.push(child);\r\n child.addEventListener(engine.Event.COMPLETE, () => {\r\n const uvs = new Float32Array([\r\n col / MAX_COL,\r\n row / MAX_ROW,\r\n (col + 1) / MAX_COL,\r\n row / MAX_ROW,\r\n (col + 1) / MAX_COL,\r\n (row + 1) / MAX_ROW,\r\n col / MAX_COL,\r\n (row + 1) / MAX_ROW,\r\n ]);\r\n\r\n child.uvs = uvs;\r\n });\r\n\r\n child.texture = engine.Texture.fromImage(url);\r\n }\r\n }\r\n // picMap[url] = spr.concat([]);\r\n // posMap[url] = pos.concat([]);\r\n console.log(spr);\r\n return [spr, pos];\r\n};\r\n","/**\r\n * Created by rockyl on 2020-01-21.\r\n */\r\nimport {props} from '../props'\r\nexport function getTexture(uuid) {\r\n return engine.Texture.from(getAssetByUUID(uuid).uuid);\r\n}\r\n\r\nexport function getTextureByName(name) {\r\n return getTexture(engine.getAssetByName(name).uuid);\r\n}\r\n\r\nexport function playSound(name) {\r\n engine.playSound(engine.getAssetByName(name).uuid, { keep: true });\r\n}\r\nexport function createSvga(name, anchorName?) {\r\n let inst = new svga.Svga();\r\n inst.source = \"asset://\" + engine.getAssetByName(name).uuid;\r\n return inst;\r\n}\r\n\r\nexport function getIndexFromRC(row, col, maxCol) {\r\n let index;\r\n index = row * maxCol + col;\r\n return index;\r\n}\r\n\r\nexport function getRandomArray(array) {\r\n array.sort(function () {\r\n return 0.5 - Math.random();\r\n });\r\n}\r\n\r\n","/**\r\n * Created by rockyl on 2018/8/16.\r\n */\r\n\r\nimport { props } from \"../props\";\r\nimport qietu from \"./qietu\";\r\nimport { getIndexFromRC, getRandomArray, getTexture } from \"./utils\";\r\nimport ObjectPool = engine.ObjectPool;\r\n\r\n// let OFFSET_X;\r\n// let OFFSET_Y;\r\nlet MAX_COL;\r\nlet MAX_ROW;\r\nlet W;\r\nlet H;\r\nlet GAP;\r\nlet GAME_TIME;\r\n// 每张图片宽\r\nlet w;\r\n// 每张图片高\r\nlet h;\r\n// 图片\r\nlet picUrl\r\n\r\nexport default class GameView extends engine.Container {\r\n private _timer;\r\n private _timeCounter = 0;\r\n private _result = []\r\n private date\r\n\r\n \r\n\r\n start() {\r\n picUrl = props.picUrl;\r\n MAX_COL = props.MAX_COL;\r\n MAX_ROW = props.MAX_ROW;\r\n GAME_TIME = props.GAME_TIME;\r\n // OFFSET_X = props.OFFSET_X;\r\n // OFFSET_Y = props.OFFSET_Y;\r\n W = props.W;\r\n H = props.H;\r\n GAP = props.GAP;\r\n // 每张图片宽\r\n w = W / MAX_COL;\r\n // 每张图片高\r\n h = H / MAX_ROW;\r\n\r\n \r\n // if (!this.guideHole) {\r\n // this.guideHole = new engine.Image();\r\n // this.guideHole.source = 'asset://' + props.blockUrl;\r\n // this.guideHole.mouseChildren = this.guideHole.mouseEnabled = false;\r\n // }\r\n\r\n // if (this.pictures) {\r\n // for (const pic of this.pictures) {\r\n // if (pic && pic.parent)\r\n // pic.parent.removeChild(pic);\r\n // }\r\n // }\r\n\r\n console.log('on start')\r\n engine.globalEvent.dispatchEvent('pictures-time-update', {\r\n second: this.getSecond(),\r\n });\r\n\r\n // 图片一维数组\r\n if(this._result.length !==0){\r\n this._result = []\r\n }\r\n\r\n this._result = qietu(this.picturesWrapper, picUrl, MAX_COL, MAX_ROW);\r\n // this.picturesWrapper.addChild(this.guideHole);\r\n\r\n // console.log(this.picturesWrapper)\r\n\r\n this.pictures = this._result[0];\r\n if(this.rightList !== null){\r\n this.rightList = []\r\n }\r\n this.rightList = this.pictures.concat([]);\r\n const posList = this._result[1];\r\n getRandomArray(this.pictures);\r\n\r\n let i = 0;\r\n let len;\r\n len = this.pictures.length;\r\n\r\n\r\n for (; i < len; i++) {\r\n this.dragPic = this.pictures[i];\r\n this.pictures[i].addEventListener(\r\n engine.MouseEvent.MOUSE_DOWN,\r\n this.onDown,\r\n this\r\n );\r\n const [x, y] = posList[i];\r\n this.dragPic.x = x;\r\n this.dragPic.y = y;\r\n\r\n }\r\n\r\n this._timer = setInterval(() => {\r\n this.onTimer();\r\n }, 10)\r\n\r\n this.date = new Date().getTime();\r\n\r\n }\r\n\r\n onTimer() {\r\n\r\n let date = new Date().getTime();\r\n\r\n let gap = ((date - this.date) / 1000);\r\n this.date = date;\r\n // console.log(gap,\"gap\");\r\n\r\n // 以GAME_TIME为标准\r\n GAME_TIME -= gap;\r\n if(GAME_TIME < 0){\r\n GAME_TIME = 0;\r\n }\r\n GAME_TIME = this.afterPointTwo(GAME_TIME);\r\n GAME_TIME = GAME_TIME.toFixed(2);\r\n if (GAME_TIME < 10) {\r\n GAME_TIME = '0' + GAME_TIME\r\n }\r\n // console.log(GAME_TIME);\r\n\r\n\r\n engine.globalEvent.dispatchEvent('pictures-time-update', {\r\n second: this.getSecond(),\r\n });\r\n\r\n if (this.getSecond() == 0) {\r\n this.stop();\r\n engine.globalEvent.dispatchEvent('pictures-game-fail', {\r\n reason: 1\r\n });\r\n\r\n this.stage.removeEventListener(\r\n engine.MouseEvent.MOUSE_UP,\r\n this.stageOnUp,\r\n this\r\n );\r\n\r\n }\r\n }\r\n\r\n afterPointTwo(n) {\r\n\r\n var floatN = parseFloat(n);\r\n if (isNaN(floatN)) {\r\n return;\r\n }\r\n floatN = Math.round(floatN * 100) / 100;\r\n return floatN;\r\n\r\n }\r\n\r\n getSecond() {\r\n return GAME_TIME\r\n }\r\n\r\n stop() {\r\n \r\n GAME_TIME = props.GAME_TIME\r\n clearInterval(this._timer);\r\n let len = this.pictures.length;\r\n for(let i=0;i<len;i++){\r\n this.pictures[i].removeAllEventListener();\r\n }\r\n }\r\n\r\n constructor() {\r\n super();\r\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\r\n }\r\n\r\n //当前图片对象\r\n dragPic;\r\n // 鼠标在当前图片上的位置\r\n localPicX;\r\n localPicY;\r\n // 拖动的图片最开始的位置(左上角为准)\r\n distanceX;\r\n distanceY;\r\n // 图片中心的位置\r\n centerX: number;\r\n centerY: number;\r\n\r\n pictures: engine.Sprite[];\r\n\r\n // 点击图片时的一维数组索引\r\n index;\r\n // 计算目标图片行和列的位置\r\n indexI: number;\r\n indexJ: number;\r\n rightList: engine.Sprite[];\r\n\r\n private picturesWrapper: engine.Sprite;\r\n private guideHole: engine.Image;\r\n\r\n createRects() { }\r\n setup() {\r\n\r\n \r\n\r\n console.log('onSteup', props);\r\n\r\n const parent = new engine.Sprite();\r\n this.picturesWrapper = parent;\r\n this.addChild(parent);\r\n\r\n // this.picturesWrapper.x = OFFSET_X;\r\n // this.picturesWrapper.y = OFFSET_Y;\r\n\r\n // 添加按钮\r\n // const btn = new engine.Rect();\r\n // btn.width = 200;\r\n // btn.height = 100;\r\n // btn.stage.top = 1000;\r\n // btn.stage.left = 350;\r\n // btn.fillColor = 'cyan';\r\n // this.addChild(btn)\r\n\r\n // btn.addEventListener(engine.MouseEvent.CLICK,this.onClk,this)\r\n\r\n }\r\n\r\n onDown(e: engine.MouseEvent) {\r\n // console.log(e);\r\n\r\n let stageLeft = (750 - props.W) / 2\r\n let stageTop = (this.stage.height - props.H) / 2;\r\n\r\n // 创建一个图片对象接收当前位置信息\r\n this.dragPic = e.target;\r\n this.picturesWrapper.addChild(this.dragPic);\r\n\r\n\r\n // 鼠标的偏移量\r\n this.localPicX = e.localX / MAX_COL;\r\n this.localPicY = e.localY / MAX_ROW;\r\n\r\n // 最开始图片的位置\r\n this.distanceX = this.dragPic.x ;\r\n this.distanceY = this.dragPic.y;\r\n\r\n // 最开始点击的图片的索引值\r\n\r\n this.indexJ = Math.floor((this.distanceX) / (w + GAP));\r\n this.indexI = Math.floor((this.distanceY) / (h + GAP));\r\n this.index = (this.indexI) * MAX_COL + this.indexJ;\r\n\r\n\r\n // this.centerX = Math.floor(e.clientX / w) * w + w / 2;\r\n // this.centerY = Math.floor(e.clientY / h) * h + h / 2;\r\n\r\n this.centerX = Math.floor((e.clientX - stageLeft) / w) * w + w / 2;\r\n this.centerY = Math.floor((e.clientY - stageTop) / h) * h + h / 2;\r\n\r\n this.stage.addEventListener(\r\n engine.MouseEvent.MOUSE_MOVE,\r\n this.onMove,\r\n this\r\n );\r\n this.stage.addEventListener(\r\n engine.MouseEvent.MOUSE_UP,\r\n this.stageOnUp,\r\n this\r\n );\r\n\r\n }\r\n\r\n listenStageOn = 1;\r\n\r\n stageOnUp(e) {\r\n\r\n let stageLeft = (750 - props.W) / 2\r\n let stageTop = (this.stage.height - props.H) / 2;\r\n\r\n this.stage.removeEventListener(\r\n engine.MouseEvent.MOUSE_MOVE,\r\n this.onMove,\r\n this\r\n );\r\n\r\n this.stage.removeEventListener(\r\n engine.MouseEvent.MOUSE_UP,\r\n this.stageOnUp,\r\n this\r\n );\r\n\r\n // 拖动的图片的中心位置在图片之外,回到原来的位置\r\n if (this.centerY < stageTop || this.centerX < stageLeft) {\r\n this.dragPic.x = this.distanceX ;\r\n this.dragPic.y = this.distanceY ;\r\n }\r\n\r\n // 判断图片是否进入另一张图片的范围内\r\n // 要交换的图片第几行第几列\r\n let curJ = Math.floor(this.centerX / (w + GAP));\r\n let curI = Math.floor(this.centerY / (h + GAP));\r\n\r\n // this.picturesWrapper.addChild(this.guideHole);\r\n\r\n\r\n\r\n // 点击图片的位置\r\n\r\n if ( 0 <= curJ && curJ < (MAX_COL) && 0 <= curI && curI < (MAX_ROW)) {\r\n\r\n // 获取交互图片的索引值\r\n let index = getIndexFromRC(curI, curJ, MAX_COL);\r\n // console.log(index);\r\n\r\n //要交换的图片\r\n let dropPic = this.pictures[index];\r\n\r\n let dropPicX = dropPic.x + stageLeft;\r\n let dropPicy = dropPic.y + stageTop;\r\n\r\n dropPic.x = this.distanceX;\r\n dropPic.y = this.distanceY;\r\n\r\n this.dragPic.x = dropPicX - stageLeft;\r\n this.dragPic.y = dropPicy - stageTop;\r\n\r\n // 交换之后索引也需要交换\r\n\r\n const dropPicIndex = this.pictures.indexOf(dropPic);\r\n const dragPicIndex = this.pictures.indexOf(this.dragPic);\r\n\r\n this.pictures[dropPicIndex] = this.dragPic;\r\n this.pictures[dragPicIndex] = dropPic;\r\n\r\n // 图片中心还是在原来的位置\r\n if (dragPicIndex === dropPicIndex) {\r\n this.dragPic.x = this.distanceX\r\n this.dragPic.y = this.distanceY\r\n }\r\n\r\n let result = true;\r\n for (let j = 0; j < this.rightList.length; j++) {\r\n if (this.rightList[j] != this.pictures[j]) {\r\n result = false;\r\n break;\r\n }\r\n }\r\n\r\n if (result) {\r\n this.onSuccess();\r\n\r\n }\r\n } else {\r\n this.dragPic.x = this.distanceX\r\n this.dragPic.y = this.distanceY\r\n }\r\n\r\n }\r\n\r\n private onSuccess() {\r\n console.log('拼图成功!');\r\n engine.globalEvent.dispatchEvent('pictures-game-success', { time: GAME_TIME });\r\n this.stop();\r\n props.GAME_TIME *= 0.9;\r\n ++props.MAX_ROW ;\r\n ++props.MAX_COL ;\r\n\r\n }\r\n\r\n onMove(e: engine.MouseEvent) {\r\n // 当前图片的位置\r\n this.dragPic.x = e.stageX - this.localPicX - (750 - props.W) / 2;\r\n this.dragPic.y = e.stageY - this.localPicY - (this.stage.height - props.H) / 2;\r\n\r\n // 当前图片的中心位置\r\n this.centerX = this.dragPic.x + w / 2;\r\n this.centerY = this.dragPic.y + h / 2;\r\n }\r\n\r\n // onClk(e){\r\n // // 重置时间\r\n // this._timeCounter = 0;\r\n // //重置图片顺序\r\n // }\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\n\r\nexport class GameWrapper extends engine.Container {\r\n\t// private _status;\r\n\tprivate _gameView: GameView;\r\n\r\n\tconstructor() {\r\n\t\tsuper();\r\n\r\n\t\tengine.globalEvent.addEventListener('pictures-start', this.start, this);\r\n\t\tengine.globalEvent.addEventListener('pictures-stop', this.stop, this);\r\n\r\n\t\t//创建实例\r\n\t\tlet gameView = this._gameView = new GameView();\r\n\t\tthis.addChild(gameView);\r\n\r\n\t}\r\n\r\n\tstart(event: engine.Event) {\r\n\t\tinjectProps(event.data);\r\n\r\n\t\t\r\n\t\t// this._status = 1;\r\n\r\n\t\tthis._gameView.start();\r\n\t}\r\n\tstop(event: engine.Event) {\r\n\t\t\r\n\t\tthis._gameView.stop();\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\t\r\n\treturn instance;\r\n}\r\n"],"names":["__extends"],"mappings":";;;;;;CAIO,IAAI,KAAK,GAAQ,EAAE,CAAC;UAEX,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;UAEe,WAAW,CAAC,CAAC;KAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC7B;;ACVA,cAAe,UAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO;KAS3C,IAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;KAClB,IAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;KAClB,IAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;KAEtB,IAAM,GAAG,GAAG,EAAE,CAAC;KACf,IAAM,GAAG,GAAG,EAAE,CAAA;6BAEL,GAAG;iCACD,GAAG;aAEV,IAAM,KAAK,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;aAGlC,KAAK,CAAC,MAAM,GAAG,CAAC,GA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,KAAI,CAAC,IAAI,EAAE,KAAI,CAAC,CAAC;SAGtE,IAAI,QAAQ,GAAG,KAAI,CAAC,SAAS,GAAG,IAAI,QAAQ,EAAE,CAAC;SAC/C,KAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;;MAExB;KAED,2BAAK,GAAL,UAAM,KAAmB;SACxB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAKxB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;MACvB;KACD,0BAAI,GAAJ,UAAK,KAAmB;SAEvB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;MACtB;KACF,kBAAC;CAAD,CAAC,CA5BgC,MAAM,CAAC,SAAS,GA4BhD;;iBC7BwB,KAAK;KAC7B,YAAY,EAAE,CAAC;KACf,WAAW,CAAC,KAAK,CAAC,CAAC;KAEnB,IAAI,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;KAEjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;"}
\ No newline at end of file
......@@ -13,7 +13,6 @@
LabelType["egg"] = "egg";
})(LabelType || (LabelType = {}));
var LabelType$1 = LabelType;
//# sourceMappingURL=LabelType.js.map
var props = {};
function prepareProps() {
......@@ -23,7 +22,6 @@
function injectProps(p) {
engine.injectProp(props, p);
}
//# sourceMappingURL=props.js.map
var levels;
var setlevelData = function () {
......@@ -40,7 +38,6 @@
var setTouchEnabled = function (b) {
touchEnabled = b;
};
//# sourceMappingURL=GoldData.js.map
function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
......@@ -48,7 +45,6 @@
function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
}
//# sourceMappingURL=utils.js.map
var Tool = (function () {
function Tool() {
......@@ -71,7 +67,6 @@
};
return Tool;
}());
//# sourceMappingURL=Tools.js.map
var curScore;
function getScore() {
......@@ -124,7 +119,6 @@
}
return getLevelData().max;
};
//# sourceMappingURL=goldData.js.map
var GameData = (function (_super) {
tslib.__extends(GameData, _super);
......@@ -211,7 +205,6 @@
};
return GameData;
}(engine.Container));
//# sourceMappingURL=gameData.js.map
var BaseItem = (function (_super) {
tslib.__extends(BaseItem, _super);
......@@ -236,7 +229,6 @@
});
return BaseItem;
}(engine.Sprite));
//# sourceMappingURL=BaseItem.js.map
var EgretRender = (function () {
function EgretRender(root, engine) {
......@@ -320,7 +312,6 @@
};
return EgretRender;
}());
//# sourceMappingURL=EgretRender.js.map
var wall = 1;
var basket = 2;
......@@ -334,7 +325,6 @@
var awardMask = wall + basket + bubble;
var bubbleMask = wall + basket + award;
var bubbleStandbyMask = wall + basket;
//# sourceMappingURL=collisionConfig.js.map
var vibrate = (function (view, count, strength) {
if (count === void 0) { count = 2; }
......@@ -372,7 +362,6 @@
}
});
});
//# sourceMappingURL=vibrate.js.map
var MovieClip = (function (_super) {
tslib.__extends(MovieClip, _super);
......@@ -461,14 +450,12 @@
});
return MovieClip;
}(engine.Image));
//# sourceMappingURL=MovieClip.js.map
var wait = function (duration) { return tslib.__awaiter(void 0, void 0, void 0, function () {
return tslib.__generator(this, function (_a) {
return [2, new Promise(function (resolve) { return setTimeout(resolve, duration); })];
});
}); };
//# sourceMappingURL=wait.js.map
var josnData = {};
function getJsonAsset(name) {
......@@ -501,7 +488,6 @@
function getJosnData(jsonName) {
return josnData[jsonName] || null;
}
//# sourceMappingURL=JsonTools.js.map
function createTextureSheet(baseTexture, altaData) {
var frames = altaData;
......@@ -530,7 +516,6 @@
}
return textures;
}
//# sourceMappingURL=createTextureSheet.js.map
function playMovieClip(parent, key, frames, frameInterval) {
if (frameInterval === void 0) { frameInterval = 5; }
......@@ -615,7 +600,6 @@
var playSuccess = function (parent) {
return playMovieClip(parent, 'success', ['success1.png', 'success2.png', 'success3.png', 'success4.png', 'success5.png', 'success6.png', 'success7.png', 'success8.png', 'success9.png'], 5);
};
//# sourceMappingURL=playMovieClip.js.map
var createCoin = function (scale) {
var josnData = getJosnData('coin');
......@@ -642,7 +626,6 @@
});
return movieclip;
};
//# sourceMappingURL=createCoin.js.map
var createBoom = function (scale) {
var josnData = getJosnData('boom');
......@@ -669,7 +652,6 @@
});
return movieclip;
};
//# sourceMappingURL=createBoom.js.map
var createGift = function (scale) {
var josnData = getJosnData('gift');
......@@ -696,7 +678,6 @@
});
return movieclip;
};
//# sourceMappingURL=createGift.js.map
var createCandy = function (scale) {
var josnData = getJosnData('candy');
......@@ -723,7 +704,6 @@
});
return movieclip;
};
//# sourceMappingURL=createCandy.js.map
var createEgg = function (scale) {
var josnData = getJosnData('egg');
......@@ -750,7 +730,6 @@
});
return movieclip;
};
//# sourceMappingURL=createEgg.js.map
var createItem = function (scale, type) {
var funcs = {
......@@ -763,7 +742,6 @@
var func = funcs[type];
return func(scale);
};
//# sourceMappingURL=createItem.js.map
var createBubble = function (_this, type, x, y, force, density) {
if (force === void 0) { force = { x: 0, y: 0 }; }
......@@ -812,7 +790,6 @@
}
}, 100);
});
//# sourceMappingURL=createItems.js.map
var clear = function (that) {
TextList.forEach(function (i) {
......@@ -859,7 +836,6 @@
});
}); };
var TextList = ['great', 'cool', 'perfect', 'awesome', 'unbelievable'];
//# sourceMappingURL=playTextAni.js.map
function check(_this) {
var egretRenderContainer = _this.egretRenderContainer;
......@@ -907,7 +883,6 @@
}
});
}
//# sourceMappingURL=check.js.map
var createBox = function (_this) {
var path1 = Matter.Vertices.fromPath('385 370 630 380 670 728 620 1080 370 1100 109 1090 57 728 108 370 0 370 0 1624 750 1624 750 0', null);
......@@ -934,7 +909,6 @@
var h2 = 10;
var rect3 = _this._egretRender.rectangle(375, 1100, w2, h2, null, { isStatic: true, collisionFilter: { group: wall, category: wall, mask: wallMask } });
};
//# sourceMappingURL=createBox.js.map
var createBubblePic = function (r) {
var bubbleTexture = getTextureByName('bubble');
......@@ -942,7 +916,6 @@
bubblePic.scaleX = bubblePic.scaleY = r * 2 / 100;
return bubblePic;
};
//# sourceMappingURL=createBubblePic.js.map
var timerLeft;
var timerRight;
......@@ -990,7 +963,6 @@
var n = end - start;
return Math.random() * n + start;
};
//# sourceMappingURL=standbyBubbles.js.map
var createBtns = (function (that) {
var createShape = function () {
......@@ -1034,7 +1006,6 @@
that._rightBtn.addChild(shapeR);
shapeLeft.alpha = shapeR.alpha = 0;
});
//# sourceMappingURL=createBtns.js.map
var GameView = (function (_super) {
tslib.__extends(GameView, _super);
......@@ -1049,7 +1020,7 @@
}
GameView.prototype.start = function (color) {
return tslib.__awaiter(this, void 0, void 0, function () {
var a, gameNode, contPng, leftBtn, rightBtn, light, basket_bottom, tmpRect, basket_top, glass, gameData, countDown, countDownLabel;
var a, gameNode, contPng, leftBtn, rightBtn, light, basket_bottom, tmpRect, gameData, countDown, countDownLabel, basket_top, glass;
return tslib.__generator(this, function (_a) {
a = new engine.Shape();
this.addChild(a);
......@@ -1091,14 +1062,6 @@
tmpRect.height = 300;
this.addChild(tmpRect);
basket_bottom.mask = tmpRect;
basket_top = this._basket_top = new engine.Sprite(getTextureByName('basket_top'));
basket_top.x = 287;
basket_top.y = 485;
this.addChild(basket_top);
glass = this._basket_top = new engine.Sprite(getTextureByName('玻璃'));
glass.x = (750 - glass.width) / 2;
glass.y = 340;
this.addChild(glass);
gameData = this._gameData = new GameData(contPng, color);
contPng.addChild(gameData);
countDown = this._countDown = new engine.Sprite(getTextureByName('倒计时'));
......@@ -1106,12 +1069,21 @@
countDown.y = 180;
this.addChild(countDown);
this._curLevelTime = getlevelTime();
countDownLabel = this._countDownLabel = Tool.getLabel(this._curLevelTime, 48, "#ffffff");
countDownLabel.x = (countDown.width - countDownLabel.width) / 2;
countDownLabel = this._countDownLabel = Tool.getLabel(this._curLevelTime, 48, "#ffffff", false, engine.TEXT_ALIGN.CENTER);
countDownLabel.width = 160;
countDownLabel.x = 0;
countDownLabel.y = (countDown.height - countDownLabel.height) / 2 - 5;
countDown.addChild(countDownLabel);
this.initGameHint();
this.startHandle();
basket_top = this._basket_top = new engine.Sprite(getTextureByName('basket_top'));
basket_top.x = 287;
basket_top.y = 485;
this.addChild(basket_top);
glass = this._basket_top = new engine.Sprite(getTextureByName('玻璃'));
glass.x = (750 - glass.width) / 2;
glass.y = 340;
this.addChild(glass);
this.levelHint();
return [2];
});
......@@ -1197,7 +1169,6 @@
this._gameData.levelUpdate();
this._curLevelTime = getlevelTime();
this._countDownLabel.text = this._curLevelTime;
this._countDownLabel.x = (this._countDown.width - this._countDownLabel.width) / 2;
this.runEngine();
};
GameView.prototype.themeChange = function (data) {
......@@ -1337,7 +1308,6 @@
GameView.prototype.updateCountDown = function () {
this._curLevelTime--;
this._countDownLabel.text = this._curLevelTime;
this._countDownLabel.x = (this._countDown.width - this._countDownLabel.width) / 2;
if (this._curLevelTime <= 0) {
this.end();
console.log('时间结束');
......@@ -1384,7 +1354,6 @@
};
return GameView;
}(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super);
......@@ -1430,7 +1399,6 @@
var instance = new GameWrapper();
return instance;
}
//# sourceMappingURL=index.js.map
return index;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -95,15 +95,7 @@ export default class GameView extends engine.Container {
this.addChild(tmpRect);
basket_bottom.mask = tmpRect;
let basket_top = this._basket_top = new engine.Sprite(getTextureByName('basket_top'));
basket_top.x = 287;
basket_top.y = 485;
this.addChild(basket_top);
let glass = this._basket_top = new engine.Sprite(getTextureByName('玻璃'));
glass.x = (750-glass.width)/2;
glass.y = 340;
this.addChild(glass);
let gameData = this._gameData = new GameData(contPng,color);
......@@ -116,8 +108,10 @@ export default class GameView extends engine.Container {
this.addChild(countDown);
this._curLevelTime = getlevelTime()
let countDownLabel = this._countDownLabel = Tool.getLabel(this._curLevelTime,48,"#ffffff")
countDownLabel.x = (countDown.width-countDownLabel.width)/2
let countDownLabel = this._countDownLabel = Tool.getLabel(this._curLevelTime,48,"#ffffff",false,engine.TEXT_ALIGN.CENTER)
countDownLabel.width = 160
countDownLabel.x = 0
countDownLabel.y = (countDown.height-countDownLabel.height)/2 - 5
countDown.addChild(countDownLabel);
......@@ -142,6 +136,15 @@ export default class GameView extends engine.Container {
// rect.addChild(toast);
this.startHandle();
let basket_top = this._basket_top = new engine.Sprite(getTextureByName('basket_top'));
basket_top.x = 287;
basket_top.y = 485;
this.addChild(basket_top);
let glass = this._basket_top = new engine.Sprite(getTextureByName('玻璃'));
glass.x = (750-glass.width)/2;
glass.y = 340;
this.addChild(glass);
this.levelHint();
}
private _lvbg;
......@@ -241,7 +244,7 @@ export default class GameView extends engine.Container {
this._gameData.levelUpdate();
this._curLevelTime = getlevelTime()
this._countDownLabel.text = this._curLevelTime;
this._countDownLabel.x = (this._countDown.width-this._countDownLabel.width)/2
//this._countDownLabel.x = (this._countDown.width-this._countDownLabel.width)/2
this.runEngine();
}
themeChange(data){
......@@ -395,7 +398,7 @@ export default class GameView extends engine.Container {
updateCountDown(){
this._curLevelTime --
this._countDownLabel.text = this._curLevelTime;
this._countDownLabel.x = (this._countDown.width-this._countDownLabel.width)/2
//this._countDownLabel.x = (this._countDown.width-this._countDownLabel.width)/2
if(this._curLevelTime <= 0)
{
this.end();
......
......@@ -29,7 +29,7 @@ export class GameWrapper extends engine.Container {
//this.start(null);
// setTimeout(() => {
// engine.globalEvent.dispatchEvent('seabed-game-startNextLevel',{level:2});
// engine.globalEvent.dispatchEvent('seabed-game-startNextLevel',{level:1});
// }, 300);
}
start(event: engine.Event) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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