Commit 1e4a3038 authored by wildfirecode's avatar wildfirecode

1

parent b182001e
...@@ -20,6 +20,12 @@ ...@@ -20,6 +20,12 @@
"url": "//yun.duiba.com.cn/aurora/assets/2a06e8c7b49d8e53955359f7a6dc5bd887978c21.png", "url": "//yun.duiba.com.cn/aurora/assets/2a06e8c7b49d8e53955359f7a6dc5bd887978c21.png",
"uuid": "c21d9b0f-1aec-40c8-bb2b-7e674506b833", "uuid": "c21d9b0f-1aec-40c8-bb2b-7e674506b833",
"ext": ".png" "ext": ".png"
},
{
"name": "conveyor",
"url": "//yun.duiba.com.cn/aurora/assets/0015de48d63d00dafe730b43141d747f47069237.png",
"uuid": "4176aa04-d943-444e-beca-5ecc1313b059",
"ext": ".png"
} }
], ],
"events": { "events": {
...@@ -57,5 +63,5 @@ ...@@ -57,5 +63,5 @@
} }
}, },
"id": "recycling", "id": "recycling",
"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.recycling = 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\t//# sourceMappingURL=utils.js.map\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 uiConfig = (function () {\n\t return [\n\t {\n\t id: 'playBg',\n\t texture: 'playBg'\n\t },\n\t {\n\t id: 'idler0',\n\t texture: 'idlerWheel',\n\t pos: [75, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler1',\n\t texture: 'idlerWheel',\n\t pos: [175, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler2',\n\t texture: 'idlerWheel',\n\t pos: [275, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler3',\n\t texture: 'idlerWheel',\n\t pos: [375, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler4',\n\t texture: 'idlerWheel',\n\t pos: [475, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler5',\n\t texture: 'idlerWheel',\n\t pos: [575, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler6',\n\t texture: 'idlerWheel',\n\t pos: [675, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t ];\n\t});\n\t//# sourceMappingURL=uiConfig.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._timeCounter = 0;\n\t _this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);\n\t return _this;\n\t }\n\t GameView.prototype.configUI = function () {\n\t var config = uiConfig();\n\t for (var _i = 0, config_1 = config; _i < config_1.length; _i++) {\n\t var item = config_1[_i];\n\t var id = item.id, texture = item.texture, pos = item.pos, anchor = item.anchor;\n\t var sp = new engine.Sprite(getTextureByName(texture));\n\t this.addChild(sp);\n\t if (anchor) {\n\t sp.anchorX = anchor[0];\n\t sp.anchorY = anchor[1];\n\t }\n\t if (pos) {\n\t sp.x = pos[0];\n\t sp.y = pos[1];\n\t if (anchor) {\n\t sp.x = pos[0] - sp.anchorX;\n\t sp.y = pos[1] - sp.anchorY;\n\t }\n\t }\n\t }\n\t };\n\t GameView.prototype.start = function () {\n\t return;\n\t };\n\t GameView.prototype.getSecond = function () { return 0; };\n\t GameView.prototype.onTimer = function () {\n\t engine.globalEvent.dispatchEvent('recycling-time-update', {\n\t second: this.getSecond(),\n\t });\n\t if (this.getSecond() == 0) {\n\t this.stop();\n\t engine.globalEvent.dispatchEvent('recycling-game-fail', {\n\t reason: 1\n\t });\n\t }\n\t };\n\t GameView.prototype.stop = function () {\n\t };\n\t GameView.prototype.createRects = function () { };\n\t GameView.prototype.setup = function () {\n\t console.log('onSteup', props);\n\t this.configUI();\n\t };\n\t GameView.prototype.onDown = function (e) {\n\t };\n\t GameView.prototype.stageOnUp = function (e) {\n\t };\n\t GameView.prototype.onSuccess = function () {\n\t };\n\t GameView.prototype.onMove = function (e) {\n\t };\n\t return GameView;\n\t}(engine.Container));\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('recycling-start', _this.start, _this);\n\t engine.globalEvent.addEventListener('recycling-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 this._gameView.stop();\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" "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.recycling = 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\t//# sourceMappingURL=utils.js.map\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 uiConfig = (function () {\n\t return [\n\t {\n\t id: 'playBg',\n\t texture: 'playBg'\n\t },\n\t {\n\t id: 'idler0',\n\t texture: 'idlerWheel',\n\t pos: [75, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler1',\n\t texture: 'idlerWheel',\n\t pos: [175, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler2',\n\t texture: 'idlerWheel',\n\t pos: [275, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler3',\n\t texture: 'idlerWheel',\n\t pos: [375, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler4',\n\t texture: 'idlerWheel',\n\t pos: [475, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler5',\n\t texture: 'idlerWheel',\n\t pos: [575, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t {\n\t id: 'idler6',\n\t texture: 'idlerWheel',\n\t pos: [675, 1038],\n\t anchor: [20, 21.5]\n\t },\n\t ];\n\t});\n\t//# sourceMappingURL=uiConfig.js.map\n\n\tvar Conveyor = (function (_super) {\n\t tslib.__extends(Conveyor, _super);\n\t function Conveyor() {\n\t var _this = _super.call(this) || this;\n\t var sp = new engine.Sprite(getTextureByName('conveyor'));\n\t _this.addChild(sp);\n\t _this.idx0 = _this.createItem(75, 50);\n\t _this.idx1 = _this.createItem(225, 50);\n\t _this.idx2 = _this.createItem(375, 50);\n\t _this.idx3 = _this.createItem(525, 50);\n\t _this.idx4 = _this.createItem(675, 50);\n\t return _this;\n\t }\n\t Conveyor.prototype.createItem = function (x, y) {\n\t var sp = new engine.Sprite();\n\t this.addChild(sp);\n\t sp.x = x - 50;\n\t sp.y = y - 50;\n\t var g = new engine.Graphics;\n\t g.beginFill(0xff0000);\n\t g.drawRect(0, 0, 100, 100);\n\t g.endFill();\n\t sp.addChild(g);\n\t return sp;\n\t };\n\t return Conveyor;\n\t}(engine.Sprite));\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._timeCounter = 0;\n\t _this.once(engine.Event.ADDED_TO_STAGE, _this.setup, _this);\n\t return _this;\n\t }\n\t GameView.prototype.configUI = function () {\n\t var uiMap = {};\n\t this.uiMap = uiMap;\n\t var config = uiConfig();\n\t for (var _i = 0, config_1 = config; _i < config_1.length; _i++) {\n\t var item = config_1[_i];\n\t var id = item.id, texture = item.texture, pos = item.pos, anchor = item.anchor;\n\t var sp = new engine.Sprite(getTextureByName(texture));\n\t this.addChild(sp);\n\t uiMap[id] = sp;\n\t if (anchor) {\n\t sp.anchorX = anchor[0];\n\t sp.anchorY = anchor[1];\n\t }\n\t if (pos) {\n\t sp.x = pos[0];\n\t sp.y = pos[1];\n\t if (anchor) {\n\t sp.x = pos[0] - sp.anchorX;\n\t sp.y = pos[1] - sp.anchorY;\n\t }\n\t }\n\t }\n\t this.configConveyors();\n\t };\n\t GameView.prototype.configConveyors = function () {\n\t var conveyor1 = new Conveyor();\n\t conveyor1.x = 0;\n\t conveyor1.y = 904.21;\n\t var conveyor2 = new Conveyor();\n\t this.addChild(conveyor1);\n\t this.addChild(conveyor2);\n\t conveyor2.x = 764;\n\t conveyor2.y = 904.21;\n\t };\n\t GameView.prototype.playAni = function () {\n\t var _this = this;\n\t var idlerWheels = ['idler0', 'idler1', 'idler2', 'idler3', 'idler4', 'idler5', 'idler6'];\n\t idlerWheels = idlerWheels.map(function (i) { return _this.uiMap[i]; });\n\t idlerWheels.forEach(function (i) {\n\t engine.Tween.get(i, { loop: true }).to({ rotation: 360 }, 3000);\n\t });\n\t };\n\t GameView.prototype.stopAni = function () {\n\t };\n\t GameView.prototype.start = function () {\n\t this.playAni();\n\t return;\n\t };\n\t GameView.prototype.getSecond = function () { return 0; };\n\t GameView.prototype.onTimer = function () {\n\t engine.globalEvent.dispatchEvent('recycling-time-update', {\n\t second: this.getSecond(),\n\t });\n\t if (this.getSecond() == 0) {\n\t this.stop();\n\t engine.globalEvent.dispatchEvent('recycling-game-fail', {\n\t reason: 1\n\t });\n\t }\n\t };\n\t GameView.prototype.stop = function () {\n\t };\n\t GameView.prototype.createRects = function () { };\n\t GameView.prototype.setup = function () {\n\t console.log('onSteup', props);\n\t this.configUI();\n\t };\n\t GameView.prototype.onDown = function (e) {\n\t };\n\t GameView.prototype.stageOnUp = function (e) {\n\t };\n\t GameView.prototype.onSuccess = function () {\n\t };\n\t GameView.prototype.onMove = function (e) {\n\t };\n\t return GameView;\n\t}(engine.Container));\n\t//# sourceMappingURL=GameView.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('recycling-start', _this.start, _this);\n\t engine.globalEvent.addEventListener('recycling-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 this._gameView.stop();\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"
} }
...@@ -49,7 +49,7 @@ function launchWithCustomModule(customModule) { ...@@ -49,7 +49,7 @@ function launchWithCustomModule(customModule) {
engine.globalEvent.dispatchEvent('recycling-start', {}); engine.globalEvent.dispatchEvent('recycling-start', {});
const d = engine.gameStage.sceneContainer.getChildAt(0); const d = engine.gameStage.sceneContainer.getChildAt(0);
}, 1000); }, 200);
}); });
engine.globalEvent.addEventListener('recycling-time-update', (e) => { engine.globalEvent.addEventListener('recycling-time-update', (e) => {
// console.log(e.type, e.data); // console.log(e.type, e.data);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -4,48 +4,46 @@ ...@@ -4,48 +4,46 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>美食从天而降</title> <title>美食从天而降</title>
<meta name="viewport" <meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
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="apple-mobile-web-app-capable" content="yes"/> <meta name="full-screen" content="true" />
<meta name="full-screen" content="true"/> <meta name="screen-orientation" content="portrait" />
<meta name="screen-orientation" content="portrait"/> <meta name="x5-fullscreen" content="true" />
<meta name="x5-fullscreen" content="true"/> <meta name="360-fullscreen" content="true" />
<meta name="360-fullscreen" content="true"/>
<style> <style>
html, html,
body { body {
padding: 0; padding: 0;
margin: 0; margin: 0;
border: 0; border: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
position: absolute; position: absolute;
background-color: gray; background-color: gray;
} }
.game-container{
.game-container {
width: 100%; width: 100%;
height: 100%; height: 100%;
line-height:0; line-height: 0;
font-size:0; font-size: 0;
} }
</style> </style>
</head> </head>
<body> <body>
<div id="game-container" class="game-container"></div> <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="engine.1de84ff79dba19e949088de63aa75af51a515e5c.js"></script>
<script crossorigin="anonymous" src="//yun.duiba.com.cn/editor/zeroing/libs/svga.fd3923ae6e664251ca7981801a65809cc5f36bc3.js"></script> <script crossorigin="anonymous" src="svga.fd3923ae6e664251ca7981801a65809cc5f36bc3.js"></script>
<!-- <script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.ebc906f6b50b8da0a669f77027981d5f3cb560ce.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:4002/debug/engine.js"></script>
<script src="http://localhost:4003/debug/engine-svga.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="//yun.duiba.com.cn/editor/zeroing/libs/engine.9a9dbfda4cb2dd5508ecddfe3d95dfd88063f7b5.js"></script>-->
<script src="app.js"></script> <script src="app.js"></script>
<script src="props.js"></script> <script src="props.js"></script>
<script src="load-assets.js"></script> <script src="load-assets.js"></script>
<script src="main.js"></script> <script src="main.js"></script>
<script> <script>
</script>
</script>
</body> </body>
\ No newline at end of file
...@@ -74,6 +74,34 @@ ...@@ -74,6 +74,34 @@
}); });
//# sourceMappingURL=uiConfig.js.map //# sourceMappingURL=uiConfig.js.map
var Conveyor = (function (_super) {
tslib.__extends(Conveyor, _super);
function Conveyor() {
var _this = _super.call(this) || this;
var sp = new engine.Sprite(getTextureByName('conveyor'));
_this.addChild(sp);
_this.idx0 = _this.createItem(75, 50);
_this.idx1 = _this.createItem(225, 50);
_this.idx2 = _this.createItem(375, 50);
_this.idx3 = _this.createItem(525, 50);
_this.idx4 = _this.createItem(675, 50);
return _this;
}
Conveyor.prototype.createItem = function (x, y) {
var sp = new engine.Sprite();
this.addChild(sp);
sp.x = x - 50;
sp.y = y - 50;
var g = new engine.Graphics;
g.beginFill(0xff0000);
g.drawRect(0, 0, 100, 100);
g.endFill();
sp.addChild(g);
return sp;
};
return Conveyor;
}(engine.Sprite));
var GameView = (function (_super) { var GameView = (function (_super) {
tslib.__extends(GameView, _super); tslib.__extends(GameView, _super);
function GameView() { function GameView() {
...@@ -83,12 +111,15 @@ ...@@ -83,12 +111,15 @@
return _this; return _this;
} }
GameView.prototype.configUI = function () { GameView.prototype.configUI = function () {
var uiMap = {};
this.uiMap = uiMap;
var config = uiConfig(); var config = uiConfig();
for (var _i = 0, config_1 = config; _i < config_1.length; _i++) { for (var _i = 0, config_1 = config; _i < config_1.length; _i++) {
var item = config_1[_i]; var item = config_1[_i];
var id = item.id, texture = item.texture, pos = item.pos, anchor = item.anchor; var id = item.id, texture = item.texture, pos = item.pos, anchor = item.anchor;
var sp = new engine.Sprite(getTextureByName(texture)); var sp = new engine.Sprite(getTextureByName(texture));
this.addChild(sp); this.addChild(sp);
uiMap[id] = sp;
if (anchor) { if (anchor) {
sp.anchorX = anchor[0]; sp.anchorX = anchor[0];
sp.anchorY = anchor[1]; sp.anchorY = anchor[1];
...@@ -102,8 +133,30 @@ ...@@ -102,8 +133,30 @@
} }
} }
} }
this.configConveyors();
};
GameView.prototype.configConveyors = function () {
var conveyor1 = new Conveyor();
conveyor1.x = 0;
conveyor1.y = 904.21;
var conveyor2 = new Conveyor();
this.addChild(conveyor1);
this.addChild(conveyor2);
conveyor2.x = 764;
conveyor2.y = 904.21;
};
GameView.prototype.playAni = function () {
var _this = this;
var idlerWheels = ['idler0', 'idler1', 'idler2', 'idler3', 'idler4', 'idler5', 'idler6'];
idlerWheels = idlerWheels.map(function (i) { return _this.uiMap[i]; });
idlerWheels.forEach(function (i) {
engine.Tween.get(i, { loop: true }).to({ rotation: 360 }, 3000);
});
};
GameView.prototype.stopAni = function () {
}; };
GameView.prototype.start = function () { GameView.prototype.start = function () {
this.playAni();
return; return;
}; };
GameView.prototype.getSecond = function () { return 0; }; GameView.prototype.getSecond = function () { return 0; };
...@@ -135,6 +188,7 @@ ...@@ -135,6 +188,7 @@
}; };
return GameView; return GameView;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) { var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super); tslib.__extends(GameWrapper, _super);
......
{"version":3,"file":"index.js","sources":["src/custom/recycling/src/game/utils.ts","src/custom/recycling/src/props.ts","src/custom/recycling/src/game/uiConfig.ts","src/custom/recycling/src/game/GameView.ts","src/custom/recycling/src/game/GameWrapper.ts","src/custom/recycling/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\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}","/**\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","export default () => {\n return [\n {\n id: 'playBg',\n texture: 'playBg'\n },\n {\n id: 'idler0',\n texture: 'idlerWheel',\n pos: [75, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler1',\n texture: 'idlerWheel',\n pos: [175, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler2',\n texture: 'idlerWheel',\n pos: [275, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler3',\n texture: 'idlerWheel',\n pos: [375, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler4',\n texture: 'idlerWheel',\n pos: [475, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler5',\n texture: 'idlerWheel',\n pos: [575, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler6',\n texture: 'idlerWheel',\n pos: [675, 1038],\n anchor: [20, 21.5]\n },\n ]\n}","/**\n * Created by rockyl on 2018/8/16.\n */\n\nimport { getTextureByName } from \"../../../recycling/src/game/utils\";\nimport { props } from \"../props\";\nimport uiConfig from \"./uiConfig\";\n\nexport default class GameView extends engine.Container {\n private _timer;\n private _timeCounter = 0;\n\n constructor() {\n super();\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\n }\n\n configUI() {\n\n const uiMap: any = {};\n const config = uiConfig();\n for (const item of config) {\n const { id, texture, pos, anchor } = item;\n const sp = new engine.Sprite(getTextureByName(texture));\n this.addChild(sp);\n if (anchor) {\n sp.anchorX = anchor[0];\n sp.anchorY = anchor[1];\n }\n if (pos) {\n sp.x = pos[0];\n sp.y = pos[1];\n if (anchor) {\n sp.x = pos[0] - sp.anchorX;\n sp.y = pos[1] - sp.anchorY;\n }\n }\n }\n\n }\n\n start() {\n\n // const bg = new engine.Sprite(getTextureByName('playBg'));\n // this.addChild(bg);\n\n return;\n console.log('on start')\n\n engine.globalEvent.dispatchEvent('recycling-time-update', {\n second: this.getSecond(),\n });\n\n this._timer = setInterval(() => {\n this.onTimer();\n }, 1000)\n }\n\n getSecond() { return 0 }\n\n onTimer() {\n engine.globalEvent.dispatchEvent('recycling-time-update', {\n second: this.getSecond(),\n });\n\n if (this.getSecond() == 0) {\n // GAME_TIME = props.GAME_TIME\n this.stop();\n engine.globalEvent.dispatchEvent('recycling-game-fail', {\n reason: 1\n });\n }\n }\n\n stop() {\n\n\n }\n\n\n createRects() { }\n\n setup() {\n console.log('onSteup', props);\n this.configUI();\n }\n\n onDown(e: engine.MouseEvent) {\n\n }\n\n stageOnUp(e) {\n\n\n }\n\n private onSuccess() {\n\n\n }\n\n onMove(e: engine.MouseEvent) {\n\n }\n\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\tconstructor() {\n\t\tsuper();\n\n\t\tengine.globalEvent.addEventListener('recycling-start', this.start, this);\n\t\tengine.globalEvent.addEventListener('recycling-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\tthis._gameView.start();\n\t}\n\tstop(event: engine.Event) {\n\t\t\n\t\tthis._gameView.stop();\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":";;;;;;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;;;CCNM,IAAI,KAAK,GAAQ,EAAE,CAAC;AAE3B,UAAgB,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;AAED,UAAgB,WAAW,CAAC,CAAC;KAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC7B,CAAC;;;ACdD,iBAAe;KACX,OAAO;SACH;aACI,EAAE,EAAE,QAAQ;aACZ,OAAO,EAAE,QAAQ;UACpB;SACD;aACI,EAAE,EAAE,QAAQ;aACZ,OAAO,EAAE,YAAY;aACrB,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC;a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QAAQ,CAAC;CACjB,CAAC;;;;;;;;;"} {"version":3,"file":"index.js","sources":["src/custom/recycling/src/game/utils.ts","src/custom/recycling/src/props.ts","src/custom/recycling/src/game/uiConfig.ts","src/custom/recycling/src/game/Conveyor.ts","src/custom/recycling/src/game/GameView.ts","src/custom/recycling/src/game/GameWrapper.ts","src/custom/recycling/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\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}","/**\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","export default () => {\n return [\n {\n id: 'playBg',\n texture: 'playBg'\n },\n {\n id: 'idler0',\n texture: 'idlerWheel',\n pos: [75, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler1',\n texture: 'idlerWheel',\n pos: [175, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler2',\n texture: 'idlerWheel',\n pos: [275, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler3',\n texture: 'idlerWheel',\n pos: [375, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler4',\n texture: 'idlerWheel',\n pos: [475, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler5',\n texture: 'idlerWheel',\n pos: [575, 1038],\n anchor: [20, 21.5]\n },\n {\n id: 'idler6',\n texture: 'idlerWheel',\n pos: [675, 1038],\n anchor: [20, 21.5]\n },\n ]\n}","import { getTextureByName } from \"./utils\";\n\nexport default class Conveyor extends engine.Sprite {\n\n idx0: engine.Sprite;\n idx1: engine.Sprite;\n idx2: engine.Sprite;\n idx3: engine.Sprite;\n idx4: engine.Sprite;\n constructor() {\n super();\n const sp = new engine.Sprite(getTextureByName('conveyor'));\n this.addChild(sp);\n\n this.idx0 = this.createItem(75,50);\n this.idx1 = this.createItem(225,50);\n this.idx2 = this.createItem(375,50);\n this.idx3 = this.createItem(525,50);\n this.idx4 = this.createItem(675,50);\n }\n\n createItem(x,y) {\n const sp = new engine.Sprite();\n this.addChild(sp);\n sp.x = x - 50;\n sp.y = y- 50;\n\n const g = new engine.Graphics;\n g.beginFill(0xff0000);\n g.drawRect(0,0,100,100);\n g.endFill();\n sp.addChild(g);\n\n return sp\n }\n}","/**\n * Created by rockyl on 2018/8/16.\n */\n\nimport { getTextureByName } from \"../../../recycling/src/game/utils\";\nimport { props } from \"../props\";\nimport uiConfig from \"./uiConfig\";\nimport Conveyor from \"./Conveyor\";\n\nexport default class GameView extends engine.Container {\n private _timer;\n private _timeCounter = 0;\n uiMap: any;\n\n constructor() {\n super();\n this.once(engine.Event.ADDED_TO_STAGE, this.setup, this);\n }\n\n configUI() {\n\n const uiMap: any = {};\n this.uiMap = uiMap;\n const config = uiConfig();\n for (const item of config) {\n const { id, texture, pos, anchor } = item;\n const sp = new engine.Sprite(getTextureByName(texture));\n this.addChild(sp);\n uiMap[id] = sp;\n if (anchor) {\n sp.anchorX = anchor[0];\n sp.anchorY = anchor[1];\n }\n if (pos) {\n sp.x = pos[0];\n sp.y = pos[1];\n if (anchor) {\n sp.x = pos[0] - sp.anchorX;\n sp.y = pos[1] - sp.anchorY;\n }\n }\n }\n\n this.configConveyors();\n }\n\n private configConveyors() {\n const conveyor1 = new Conveyor();\n conveyor1.x=0;\n conveyor1.y=904.21;\n const conveyor2 = new Conveyor();\n this.addChild(conveyor1);\n this.addChild(conveyor2);\n conveyor2.x=764;\n conveyor2.y=904.21;\n }\n\n playAni() {\n let idlerWheels = ['idler0', 'idler1', 'idler2', 'idler3', 'idler4', 'idler5', 'idler6'];\n idlerWheels = idlerWheels.map(i => this.uiMap[i]);\n idlerWheels.forEach(i=>{\n engine.Tween.get(i,{loop:true}).to({rotation:360},3000);\n })\n }\n\n stopAni() {\n\n }\n\n start() {\n this.playAni();\n // const bg = new engine.Sprite(getTextureByName('playBg'));\n // this.addChild(bg);\n\n return;\n console.log('on start')\n\n engine.globalEvent.dispatchEvent('recycling-time-update', {\n second: this.getSecond(),\n });\n\n this._timer = setInterval(() => {\n this.onTimer();\n }, 1000)\n }\n\n getSecond() { return 0 }\n\n onTimer() {\n engine.globalEvent.dispatchEvent('recycling-time-update', {\n second: this.getSecond(),\n });\n\n if (this.getSecond() == 0) {\n // GAME_TIME = props.GAME_TIME\n this.stop();\n engine.globalEvent.dispatchEvent('recycling-game-fail', {\n reason: 1\n });\n }\n }\n\n stop() {\n\n\n }\n\n\n createRects() { }\n\n setup() {\n console.log('onSteup', props);\n this.configUI();\n }\n\n onDown(e: engine.MouseEvent) {\n\n }\n\n stageOnUp(e) {\n\n\n }\n\n private onSuccess() {\n\n\n }\n\n onMove(e: engine.MouseEvent) {\n\n }\n\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\tconstructor() {\n\t\tsuper();\n\n\t\tengine.globalEvent.addEventListener('recycling-start', this.start, this);\n\t\tengine.globalEvent.addEventListener('recycling-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\tthis._gameView.start();\n\t}\n\tstop(event: engine.Event) {\n\t\t\n\t\tthis._gameView.stop();\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":";;;;;;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;;;CCNM,IAAI,KAAK,GAAQ,EAAE,CAAC;AAE3B,UAAgB,YAAY;KAC3B,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;KAE3B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CACrC,CAAC;AAED,UAAgB,WAAW,CAAC,CAAC;KAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CAC7B,CAAC;;;ACdD,iBAAe;KACX,OAAO;SACH;aACI,EAAE,EAAE,QAAQ;aACZ,OAAO,EAAE,QAAQ;UACpB;SACD;aACI,EAAE,EAAE,QAAQ;aACZ,OAAO,EAAE,YAAY;aACrB,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC;aACf,MAAM,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC;UACrB;SACD;aACI,EAAE,EAAE,QAAQ;aACZ,OAAO,EAAE,YAAY;aACrB,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC;aAChB,MAAM,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC;UACrB;SACD;aAC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MAGC;KAED,yBAAM,GAAN,UAAO,CAAoB;MAE1B;KAEH,eAAC;CAAD,CAAC,CA5HqC,MAAM,CAAC,SAAS,GA4HrD;;;CC7HD;KAAiCA,qCAAgB;KAGhD;SAAA,YACC,iBAAO,SASP;SAPA,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,KAAI,CAAC,KAAK,EAAE,KAAI,CAAC,CAAC;SACzE,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,KAAI,CAAC,IAAI,EAAE,KAAI,CAAC,CAAC;SAGvE,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;SAExB,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,CAxBgC,MAAM,CAAC,SAAS,GAwBhD;;;iBCzBwB,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 \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -19,6 +19,12 @@ ...@@ -19,6 +19,12 @@
"url": "//yun.duiba.com.cn/aurora/assets/2a06e8c7b49d8e53955359f7a6dc5bd887978c21.png", "url": "//yun.duiba.com.cn/aurora/assets/2a06e8c7b49d8e53955359f7a6dc5bd887978c21.png",
"uuid": "c21d9b0f-1aec-40c8-bb2b-7e674506b833", "uuid": "c21d9b0f-1aec-40c8-bb2b-7e674506b833",
"ext": ".png" "ext": ".png"
},
{
"name": "conveyor",
"url": "//yun.duiba.com.cn/aurora/assets/0015de48d63d00dafe730b43141d747f47069237.png",
"uuid": "4176aa04-d943-444e-beca-5ecc1313b059",
"ext": ".png"
} }
], ],
......
import { getTextureByName } from "./utils";
export default class Conveyor extends engine.Sprite {
idx0: engine.Sprite;
idx1: engine.Sprite;
idx2: engine.Sprite;
idx3: engine.Sprite;
idx4: engine.Sprite;
constructor() {
super();
const sp = new engine.Sprite(getTextureByName('conveyor'));
this.addChild(sp);
this.idx0 = this.createItem(75,50);
this.idx1 = this.createItem(225,50);
this.idx2 = this.createItem(375,50);
this.idx3 = this.createItem(525,50);
this.idx4 = this.createItem(675,50);
}
createItem(x,y) {
const sp = new engine.Sprite();
this.addChild(sp);
sp.x = x - 50;
sp.y = y- 50;
const g = new engine.Graphics;
g.beginFill(0xff0000);
g.drawRect(0,0,100,100);
g.endFill();
sp.addChild(g);
return sp
}
}
\ No newline at end of file
...@@ -5,10 +5,12 @@ ...@@ -5,10 +5,12 @@
import { getTextureByName } from "../../../recycling/src/game/utils"; import { getTextureByName } from "../../../recycling/src/game/utils";
import { props } from "../props"; import { props } from "../props";
import uiConfig from "./uiConfig"; import uiConfig from "./uiConfig";
import Conveyor from "./Conveyor";
export default class GameView extends engine.Container { export default class GameView extends engine.Container {
private _timer; private _timer;
private _timeCounter = 0; private _timeCounter = 0;
uiMap: any;
constructor() { constructor() {
super(); super();
...@@ -18,11 +20,13 @@ export default class GameView extends engine.Container { ...@@ -18,11 +20,13 @@ export default class GameView extends engine.Container {
configUI() { configUI() {
const uiMap: any = {}; const uiMap: any = {};
this.uiMap = uiMap;
const config = uiConfig(); const config = uiConfig();
for (const item of config) { for (const item of config) {
const { id, texture, pos, anchor } = item; const { id, texture, pos, anchor } = item;
const sp = new engine.Sprite(getTextureByName(texture)); const sp = new engine.Sprite(getTextureByName(texture));
this.addChild(sp); this.addChild(sp);
uiMap[id] = sp;
if (anchor) { if (anchor) {
sp.anchorX = anchor[0]; sp.anchorX = anchor[0];
sp.anchorY = anchor[1]; sp.anchorY = anchor[1];
...@@ -37,10 +41,34 @@ export default class GameView extends engine.Container { ...@@ -37,10 +41,34 @@ export default class GameView extends engine.Container {
} }
} }
this.configConveyors();
} }
start() { private configConveyors() {
const conveyor1 = new Conveyor();
conveyor1.x=0;
conveyor1.y=904.21;
const conveyor2 = new Conveyor();
this.addChild(conveyor1);
this.addChild(conveyor2);
conveyor2.x=764;
conveyor2.y=904.21;
}
playAni() {
let idlerWheels = ['idler0', 'idler1', 'idler2', 'idler3', 'idler4', 'idler5', 'idler6'];
idlerWheels = idlerWheels.map(i => this.uiMap[i]);
idlerWheels.forEach(i=>{
engine.Tween.get(i,{loop:true}).to({rotation:360},3000);
})
}
stopAni() {
}
start() {
this.playAni();
// const bg = new engine.Sprite(getTextureByName('playBg')); // const bg = new engine.Sprite(getTextureByName('playBg'));
// this.addChild(bg); // this.addChild(bg);
......
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