Commit f3ed9fcd authored by lujinlei's avatar lujinlei

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

parents cc65c4f8 a5553149
{
"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"
}
{
"name": "拼图",
"desc": "拼图模块1.0",
"props": {
"MAX_COL": {
"alias": "图片分成几列",
"type": "number",
"default": 3
},
"MAX_ROW": {
"alias": "图片分成几行",
"type": "number",
"default": 4
},
"W": {
"alias": "图片的宽度",
"type": "number",
"default": 618
},
"H": {
"alias": "图片的高度",
"type": "number",
"default": 827
},
"OFFSET_X": {
"alias": "OFFSET_X",
"type": "number",
"default": 0
},
"OFFSET_Y": {
"alias": "OFFSET_Y",
"type": "number",
"default": 0
},
"GAP": {
"alias": "图片间隙",
"type": "number",
"default": 0
},
"GAME_TIME": {
"alias": "游戏时间",
"type": "number",
"default": 10
}
},
"assets": [
{
"name": "block",
"url": "//yun.duiba.com.cn/aurora/assets/f91184b338ef9540b167eebe7d58e71402e8d9d9.png",
"uuid": "888",
"ext": ".png"
},
{
"name": "ball",
"url": "//yun.duiba.com.cn/aurora/assets/3dc11f2d91659b7e7e1d06a9853cbc9f818e1ea2.png",
"uuid": "999",
"ext": ".png"
}
],
"events": {
"in": {
"pictures-start": {
"alias": "开始",
"data": {
"picUrl": "图片路径",
"blockUrl": "blockUrl",
"row": "行",
"column": "列",
"gameTime": "游戏时间"
}
},
"pictures-stop": {
"alias": "停止"
}
},
"out": {
"pictures-time-update": {
"alias": "倒计时更新",
"data": {
"time": "剩余时间"
}
},
"pictures-game-fail": {
"alias": "游戏结束",
"data": {
"reason": "结束原因(1:时间到了)"
}
},
"pictures-game-success": {
"alias": "游戏成功",
"data": {
"time": "游戏消耗时间"
}
}
}
},
"id": "p2demo",
"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.p2demo = factory(global.tslib));\n}(this, (function (tslib) { 'use strict';\n\n\tfunction getTexture(uuid) {\n\t return engine.Texture.from(getAssetByUUID(uuid).uuid);\n\t}\n\tfunction getTextureByName(name) {\n\t return getTexture(engine.getAssetByName(name).uuid);\n\t}\n\tvar OptionState;\n\t(function (OptionState) {\n\t OptionState[OptionState[\"CHOICE_RIGHT\"] = 0] = \"CHOICE_RIGHT\";\n\t OptionState[OptionState[\"CHOICE_WRONG\"] = 1] = \"CHOICE_WRONG\";\n\t OptionState[OptionState[\"CHOICE_SELECT\"] = 2] = \"CHOICE_SELECT\";\n\t})(OptionState || (OptionState = {}));\n\tvar GameState;\n\t(function (GameState) {\n\t GameState[GameState[\"STATE_START\"] = 0] = \"STATE_START\";\n\t GameState[GameState[\"STATE_END\"] = 1] = \"STATE_END\";\n\t})(GameState || (GameState = {}));\n\t//# sourceMappingURL=utils.js.map\n\n\tvar GameView = (function (_super) {\n\t tslib.__extends(GameView, _super);\n\t function GameView() {\n\t var _this = _super.call(this) || this;\n\t _this.factor = 10;\n\t _this.isDebug = 0;\n\t _this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);\n\t return _this;\n\t }\n\t GameView.prototype.createBall = function (r) {\n\t var shape = new engine.Shape();\n\t shape.beginFill(0xfff000);\n\t shape.drawCircle(0, 0, r);\n\t shape.endFill();\n\t return shape;\n\t };\n\t GameView.prototype.start = function () {\n\t console.log('start');\n\t this.stage.addEventListener(engine.MouseEvent.CLICK, this.onClick, this);\n\t };\n\t GameView.prototype.createBitmapByName = function (name) {\n\t var imgContainer = new engine.Sprite();\n\t var img = new engine.Sprite(getTextureByName(name));\n\t img.anchorX = img.width / 2;\n\t img.anchorY = img.height / 2;\n\t img.x = -img.width / 2;\n\t img.y = -img.height / 2;\n\t imgContainer.addChild(img);\n\t return imgContainer;\n\t };\n\t GameView.prototype.createBox = function (width, height) {\n\t var shape = new engine.Shape();\n\t shape.beginFill(0xfff000);\n\t shape.drawRect(-width / 2, -height / 2, width, height);\n\t shape.endFill();\n\t return shape;\n\t };\n\t GameView.prototype.onClick = function (e) {\n\t var _a = this, world = _a.world, factor = _a.factor;\n\t var positionX = (e.stageX / factor);\n\t var positionY = ((engine.gameStage.stage.height - e.stageY) / factor);\n\t var display;\n\t if (Math.random() > .5) {\n\t var boxShape = new p2.Box({ width: 306 / factor, height: 172 / factor });\n\t var boxBody = new p2.Body({ mass: 1, position: [positionX, positionY], angularVelocity: 1 });\n\t boxBody.addShape(boxShape);\n\t world.addBody(boxBody);\n\t if (this.isDebug) {\n\t display = this.createBox(boxShape.width * factor, boxShape.height * factor);\n\t }\n\t else {\n\t display = this.createBitmapByName(\"block\");\n\t }\n\t }\n\t else {\n\t var boxShape = new p2.Circle({ radius: 120 / 2 / factor });\n\t var boxBody = new p2.Body({ mass: 1, position: [positionX, positionY] });\n\t boxBody.addShape(boxShape);\n\t world.addBody(boxBody);\n\t if (this.isDebug) {\n\t display = this.createBall(boxShape.radius * factor);\n\t }\n\t else {\n\t display = this.createBitmapByName(\"ball\");\n\t }\n\t }\n\t boxBody.displays = [display];\n\t this.addChild(display);\n\t };\n\t GameView.prototype.setup = function () {\n\t console.log('setup');\n\t var world = new p2.World({\n\t gravity: [0, -10],\n\t });\n\t world.sleepMode = p2.World.BODY_SLEEPING;\n\t var planeShape = new p2.Plane();\n\t var planeBody = new p2.Body();\n\t planeBody.addShape(planeShape);\n\t planeBody.displays = [];\n\t world.addBody(planeBody);\n\t this.world = world;\n\t this.stage.addEventListener(engine.Event.ENTER_FRAME, this.onEnterFrame, this);\n\t };\n\t GameView.prototype.onEnterFrame = function () {\n\t var _a = this, world = _a.world, factor = _a.factor;\n\t world.step(60 / 1000);\n\t var stageHeight = engine.gameStage.stage.height;\n\t var l = world.bodies.length;\n\t for (var i = 0; i < l; i++) {\n\t var boxBody = world.bodies[i];\n\t var box = boxBody.displays[0];\n\t if (box) {\n\t box.x = boxBody.position[0] * factor;\n\t box.y = stageHeight - boxBody.position[1] * factor;\n\t box.rotation = 360 - (boxBody.angle + boxBody.shapes[0].angle) * 180 / Math.PI;\n\t if (boxBody.sleepState == p2.Body.SLEEPING) {\n\t box.alpha = 0.5;\n\t }\n\t else {\n\t box.alpha = 1;\n\t }\n\t }\n\t }\n\t };\n\t return GameView;\n\t}(engine.Container));\n\n\tvar props = {};\n\tfunction prepareProps() {\n\t var metaProps = getProps();\n\t engine.injectProp(props, metaProps);\n\t}\n\tfunction injectProps(p) {\n\t engine.injectProp(props, p);\n\t}\n\t//# sourceMappingURL=props.js.map\n\n\tvar GameWrapper = (function (_super) {\n\t tslib.__extends(GameWrapper, _super);\n\t function GameWrapper() {\n\t var _this = _super.call(this) || this;\n\t engine.globalEvent.addEventListener('pictures-start', _this.start, _this);\n\t engine.globalEvent.addEventListener('pictures-stop', _this.stop, _this);\n\t var gameView = _this._gameView = new GameView();\n\t _this.addChild(gameView);\n\t return _this;\n\t }\n\t GameWrapper.prototype.start = function (event) {\n\t injectProps(event.data);\n\t this._gameView.start();\n\t };\n\t GameWrapper.prototype.stop = function (event) {\n\t };\n\t return GameWrapper;\n\t}(engine.Container));\n\t//# sourceMappingURL=GameWrapper.js.map\n\n\tfunction index (props) {\n\t prepareProps();\n\t injectProps(props);\n\t var instance = new GameWrapper();\n\t return instance;\n\t}\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": [
......@@ -57,7 +57,10 @@
"alias": "开始",
"data": {
"picUrl": "图片路径",
"blockUrl": "blockUrl"
"blockUrl": "blockUrl",
"row": "行",
"column": "列",
"gameTime": "游戏时间"
}
},
"pictures-stop": {
......@@ -86,5 +89,5 @@
}
},
"id": "pictures",
"code": "\"use strict\";var tslib=require(\"tslib\"),props={};function prepareProps(){var t=getProps();engine.injectProp(props,t)}function injectProps(t){engine.injectProp(props,t)}var MAX_COL,MAX_ROW,W,H,GAP,GAME_TIME,w,h,picMap={},posMap={},qietu=function(n,r,o,a){if(picMap[r]){for(var t=0,e=picMap[r];t<e.length;t++){var i=e[t];n.addChild(i)}return[picMap[r],posMap[r]]}for(var p=props.W,h=props.H,c=props.GAP,d=[],g=[],s=0;s<a;s++)!function(s){for(var t=0;t<o;t++)!function(e){var i=engine.Sprite.fromImage(r);d.push(i),i.scaleX=1/o,i.scaleY=1/a,n.addChild(i),i.x=e*(p/o+c),i.y=s*(h/a+c),g.push([i.x,i.y]),i.addEventListener(engine.Event.COMPLETE,function(){var t=new Float32Array([e/o,s/a,(e+1)/o,s/a,(e+1)/o,(s+1)/a,e/o,(s+1)/a]);i.uvs=t})}(t)}(s);return picMap[r]=d.concat([]),posMap[r]=g.concat([]),[d,g]};function getIndexFromRC(t,e,i){return t*i+e}function getRandomArray(t){t.sort(function(){return.5-Math.random()})}var GameView=function(e){function t(){var t=e.call(this)||this;return t._timeCounter=0,t.listenStageOn=1,t.once(engine.Event.ADDED_TO_STAGE,t.setup,t),t}return tslib.__extends(t,e),t.prototype.start=function(){var t=this;if(this.guideHole||(this.guideHole=new engine.Image,this.guideHole.source=\"asset://\"+props.blockUrl,this.guideHole.mouseChildren=this.guideHole.mouseEnabled=!1),this.pictures)for(var e=0,i=this.pictures;e<i.length;e++){var s=i[e];s&&s.parent&&s.parent.removeChild(s)}console.log(\"on start\"),engine.globalEvent.dispatchEvent(\"pictures-time-update\",{second:this.getSecond()});var n=qietu(this.picturesWrapper,props.picUrl,MAX_COL,MAX_ROW);this.picturesWrapper.addChild(this.guideHole),console.log(this.picturesWrapper),this.pictures=n[0],this.rightList=this.pictures.concat([]);var r=n[1];getRandomArray(this.pictures);for(var o=0,a=this.pictures.length;o<a;o++){this.dragPic=this.pictures[o],this.pictures[o].addEventListener(engine.MouseEvent.MOUSE_DOWN,this.onDown,this);var p=r[o],h=p[0],c=p[1];this.dragPic.x=h,this.dragPic.y=c}this._timer=setInterval(function(){t.onTimer()},10),this.date=(new Date).getTime()},t.prototype.onTimer=function(){var t=(new Date).getTime(),e=(t-this.date)/1e3;this.date=t,console.log(e,\"gap\"),(GAME_TIME-=e)<0&&(GAME_TIME=0),(GAME_TIME=(GAME_TIME=this.afterPointTwo(GAME_TIME)).toFixed(2))<10&&(GAME_TIME=\"0\"+GAME_TIME),console.log(GAME_TIME),engine.globalEvent.dispatchEvent(\"pictures-time-update\",{second:this.getSecond()}),0==this.getSecond()&&(this.stop(),engine.globalEvent.dispatchEvent(\"pictures-game-fail\",{reason:1}))},t.prototype.afterPointTwo=function(t){var e=parseFloat(t);if(!isNaN(e))return e=Math.round(100*e)/100},t.prototype.getSecond=function(){return GAME_TIME},t.prototype.stop=function(){GAME_TIME=props.GAME_TIME,clearInterval(this._timer);for(var t=this.pictures.length,e=0;e<t;e++)this.pictures[e].removeAllEventListener();this.stage.removeEventListener(engine.MouseEvent.MOUSE_UP,this.stageOnUp,this)},t.prototype.createRects=function(){},t.prototype.setup=function(){MAX_COL=props.MAX_COL,MAX_ROW=props.MAX_ROW,GAME_TIME=props.GAME_TIME,W=props.W,H=props.H,GAP=props.GAP,w=W/MAX_COL,h=H/MAX_ROW,console.log(\"onSteup\",props);var t=new engine.Sprite;this.picturesWrapper=t,this.addChild(t)},t.prototype.onDown=function(t){var e=(750-props.W)/2,i=(this.stage.height-props.H)/2;this.dragPic=t.target,this.picturesWrapper.addChild(this.dragPic),this.localPicX=t.localX/MAX_COL,this.localPicY=t.localY/MAX_ROW,this.distanceX=this.dragPic.x,this.distanceY=this.dragPic.y,this.indexJ=Math.floor(this.distanceX/(w+GAP)),this.indexI=Math.floor(this.distanceY/(h+GAP)),this.index=this.indexI*MAX_COL+this.indexJ,this.centerX=Math.floor((t.clientX-e)/w)*w+w/2,this.centerY=Math.floor((t.clientY-i)/h)*h+h/2,this.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE,this.onMove,this),this.stage.addEventListener(engine.MouseEvent.MOUSE_UP,this.stageOnUp,this)},t.prototype.stageOnUp=function(t){var e=(750-props.W)/2,i=(this.stage.height-props.H)/2;this.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE,this.onMove,this),this.stage.removeEventListener(engine.MouseEvent.MOUSE_UP,this.stageOnUp,this),(this.centerY<i||this.centerX<e)&&(this.dragPic.x=this.distanceX,this.dragPic.y=this.distanceY);var s=Math.floor(this.centerX/(w+GAP)),n=Math.floor(this.centerY/(h+GAP));if(this.picturesWrapper.addChild(this.guideHole),0<=s&&s<MAX_COL&&0<=n&&n<MAX_ROW){var r=getIndexFromRC(n,s,MAX_COL),o=this.pictures[r],a=o.x+e,p=o.y+i;o.x=this.distanceX,o.y=this.distanceY,this.dragPic.x=a-e,this.dragPic.y=p-i;var c=this.pictures.indexOf(o),d=this.pictures.indexOf(this.dragPic);this.pictures[c]=this.dragPic,this.pictures[d]=o,d===c&&(this.dragPic.x=this.distanceX,this.dragPic.y=this.distanceY);for(var g=!0,u=0;u<this.rightList.length;u++)if(this.rightList[u]!=this.pictures[u]){g=!1;break}g&&this.onSuccess()}else this.dragPic.x=this.distanceX,this.dragPic.y=this.distanceY},t.prototype.onSuccess=function(){console.log(\"拼图成功!\"),engine.globalEvent.dispatchEvent(\"pictures-game-success\",{time:GAME_TIME}),this.stop()},t.prototype.onMove=function(t){this.dragPic.x=t.stageX-this.localPicX-(750-props.W)/2,this.dragPic.y=t.stageY-this.localPicY-(this.stage.height-props.H)/2,this.centerX=this.dragPic.x+w/2,this.centerY=this.dragPic.y+h/2},t}(engine.Container),GameWrapper=function(i){function t(){var t=i.call(this)||this;engine.globalEvent.addEventListener(\"pictures-start\",t.start,t),engine.globalEvent.addEventListener(\"pictures-stop\",t.stop,t);var e=t._gameView=new GameView;return t.addChild(e),t}return tslib.__extends(t,i),t.prototype.start=function(t){injectProps(t.data),this._gameView.start()},t.prototype.stop=function(t){this._gameView.stop()},t}(engine.Container);function index(t){return prepareProps(),injectProps(t),new GameWrapper}module.exports=index;\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"
}
/**
* Created by renjianfeng on 2020-03-13.
*/
const customId = 'basket';
(async function () {
let customModule = await fetch(`../meta.json`);
customModule = await customModule.json();
console.log(customModule);
await loadAssets(customModule.assets);
launchWithCustomModule(customModule);
})();
function launchWithCustomModule(customModule) {
//engine.registerCustomCodeModule(customModule);
engine.registerCustomModule(customId, window[customId]);
const { props: propsOption, assets } = customModule;
let props = engine.computeProps(customModuleProps, propsOption);
const customModuleIns = {
id: customId,
props,
assets,
};
engine.registerCustomModules([customModuleIns]);
engine.launchWithConfig({
options: {
entrySceneView: 'entry',
},
assets: [],
views: [{
name: 'entry',
type: 'node',
properties: {
x: 0,
y: 0,
}
}],
customs: [],
}, null, function () {
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', {
// });
// engine.globalEvent.dispatchEvent('pictures-start', {
// });
// }, 1000);
});
// engine.globalEvent.addEventListener('cloud-time-update', (e) => {
// // console.log(e.type, e.data);
// });
// engine.globalEvent.addEventListener('cloud-game-fail', (e) => {
// console.log(e.type, e.data);
// });
// 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) {
return engine.resolveCustomAsset(customId, uuid);
}
function getProps() {
return engine.getProps(customId);
}
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>美食从天而降</title>
<meta name="viewport"
content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="full-screen" content="true"/>
<meta name="screen-orientation" content="portrait"/>
<meta name="x5-fullscreen" content="true"/>
<meta name="360-fullscreen" content="true"/>
<style>
html,
body {
padding: 0;
margin: 0;
border: 0;
width: 100%;
height: 100%;
overflow: hidden;
position: absolute;
background-color: gray;
}
.game-container{
width: 100%;
height: 100%;
line-height:0;
font-size:0;
}
</style>
</head>
<body>
<div id="game-container" class="game-container"></div>
<!-- <script crossorigin="anonymous" src="//yun.duiba.com.cn/editor/zeroing/libs/engine.1de84ff79dba19e949088de63aa75af51a515e5c.js"></script>
<script crossorigin="anonymous" src="//yun.duiba.com.cn/editor/zeroing/libs/svga.fd3923ae6e664251ca7981801a65809cc5f36bc3.js"></script> -->
<script crossorigin="anonymous" src="//yun.duiba.com.cn/editor/zeroing/libs/engine.cba09e24bd26909e1a67685a889d4799f4c2597a.js"></script>
<script crossorigin="anonymous" src="//yun.duiba.com.cn/editor/zeroing/libs/svga.bbb584f45f3ee647d0611653cb854c5d5bb8fb47.js"></script>
<script src="//yun.duiba.com.cn/js-libs/p2.js/0.7.1/p2.min.js"></script>
<!-- <script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.ebc906f6b50b8da0a669f77027981d5f3cb560ce.js"></script> -->
<!-- <script src="http://localhost:4002/debug/engine.js"></script>
<script src="http://localhost:4003/debug/engine-svga.js"></script> -->
<!--<script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.9a9dbfda4cb2dd5508ecddfe3d95dfd88063f7b5.js"></script>-->
<script src="app.js"></script>
<script src="props.js"></script>
<script src="load-assets.js"></script>
<script src="main.js"></script>
<script>
</script>
</body>
/**
* Created by rockyl on 2020-01-21.
*/
const 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"
}
];
function loadAssets(customModuleAssets, onProgress, onComplete){
return engine.loadAssets(assets.concat(...customModuleAssets), onProgress, onComplete);
}
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :
typeof define === 'function' && define.amd ? define(['tslib'], factory) :
(global = global || self, global.basket = factory(global.tslib));
}(this, (function (tslib) { 'use strict';
function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
}
function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
}
//# sourceMappingURL=utils.js.map
var GameTest = (function (_super) {
tslib.__extends(GameTest, _super);
function GameTest() {
var _this = _super.call(this) || this;
_this.isDebug = true;
_this.factor = 10;
_this.isRight = false;
_this.saleX = _this.isRight ? 1 : -1;
_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,
});
var boxBody = new p2.Body({
mass: 1,
position: [positionX, positionY],
angularVelocity: 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 boxBody = new p2.Body({
mass: 1,
position: [positionX, positionY],
});
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
});
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
});
var boardBody = new p2.Body({
position: [80 / this.factor, 1000 / this.factor]
});
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,
});
var boardPointBody = new p2.Body({
position: [100 / this.factor,]
});
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
});
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];
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.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;
}
};
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;
};
GameTest.prototype.createPlane = function (x, y, w, h) {
var sp = new engine.Shape();
sp.beginFill(0x0000ff, 1);
sp.drawRect(x, y, w, h);
sp.endFill();
this.addChild(sp);
return sp;
};
GameTest.prototype.createBall = function (r) {
var sp = new engine.Shape();
sp.beginFill(0xff0000, 0.4);
sp.drawCircle(0, 0, r);
sp.endFill();
return sp;
};
GameTest.prototype.createBox = function (width, height) {
var sp = new engine.Shape();
sp.beginFill(0xf0f0f0, 1);
sp.drawRect(-width / 2, -height / 2, width, height);
sp.endFill();
return sp;
};
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 = {};
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('game-start', _this.start, _this);
engine.globalEvent.addEventListener('game-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
{"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,OAAO,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;CACrD,CAAC;;;CCRD;KAAsCA,kCAAgB;KAclD;SAAA,YACI,iBAAO,SAEV;SAdD,aAAO,GAAG,IAAI,CAAC;SAGf,YAAM,GAAG,EAAE,CAAC;SAEJ,aAAO,GAAG,KAAK,CAAC;SAChB,WAAK,GAAG,KAAI,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;SAE9B,mBAAa,GAAG,CAAC,EAAE,CAAC;SACpB,mBAAa,GAAG,EAAE,CAAC;SAIvB,KAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,KAAI,CAAC,KAAK,EAAE,KAAI,CAAC,CAAC;;MACxE;KACD,wBAAK,GAAL;SACI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;SAQxB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CACvB,MAAM,CAAC,UAAU,CAAC,KAAK,EACvB,IAAI,CAAC,SAAS,EACd,IAAI,CACP,CAAC;MACL;KAED,0BAAO,GAAP,UAAQ,CAAoB;SAClB,IAAA,KAAoB,IAAI,EAAtB,KAAK,WAAA,EAAE,MAAM,YAAS,CAAC;SAE/B,IAAI,SAAS,GAAW,CAAC,CAAC,MAAM,GAAG,MAAM,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on 2020-01-21.
*/
let customModuleProps = {
};
{
"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": "游戏消耗时间"
}
}
}
}
}
\ No newline at end of file
import {getTextureByName} from './utils'
export default class BasketBoard extends engine.Container{
board:engine.Sprite = new engine.Sprite(getTextureByName('篮板'));
netFront:engine.Sprite = new engine.Sprite(getTextureByName('球网前'));
netBack:engine.Sprite = new engine.Sprite(getTextureByName('球网后'));
// 篮筐传感,圆环
private 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
}
}
constructor(){
super();
this.addChild(this.board);
// 椭圆
let shape = new engine.Shape();
shape.beginFill(0xff0000,0.5);
shape.drawEllipse(50,150,200,80);
shape.endFill();
this.board.addChild(shape)
}
setPosition(x,y){
this.x = x;
this.y = y;
}
}
\ No newline at end of file
export default class Basketball extends engine.Container{
ball:engine.Shape
gravity = -5;
constructor(){
super()
this.ball = new engine.Shape();
this.ball.beginFill(0x0000ff,0.7);
this.ball.drawCircle(0,0,60);
this.ball.endFill();
this.addChild(this.ball);
}
initPos(x,y){
this.x = x;
this.y = y;
}
updatePos(){
}
}
\ 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 { getTextureByName, getTexture } from "./utils";
import BasketBoard from "./basketBoard";
import Basketball from "./Basketball";
export default class GameView extends engine.Container {
private world: p2.World;
private boxBody: p2.Body;
private planeBody: p2.Body;
private basketball: p2.Body;
private ball: engine.Sprite;
private plane: engine.Sprite;
private box: engine.Sprite;
private circleBody:p2.Body;
private circleBody1:p2.Body;
basketBoard: BasketBoard = new BasketBoard();
private pool = {};
private horizontal = [74, 676]; //二值
private verticalArea = [200, 600]; //范围
private verticalInit = 462 - 45;
private positionInitBall = {
x: 551,
y: 805,
};
private vertical = this.verticalInit;
private isRight = false;
private saleX = this.isRight ? 1 : -1;
private 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,
// length: 2,
// radius: 0.1,
width: 0.3,
height: 2,
},
upSensorBody: {
x: 100,
y: 65,
radius: 0.05,
},
downSensorBody: {
x: 100,
y: 65 + 80,
radius: 0.05,
},
};
private onEnterFrameBind: Function;
private view;
// private basketball;
private direction;
private toRo = 180 / Math.PI;
private loopMark = false;
private guideMark = false;
//碰撞标志位
private inPointMark = false;
private outPointMark = false;
private boardMark = false;
private pointMark = false;
private planeMark = false;
private stringMark = "";
private ballAddSpeedX = -40;
private ballAddSpeedY = -80;
private gravity = -5;
private stepSpeed = [0.5, 3.5]; //3.5正常速度,2慢速播放
private detaTimeEf = this.stepSpeed[1];
private ballSpeedLimitX = 3;
private planeHeight = 1100;
private brokeMark = false;
private doubleHit = 0;
private timeLimit = window["timeLimit"] ? window["timeLimit"] : 5;
private timeMark = false;
private timeCount = this.timeLimit;
private timeSpeed = 1 / 60;
private clickMark = false;
constructor() {
super();
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];
// this.world.gravity = [0,-5];
//创建box
var box: p2.Box = new p2.Box({
width: 20,
height: 200,
material: materialBoard,
});
// var box:p2.Box = new p2.Box({width:this.config.boardBody.width, height:this.config.boardBody.height,material:materialBoard});
// this.boxBody = new p2.Body({mass:10, angularVelocity:1, position:[200,200]});
this.boxBody = new p2.Body({
mass: 0,
type: p2.Body.STATIC,
position: [20, 400],
});
this.boxBody.addShape(box);
// 添加图片
this.box = this.createBox(0, -100, 20, 200);
this.boxBody.displays = [this.box];
// let display = new engine.Texture(getTextureByName('篮板'));
// let displays = new engine.Sprite(display)
// this.addChild(displays)
// this.boxBody.displays = [displays];
this.world.addBody(this.boxBody);
// 设置摩擦和回弹系数
this.world.defaultContactMaterial.friction = 0.1;
this.world.defaultContactMaterial.restitution = 1;
this.world.setGlobalStiffness(1e5);
// material
var materialBall = new p2.Material(2); //参数id:number
var materialPoint = new p2.Material(2);
var materialBoard = new p2.Material(2);
var materialPlane = new p2.Material(2);
// 不同material碰撞系数
var contactMaterialBallPoint = new p2.ContactMaterial(
materialBall,
materialPoint,
{
friction: 0.3,
restitution: 0.5,
}
);
var contactMaterialBallBoard = new p2.ContactMaterial(
materialBall,
materialBoard,
{
friction: 0.1,
restitution: 1,
}
);
var contactMaterialBallPlane = new p2.ContactMaterial(
materialBall,
materialPlane,
{
friction: 0.1,
restitution: 1,
}
);
this.world.addContactMaterial(contactMaterialBallPoint);
this.world.addContactMaterial(contactMaterialBallBoard);
this.world.addContactMaterial(contactMaterialBallPlane);
// 框点
var circleShape = new p2.Circle({
// radius: this.config.outsidePointBody.radius,
radius: 1,
material: materialPoint,
});
var circleBody = this.circleBody = new p2.Body({
mass: 0,
// position: [5.65, -5.5],
position: [60, 500],
type: p2.Body.STATIC,
});
circleBody.addShape(circleShape);
this.world.addBody(circleBody);
var ellipse = this.createBox(0, 0, 20, 20);
circleBody.displays = [ellipse];
var circleShape1 = new p2.Circle({
// radius: this.config.insidePointBody.radius,
radius: 1,
material: materialPoint,
});
var circleBody1 = this.circleBody1 = new p2.Body({
mass: 0,
// position: [5.65, -5.5],
position: [200, 500],
type: p2.Body.STATIC,
});
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],
// type:p2.Body.DYNAMIC,
material: materialBall,
});
this.basketball.addShape(ball);
this.world.addBody(this.basketball);
this.ball = this.createCircle();
this.basketball.displays = [this.ball];
// let balldisplay = new engine.Texture(getTextureByName('篮球'));
// let balldisplays = new engine.Sprite(balldisplay);
// balldisplays.width = 120;
// balldisplays.height = 120
// this.addChild(balldisplays)
// this.basketball.displays = [balldisplays];
//进球感应区域
// var sensorShape = new p2.Circle({
// radius: this.config.upSensorBody.radius
// });
// sensorShape.sensor = true;
// var sensorBody = new p2.Body({
// position: [this.config.upSensorBody.x, this.config.upSensorBody.y]
// });
// sensorBody.damping = 0;
// sensorBody.addShape(sensorShape);
// this.world.addBody(sensorBody);
// var sensorShape1 = new p2.Circle({
// radius: this.config.downSensorBody.radius
// });
// sensorShape1.sensor = true;
// var sensorBody1 = new p2.Body({
// position: [this.config.downSensorBody.x, this.config.downSensorBody.y]
// });
// sensorBody1.damping = 0;
// sensorBody1.addShape(sensorShape1);
// this.world.addBody(sensorBody1);
//contactPointA 相对于bodyA的碰撞点位置,
//contactPointB 相对于bodyB的碰撞点位置,
let stringMark = this.stringMark;
let self = this;
let boardMarkSetTime;
let pointMarkSetTime;
//创建plane Plane shape class. The plane is facing in the Y direction.
var plane: p2.Plane = new p2.Plane();
this.planeBody = new p2.Body({
position: [engine.gameStage.width, engine.gameStage.height - 200],
material: materialPlane,
}); //GameConst.stage保存全局静态变量stage
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){
// let direction = self.isRight ? 1 : -1;
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
);
}
private onEnterFrame() {
// this.basketball.position[0] = this.basketball.interpolatedPosition[0] * 100;
// this.basketball.position[1] = -this.basketball.interpolatedPosition[1] * 100;
// this.basketball.rotation = -this.basketball.interpolatedAngle * this.toRo;
//更新物理世界
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];
display.x = body.position[0]; //同步刚体和egret显示对象的位置和旋转角度
display.y = body.position[1];
display.rotation = (body.angle * 180) / Math.PI;
}
if (this.basketball.position[0] < -120) {
this.basketball.position[0] = 750;
}
if (this.basketball.position[0] > 750 + 120) {
this.basketball.position[0] = - 120;
}
}
private createBox(x, y, w, h) {
// var sp:engine.Sprite = new engine.Sprite();
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;
}
private createPlane() {
// var sp:engine.Sprite = new engine.Sprite();
var sp = new engine.Shape();
// sp.lineStyle(10, 0x00ff00);
sp.beginFill(0x0000ff, 1);
// sp.moveTo(0, 0);
// sp.lineTo(engine.gameStage.width,0);
sp.drawRect(0, -10, engine.gameStage.width, 10);
sp.endFill();
sp.anchorX = sp.width / 2;
sp.anchorY = sp.height / 2;
this.addChild(sp);
return sp;
}
private createCircle() {
var sp = new engine.Shape();
sp.beginFill(0xff0000, 0.7);
sp.drawCircle(0, 0, 60);
sp.endFill();
sp.anchorX = sp.width / 2;
sp.anchorY = sp.height / 2;
this.addChild(sp);
return sp;
}
private createEclipse() {
var sp = new engine.Shape();
sp.beginFill(0x00ff00, 0.4);
sp.drawEllipse(0, 0, 200, 80);
sp.endFill();
this.addChild(sp);
return sp;
}
changePosition(){
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;
}
onMouseDown(e: engine.MouseEvent) {
var direction = this.isRight ? -1 : 1;
this.basketball.velocity[0] = this.ballAddSpeedX * direction;
this.basketball.velocity[1] = this.ballAddSpeedY;
this.basketball.angularVelocity = -2 * direction;
}
addEvent() {
this.addEventListener(
engine.Event.ENTER_FRAME,
(this.onEnterFrameBind = this.onEnterFrame.bind(this))
);
}
removeEvent() {
this.removeEventListener(
engine.Event.ENTER_FRAME,
this.onEnterFrameBind
);
}
start() {
// let gameBg = new engine.Sprite(
// getTexture("a880ee6b-c6d1-4d8f-8734-367f368a1803")
// );
// this.addChild(gameBg);
this.stage.addEventListener(
engine.MouseEvent.CLICK,
this.onMouseDown,
this
);
console.log(this.world);
// this.basketBoard.setPosition(0,100);
// this.addChild(this.basketBoard)
// console.log('1')
// this.basketball.initPos(400,200);
// this.addChild(this.basketball);
}
stop() {}
}
import GameView from "./GameView";
import GameTest from './GameTest'
import { injectProps } from "../props";
export class GameWrapper extends engine.Container {
// private _status;
private _gameView: GameView;
private _gameTest: GameTest;
constructor() {
super();
engine.globalEvent.addEventListener('game-start', this.start, this);
engine.globalEvent.addEventListener('game-stop', this.stop, this);
//创建实例
// let gameView = this._gameView = new GameView();
// this.addChild(gameView);
let gameTest = this._gameTest = new GameTest();
this.addChild(gameTest);
}
start(event: engine.Event) {
injectProps(event.data);
// this._status = 1;
// this._gameView.start();
this._gameTest.start();
}
stop(event: engine.Event) {
// this._gameView.stop();
this._gameTest.stop();
}
// reset(event:engine.Event){
// this._gameView.reset();
// }
}
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
/**
* Created by rockyl on 2020-01-21.
*/
export function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
}
export function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
}
export function playSound(name) {
engine.playSound(engine.getAssetByName(name).uuid, {keep: true});
}
export function createSvga(name, anchorName?) {
let inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
return inst;
}
export function getIndexFromRC(row,col,maxCol){
let index;
index = row * maxCol + col ;
return index
}
export function getRandomArray(array){
array.sort(function() {
return .5 - Math.random();
});
}
\ No newline at end of file
import {GameWrapper} from "./game/GameWrapper";
import {injectProps, prepareProps} from "./props";
export default function (props) {
prepareProps();
injectProps(props);
let instance = new GameWrapper();
return instance;
}
//////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014-present, Egret Technology.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Egret nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////////////
declare module p2 {
export class AABB {
upperBound: number[];
lowerBound: number[];
constructor(options?: {
upperBound?: number[];
lowerBound?: number[];
});
containsPoint(point: number[]): boolean;
setFromPoints(points: number[][], position: number[], angle: number, skinSize: number): void;
copy(aabb: AABB): void;
extend(aabb: AABB): void;
overlaps(aabb: AABB): boolean;
overlapsRay(ray:Ray): number;
}
export class Broadphase {
static AABB: number;
static BOUNDING_CIRCLE: number;
static boundingRadiusCheck(bodyA: Body, bodyB: Body): boolean;
static aabbCheck(bodyA: Body, bodyB: Body): boolean;
static canCollide(bodyA: Body, bodyB: Body): boolean;
constructor(type: number);
result: Body[];
world: World;
boundingVolumeType: number;
setWorld(world: World): void;
getCollisionPairs(world: World): Body[];
boundingVolumeCheck(bodyA: Body, bodyB: Body): boolean;
}
export class NaiveBroadphase extends Broadphase {
aabbQuery(world: World, aabb: AABB, result: Body[]): Body[];
}
export class Narrowphase {
static findSeparatingAxis(c1:Convex, offset1:number[], angle1:number, c2:Convex, offset2:number[], angle2:number, sepAxis:number[]): boolean;
static getClosestEdge(c:Convex, angle:number, axis:number[], flip:boolean): number;
static projectConvexOntoAxis(convexShape:Convex, convexOffset:number[], convexAngle:number, worldAxis:number[], result:number[]): void;
contactEquationPool: ContactEquationPool;
contactEquations: ContactEquation[];
contactSkinSize: number;
enabledEquations: boolean;
enableFriction: boolean;
frictionCoefficient: number;
frictionEquationPool: FrictionEquationPool;
frictionEquations: FrictionEquation[];
frictionRelaxation: number;
frictionStiffness: number;
restitution: number;
slipForce: number;
stiffness: number;
surfaceVelocity: number;
//官方不赞成使用的属性
enableFrictionReduction: boolean;
bodiesOverlap(bodyA: Body, bodyB: Body): boolean;
capsuleCapsule(bi: Body, si: Capsule, xi: number[], ai: number, bj: Body, sj: Capsule, xj: number[], aj: number): void;
circleCapsule(bi: Body, si: Circle, xi: number[], ai: number, bj: Body, sj: Line, xj: number[], aj: number): void;
circleCircle(bodyA: Body, shapeA: Circle, offsetA: number[], angleA: number, bodyB: Body, shapeB: Circle, offsetB: number[], angleB: number, justTest: boolean, radiusA?:number, radiusB?:number): void;
circleConvex(circleBody:Body, circleShape:Circle, circleOffset:number[], circleAngle:number, convexBody:Body, convexShape:Convex, convexOffset:number[], convexAngle:number, justTest:boolean, circleRadius:number): void;
circleHeightfield(bi:Body, si:Circle, xi:number[], bj:Body, sj:Heightfield, xj:number[], aj:number): void;
circleLine(circleBody:Body, circleShape:Circle, circleOffset:number[], circleAngle:number, lineBody:Body, lineShape:Line, lineOffset:number[], lineAngle:number, justTest:boolean, lineRadius:number, circleRadius:number): void;
circleParticle(circleBody:Body, circleShape:Circle, circleOffset:number[], circleAngle:number, particleBody:Body, particleShape:Particle, particleOffset:number[], particleAngle:number, justTest:boolean): void;
circlePlane(bi:Body, si:Circle, xi:number[], bj:Body, sj:Plane, xj:number[], aj:number): void;
collidedLastStep(bodyA: Body, bodyB: Body): boolean;
convexCapsule(convexBody:Body, convexShape:Convex, convexPosition:number[], convexAngle:number, capsuleBody:Body, capsuleShape:Capsule, capsulePosition:number[], capsuleAngle:number): void;
convexConvex(bi:Body, si:Convex, xi:number[], ai:number, bj:Body, sj:Convex, xj:number[], aj:number): void;
convexLine(convexBody:Body, convexShape:Convex, convexOffset:number[], convexAngle:number, lineBody:Body, lineShape:Line, lineOffset:number[], lineAngle:number, justTest:boolean): void;
createContactEquation(bodyA: Body, bodyB: Body): ContactEquation;
createFrictionEquation(bodyA: Body,bodyB: Body): FrictionEquation;
createFrictionFromContact(contactEquation: ContactEquation): FrictionEquation;
lineBox(lineBody:Body, lineShape:Line, lineOffset:number[], lineAngle:number, boxBody:Body, boxShape:Box, boxOffset:number[], boxAngle:number, justTest:boolean): void;
lineCapsule(lineBody:Body, lineShape:Line, linePosition:number[], lineAngle:number, capsuleBody:Body, capsuleShape:Capsule, capsulePosition:number[], capsuleAngle:number): void;
lineLine(bodyA:Body, shapeA:Line, positionA:number[], angleA:number, bodyB:Body, shapeB:Line, positionB:number[], angleB:number): void;
particleConvex(particleBody:Body, particleShape:Particle, particleOffset:number[], particleAngle:number, convexBody:Body, convexShape:Convex, convexOffset:number[], convexAngle:number, justTest:boolean): void;
particlePlane(particleBody:Body, particleShape:Particle, particleOffset:number[], particleAngle:number, planeBody:Body, planeShape:Plane, planeOffset:number[], planeAngle:number, justTest:boolean): void;
planeCapsule(planeBody:Body, planeShape:Circle, planeOffset:number[], planeAngle:number, capsuleBody:Body, capsuleShape:Particle, capsuleOffset:number[], capsuleAngle:number, justTest:boolean): void;
planeConvex(planeBody:Body, planeShape:Plane, planeOffset:number[], planeAngle:number, convexBody:Body, convexShape:Convex, convexOffset:number[], convexAngle:number, justTest:boolean): void;
planeLine(planeBody:Body, planeShape:Plane, planeOffset:number[], planeAngle:number, lineBody:Body, lineShape:Line, lineOffset:number[], lineAngle:number): void;
reset(): void;
}
export class SAPBroadphase extends Broadphase {
axisIndex: number;
axisList: Body[];
aabbQuery(world: World, aabb: AABB, result: Body[]): Body[];
sortAxisList(a: Body[], axisIndex: number): Body[];
}
export class Constraint {
static DISTANCE: number;
static GEAR: number;
static LOCK: number;
static PRISMATIC: number;
static REVOLUTE: number;
constructor(bodyA: Body, bodyB: Body, type: number, options?: {
collideConnected?: boolean;
});
type: number;
equations: Equation[];
bodyA: Body;
bodyB: Body;
collideConnected: boolean;
update(): void;
setStiffness(stiffness: number): void;
setRelaxation(relaxation: number): void;
}
export class DistanceConstraint extends Constraint {
constructor(bodyA: Body, bodyB: Body, options?: {
distance?: number;
localAnchorA?: number[];
localAnchorB?: number[];
maxForce?: number;
});
localAnchorA: number[];
localAnchorB: number[];
distance: number;
maxForce: number;
upperLimitEnabled: boolean;
upperLimit: number;
lowerLimitEnabled: boolean;
lowerLimit: number;
position: number;
setMaxForce(maxForce: number): void;
getMaxForce(): number;
}
export class GearConstraint extends Constraint {
constructor(bodyA: Body, bodyB: Body, options?: {
angle?: number;
ratio?: number;
maxTorque?: number;
});
ratio: number;
angle: number;
setMaxTorque(torque: number): void;
getMaxTorque(): number;
}
export class LockConstraint extends Constraint {
constructor(bodyA: Body, bodyB: Body, options?: {
localOffsetB?: number[];
localAngleB?: number;
maxForce?: number;
collideConnected?: boolean;
});
localAngleB: number;
localOffsetB: number[];
setMaxForce(force: number): void;
getMaxForce(): number;
}
export class PrismaticConstraint extends Constraint {
constructor(bodyA: Body, bodyB: Body, options?: {
maxForce?: number;
localAnchorA?: number[];
localAnchorB?: number[];
localAxisA?: number[];
disableRotationalLock?: boolean;
upperLimit?: number;
lowerLimit?: number;
collideConnected?: boolean;
});
localAnchorA: number[];
localAnchorB: number[];
localAxisA: number[];
lowerLimit: number;
lowerLimitEnabled: boolean;
motorEnabled: boolean;
motorEquation: Equation;
motorSpeed: number;
position: number;
upperLimit: number;
upperLimitEnabled: boolean;
disableMotor(): void;
enableMotor(): void;
setLimits(lower: number, upper: number): void;
}
export class RevoluteConstraint extends Constraint {
constructor(bodyA: Body, bodyB: Body, options?: {
worldPivot?: number[];
localPivotA?: number[];
localPivotB?: number[];
maxForce?: number;
collideConnected?: boolean;
});
angle: number;
lowerLimit: number;
lowerLimitEnabled: boolean;
motorEnabled: boolean;
pivotA: number[];
pivotB: number[];
upperLimit: number;
upperLimitEnabled: boolean;
disableMotor(): void;
enableMotor(): void;
getMotorSpeed(): number;
//官方不赞成使用了
motorIsEnabled(): boolean;
setLimits(lower: number, upper: number): void;
setMotorSpeed(speed: number): void;
}
export class AngleLockEquation extends Equation {
constructor(bodyA: Body, bodyB: Body, options?: {
angle?: number;
ratio?: number;
});
computeGq(): number;
setRatio(ratio: number): number;
setMaxTorque(torque: number): number;
}
export class ContactEquation extends Equation {
constructor(bodyA: Body, bodyB: Body);
contactPointA: number[];
contactPointB: number[];
normalA: number[];
restitution: number;
firstImpact: boolean;
shapeA: Shape;
shapeB: Shape;
}
export class Equation {
static DEFAULT_STIFFNESS: number;
static DEFAULT_RELAXATION: number;
constructor(bodyA: Body, bodyB: Body, minForce?: number, maxForce?: number);
minForce: number;
maxForce: number;
bodyA: Body;
bodyB: Body;
stiffness: number;
relaxation: number;
G: number[];
needsUpdate: boolean;
multiplier: number;
relativeVelocity: number;
enabled: boolean;
gmult(): number;
computeB(): number;
computeGq(): number;
computeGW(): number;
computeGWlambda(): number;
computeGiMf(): number;
computeGiMGt(): number;
addToWlambda(deltalambda: number): void;
computeInvC(eps: number): number;
update(): void;
}
export class FrictionEquation extends Equation {
constructor(bodyA: Body, bodyB: Body, slipForce: number);
contactEquations: ContactEquation;
contactPointA: number[];
contactPointB: number[];
t: number[];
shapeA: Shape;
shapeB: Shape;
frictionCoefficient: number;
setSlipForce(slipForce: number): void;
getSlipForce(): number;
}
export class RotationalLockEquation extends Equation {
constructor(bodyA: Body, bodyB: Body, options?: {
angle?: number;
});
angle: number;
}
export class RotationalVelocityEquation extends Equation {
constructor(bodyA: Body, bodyB: Body);
}
export class EventEmitter {
on(type: string, listener: Function, context?: any): EventEmitter;
has(type: string, listener: Function): boolean;
off(type: string, listener: Function): EventEmitter;
emit(event: any): EventEmitter;
}
export class ContactMaterialOptions {
friction?: number;
restitution?: number;
stiffness?: number;
relaxation?: number;
frictionStiffness?: number;
frictionRelaxation?: number;
surfaceVelocity?: number;
}
export class ContactMaterial {
constructor(materialA: Material, materialB: Material, options?: ContactMaterialOptions);
id: number;
materialA: Material;
materialB: Material;
friction: number;
restitution: number;
stiffness: number;
relaxation: number;
frictionStuffness: number;
frictionRelaxation: number;
surfaceVelocity: number;
contactSkinSize: number;
}
export class Material {
constructor(id: number);
id: number;
}
export class vec2 {
static add(out: number[], a: number[], b: number[]): number[];
static centroid(out: number[], a: number[], b: number[], c: number[]): number[];
static clone(a: number[]): number[];
static copy(out: number[], a: number[]): number[];
static create(): number[];
static crossLength(a: number[], b: number[]): number;
static crossVZ(out: number[], vec: number[], zcomp: number): number;
static crossZV(out: number[], zcomp: number, vec: number[]): number;
static dist(a: number[], b: number[]): number;
static distance(a: number[], b: number[]): number;
static div(out: number[], a: number[], b: number[]): number[];
static divide(out: number[], a: number[], b: number[]): number[];
static dot(a: number[], b: number[]): number;
static fromValues(x: number, y: number): number[];
static getLineSegmentsIntersection(out: number[], p0: number[], p1: number[], p2: number[], p3: number[]): boolean;
static getLineSegmentsIntersectionFraction(p0: number[], p1: number[], p2: number[], p3: number[]): number;
static len(a: number[]): number;
static length(a: number[]): number;
static lerp(out: number[], a: number[], b: number[], t: number): void;
static mul(out: number[], a: number[], b: number[]): number[];
static multiply(out: number[], a: number[], b: number[]): number[];
static negate(out: number[], a: number[]): number[];
static normalize(out: number[], a: number[]): number[];
static reflect(out: number[], vector: number[], normal: number[]): void;
static rotate(out: number[], a: number[], angle: number): void;
static rotate90cw(out: number[], a: number[]): void;
static scale(out: number[], a: number[], b: number): number[];
static set(out: number[], x: number, y: number): number[];
static sqrDist(a: number[], b: number[]): number;
static squaredDistance(a: number[], b: number[]): number;
static sqrLen(a: number[]): number;
static squaredLength(a: number[]): number;
static str(vec: number[]): string;
static sub(out: number[], a: number[], b: number[]): number[];
static subtract(out: number[], a: number[], b: number[]): number[];
static toGlobalFrame(out: number[], localPoint: number[], framePosition: number[], frameAngle: number): void;
static toLocalFrame(out: number[], worldPoint: number[], framePosition: number[], frameAngle: number): void;
static vectorToLocalFrame(out: number[], worldVector: number[], frameAngle: number): void;
}
// export class BodyOptions {
//
// mass: number;
// position: number[];
// velocity: number[];
// angle: number;
// angularVelocity: number;
// force: number[];
// angularForce: number;
// fixedRotation: number;
//
// }
/**
* 刚体。有质量、位置、速度等属性以及一组被用于碰撞的形状
*
* @class Body
* @constructor
* @extends EventEmitter
* @param {Array} [options.force]
* @param {Array} [options.position]
* @param {Array} [options.velocity]
* @param {Boolean} [options.allowSleep]
* @param {Boolean} [options.collisionResponse]
* @param {Number} [options.angle=0]
* @param {Number} [options.angularForce=0]
* @param {Number} [options.angularVelocity=0]
* @param {Number} [options.ccdIterations=10]
* @param {Number} [options.ccdSpeedThreshold=-1]
* @param {Number} [options.fixedRotation=false]
* @param {Number} [options.gravityScale]
* @param {Number} [options.id]
* @param {Number} [options.mass=0] 一个大于0的数字。如果设置成0,其type属性将被设置为 Body.STATIC.
* @param {Number} [options.sleepSpeedLimit]
* @param {Number} [options.sleepTimeLimit]
* @param {Object} [options]
*
* @example
* // 创建一个刚体
* var body = new Body({
* mass: 1,
* position: [0, 0],
* angle: 0,
* velocity: [0, 0],
* angularVelocity: 0
* });
*
* // 将一个圆形形状添加到刚体
* body.addShape(new Circle({ radius: 1 }));
*
* // 将刚体加入 world
* world.addBody(body);
*/
export class Body extends EventEmitter {
sleepyEvent: {
type: string;
};
sleepEvent: {
type: string;
};
wakeUpEvent: {
type: string;
};
static DYNAMIC: number;
static STATIC: number;
static KINEMATIC: number;
static AWAKE: number;
static SLEEPY: number;
static SLEEPING: number;
constructor(options?);
/**
* 刚体id
* @property id
* @type {Number}
*/
id: number;
/**
* 刚体被添加到的 world。如果没有被添加到 world 该属性将被设置为 null
* @property world
* @type {World}
*/
world: World;
/**
* 刚体的碰撞形状
*
* @property shapes
* @type {Array}
*/
shapes: Shape[];
/**
* 质量
* @property mass
* @type {number}
*/
mass: number;
/**
* 惯性
* @property inertia
* @type {number}
*/
inertia: number;
/**
* 是否固定旋转
* @property fixedRotation
* @type {Boolean}
*/
fixedRotation: boolean;
/**
* 位置
* @property position
* @type {Array}
*/
position: number[];
/**
* 位置插值
* @property interpolatedPosition
* @type {Array}
*/
interpolatedPosition: number[];
/**
* 角度插值
* @property interpolatedAngle
* @type {Number}
*/
interpolatedAngle: number;
/**
* 速度
* @property velocity
* @type {Array}
*/
velocity: number[];
/**
* 角度
* @property angle
* @type {number}
*/
angle: number;
/**
* 力
* @property force
* @type {Array}
*/
force: number[];
/**
* 角力
* @property angularForce
* @type {number}
*/
angularForce: number;
/**
* 限行阻尼。取值区间[0,1]
* @property damping
* @type {Number}
* @default 0.1
*/
damping: number;
/**
* 角阻尼。取值区间[0,1]
* @property angularDamping
* @type {Number}
* @default 0.1
*/
angularDamping: number;
/**
* 运动类型。 应该是Body.STATIC,Body.DYNAMIC,Body.KINEMATIC之一
*
* * Static 刚体不会动,不响应力或者碰撞
* * Dynamic 刚体会动,响应力和碰撞
* * Kinematic 刚体仅根据自身属性运动,不响应力或者碰撞
*
* @property type
* @type {number}
*
* @example
* // 默认值是STATIC
* var body = new Body();
* console.log(body.type == Body.STATIC); // true
*
* @example
* // 将质量设置为非0的值,会变为DYNAMIC
* var dynamicBody = new Body({
* mass : 1
* });
* console.log(dynamicBody.type == Body.DYNAMIC); // true
*
* @example
* // KINEMATIC刚体只会运动,如果你改变它的速度
* var kinematicBody = new Body({
* type: Body.KINEMATIC
* });
*/
type: number;
/**
* 边界圆半径
* @property boundingRadius
* @type {Number}
*/
boundingRadius: number;
/**
* 边框
* @property aabb
* @type {AABB}
*/
aabb: AABB;
/**
* 设置AABB是否会更新。通过调用 updateAABB 方法更新它
* @property aabbNeedsUpdate
* @type {Boolean}
* @see updateAABB
*
* @example
* body.aabbNeedsUpdate = true;
* body.updateAABB();
* console.log(body.aabbNeedsUpdate); // false
*/
aabbNeedsUpdate: boolean;
/**
* 设置为true,刚体会自动进入睡眠。需要在 World 中允许刚体睡眠
* @property allowSleep
* @type {Boolean}
* @default true
*/
allowSleep: boolean;
/**
* Body.AWAKE,Body.SLEEPY,Body.SLEEPING之一
*
* 默认值是 Body.AWAKE。如果刚体速度低于 sleepSpeedLimit,该属性将变为 Body.SLEEPY。如果持续 Body.SLEEPY 状态 sleepTimeLimit 秒,该属性将变为 Body.SLEEPY。
*
* @property sleepState
* @type {Number}
* @default Body.AWAKE
*/
sleepState: number;
/**
* 如果速度小于该值,sleepState 将变为 Body.SLEEPY 状态
* @property sleepSpeedLimit
* @type {Number}
* @default 0.2
*/
sleepSpeedLimit: number;
/**
* 如果持续 Body.SLEEPY 状态 sleepTimeLimit 秒,sleepState 将变为 Body.SLEEPING
* @property sleepTimeLimit
* @type {Number}
* @default 1
*/
sleepTimeLimit: number;
/**
* 重力缩放因子。如果你想忽略刚体重心,设置为零。如果你想反转重力,将其设置为-1。
* @property {Number} gravityScale
* @default 1
*/
gravityScale: number;
/**
* The angular velocity of the body, in radians per second.
* @property angularVelocity
* @type {number}
*/
angularVelocity: number;
/**
* The inverse inertia of the body.
* @property invInertia
* @type {number}
*/
invInertia: number;
/**
* The inverse mass of the body.
* @property invMass
* @type {number}
*/
invMass: number;
/**
* The previous angle of the body.
* @property previousAngle
* @type {number}
*/
previousAngle: number;
/**
* The previous position of the body.
* @property previousPosition
* @type {Array}
*/
previousPosition: number[];
/**
* Constraint velocity that was added to the body during the last step.
* @property vlambda
* @type {Array}
*/
vlambda: number[];
/**
* Angular constraint velocity that was added to the body during last step.
* @property wlambda
* @type {Array}
*/
wlambda: number[];
/**
* The number of iterations that should be used when searching for the time of impact during CCD. A larger number will assure that there's a small penetration on CCD collision, but a small number will give more performance.
* @property {Number} ccdIterations
* @default 10
*/
ccdIterations: number;
/**
* If the body speed exceeds this threshold, CCD (continuous collision detection) will be enabled. Set it to a negative number to disable CCD completely for this body.
* @property {Number} ccdSpeedThreshold
* @default -1
*/
ccdSpeedThreshold: number;
/**
* Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled. That means that this body will move through other bodies, but it will still trigger contact events, etc.
* @property collisionResponse
* @type {Boolean}
*/
collisionResponse: boolean;
/**
* Set to true if you want to fix the body movement along the X axis. The body will still be able to move along Y.
* @property fixedX
* @type {Boolean}
*/
fixedX: boolean;
/**
* Set to true if you want to fix the body movement along the Y axis. The body will still be able to move along X.
* @property fixedY
* @type {Boolean}
*/
fixedY: boolean;
/**
* How long the body has been sleeping.
* @property idleTime
* @type {Number}
*/
idleTime: number;
/**
* 与每个形状对应的显示对象
*/
displays: engine.DisplayObject[];
/**
* 设置刚体总密度
* @method setDensity
*/
setDensity(density: number): void;
/**
* 得到所有形状的总面积
* @method getArea
* @return {Number}
*/
getArea(): number;
/**
* 获得AABB
* @method getAABB
*/
getAABB(): AABB;
/**
* 更新AABB
* @method updateAABB
*/
updateAABB(): void;
/**
* 更新外边界
* @method updateBoundingRadius
*/
updateBoundingRadius(): void;
/**
* 添加一个形状
*
* @method addShape
* @param {Shape} shape 形状
* @param {Array} [offset] 偏移
* @param {Number} [angle] 角度
*
* @example
* var body = new Body(),
* shape = new Circle();
*
* // 位于中心
* body.addShape(shape);
*
* // 偏移量为x轴一个单位
* body.addShape(shape,[1,0]);
*
* // 偏移量为y轴一个单位,同时逆时针旋转90度
* body.addShape(shape,[0,1],Math.PI/2);
*/
addShape(shape: Shape, offset?: number[], angle?: number): void;
/**
* 移除形状
* @method removeShape
* @param {Shape} shape
* @return {Boolean}
*/
removeShape(shape: Shape): boolean;
/**
* 更新属性,结构或者质量改变时会被调用
*
* @method updateMassProperties
*
* @example
* body.mass += 1;
* body.updateMassProperties();
*/
updateMassProperties(): void;
/**
* 相对于 world 中的一个点施加力
* @method applyForce
* @param {Array} force 力
* @param {Array} relativePoint 以物体中心点为基准的点
*/
applyForce(force: number[], relativePoint: number[]): void;
/**
* Wake the body up. Normally you should not need this, as the body is automatically awoken at events such as collisions.
* Sets the sleepState to {{#crossLink "Body/AWAKE:property"}}Body.AWAKE{{/crossLink}} and emits the wakeUp event if the body wasn't awake before.
* @method wakeUp
*/
wakeUp(): void;
/**
* Force body sleep
* @method sleep
*/
sleep(): void;
/**
* Called every timestep to update internal sleep timer and change sleep state if needed.
* @method sleepTick
* @param {number} time The world time in seconds
* @param {boolean} dontSleep
* @param {number} dt
*/
sleepTick(time: number, dontSleep: boolean, dt: number): void;
/**
* Check if the body is overlapping another body. Note that this method only works if the body was added to a World and if at least one step was taken.
* @method overlaps
* @param {Body} body
* @return {boolean}
*/
overlaps(body: Body): boolean;
/**
* Moves the shape offsets so their center of mass becomes the body center of mass.
* @method adjustCenterOfMass
*/
adjustCenterOfMass(): void;
/**
* Apply damping.
* @method applyDamping
* @param {number} dt Current time step
*/
applyDamping(dt: number): void;
/**
* Reads a polygon shape path, and assembles convex shapes from that and puts them at proper offset points.
* @method fromPolygon
* @param {Array} path An array of 2d vectors, e.g. [[0,0],[0,1],...] that resembles a concave or convex polygon. The shape must be simple and without holes.
* @param {Object} [options]
* @param {Boolean} [options.optimalDecomp=false] Set to true if you need optimal decomposition. Warning: very slow for polygons with more than 10 vertices.
* @param {Boolean} [options.skipSimpleCheck=false] Set to true if you already know that the path is not intersecting itself.
* @param {Boolean|Number} [options.removeCollinearPoints=false] Set to a number (angle threshold value) to remove collinear points, or false to keep all points.
* @return {Boolean} True on success, else false.
*/
fromPolygon(path:number[][], options?: {
optimalDecomp?: boolean;
skipSimpleCheck?: boolean;
removeCollinearPoints?: boolean; // Boolean | Number
}): boolean;
/**
* Sets the force on the body to zero.
* @method setZeroForce
*/
setZeroForce(): void;
/**
* Transform a world point to local body frame.
* @method toLocalFrame
* @param {Array} out The vector to store the result in
* @param {Array} worldPoint The input world point
*/
toLocalFrame(out: number[], worldPoint: number[]): void;
/**
* Transform a local point to world frame.
* @method toWorldFrame
* @param {Array} out The vector to store the result in
* @param {Array} localPoint The input local point
*/
toWorldFrame(out: number[], localPoint: number[]): void;
/**
* Apply force to a body-local point.
* @method applyForceLocal
* @param {Array} localForce The force vector to add, oriented in local body space.
* @param {Array} localPoint A point relative to the body in world space. If not given, it is set to zero and all of the impulse will be excerted on the center of mass.
*/
applyForceLocal(localForce: number[], localPoint: number[]): void;
/**
* Apply impulse to a point relative to the body. This could for example be a point on the Body surface. An impulse is a force added to a body during a short period of time (impulse = force * time). Impulses will be added to Body.velocity and Body.angularVelocity.
* @method applyImpulse
* @param {Array} impulse The impulse vector to add, oriented in world space.
* @param {Array} relativePoint A point relative to the body in world space. If not given, it is set to zero and all of the impulse will be excerted on the center of mass.
*/
applyImpulse(impulse: number[], relativePoint: number[]): void;
/**
* Apply impulse to a point relative to the body. This could for example be a point on the Body surface. An impulse is a force added to a body during a short period of time (impulse = force * time). Impulses will be added to Body.velocity and Body.angularVelocity.
* @method applyImpulseLocal
* @param {Array} impulse The impulse vector to add, oriented in world space.
* @param {Array} relativePoint A point relative to the body in world space. If not given, it is set to zero and all of the impulse will be excerted on the center of mass.
*/
applyImpulseLocal(impulse: number[], relativePoint: number[]): void;
/**
* Get velocity of a point in the body.
* @method getVelocityAtPoint
* @param {Array} result A vector to store the result in
* @param {Array} relativePoint A world oriented vector, indicating the position of the point to get the velocity from
* @return {Array}
*/
getVelocityAtPoint(result: number[], relativePoint: number[]): number[];
/**
* Move the body forward in time given its current velocity.
* @method integrate
* @param {number} dt
*/
integrate(dt: number): void;
/**
* Transform a world point to local body frame.
* @method vectorToLocalFrame
* @param {Array} out The vector to store the result in
* @param {Array} worldVector The input world vector
*/
vectorToLocalFrame(out: number[], worldVector: number[]): void;
/**
* Transform a local point to world frame.
* @method vectorToWorldFrame
* @param {Array} out The vector to store the result in
* @param {Array} localVector The input local vector
*/
vectorToWorldFrame(out: number[], localVector: number[]): void;
}
/**
* Box shape class.
*
* @class Box
* @constructor
* @extends Convex
* @param {Object} [options] (Note that this options object will be passed on to the Shape constructor.)
* @param {Number} [options.width=1] Total width of the box
* @param {Number} [options.height=1] Total height of the box
*/
export class Box extends Convex {
constructor(options?: Object);
width: number;
height: number;
}
export class Pool {
objects: any[];
get(): Object;
release(object: Object): Pool;
resize(size: number): Pool;
}
export class OverlapKeeperRecordPool extends Pool {
}
export class IslandPool extends Pool {
}
export class IslandNodePool extends Pool {
}
export class ContactEquationPool extends Pool {
}
export class FrictionEquationPool extends Pool {
}
export class Ray {
static ALL: number;
static ANY: number;
static CLOSEST: number;
constructor(options?: {
from?: number[];
to?: number[];
checkCollisionResponse?: boolean;
skipBackfaces?: boolean;
collisionMask?: number;
collisionGroup?: number;
mode?: number;
callback?: number;
});
callback: Function;
checkCollisionResponse: boolean;
collisionGroup: number;
collisionMask: number;
direction: number[];
from: number[];
length: number;
mode: number;
skipBackfaces: boolean;
to: number[];
getAABB(aabb: AABB): void;
intersectBodies(bodies: Body[]): void;
update(): void;
}
export class RaycastResult {
body: Body;
faceIndex: number;
fraction: number;
isStopped: boolean;
normal: number[];
shape: Shape;
getHitDistance(ray: Ray): void;
getHitPoint(out:number[], ray: Ray): void;
hasHit():boolean;
reset(): void;
stop(): void;
}
export class TopDownVehicle {
constructor(chassisBody: Body, options?: Object);
chassisBody: Body;
wheels: WheelConstraint[];
addToWorld(world: World): void;
addWheel(wheelOptions?: Object): WheelConstraint;
removeFromWorld(world: World): void;
update(): void;
}
export class WheelConstraint extends Constraint {
constructor(vehicle: TopDownVehicle, options?: {
localForwardVector?: number[];
localPosition?: number[];
sideFriction?: number;
});
engineForce: number;
localForwardVector: number[];
localPosition: number[];
steerValue: number;
getSpeed(): number;
update(): void;
}
export class Spring {
constructor(bodyA: Body, bodyB: Body, options?: {
stiffness?: number;
damping?: number;
localAnchorA?: number[];
localAnchorB?: number[];
worldAnchorA?: number[];
worldAnchorB?: number[];
});
bodyA: Body;
bodyB: Body;
damping: number;
stiffness: number;
applyForce(): void;
}
export class LinearSpring extends Spring {
constructor(bodyA: Body, bodyB: Body, options?: {
restLength?: number;
stiffness?: number;
damping?: number;
worldAnchorA?: number[];
worldAnchorB?: number[];
localAnchorA?: number[];
localAnchorB?: number[];
});
localAnchorA: number[];
localAnchorB: number[];
restLength: number;
setWorldAnchorA(worldAnchorA: number[]): void;
setWorldAnchorB(worldAnchorB: number[]): void;
getWorldAnchorA(result: number[]): void;
getWorldAnchorB(result: number[]): void;
}
export class RotationalSpring extends Spring {
constructor(bodyA: Body, bodyB: Body, options?: {
restAngle?: number;
stiffness?: number;
damping?: number;
});
restAngle: number;
}
/**
* Capsule shape class.
*
* @class Capsule
* @constructor
* @extends Shape
* @param {Object} [options] (Note that this options object will be passed on to the Shape constructor.)
* @param {Number} [options.length=1] The distance between the end points
* @param {Number} [options.radius=1] Radius of the capsule
*/
export class Capsule extends Shape {
constructor(options?: Object);
length: number;
radius: number;
conputeMomentOfInertia(mass: number): number;
}
/**
* Circle shape class.
*
* @class Circle
* @constructor
* @extends Shape
* @param {Object} [options] (Note that this options object will be passed on to the Shape constructor.)
* @param {Number} [options.radius=1] The radius of this circle
* @example
* var circleShape = new Circle({ radius: 1 });
* body.addShape(circleShape);
*/
export class Circle extends Shape {
constructor(options?: Object);
/**
* 半径
* @property radius
* @type {number}
*/
radius: number;
}
/**
* Convex shape class.
*
* @class Convex
* @constructor
* @extends Shape
* @param {Object} [options] (Note that this options object will be passed on to the Shape constructor.)
* @param {Array} [options.vertices] An array of vertices that span this shape. Vertices are given in counter-clockwise (CCW) direction.
* @param {Array} [options.axes] An array of unit length vectors, representing the symmetry axes in the convex.
* @example
* var vertices = [[-1,-1], [1,-1], [1,1], [-1,1]];
* var convexShape = new Convex({ vertices: vertices });
* body.addShape(convexShape);
*/
export class Convex extends Shape {
static projectOntoAxis(offset: number[], localAxis: number[], result: number[]): void;
static triangleArea(a: number[], b: number[], c: number[]): number;
constructor(options?: Object);
vertices: number[][];
axes: number[];
centerOfMass: number[];
triangles: number[];
updateCenterOfMass(): void;
updateTriangles(): void;
}
export class Heightfield extends Shape {
constructor(options?: {
heights?: number[];
minValue?: number;
maxValue?: number;
elementWidth?: number;
});
heights: number[];
maxValue: number;
minValue: number;
elementWidth: number;
getLineSegment(start:number[], end:number[], i:number): void;
updateMaxMinValues(): void;
}
export class Shape {
static BOX: number;
static CAPSULE: number;
static CIRCLE: number;
static CONVEX: number;
static HEIGHTFIELD: number;
static LINE: number;
static PARTICLE: number;
static PLANE: number;
constructor(options?: {
position?: number[];
angle?: number;
collisionGroup?: number;
collisionMask?: number;
sensor?: boolean;
collisionResponse?: boolean;
type?: number;
});
angle: number;
area: number;
body: Body;
boundingRadius: number;
collisionGroup: number;
collisionMask: number;
collisionResponse: boolean;
id: number;
material: Material;
position: number[];
sensor: boolean;
type: number;
computeAABB(out: AABB, position: number[], angle: number): void;
computeMomentOfInertia(mass: number): number;
raycast(result: RaycastResult, ray: Ray, position: number[], angle: number): void;
updateArea(): void;
updateBoundingRadius(): number;
}
export class Line extends Shape {
constructor(options?: {
length?: number;
});
length: number;
}
export class Particle extends Shape {
}
export class Plane extends Shape {
}
export class Solver extends EventEmitter {
constructor();
equations: Equation[];
equationSortFunction: Function; //Function | boolean
addEquation(eq: Equation): void;
addEquations(eqs: Equation[]): void;
removeAllEquations(): void;
removeEquation(eq: Equation): void;
solve(dt: number, world: World): void;
solveIsland(dt: number, island: Island): void;
sortEquations(): void;
}
export class GSSolver extends Solver {
constructor(options?: {
iterations?: number;
tolerance?: number;
});
iterations: number;
tolerance: number;
useZeroRHS: boolean;
frictionIterations: number;
usedIterations: number;
solve(h: number, world: World): void;
}
export class OverlapKeeper {
constructor();
recordPool: OverlapKeeperRecordPool;
tick(): void;
setOverlapping(bodyA: Body, shapeA: Body, bodyB: Body, shapeB: Body): void;
bodiesAreOverlapping(bodyA: Body, bodyB: Body): boolean;
}
export class OverlapKeeperRecord {
constructor(bodyA: Body, shapeA: Shape, bodyB: Body, shapeB: Shape);
bodyA: Body;
bodyB: Body;
shapeA: Shape;
shapeB: Shape;
set(bodyA: Body, shapeA: Shape, bodyB: Body, shapeB: Shape): void;
}
export class TupleDictionary {
data: Object;
keys: number[];
copy(dict: TupleDictionary): void;
get(i: number, j: number): number;
getByKey(key: number): Object;
getKey(i: number, j: number): string;
reset(): void;
set(i: number, j: number, value: number): void;
}
export class Utils {
static appendArray<T>(a: Array<T>, b: Array<T>): Array<T>;
static splice<T>(array: Array<T>, index: number, howMany: number): void;
static extend(a: any, b: any): void;
static defaults(options: any, defaults: any): any;
}
export class Island {
equations: Equation[];
bodies: Body[];
reset(): void;
getBodies(): Body[];
wantsToSleep(): boolean;
sleep(): void;
}
export class IslandManager extends Solver {
static getUnvisitedNode(nodes: Node[]): IslandNode; // IslandNode | boolean
constructor(options?: Object);
islands: Island[];
nodes: IslandNode[];
islandPool: IslandPool;
nodePool: IslandNodePool;
visit(node: IslandNode, bds: Body[], eqs: Equation[]): void;
bfs(root: IslandNode, bds: Body[], eqs: Equation[]): void;
split(world: World): Island[];
}
export class IslandNode {
constructor(body: Body);
body: Body;
neighbors: IslandNode[];
equations: Equation[];
visited: boolean;
reset(): void;
}
/**
* world,包含所有刚体
*
* @class World
* @constructor
* @param {Object} [options]
* @param {Solver} [options.solver] 默认值 GSSolver.
* @param {Array} [options.gravity] 默认值 [0,-9.78]
* @param {Broadphase} [options.broadphase] 默认值 NaiveBroadphase
* @param {Boolean} [options.islandSplit=false]
* @param {Boolean} [options.doProfiling=false]
* @extends EventEmitter
*
* @example
* var world = new World({
* gravity: [0, -9.81],
* broadphase: new SAPBroadphase()
* });
*/
export class World extends EventEmitter {
/**
* step() 执行之后调用
* @event postStep
*/
postStepEvent: {
type: string;
};
/**
* Body 加入时调用
* @event addBody
* @param {Body} body
*/
addBodyEvent: {
type: string;
body: Body;
};
/**
* Body移除时调用
* @event removeBody
* @param {Body} body
*/
removeBodyEvent: {
type: string;
body: Body;
};
/**
* Spring 加入时调用
* @event addSpring
* @param {Spring} spring
*/
addSpringEvent: {
type: string;
spring: Spring;
};
/**
* 当两个刚体第一次碰撞时调用。调用时碰撞步骤已经完成
* @event impact
* @param {Body} bodyA
* @param {Body} bodyB
*/
impactEvent: {
type: string;
bodyA: Body;
bodyB: Body;
shapeA: Shape;
shapeB: Shape;
contactEquation: ContactEquation;
};
/**
* 当 Broadphase 手机对碰之后被调用
* @event postBroadphase
* @param {Array} 对碰数组
*/
postBroadphaseEvent: {
type: string;
pairs: Body[];
};
/**
* 当两个形状重叠时调用
* @event beginContact
* @param {Shape} shapeA
* @param {Shape} shapeB
* @param {Body} bodyA
* @param {Body} bodyB
* @param {Array} contactEquations
*/
beginContactEvent: {
type: string;
shapeA: Shape;
shapeB: Shape;
bodyA: Body;
bodyB: Body;
contactEquations: ContactEquation[];
};
/**
* 当两个形状停止重叠时调用
* @event endContact
* @param {Shape} shapeA
* @param {Shape} shapeB
* @param {Body} bodyA
* @param {Body} bodyB
*/
endContactEvent: {
type: string;
shapeA: Shape;
shapeB: Shape;
bodyA: Body;
bodyB: Body;
};
/**
* Fired just before equations are added to the solver to be solved. Can be used to control what equations goes into the solver.
* @event preSolve
* @param {Array} contactEquations An array of contacts to be solved.
* @param {Array} frictionEquations An array of friction equations to be solved.
*/
preSolveEvent: {
type: string;
contactEquations: ContactEquation[];
frictionEquations: FrictionEquation[];
};
/**
* 从不让刚体睡眠
* @static
* @property {number} NO_SLEEPING
*/
static NO_SLEEPING: number;
/**
* 刚体睡眠
* @static
* @property {number} BODY_SLEEPING
*/
static BODY_SLEEPING: number;
/**
* 取消激活在接触中的刚体,如果所有刚体都接近睡眠。必须设置 World.islandSplit
* @static
* @property {number} ISLAND_SLEEPING
*/
static ISLAND_SLEEPING: number;
constructor(options?: {
solver?: Solver;
gravity?: number[];
broadphase?: Broadphase;
islandSplit?: boolean;
});
/**
* For keeping track of what time step size we used last step
* @property lastTimeStep
* @type {number}
*/
lastTimeStep: number;
overlapKeeper: OverlapKeeper;
/**
* If the length of .gravity is zero, and .useWorldGravityAsFrictionGravity=true, then switch to using .frictionGravity for friction instead. This fallback is useful for gravityless games.
* @property {boolean} useFrictionGravityOnZeroGravity
* @default true
*/
useFrictionGravityOnZeroGravity: boolean;
/**
* 所有 Spring
* @property springs
* @type {Array}
*/
springs: Spring[];
/**
* 所有 Body
* @property {Array} bodies
*/
bodies: Body[];
/**
* 所使用的求解器,以满足约束条件和接触。 默认值是 GSSolver
* @property {Solver} solver
*/
solver: Solver;
/**
* @property narrowphase
* @type {Narrowphase}
*/
narrowphase: Narrowphase;
/**
* The island manager of this world.
* @property {IslandManager} islandManager
*/
islandManager: IslandManager;
/**
* 重力。在每个 step() 开始对所有刚体生效
*
* @property gravity
* @type {Array}
*/
gravity: number[];
/**
* 重力摩擦
* @property {Number} frictionGravity
*/
frictionGravity: number;
/**
* 设置为true,frictionGravity 会被自动设置为 gravity 长度.
* @property {Boolean} useWorldGravityAsFrictionGravity
*/
useWorldGravityAsFrictionGravity: boolean;
/**
* @property broadphase
* @type {Broadphase}
*/
broadphase: Broadphase;
/**
* 用户添加限制
*
* @property constraints
* @type {Array}
*/
constraints: Constraint[];
/**
* 默认材料,defaultContactMaterial 时使用
* @property {Material} defaultMaterial
*/
defaultMaterial: Material;
/**
* 使用的默认接触材料,如果没有接触材料被设置为碰撞的材料
* @property {ContactMaterial} defaultContactMaterial
*/
defaultContactMaterial: ContactMaterial;
/**
* 设置自动使用弹簧力
* @property applySpringForces
* @type {Boolean}
*/
applySpringForces: boolean;
/**
* 设置自动使用阻尼
* @property applyDamping
* @type {Boolean}
*/
applyDamping: boolean;
/**
* 设置自动使用重力
* @property applyGravity
* @type {Boolean}
*/
applyGravity: boolean;
/**
* 使用约束求解
* @property solveConstraints
* @type {Boolean}
*/
solveConstraints: boolean;
/**
* 接触材料
* @property contactMaterials
* @type {Array}
*/
contactMaterials: ContactMaterial[];
/**
* 世界时间
* @property time
* @type {Number}
*/
time: number;
/**
* 是否正在 step 阶段
* @property {Boolean} stepping
*/
stepping: boolean;
/**
* 是否启用岛内分裂
* @property {Boolean} islandSplit
*/
islandSplit: boolean;
/**
* 设置为true,world会派发 impact 事件,关闭可以提高性能
* @property emitImpactEvent
* @type {Boolean}
*/
emitImpactEvent: boolean;
/**
* 刚体睡眠策略。取值是 World.NO_SLEEPING,World.BODY_SLEEPING,World.ISLAND_SLEEPING 之一
* @property sleepMode
* @type {number}
* @default World.NO_SLEEPING
*/
sleepMode: number;
/**
* 添加约束
* @method addConstraint
* @param {Constraint} constraint
*/
addConstraint(constraint: Constraint): void;
/**
* 添加触点材料
* @method addContactMaterial
* @param {ContactMaterial} contactMaterial
*/
addContactMaterial(contactMaterial: ContactMaterial): void;
/**
* 移除触点材料
* @method removeContactMaterial
* @param {ContactMaterial} cm
*/
removeContactMaterial(cm: ContactMaterial): void;
/**
* 通过2个材料获得触点材料
* @method getContactMaterial
* @param {Material} materialA
* @param {Material} materialB
* @return {ContactMaterial} 获得的触点材料或者false
*/
getContactMaterial(materialA: Material, materialB: Material): ContactMaterial;
/**
* 移除约束
* @method removeConstraint
* @param {Constraint} constraint
*/
removeConstraint(constraint: Constraint): void;
/**
* 使物理系统向前经过一定时间
*
* @method step
* @param {Number} dt 时长
* @param {Number} [timeSinceLastCalled=0]
* @param {Number} [maxSubSteps=10]
*
* @example
* var world = new World();
* world.step(0.01);
*/
step(dt: number, timeSinceLastCalled?: number, maxSubSteps?: number): void;
/**
* 添加一个 Spring
*
* @method addSpring
* @param {Spring} spring
*/
addSpring(spring: Spring): void;
/**
* 移除一个 Spring
*
* @method removeSpring
* @param {Spring} spring
*/
removeSpring(spring: Spring): void;
/**
* 添加一个 Body
*
* @method addBody
* @param {Body} body
*
* @example
* var world = new World(),
* body = new Body();
* world.addBody(body);
*/
addBody(body: Body): void;
/**
* 移除一个 Body。如果在 step()阶段调用,将会在阶段之后移除
*
* @method removeBody
* @param {Body} body
*/
removeBody(body: Body): void;
/**
* 通过id获取一个 Body
* @method getBodyById
* @return {Body|Boolean} 得到的刚体或者false
*/
getBodyByID(id: number): Body;
/**
* 两个刚体之间禁用碰撞
* @method disableBodyCollision
* @param {Body} bodyA
* @param {Body} bodyB
*/
disableBodyCollision(bodyA: Body, bodyB: Body): void;
/**
* 两个刚体之间启用碰撞
* @method enableBodyCollision
* @param {Body} bodyA
* @param {Body} bodyB
*/
enableBodyCollision(bodyA: Body, bodyB: Body): void;
/**
* 重置 world
* @method clear
*/
clear(): void;
/**
* Test if a world point overlaps bodies
* @method hitTest
* @param {Array} worldPoint Point to use for intersection tests
* @param {Array} bodies A list of objects to check for intersection
* @param {number} precision Used for matching against particles and lines. Adds some margin to these infinitesimal objects.
* @return {Array} Array of bodies that overlap the point
*/
hitTest(worldPoint: number[], bodies: Body[], precision: number): Body[];
/**
* Ray cast against all bodies in the world.
* @method raycast
* @param {RaycastResult} result
* @param {Ray} ray
* @return {boolean} True if any body was hit.
*/
raycast(result: RaycastResult, ray: Ray): boolean;
/**
* Runs narrowphase for the shape pair i and j.
* @method runNarrowphase
* @param {Narrowphase} np
* @param {Body} bi
* @param {Shape} si
* @param {Array} xi
* @param {number} ai
* @param {Body} bj
* @param {Shape} sj
* @param {Array} xj
* @param {number} aj
* @param {number} mu
*/
runNarrowphase(np:Narrowphase, bi:Body, si:Shape, xi:number[], ai:number, bj:Body, sj:Shape, xj:number[], aj:number, mu:number): void;
/**
* Set the relaxation for all equations and contact materials.
* @method setGlobalRelaxation
* @param {number} relaxation
*/
setGlobalRelaxation(relaxation: number): void;
/**
* Set the stiffness for all equations and contact materials.
* @method setGlobalStiffness
* @param {Number} stiffness
*/
setGlobalStiffness(stiffness: number): void;
}
}
\ No newline at end of file
export let props: any = {};
export function prepareProps() {
let metaProps = getProps();
engine.injectProp(props, metaProps);
}
export function injectProps(p) {
engine.injectProp(props, p);
}
......@@ -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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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;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,IAA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,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;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;
......
/**
* Created by renjianfeng on 2020-03-13.
*/
const customId = 'p2demo';
(async function () {
let customModule = await fetch(`../meta.json`);
customModule = await customModule.json();
console.log(customModule);
await loadAssets(customModule.assets);
launchWithCustomModule(customModule);
})();
function launchWithCustomModule(customModule) {
//engine.registerCustomCodeModule(customModule);
engine.registerCustomModule(customId, window[customId]);
const { props: propsOption, assets } = customModule;
let props = engine.computeProps(customModuleProps, propsOption);
const customModuleIns = {
id: customId,
props,
assets,
};
engine.registerCustomModules([customModuleIns]);
engine.launchWithConfig({
options: {
entrySceneView: 'entry',
},
assets: [],
views: [{
name: 'entry',
type: 'node',
properties: {
x: 0,
y: 0,
}
}],
customs: [],
}, null, function () {
setTimeout(() => {
engine.addCustomModule(customId, engine.gameStage.sceneContainer.getChildAt(0));
}, 100);
setTimeout(() => {
engine.globalEvent.dispatchEvent('pictures-start', { });
const d = engine.gameStage.sceneContainer.getChildAt(0);
}, 100);
// setTimeout(() => {
// engine.globalEvent.dispatchEvent('pictures-start', {
// picUrl: "http://yun.duiba.com.cn/aurora/assets/e1593b97c27077b85b92f7eaaeae1ed64a1eb79a.png",
// // picUrl: "http://yun.duiba.com.cn/aurora/assets/d23e73d37ec01931e48cbd0a4095367044c5675c.png"
// blockUrl: "888"
// });
// }, 30*1000);
});
engine.globalEvent.addEventListener('pictures-time-update', (e) => {
// console.log(e.type, e.data);
});
engine.globalEvent.addEventListener('pictures-game-fail', (e) => {
console.log(e.type, e.data);
});
engine.globalEvent.addEventListener('pictures-game-success', (e) => {
console.log(e.type, e.data);
});
}
function getAssetByUUID(uuid) {
return engine.resolveCustomAsset(customId, uuid);
}
function getProps() {
return engine.getProps(customId);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>美食从天而降</title>
<meta name="viewport"
content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="full-screen" content="true"/>
<meta name="screen-orientation" content="portrait"/>
<meta name="x5-fullscreen" content="true"/>
<meta name="360-fullscreen" content="true"/>
<style>
html,
body {
padding: 0;
margin: 0;
border: 0;
width: 100%;
height: 100%;
overflow: hidden;
position: absolute;
background-color: gray;
}
.game-container{
width: 100%;
height: 100%;
line-height:0;
font-size:0;
}
</style>
</head>
<body>
<div id="game-container" class="game-container"></div>
<script crossorigin="anonymous" src="//yun.duiba.com.cn/editor/zeroing/libs/engine.1de84ff79dba19e949088de63aa75af51a515e5c.js"></script>
<script crossorigin="anonymous" src="//yun.duiba.com.cn/editor/zeroing/libs/svga.fd3923ae6e664251ca7981801a65809cc5f36bc3.js"></script>
<script src="//yun.duiba.com.cn/js-libs/p2.js/0.7.1/p2.min.js"></script>
<!-- <script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.ebc906f6b50b8da0a669f77027981d5f3cb560ce.js"></script> -->
<!-- <script src="http://localhost:4002/debug/engine.js"></script>
<script src="http://localhost:4003/debug/engine-svga.js"></script> -->
<!--<script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.9a9dbfda4cb2dd5508ecddfe3d95dfd88063f7b5.js"></script>-->
<script src="app.js"></script>
<script src="props.js"></script>
<script src="load-assets.js"></script>
<script src="main.js"></script>
<script>
</script>
</body>
\ No newline at end of file
/**
* Created by rockyl on 2020-01-21.
*/
const assets = [
{
"name": "玩家icon",
"url": "//yun.duiba.com.cn/aurora/assets/5b3e30496b2d9fdafb0cf3835fd6704ce10e45b4.png",
"uuid": "888",
"ext": ".png"
},
{
"name": "雨滴",
"url": "//yun.duiba.com.cn/aurora/assets/8564c8c9be3aead71b05a0bab8d7d07ac3f778a1.png",
"uuid": "264a6192-d7bf-45e8-8f15-6ba2c439a532",
"ext": ".png"
},
{
"name": "炸弹",
"url": "//yun.duiba.com.cn/aurora/assets/171e92283cd13c013ee1b76d28d252ff08815d47.png",
"uuid": "eb88b42d-e151-4c1b-94b9-7c16f7bfac29",
"ext": ".png"
},
{
"name": "石块",
"url": "//yun.duiba.com.cn/aurora/assets/99b0af0c59fe79a415a3f032149cfacc27e3ac2c.png",
"uuid": "ab1bdabc-21ba-46bf-9299-6c638f766c88",
"ext": ".png"
},
{
"name": "水花",
"url": "//yun.duiba.com.cn/aurora/assets/93d37b4a0e367e80e375308a6b4414d72d7666fc.svga",
"uuid": "b521bf94-20e1-44dd-8eca-d24996cbaeae",
"ext": ".svga"
},
{
"name": "炸弹",
"url": "//yun.duiba.com.cn/aurora/assets/4dd18f0689c663bbcf710a7afc4d929084d97d36.svga",
"uuid": "322edf39-805b-4e84-9d07-5573dfeebc0e",
"ext": ".svga"
},
{
"name": "玩家",
"url": "//yun.duiba.com.cn/aurora/assets/b66300c5d4f27134b0aac3dc90a3220e8ae572eb.svga",
"uuid": "71d8dcbc-3931-471a-b585-b3ae01b25aa6",
"ext": ".svga"
}
];
function loadAssets(customModuleAssets, onProgress, onComplete){
return engine.loadAssets(assets.concat(...customModuleAssets), onProgress, onComplete);
}
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('tslib')) :
typeof define === 'function' && define.amd ? define(['tslib'], factory) :
(global = global || self, global.p2demo = factory(global.tslib));
}(this, (function (tslib) { 'use strict';
function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
}
function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
}
var OptionState;
(function (OptionState) {
OptionState[OptionState["CHOICE_RIGHT"] = 0] = "CHOICE_RIGHT";
OptionState[OptionState["CHOICE_WRONG"] = 1] = "CHOICE_WRONG";
OptionState[OptionState["CHOICE_SELECT"] = 2] = "CHOICE_SELECT";
})(OptionState || (OptionState = {}));
var GameState;
(function (GameState) {
GameState[GameState["STATE_START"] = 0] = "STATE_START";
GameState[GameState["STATE_END"] = 1] = "STATE_END";
})(GameState || (GameState = {}));
//# sourceMappingURL=utils.js.map
var GameView = (function (_super) {
tslib.__extends(GameView, _super);
function GameView() {
var _this = _super.call(this) || this;
_this.factor = 10;
_this.isDebug = 0;
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
return _this;
}
GameView.prototype.createBall = function (r) {
var shape = new engine.Shape();
shape.beginFill(0xfff000);
shape.drawCircle(0, 0, r);
shape.endFill();
return shape;
};
GameView.prototype.start = function () {
console.log('start');
this.stage.addEventListener(engine.MouseEvent.CLICK, this.onClick, this);
};
GameView.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;
};
GameView.prototype.createBox = function (width, height) {
var shape = new engine.Shape();
shape.beginFill(0xfff000);
shape.drawRect(-width / 2, -height / 2, width, height);
shape.endFill();
return shape;
};
GameView.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() > .5) {
var boxShape = new p2.Box({ width: 306 / factor, height: 172 / factor });
var boxBody = new p2.Body({ mass: 1, position: [positionX, positionY], angularVelocity: 1 });
boxBody.addShape(boxShape);
world.addBody(boxBody);
if (this.isDebug) {
display = this.createBox(boxShape.width * factor, boxShape.height * factor);
}
else {
display = this.createBitmapByName("block");
}
}
else {
var boxShape = new p2.Circle({ radius: 120 / 2 / factor });
var boxBody = new p2.Body({ mass: 1, position: [positionX, positionY] });
boxBody.addShape(boxShape);
world.addBody(boxBody);
if (this.isDebug) {
display = this.createBall(boxShape.radius * factor);
}
else {
display = this.createBitmapByName("ball");
}
}
boxBody.displays = [display];
this.addChild(display);
};
GameView.prototype.setup = function () {
console.log('setup');
var world = new p2.World({
gravity: [0, -10],
});
world.sleepMode = p2.World.BODY_SLEEPING;
var planeShape = new p2.Plane();
var planeBody = new p2.Body();
planeBody.addShape(planeShape);
planeBody.displays = [];
world.addBody(planeBody);
this.world = world;
this.stage.addEventListener(engine.Event.ENTER_FRAME, this.onEnterFrame, this);
};
GameView.prototype.onEnterFrame = function () {
var _a = this, world = _a.world, factor = _a.factor;
world.step(60 / 1000);
var stageHeight = engine.gameStage.stage.height;
var l = world.bodies.length;
for (var i = 0; i < l; i++) {
var boxBody = world.bodies[i];
var box = boxBody.displays[0];
if (box) {
box.x = boxBody.position[0] * factor;
box.y = stageHeight - boxBody.position[1] * factor;
box.rotation = 360 - (boxBody.angle + boxBody.shapes[0].angle) * 180 / Math.PI;
if (boxBody.sleepState == p2.Body.SLEEPING) {
box.alpha = 0.5;
}
else {
box.alpha = 1;
}
}
}
};
return GameView;
}(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 gameView = _this._gameView = new GameView();
_this.addChild(gameView);
return _this;
}
GameWrapper.prototype.start = function (event) {
injectProps(event.data);
this._gameView.start();
};
GameWrapper.prototype.stop = function (event) {
};
return GameWrapper;
}(engine.Container));
//# sourceMappingURL=GameWrapper.js.map
function index (props) {
prepareProps();
injectProps(props);
var instance = new GameWrapper();
return instance;
}
//# sourceMappingURL=index.js.map
return index;
})));
//# sourceMappingURL=main.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sources":["src/custom/answer-game/src/game/utils.ts","src/custom/p2demo/src/game/GameView.ts","src/custom/p2demo/src/props.ts","src/custom/p2demo/src/game/GameWrapper.ts","src/custom/p2demo/src/index.ts"],"sourcesContent":["\n/**\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 getStage(){\n\treturn engine.gameStage.stage;\n}\n\n\nexport enum OptionState{\n\tCHOICE_RIGHT,//选对\n\tCHOICE_WRONG,//选错\n\tCHOICE_SELECT,//选中\n}\n\nexport enum GameState{\n\tSTATE_START,//开始 选择中\n\tSTATE_END,//倒计时结束\n}","import { Tool } from \"../../../seabed-game/src/game/Tools\";\nimport { getTextureByName } from \"../../../answer-game/src/game/utils\";\n\nexport default class GameView extends engine.Container {\n world: p2.World;\n factor: number = 10;\n isDebug = 0;\n constructor() {\n super();\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\n }\n\n private createBall(r: number) {\n var shape = new engine.Shape();\n shape.beginFill(0xfff000);\n shape.drawCircle(0, 0, r);\n shape.endFill();\n return shape;\n }\n\n start() {\n console.log('start');\n this.stage.addEventListener(engine.MouseEvent.CLICK, this.onClick, this);\n }\n\n createBitmapByName(name) {\n const imgContainer = new engine.Sprite();\n const img = new engine.Sprite(getTextureByName(name));\n img.anchorX = img.width / 2;\n img.anchorY = img.height / 2;\n img.x = -img.width / 2;\n img.y = -img.height / 2;\n imgContainer.addChild(img);\n return imgContainer\n }\n\n private createBox(width: number, height: number): engine.Shape {\n var shape = new engine.Shape();\n shape.beginFill(0xfff000);\n shape.drawRect(-width / 2, -height / 2, width, height);\n shape.endFill();\n return shape;\n }\n\n onClick(e: engine.MouseEvent) {\n\n // const ball = this.createBitmapByName('ball');\n // this.addChild(ball);\n // engine.Tween.get(ball, { loop: true }).to({ rotation: 360 }, 1000);\n // return;\n\n // const box = this.createBitmapByName('block');\n // this.addChild(box);\n // engine.Tween.get(box, { loop: true }).to({ rotation: 360 }, 1000);\n // return;\n\n // const box = this.createBox(750, 100)\n // this.addChild(box);\n // box.x = 750/2;\n // box.y = 1624/2;\n // engine.Tween.get(box, { loop: true }).to({ rotation: 360 }, 1000)\n // return;\n\n // const ball = this.createBall(750/2);\n // this.addChild(ball);\n // ball.x = e.stageX;\n // ball.y = e.stageY;\n // return;\n const { world, factor } = this;\n var positionX: number = (e.stageX / factor);\n var positionY: number = ((engine.gameStage.stage.height - e.stageY) / factor);\n var display: engine.DisplayObject;\n\n if (Math.random() > .5) {\n //添加方形刚体\n var boxShape: p2.Shape = new p2.Box({ width: 306 / factor, height: 172 / factor });\n var boxBody: p2.Body = new p2.Body({ mass: 1, position: [positionX, positionY], angularVelocity: 1 });\n boxBody.addShape(boxShape);\n world.addBody(boxBody);\n\n if (this.isDebug) {\n display = this.createBox((<p2.Box>boxShape).width * factor, (<p2.Box>boxShape).height * factor);\n } else {\n display = this.createBitmapByName(\"block\");\n }\n }\n else {\n //添加圆形刚体\n var boxShape: p2.Shape = new p2.Circle({ radius: 120 / 2 / factor });\n var boxBody: p2.Body = new p2.Body({ mass: 1, position: [positionX, positionY] });\n boxBody.addShape(boxShape);\n world.addBody(boxBody);\n\n if (this.isDebug) {\n display = this.createBall((<p2.Circle>boxShape).radius * factor);\n } else {\n display = this.createBitmapByName(\"ball\");\n }\n\n // display.width = (<p2.Circle>boxShape).radius * 2 * factor;\n // display.height = (<p2.Circle>boxShape).radius * 2 * factor;\n\n }\n\n // display.anchorX = display.width / 2;\n // display.anchorY = display.height / 2;\n\n boxBody.displays = [display];\n\n this.addChild(display);\n\n }\n\n setup() {\n console.log('setup');\n\n //创建world\n var world: p2.World = new p2.World({\n gravity: [0, -10],\n });\n\n world.sleepMode = p2.World.BODY_SLEEPING;\n\n //创建plane\n var planeShape: p2.Plane = new p2.Plane();\n var planeBody: p2.Body = new p2.Body();\n planeBody.addShape(planeShape);\n planeBody.displays = [];\n world.addBody(planeBody);\n this.world = world;\n\n this.stage.addEventListener(engine.Event.ENTER_FRAME, this.onEnterFrame, this)\n }\n\n onEnterFrame() {\n const { world, factor } = this;\n world.step(60 / 1000);\n const stageHeight = engine.gameStage.stage.height;\n var l = world.bodies.length;\n\n for (var i: number = 0; i < l; i++) {\n var boxBody: p2.Body = world.bodies[i];\n var box = boxBody.displays[0];\n if (box) {\n box.x = boxBody.position[0] * factor;\n box.y = stageHeight - boxBody.position[1] * factor;\n\n box.rotation = 360 - (boxBody.angle + boxBody.shapes[0].angle) * 180 / Math.PI;\n if (boxBody.sleepState == p2.Body.SLEEPING) {\n box.alpha = 0.5;\n }\n else {\n box.alpha = 1;\n }\n }\n }\n\n }\n\n}\n","/**\n * Created by rockyl on 2020-01-21.\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","/**\n * Created by rockyl on 2020-01-09.\n */\n\nimport GameView from \"./GameView\";\nimport { injectProps } from \"../props\";\n\n\nexport class GameWrapper extends engine.Container {\n\t// private _status;\n\tprivate _gameView: GameView;\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\tlet gameView = this._gameView = new GameView();\n\t\tthis.addChild(gameView);\n\n\t}\n\n\tstart(event: engine.Event) {\n\t\tinjectProps(event.data);\n\n\t\t// this._status = 1;\n\n\t\tthis._gameView.start();\n\t}\n\tstop(event: engine.Event) {\n\t\t\n\t}\n}\n","/**\n * Created by rockyl on 2019-11-20.\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":";;;;;;UAKgB,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;CAUD,IAAY,WAIX;CAJD,WAAY,WAAW;KACtB,6DAAY,CAAA;KACZ,6DAAY,CAAA;KACZ,+DAAa,CAAA;CACd,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;CAED,IAAY,SAGX;CAHD,WAAY,SAAS;KACpB,uDAAW,CAAA;KACX,mDAAS,CAAA;CACV,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;;;CC3BD;KAAsCA,kCAAgB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EAAE,CAAC;KAEjC,OAAO,QAAQ,CAAC;CACjB,CAAC;;;;;;;;;"}
\ No newline at end of file
/**
* Created by rockyl on 2020-01-21.
*/
let customModuleProps = {
};
{
"name": "拼图",
"desc": "拼图模块1.0",
"props": {
"MAX_COL": {
"alias": "图片分成几列",
"type": "number",
"default": 3
},
"MAX_ROW": {
"alias": "图片分成几行",
"type": "number",
"default": 4
},
"W": {
"alias": "图片的宽度",
"type": "number",
"default": 618
},
"H": {
"alias": "图片的高度",
"type": "number",
"default": 827
},
"OFFSET_X": {
"alias": "OFFSET_X",
"type": "number",
"default": 0
},
"OFFSET_Y": {
"alias": "OFFSET_Y",
"type": "number",
"default": 0
},
"GAP": {
"alias": "图片间隙",
"type": "number",
"default": 0
},
"GAME_TIME": {
"alias": "游戏时间",
"type": "number",
"default": 10
}
},
"assets": [
{
"name": "block",
"url": "//yun.duiba.com.cn/aurora/assets/f91184b338ef9540b167eebe7d58e71402e8d9d9.png",
"uuid": "888",
"ext": ".png"
},
{
"name": "ball",
"url": "//yun.duiba.com.cn/aurora/assets/3dc11f2d91659b7e7e1d06a9853cbc9f818e1ea2.png",
"uuid": "999",
"ext": ".png"
}
],
"events": {
"in": {
"pictures-start": {
"alias": "开始",
"data": {
"picUrl":"图片路径",
"blockUrl":"blockUrl",
"row":"行",
"column":"列",
"gameTime":"游戏时间"
}
},
"pictures-stop": {
"alias": "停止"
}
},
"out": {
"pictures-time-update": {
"alias": "倒计时更新",
"data": {
"time":"剩余时间"
}
},
"pictures-game-fail": {
"alias": "游戏结束",
"data": {
"reason": "结束原因(1:时间到了)"
}
},
"pictures-game-success": {
"alias": "游戏成功",
"data": {
"time": "游戏消耗时间"
}
}
}
}
}
\ No newline at end of file
import { Tool } from "../../../seabed-game/src/game/Tools";
import { getTextureByName } from "../../../answer-game/src/game/utils";
export default class GameView extends engine.Container {
world: p2.World;
factor: number = 10;
isDebug = 0;
constructor() {
super();
this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);
}
private createBall(r: number) {
var shape = new engine.Shape();
shape.beginFill(0xfff000);
shape.drawCircle(0, 0, r);
shape.endFill();
return shape;
}
start() {
console.log('start');
this.stage.addEventListener(engine.MouseEvent.CLICK, this.onClick, this);
}
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
}
private createBox(width: number, height: number): engine.Shape {
var shape = new engine.Shape();
shape.beginFill(0xfff000);
shape.drawRect(-width / 2, -height / 2, width, height);
shape.endFill();
return shape;
}
onClick(e: engine.MouseEvent) {
// const ball = this.createBitmapByName('ball');
// this.addChild(ball);
// engine.Tween.get(ball, { loop: true }).to({ rotation: 360 }, 1000);
// return;
// const box = this.createBitmapByName('block');
// this.addChild(box);
// engine.Tween.get(box, { loop: true }).to({ rotation: 360 }, 1000);
// return;
// const box = this.createBox(750, 100)
// this.addChild(box);
// box.x = 750/2;
// box.y = 1624/2;
// engine.Tween.get(box, { loop: true }).to({ rotation: 360 }, 1000)
// return;
// const ball = this.createBall(750/2);
// this.addChild(ball);
// ball.x = e.stageX;
// ball.y = e.stageY;
// return;
const { world, factor } = this;
var positionX: number = (e.stageX / factor);
var positionY: number = ((engine.gameStage.stage.height - e.stageY) / factor);
var display: engine.DisplayObject;
if (Math.random() > .5) {
//添加方形刚体
var boxShape: p2.Shape = new p2.Box({ width: 306 / factor, height: 172 / factor });
var boxBody: p2.Body = new p2.Body({ mass: 1, position: [positionX, positionY], angularVelocity: 1 });
boxBody.addShape(boxShape);
world.addBody(boxBody);
if (this.isDebug) {
display = this.createBox((<p2.Box>boxShape).width * factor, (<p2.Box>boxShape).height * factor);
} else {
display = this.createBitmapByName("block");
}
}
else {
//添加圆形刚体
var boxShape: p2.Shape = new p2.Circle({ radius: 120 / 2 / factor });
var boxBody: p2.Body = new p2.Body({ mass: 1, position: [positionX, positionY] });
boxBody.addShape(boxShape);
world.addBody(boxBody);
if (this.isDebug) {
display = this.createBall((<p2.Circle>boxShape).radius * factor);
} else {
display = this.createBitmapByName("ball");
}
// 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() {
console.log('setup');
//创建world
var world: p2.World = new p2.World({
gravity: [0, -10],
});
world.sleepMode = p2.World.BODY_SLEEPING;
//创建plane
var planeShape: p2.Plane = new p2.Plane();
var planeBody: p2.Body = new p2.Body();
planeBody.addShape(planeShape);
planeBody.displays = [];
world.addBody(planeBody);
this.world = world;
this.stage.addEventListener(engine.Event.ENTER_FRAME, this.onEnterFrame, this)
}
onEnterFrame() {
const { world, factor } = this;
world.step(60 / 1000);
const stageHeight = engine.gameStage.stage.height;
var l = world.bodies.length;
for (var i: number = 0; i < l; i++) {
var boxBody: p2.Body = world.bodies[i];
var box = boxBody.displays[0];
if (box) {
box.x = boxBody.position[0] * factor;
box.y = stageHeight - boxBody.position[1] * factor;
box.rotation = 360 - (boxBody.angle + boxBody.shapes[0].angle) * 180 / Math.PI;
if (boxBody.sleepState == p2.Body.SLEEPING) {
box.alpha = 0.5;
}
else {
box.alpha = 1;
}
}
}
}
}
/**
* Created by rockyl on 2020-01-09.
*/
import GameView from "./GameView";
import { injectProps } from "../props";
export class GameWrapper extends engine.Container {
// private _status;
private _gameView: GameView;
constructor() {
super();
engine.globalEvent.addEventListener('pictures-start', this.start, this);
engine.globalEvent.addEventListener('pictures-stop', this.stop, this);
//创建实例
let gameView = this._gameView = new GameView();
this.addChild(gameView);
}
start(event: engine.Event) {
injectProps(event.data);
// this._status = 1;
this._gameView.start();
}
stop(event: engine.Event) {
}
}
/**
* Created by rockyl on 2020-02-03.
*/
import {Goods} from "./Goods";
import ObjectPool = engine.ObjectPool;
export const PoolName: string = 'goods';
ObjectPool.registerPool(PoolName, function () {
return new Goods();
}, function (item: Goods, data) {
item.reset();
});
import { props } from "../props";
const urls = [];
const picMap = {};
const posMap = {};
export default (parent, url, MAX_COL, MAX_ROW) => {
if (picMap[url]) {
const pics:any[] = picMap[url];
for (const pic of pics) {
parent.addChild(pic);
}
return [picMap[url], posMap[url]]
}
const W = props.W;
const H = props.H;
const GAP = props.GAP;
const spr = [];
const pos = []
for (let row = 0; row < MAX_ROW; row++) {
for (let col = 0; col < MAX_COL; col++) {
const child = engine.Sprite.fromImage(url);
spr.push(child);
child.scaleX = 1 / MAX_COL;
child.scaleY = 1 / MAX_ROW;
parent.addChild(child);
child.x = col * (W / MAX_COL + GAP);
child.y = row * (H / MAX_ROW + GAP);
pos.push([child.x, child.y]);
// child.texture.addEventListener('update', () => {
child.addEventListener(engine.Event.COMPLETE, () => {
const uvs = new Float32Array([
col / MAX_COL,
row / MAX_ROW,
(col + 1) / MAX_COL,
row / MAX_ROW,
(col + 1) / MAX_COL,
(row + 1) / MAX_ROW,
col / MAX_COL,
(row + 1) / MAX_ROW,
]);
child.uvs = uvs;
// spr.push(child);
});
}
}
picMap[url] = spr.concat([]);
posMap[url] = pos.concat([]);;
// console.log(spr);
return [spr, pos];
};
/**
* Created by rockyl on 2020-01-21.
*/
export function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
}
export function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
}
export function playSound(name) {
engine.playSound(engine.getAssetByName(name).uuid, {keep: true});
}
export function createSvga(name, anchorName?) {
let inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
return inst;
}
export function getIndexFromRC(row,col,maxCol){
let index;
index = row * maxCol + col ;
return index
}
export function getRandomArray(array){
array.sort(function() {
return .5 - Math.random();
});
}
\ No newline at end of file
/**
* Created by rockyl on 2019-11-20.
*/
import {GameWrapper} from "./game/GameWrapper";
import {injectProps, prepareProps} from "./props";
export default function (props) {
prepareProps();
injectProps(props);
let instance = new GameWrapper();
return instance;
}
/**
* Created by rockyl on 2020-01-21.
*/
export let props: any = {};
export function prepareProps() {
let metaProps = getProps();
engine.injectProp(props, metaProps);
}
export function injectProps(p) {
engine.injectProp(props, p);
}
......@@ -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,
......@@ -49,11 +52,14 @@ function launchWithCustomModule(customModule) {
engine.globalEvent.dispatchEvent('pictures-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);
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(() => {
......
"use strict";var tslib=require("tslib"),props={};function prepareProps(){var t=getProps();engine.injectProp(props,t)}function injectProps(t){engine.injectProp(props,t)}var MAX_COL,MAX_ROW,W,H,GAP,GAME_TIME,w,h,picMap={},posMap={},qietu=function(n,r,o,a){if(picMap[r]){for(var t=0,e=picMap[r];t<e.length;t++){var i=e[t];n.addChild(i)}return[picMap[r],posMap[r]]}for(var p=props.W,h=props.H,c=props.GAP,d=[],g=[],s=0;s<a;s++)!function(s){for(var t=0;t<o;t++)!function(e){var i=engine.Sprite.fromImage(r);d.push(i),i.scaleX=1/o,i.scaleY=1/a,n.addChild(i),i.x=e*(p/o+c),i.y=s*(h/a+c),g.push([i.x,i.y]),i.addEventListener(engine.Event.COMPLETE,function(){var t=new Float32Array([e/o,s/a,(e+1)/o,s/a,(e+1)/o,(s+1)/a,e/o,(s+1)/a]);i.uvs=t})}(t)}(s);return picMap[r]=d.concat([]),posMap[r]=g.concat([]),[d,g]};function getIndexFromRC(t,e,i){return t*i+e}function getRandomArray(t){t.sort(function(){return.5-Math.random()})}var GameView=function(e){function t(){var t=e.call(this)||this;return t._timeCounter=0,t.listenStageOn=1,t.once(engine.Event.ADDED_TO_STAGE,t.setup,t),t}return tslib.__extends(t,e),t.prototype.start=function(){var t=this;if(this.guideHole||(this.guideHole=new engine.Image,this.guideHole.source="asset://"+props.blockUrl,this.guideHole.mouseChildren=this.guideHole.mouseEnabled=!1),this.pictures)for(var e=0,i=this.pictures;e<i.length;e++){var s=i[e];s&&s.parent&&s.parent.removeChild(s)}console.log("on start"),engine.globalEvent.dispatchEvent("pictures-time-update",{second:this.getSecond()});var n=qietu(this.picturesWrapper,props.picUrl,MAX_COL,MAX_ROW);this.picturesWrapper.addChild(this.guideHole),console.log(this.picturesWrapper),this.pictures=n[0],this.rightList=this.pictures.concat([]);var r=n[1];getRandomArray(this.pictures);for(var o=0,a=this.pictures.length;o<a;o++){this.dragPic=this.pictures[o],this.pictures[o].addEventListener(engine.MouseEvent.MOUSE_DOWN,this.onDown,this);var p=r[o],h=p[0],c=p[1];this.dragPic.x=h,this.dragPic.y=c}this._timer=setInterval(function(){t.onTimer()},10),this.date=(new Date).getTime()},t.prototype.onTimer=function(){var t=(new Date).getTime(),e=(t-this.date)/1e3;this.date=t,console.log(e,"gap"),(GAME_TIME-=e)<0&&(GAME_TIME=0),(GAME_TIME=(GAME_TIME=this.afterPointTwo(GAME_TIME)).toFixed(2))<10&&(GAME_TIME="0"+GAME_TIME),console.log(GAME_TIME),engine.globalEvent.dispatchEvent("pictures-time-update",{second:this.getSecond()}),0==this.getSecond()&&(this.stop(),engine.globalEvent.dispatchEvent("pictures-game-fail",{reason:1}))},t.prototype.afterPointTwo=function(t){var e=parseFloat(t);if(!isNaN(e))return e=Math.round(100*e)/100},t.prototype.getSecond=function(){return GAME_TIME},t.prototype.stop=function(){GAME_TIME=props.GAME_TIME,clearInterval(this._timer);for(var t=this.pictures.length,e=0;e<t;e++)this.pictures[e].removeAllEventListener();this.stage.removeEventListener(engine.MouseEvent.MOUSE_UP,this.stageOnUp,this)},t.prototype.createRects=function(){},t.prototype.setup=function(){MAX_COL=props.MAX_COL,MAX_ROW=props.MAX_ROW,GAME_TIME=props.GAME_TIME,W=props.W,H=props.H,GAP=props.GAP,w=W/MAX_COL,h=H/MAX_ROW,console.log("onSteup",props);var t=new engine.Sprite;this.picturesWrapper=t,this.addChild(t)},t.prototype.onDown=function(t){var e=(750-props.W)/2,i=(this.stage.height-props.H)/2;this.dragPic=t.target,this.picturesWrapper.addChild(this.dragPic),this.localPicX=t.localX/MAX_COL,this.localPicY=t.localY/MAX_ROW,this.distanceX=this.dragPic.x,this.distanceY=this.dragPic.y,this.indexJ=Math.floor(this.distanceX/(w+GAP)),this.indexI=Math.floor(this.distanceY/(h+GAP)),this.index=this.indexI*MAX_COL+this.indexJ,this.centerX=Math.floor((t.clientX-e)/w)*w+w/2,this.centerY=Math.floor((t.clientY-i)/h)*h+h/2,this.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE,this.onMove,this),this.stage.addEventListener(engine.MouseEvent.MOUSE_UP,this.stageOnUp,this)},t.prototype.stageOnUp=function(t){var e=(750-props.W)/2,i=(this.stage.height-props.H)/2;this.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE,this.onMove,this),this.stage.removeEventListener(engine.MouseEvent.MOUSE_UP,this.stageOnUp,this),(this.centerY<i||this.centerX<e)&&(this.dragPic.x=this.distanceX,this.dragPic.y=this.distanceY);var s=Math.floor(this.centerX/(w+GAP)),n=Math.floor(this.centerY/(h+GAP));if(this.picturesWrapper.addChild(this.guideHole),0<=s&&s<MAX_COL&&0<=n&&n<MAX_ROW){var r=getIndexFromRC(n,s,MAX_COL),o=this.pictures[r],a=o.x+e,p=o.y+i;o.x=this.distanceX,o.y=this.distanceY,this.dragPic.x=a-e,this.dragPic.y=p-i;var c=this.pictures.indexOf(o),d=this.pictures.indexOf(this.dragPic);this.pictures[c]=this.dragPic,this.pictures[d]=o,d===c&&(this.dragPic.x=this.distanceX,this.dragPic.y=this.distanceY);for(var g=!0,u=0;u<this.rightList.length;u++)if(this.rightList[u]!=this.pictures[u]){g=!1;break}g&&this.onSuccess()}else this.dragPic.x=this.distanceX,this.dragPic.y=this.distanceY},t.prototype.onSuccess=function(){console.log("拼图成功!"),engine.globalEvent.dispatchEvent("pictures-game-success",{time:GAME_TIME}),this.stop()},t.prototype.onMove=function(t){this.dragPic.x=t.stageX-this.localPicX-(750-props.W)/2,this.dragPic.y=t.stageY-this.localPicY-(this.stage.height-props.H)/2,this.centerX=this.dragPic.x+w/2,this.centerY=this.dragPic.y+h/2},t}(engine.Container),GameWrapper=function(i){function t(){var t=i.call(this)||this;engine.globalEvent.addEventListener("pictures-start",t.start,t),engine.globalEvent.addEventListener("pictures-stop",t.stop,t);var e=t._gameView=new GameView;return t.addChild(e),t}return tslib.__extends(t,i),t.prototype.start=function(t){injectProps(t.data),this._gameView.start()},t.prototype.stop=function(t){this._gameView.stop()},t}(engine.Container);function index(t){return prepareProps(),injectProps(t),new GameWrapper}module.exports=index;
(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.pictures = factory(global.tslib));
}(this, (function (tslib) { 'use strict';
var props = {};
function prepareProps() {
var metaProps = getProps();
engine.injectProp(props, metaProps);
}
function injectProps(p) {
engine.injectProp(props, p);
}
//# sourceMappingURL=props.js.map
var picMap = {};
var posMap = {};
var qietu = (function (parent, url, MAX_COL, MAX_ROW) {
if (picMap[url]) {
var pics = picMap[url];
for (var _i = 0, pics_1 = pics; _i < pics_1.length; _i++) {
var pic = pics_1[_i];
parent.addChild(pic);
}
return [picMap[url], posMap[url]];
}
var W = props.W;
var H = props.H;
var GAP = props.GAP;
var spr = [];
var pos = [];
var _loop_1 = function (row) {
var _loop_2 = function (col) {
var child = engine.Sprite.fromImage(url);
spr.push(child);
child.scaleX = 1 / MAX_COL;
child.scaleY = 1 / MAX_ROW;
parent.addChild(child);
child.x = col * (W / MAX_COL + GAP);
child.y = row * (H / MAX_ROW + GAP);
pos.push([child.x, child.y]);
child.addEventListener(engine.Event.COMPLETE, function () {
var uvs = new Float32Array([
col / MAX_COL,
row / MAX_ROW,
(col + 1) / MAX_COL,
row / MAX_ROW,
(col + 1) / MAX_COL,
(row + 1) / MAX_ROW,
col / MAX_COL,
(row + 1) / MAX_ROW,
]);
child.uvs = uvs;
});
};
for (var col = 0; col < MAX_COL; col++) {
_loop_2(col);
}
};
for (var row = 0; row < MAX_ROW; row++) {
_loop_1(row);
}
picMap[url] = spr.concat([]);
posMap[url] = pos.concat([]);
return [spr, pos];
});
//# sourceMappingURL=qietu.js.map
function getIndexFromRC(row, col, maxCol) {
var index;
index = row * maxCol + col;
return index;
}
function getRandomArray(array) {
array.sort(function () {
return .5 - Math.random();
});
}
//# sourceMappingURL=utils.js.map
var MAX_COL;
var MAX_ROW;
var W;
var H;
var GAP;
var GAME_TIME;
var w;
var h;
var GameView = (function (_super) {
tslib.__extends(GameView, _super);
function GameView() {
var _this = _super.call(this) || this;
_this._timeCounter = 0;
_this.listenStageOn = 1;
_this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);
return _this;
}
GameView.prototype.start = function () {
var _this = this;
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;
this.guideHole.mouseChildren = this.guideHole.mouseEnabled = false;
}
if (this.pictures) {
for (var _i = 0, _a = this.pictures; _i < _a.length; _i++) {
var pic = _a[_i];
if (pic && pic.wrapper)
pic.wrapper.removeChild(pic);
}
}
console.log('on start');
engine.globalEvent.dispatchEvent('pictures-time-update', {
second: this.getSecond(),
});
var result = qietu(this.picturesWrapper, props.picUrl, MAX_COL, MAX_ROW);
this.picturesWrapper.addChild(this.guideHole);
console.log(this.picturesWrapper);
this.pictures = result[0];
this.rightList = this.pictures.concat([]);
var posList = result[1];
getRandomArray(this.pictures);
var i = 0;
var len;
len = this.pictures.length;
for (; i < len; i++) {
this.dragPic = this.pictures[i];
this.pictures[i].addEventListener(engine.MouseEvent.MOUSE_DOWN, this.onDown, this);
var _b = posList[i], x = _b[0], y = _b[1];
this.dragPic.x = x;
this.dragPic.y = y;
}
this._timer = setInterval(function () {
_this.onTimer();
}, 10);
this.date = new Date().getTime();
};
GameView.prototype.onTimer = function () {
var date = new Date().getTime();
var gap = ((date - this.date) / 1000);
this.date = date;
console.log(gap, "gap");
GAME_TIME -= gap;
if (GAME_TIME < 0) {
GAME_TIME = 0;
}
GAME_TIME = this.afterPointTwo(GAME_TIME);
GAME_TIME = GAME_TIME.toFixed(2);
if (GAME_TIME < 10) {
GAME_TIME = '0' + GAME_TIME;
}
console.log(GAME_TIME, "gametime1");
engine.globalEvent.dispatchEvent('pictures-time-update', {
second: this.getSecond(),
});
if (this.getSecond() == 0) {
this.stop();
engine.globalEvent.dispatchEvent('pictures-game-fail', {
reason: 1
});
}
};
GameView.prototype.afterPointTwo = function (n) {
var floatN = parseFloat(n);
if (isNaN(floatN)) {
return;
}
floatN = Math.round(floatN * 100) / 100;
return floatN;
};
GameView.prototype.getSecond = function () {
return GAME_TIME;
};
GameView.prototype.stop = function () {
GAME_TIME = props.GAME_TIME;
clearInterval(this._timer);
var len = this.pictures.length;
for (var i = 0; i < len; i++) {
this.pictures[i].removeAllEventListener();
}
this.stage.removeEventListener(engine.MouseEvent.MOUSE_UP, this.stageOnUp, this);
};
GameView.prototype.createRects = function () { };
GameView.prototype.setup = function () {
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;
w = W / MAX_COL;
h = H / MAX_ROW;
console.log('onSteup', props);
var parent = new engine.Sprite();
this.picturesWrapper = parent;
this.addChild(parent);
};
GameView.prototype.onDown = function (e) {
var stageLeft = (750 - props.W) / 2;
var stageTop = (this.stage.height - props.H) / 2;
this.dragPic = e.target;
this.picturesWrapper.addChild(this.dragPic);
this.localPicX = e.localX / MAX_COL;
this.localPicY = e.localY / MAX_ROW;
this.distanceX = this.dragPic.x;
this.distanceY = this.dragPic.y;
this.indexJ = Math.floor((this.distanceX) / (w + GAP));
this.indexI = Math.floor((this.distanceY) / (h + GAP));
this.index = (this.indexI) * MAX_COL + this.indexJ;
this.centerX = Math.floor((e.clientX - stageLeft) / w) * w + w / 2;
this.centerY = Math.floor((e.clientY - stageTop) / h) * h + h / 2;
this.stage.addEventListener(engine.MouseEvent.MOUSE_MOVE, this.onMove, this);
this.stage.addEventListener(engine.MouseEvent.MOUSE_UP, this.stageOnUp, this);
};
GameView.prototype.stageOnUp = function (e) {
var stageLeft = (750 - props.W) / 2;
var stageTop = (this.stage.height - props.H) / 2;
this.stage.removeEventListener(engine.MouseEvent.MOUSE_MOVE, this.onMove, this);
this.stage.removeEventListener(engine.MouseEvent.MOUSE_UP, this.stageOnUp, this);
if (this.centerY < stageTop || this.centerX < stageLeft) {
this.dragPic.x = this.distanceX;
this.dragPic.y = this.distanceY;
}
var curJ = Math.floor(this.centerX / (w + GAP));
var curI = Math.floor(this.centerY / (h + GAP));
this.picturesWrapper.addChild(this.guideHole);
if (0 <= curJ && curJ < (MAX_COL) && 0 <= curI && curI < (MAX_ROW)) {
var index = getIndexFromRC(curI, curJ, MAX_COL);
var dropPic = this.pictures[index];
var dropPicX = dropPic.x + stageLeft;
var dropPicy = dropPic.y + stageTop;
dropPic.x = this.distanceX;
dropPic.y = this.distanceY;
this.dragPic.x = dropPicX - stageLeft;
this.dragPic.y = dropPicy - stageTop;
var dropPicIndex = this.pictures.indexOf(dropPic);
var dragPicIndex = this.pictures.indexOf(this.dragPic);
this.pictures[dropPicIndex] = this.dragPic;
this.pictures[dragPicIndex] = dropPic;
if (dragPicIndex === dropPicIndex) {
this.dragPic.x = this.distanceX;
this.dragPic.y = this.distanceY;
}
var result = true;
for (var j = 0; j < this.rightList.length; j++) {
if (this.rightList[j] != this.pictures[j]) {
result = false;
break;
}
}
if (result) {
this.onSuccess();
}
}
else {
this.dragPic.x = this.distanceX;
this.dragPic.y = this.distanceY;
}
};
GameView.prototype.onSuccess = function () {
console.log('拼图成功!');
engine.globalEvent.dispatchEvent('pictures-game-success', { time: GAME_TIME });
this.stop();
};
GameView.prototype.onMove = function (e) {
this.dragPic.x = e.stageX - this.localPicX - (750 - props.W) / 2;
this.dragPic.y = e.stageY - this.localPicY - (this.stage.height - props.H) / 2;
this.centerX = this.dragPic.x + w / 2;
this.centerY = this.dragPic.y + h / 2;
};
return GameView;
}(engine.Container));
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 gameView = _this._gameView = new GameView();
_this.addChild(gameView);
return _this;
}
GameWrapper.prototype.start = function (event) {
injectProps(event.data);
this._gameView.start();
};
GameWrapper.prototype.stop = function (event) {
this._gameView.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
{"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 \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 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 GAME_TIME = props.GAME_TIME\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,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC7B,CAAC;;;CCZD,IAAM,MAAM,GAAG,EAAE,CAAC;CAClB,IAAM,MAAM,GAAG,EAAE,CAA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AI,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;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;;;CCZD,IAAM,MAAM,GAAG,EAAE,CAAC;CAClB,IAAM,MAAM,GAAG,EAAE,CAAC;AAClB,cAAe,UAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO;KAC3C,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE;SACf,IAAM,IAAI,GAAS,MAAM,CAAC,GAAG,CAA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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
......@@ -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": {
......@@ -59,7 +57,10 @@
"alias": "开始",
"data": {
"picUrl":"图片路径",
"blockUrl":"blockUrl"
"blockUrl":"blockUrl",
"row":"行",
"column":"列",
"gameTime":"游戏时间"
}
},
"pictures-stop": {
......@@ -70,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;
......@@ -28,6 +25,15 @@ export default class GameView extends engine.Container {
start() {
//优先获取start事件接收到的参数
// 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;
......@@ -101,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', {
......@@ -185,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,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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,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,GAAG,IAAI,CAAC,GAAG,OAAO,GAAG,GAAG,CAAC,CAAC;aACpC,KAAK,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,OAAO,GAAG,GAAG,CAAC,CAAC;aACpC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aAC7B,GAAG,CAAC,IAAI,CAAC,KAAK,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,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
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