Commit 1e4a3038 authored by wildfirecode's avatar wildfirecode

1

parent b182001e
This diff is collapsed.
......@@ -49,7 +49,7 @@ function launchWithCustomModule(customModule) {
engine.globalEvent.dispatchEvent('recycling-start', {});
const d = engine.gameStage.sceneContainer.getChildAt(0);
}, 1000);
}, 200);
});
engine.globalEvent.addEventListener('recycling-time-update', (e) => {
// console.log(e.type, e.data);
......
......@@ -2,50 +2,48 @@
<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>
<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/editor/zeroing/libs/engine.ebc906f6b50b8da0a669f77027981d5f3cb560ce.js"></script> -->
<!-- <script src="http://localhost:4002/debug/engine.js"></script>
<div id="game-container" class="game-container"></div>
<script crossorigin="anonymous" src="engine.1de84ff79dba19e949088de63aa75af51a515e5c.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="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>
<!--<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
......@@ -74,6 +74,34 @@
});
//# 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) {
tslib.__extends(GameView, _super);
function GameView() {
......@@ -83,12 +111,15 @@
return _this;
}
GameView.prototype.configUI = function () {
var uiMap = {};
this.uiMap = uiMap;
var config = uiConfig();
for (var _i = 0, config_1 = config; _i < config_1.length; _i++) {
var item = config_1[_i];
var id = item.id, texture = item.texture, pos = item.pos, anchor = item.anchor;
var sp = new engine.Sprite(getTextureByName(texture));
this.addChild(sp);
uiMap[id] = sp;
if (anchor) {
sp.anchorX = anchor[0];
sp.anchorY = anchor[1];
......@@ -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 () {
this.playAni();
return;
};
GameView.prototype.getSecond = function () { return 0; };
......@@ -135,6 +188,7 @@
};
return GameView;
}(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super);
......
This diff is collapsed.
......@@ -19,6 +19,12 @@
"url": "//yun.duiba.com.cn/aurora/assets/2a06e8c7b49d8e53955359f7a6dc5bd887978c21.png",
"uuid": "c21d9b0f-1aec-40c8-bb2b-7e674506b833",
"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 @@
import { getTextureByName } from "../../../recycling/src/game/utils";
import { props } from "../props";
import uiConfig from "./uiConfig";
import Conveyor from "./Conveyor";
export default class GameView extends engine.Container {
private _timer;
private _timeCounter = 0;
uiMap: any;
constructor() {
super();
......@@ -18,11 +20,13 @@ export default class GameView extends engine.Container {
configUI() {
const uiMap: any = {};
this.uiMap = uiMap;
const config = uiConfig();
for (const item of config) {
const { id, texture, pos, anchor } = item;
const sp = new engine.Sprite(getTextureByName(texture));
this.addChild(sp);
uiMap[id] = sp;
if (anchor) {
sp.anchorX = anchor[0];
sp.anchorY = anchor[1];
......@@ -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'));
// 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