Commit 83a2ee94 authored by zjz1994's avatar zjz1994

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

# Conflicts:
#	package-lock.json
#	src/custom/dxbcyj-game/debug/main.js.map
#	src/custom/dxbcyj-game/src/game/GameWrapper.ts
parents 0e5d2450 33823dbd
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"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"
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/**
* 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('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);
}
This diff is collapsed.
This diff is collapsed.
/**
* Created by rockyl 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
This diff is collapsed.
import GameView from "./GameView";
import { injectProps } from "../props";
export class GameWrapper extends engine.Container {
// private _status;
private _gameView: GameView;
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);
}
start(event: engine.Event) {
injectProps(event.data);
// this._status = 1;
this._gameView.start();
}
stop(event: engine.Event) {
this._gameView.stop();
}
// reset(event:engine.Event){
// this._gameView.reset();
// }
}
/**
* Created by rockyl on 2020-01-21.
*/
export function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
}
export function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
}
export function playSound(name) {
engine.playSound(engine.getAssetByName(name).uuid, {keep: true});
}
export function createSvga(name, anchorName?) {
let inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
return inst;
}
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;
}
This diff is collapsed.
export let props: any = {};
export function prepareProps() {
let metaProps = getProps();
engine.injectProp(props, metaProps);
}
export function injectProps(p) {
engine.injectProp(props, p);
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -13,7 +13,7 @@ export class GameWrapper extends engine.Container {
super();
engine.globalEvent.addEventListener('dxbcyj-game-start', this.start, this);
engine.globalEvent.addEventListener('dxbcyj-game-revive',this.revive);
let gameView = this._gameView = new GameView();
this.addChild(gameView);
......@@ -23,7 +23,4 @@ export class GameWrapper extends engine.Container {
start(event: engine.Event) {
this._gameView.start(event.data.guide);
}
revive(){
this._gameView.revive();
}
}
/**
* Created by renjianfeng on 2020-03-13.
*/
const customId = 'getAwayFromCloud';
(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);
// 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(() => {
// 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('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);
});
}
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/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": "玩家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);
}
This diff is collapsed.
This diff is collapsed.
/**
* Created by rockyl on 2020-01-21.
*/
let customModuleProps = {
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import {getTexture} from './utils'
export default class TimeCounter extends engine.Container{
timeCounter:engine.Sprite = new engine.Sprite(getTexture('b7d2a60a-9e60-4eca-be80-a991abea47c9'));
timeText:any;
time:number
constructor(){
super()
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;
}
updateTime(time){
this.time = time;
this.timeText.text = this.time + 's'
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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