Commit 33676a89 authored by zjz1994's avatar zjz1994

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

parents a940764e f3ed9fcd
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -44,7 +44,18 @@ function launchWithCustomModule(customModule) {
setTimeout(() => {
engine.addCustomModule(customId, engine.gameStage.sceneContainer.getChildAt(0));
}, 100);
setTimeout(() => {
engine.globalEvent.dispatchEvent('game-start', {
picUrl: "http://yun.duiba.com.cn/aurora/assets/e1593b97c27077b85b92f7eaaeae1ed64a1eb79a.png",
blockUrl: "888",
column:"2",
row:"2",
gameTime:"50"
});
const d = engine.gameStage.sceneContainer.getChildAt(0);
}, 100);
// setTimeout(() => {
// engine.globalEvent.dispatchEvent('cloud-game-reset', {
......
This diff is collapsed.
This diff is collapsed.
import { getTextureByName, getTexture } from "./utils";
export default class GameTest extends engine.Container {
world: p2.World;
planeBody: p2.Body;
isDebug = true;
private plane;
private boxBody: p2.Body;
factor = 10;
private isRight = false;
private saleX = this.isRight ? 1 : -1;
private ballAddSpeedX = -10;
private ballAddSpeedY = 30;
constructor() {
super();
this.addEventListener(engine.Event.ADDED_TO_STAGE, this.setup, this);
}
start() {
console.log("starting");
// this.stage.addEventListener(
// engine.MouseEvent.CLICK,
// this.onClick,
// this
// );
this.stage.addEventListener(
engine.MouseEvent.CLICK,
this.clickball,
this
);
}
onClick(e: engine.MouseEvent) {
const { world, factor } = this;
var positionX: number = e.stageX / factor;
var positionY: number =
(engine.gameStage.stage.height - e.stageY) / factor;
var display: engine.DisplayObject;
var self = this;
if (Math.random() > 0.5) {
//添加方形刚体
var boxShape: p2.Shape = new p2.Box({
width: 200 / factor,
height: 100 / factor,
});
var boxBody: p2.Body = new p2.Body({
mass: 1,
position: [positionX, positionY],
angularVelocity: 1,
});
boxBody.addShape(boxShape);
world.addBody(boxBody);
// if (this.isDebug) {
if (true) {
display = this.createBox(
(<p2.Box>boxShape).width * factor,
(<p2.Box>boxShape).height * factor
);
} else {
// display = self.createBitmapByName("rect");
// display.width = (<p2.Box>boxShape).width * factor;
// display.height = (<p2.Box>boxShape).height * factor;
}
} else {
//添加圆形刚体
var boxShape: p2.Shape = new p2.Circle({
radius: 60 / factor,
});
var boxBody: p2.Body = new p2.Body({
mass: 1,
position: [positionX, positionY],
});
boxBody.addShape(boxShape);
world.addBody(boxBody);
// if (this.isDebug) {
if (false) {
display = this.createBall(
(<p2.Circle>boxShape).radius * factor
);
} else {
display = this.createBitmapByName("篮球");
// display.width = (<p2.Circle>boxShape).radius * 2 * this.factor;
// display.height = (<p2.Circle>boxShape).radius * 2 * this.factor;
}
// display.width = (<p2.Circle>boxShape).radius * 2 * factor;
// display.height = (<p2.Circle>boxShape).radius * 2 * factor;
}
// display.anchorX = display.width / 2;
// display.anchorY = display.height / 2;
boxBody.displays = [display];
this.addChild(display);
}
setup() {
// // 创建地平面
// var plane: p2.Plane = new p2.Plane();
// this.planeBody = new p2.Body({
// position: [0, 100 / this.factor],
// type:p2.Body.STATIC
// });
// // this.planeBody.angle = Math.PI;
// this.planeBody.addShape(plane);
// this.world.addBody(this.planeBody);
// this.plane = this.createPlane(
// 0,
// 100,
// engine.gameStage.width,
// 20
// );
// this.planeBody.displays = [this.plane];
console.log("setup");
//创建world
var world: p2.World = new p2.World({
// gravity: [0, -1],
});
world.sleepMode = p2.World.BODY_SLEEPING;
world.defaultContactMaterial.friction = 0.3;
world.defaultContactMaterial.restitution = 0.7;
//创建plane
var planeShape: p2.Plane = new p2.Plane();
var planeBody: p2.Body = new p2.Body({
type:p2.Body.STATIC
});
planeBody.addShape(planeShape);
planeBody.displays = [];
world.addBody(planeBody);
this.world = world;
this.stage.addEventListener(
engine.Event.ENTER_FRAME,
this.onEnterFrame,
this
);
var display: engine.DisplayObject;
// 背景
let gameBg = new engine.Sprite(getTextureByName("背景"));
this.addChild(gameBg);
// 篮板
var boardShape:p2.Shape = new p2.Box({
width:20/this.factor,
height:200/this.factor
});
var boardBody = new p2.Body({
position:[80/this.factor,1000/this.factor]
})
boardBody.addShape(boardShape);
let board = this.createBitmapByName('篮板');
this.addChild(board)
boardBody.displays = [board];
this.world.addBody(boardBody)
// 框点
var boardPoint:p2.Shape = new p2.Circle({
radius:1/this.factor,
})
var boardPointBody:p2.Body = new p2.Body({
position:[100/this.factor,800/this.factor]
})
boardPointBody.addShape(boardPoint);
boardPointBody.displays = []
// 篮球
var boxShape: p2.Shape = new p2.Circle({radius: 60 / this.factor});
this.boxBody = new p2.Body({
mass: 0.1,
position: [300/this.factor, 900/this.factor],
velocity:[-5,-10],
angularVelocity:-1
});
let balldisplay = this.createBitmapByName("篮球");
this.addChild(balldisplay)
this.boxBody.displays = [balldisplay]
this.boxBody.addShape(boxShape);
this.world.addBody(this.boxBody);
}
onEnterFrame() {
this.world.step(60 / 1000);
var len: number = this.world.bodies.length;
for (var i: number = 0; i < len; i++) {
var body: p2.Body = this.world.bodies[i];
var display: engine.DisplayObject = body.displays[0];
const stageHeight = engine.gameStage.stage.height;
if (display) {
display.x = body.position[0] * this.factor; //同步刚体和egret显示对象的位置和旋转角度
display.y = stageHeight - body.position[1] * this.factor;
display.rotation =
((body.angle + body.shapes[0].angle) * 180) / Math.PI;
if (body.sleepState == p2.Body.SLEEPING) {
display.alpha = 0.5;
} else {
display.alpha = 1;
}
}
// display.rotation = (body.angle * 180) / Math.PI;
}
if(this.boxBody.position[0] < -120/this.factor){
this.boxBody.position[0] = (750 + 120) / this.factor;
}
if(this.boxBody.position[0] > (750 +120) / this.factor){
this.boxBody.position[0] = -120 /this.factor
}
}
clickball(){
var direction = this.isRight ? -1 : 1;
this.boxBody.velocity[0] = this.ballAddSpeedX * direction;
this.boxBody.velocity[1] = this.ballAddSpeedY;
this.boxBody.angularVelocity = -2 * direction;
}
private createPlane(x, y, w, h) {
var sp = new engine.Shape();
sp.beginFill(0x0000ff, 1);
sp.drawRect(x, y, w, h);
sp.endFill();
// sp.anchorX = sp.width / 2;
// sp.anchorY = sp.height / 2;
this.addChild(sp);
return sp;
}
private createBall(r) {
var sp = new engine.Shape();
sp.beginFill(0xff0000, 0.4);
sp.drawCircle(0, 0, r);
sp.endFill();
// this.addChild(sp);
return sp;
}
private createBox(width, height) {
var sp = new engine.Shape();
sp.beginFill(0xf0f0f0, 1);
sp.drawRect(-width / 2, -height / 2, width, height);
sp.endFill();
// sp.anchorX = w / 2;
// sp.anchorY = h / 2;
return sp;
}
// 图片的中心点位置
private createBitmapByName(name) {
const imgContainer = new engine.Sprite();
const img = new engine.Sprite(getTextureByName(name));
img.anchorX = img.width / 2;
img.anchorY = img.height / 2;
img.x = -img.width / 2;
img.y = -img.height / 2;
imgContainer.addChild(img);
return imgContainer;
}
stop() {}
}
import GameView from "./GameView";
import GameTest from './GameTest'
import { injectProps } from "../props";
......@@ -7,6 +8,7 @@ import { injectProps } from "../props";
export class GameWrapper extends engine.Container {
// private _status;
private _gameView: GameView;
private _gameTest: GameTest;
constructor() {
super();
......@@ -15,8 +17,10 @@ export class GameWrapper extends engine.Container {
engine.globalEvent.addEventListener('game-stop', this.stop, this);
//创建实例
let gameView = this._gameView = new GameView();
this.addChild(gameView);
// let gameView = this._gameView = new GameView();
// this.addChild(gameView);
let gameTest = this._gameTest = new GameTest();
this.addChild(gameTest);
}
......@@ -25,11 +29,13 @@ export class GameWrapper extends engine.Container {
// this._status = 1;
this._gameView.start();
// this._gameView.start();
this._gameTest.start();
}
stop(event: engine.Event) {
this._gameView.stop();
// this._gameView.stop();
this._gameTest.stop();
}
// reset(event:engine.Event){
......
export class Particle {
public view;
private x;
private y;
private vx;
private vy;
private life;
private maxLife;
public dieMark = false;
public gravity = 1;
public alphaSpeed = 0.01
public scaleSpeed = 0;
constructor(x, y, vx, vy, maxLife, view) {
this.x = x;
this.y = y;
this.vx = vx;
this.vy = vy;
this.life = 0;
this.maxLife = maxLife;
this.view = view;
// this.view.alpha=this.randomT(0.5,1)
}
public update() {
if (this.dieMark) return
this.x += this.vx;
this.y += this.vy;
this.vy += this.gravity;
this.life++;
if (this.life >= this.maxLife) {
this.dieMark = true;
}
this.view.x = this.x;
this.view.y = this.y;
if (this.view.alpha > 0) this.view.alpha -= this.alphaSpeed;
if (this.view.scaleX > 0.2) {
this.view.scaleX -= this.scaleSpeed;
this.view.scaleY -= this.scaleSpeed;
}
};
public init(x, y, vx, vy, maxLife) {
this.dieMark = false;
this.life = 0;
// this.view.alpha=this.randomT(0.5,1);
this.x = x;
this.y = y;
this.vx = vx;
this.vy = vy;
this.maxLife = maxLife;
}
private randomT(e, n?) {
return e && "number" == typeof e.length && e.length ? e[Math.floor(Math.random() * e.length)] : ("number" != typeof n && (n = e || 1, e = 0), e + Math.random() * (n - e))
}
}
\ No newline at end of file
......@@ -46,6 +46,9 @@ function launchWithCustomModule(customModule) {
}, 100);
setTimeout(() => {
engine.globalEvent.dispatchEvent('cloud-game-reset', {
});
engine.globalEvent.dispatchEvent('pictures-start', {
});
......@@ -55,6 +58,15 @@ function launchWithCustomModule(customModule) {
// engine.gameStage.sceneContainer.getChildAt(0).y = (d.stage.height-props.H)/2;
}, 1000);
setTimeout(() => {
engine.globalEvent.dispatchEvent('cloud-game-reset', {
});
engine.globalEvent.dispatchEvent('pictures-start', {
});
}, 20*1000);
// setTimeout(() => {
// engine.globalEvent.dispatchEvent('pictures-start', {
// picUrl: "http://yun.duiba.com.cn/aurora/assets/e1593b97c27077b85b92f7eaaeae1ed64a1eb79a.png",
......@@ -73,6 +85,9 @@ function launchWithCustomModule(customModule) {
engine.globalEvent.addEventListener('cloud-game-success', (e) => {
console.log(e.type, e.data);
});
engine.globalEvent.addEventListener('cloud-game-reset', (e) => {
console.log(e.type, e.data);
});
}
function getAssetByUUID(uuid) {
......
This diff is collapsed.
......@@ -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;
......@@ -49,8 +50,5 @@ export default class CloudRain extends engine.Container{
}
}
\ No newline at end of file
......@@ -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;
this.anchorX = this.width + this.width / 2
this.anchorY = this.height;
if(aaa > 90 && aaa<=100 ){
this.scaleY = 0.99;
this.scaleX = 1.01;
}
// 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;
}
// if(aaa >190 && aaa < 200){
// this.scaleX = 1;
// this.scaleY = 1;
// aaa = 0;
// }
pt = Date.now();
})
// pt = Date.now();
// })
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:0.99},100)
.to({scaleX:1,scaleY:1},100)
}
}
\ No newline at end of file
......@@ -9,7 +9,12 @@ export default class Moist extends engine.Container{
txt = new engine.TextInput();
hintpic:engine.Sprite = new engine.Sprite(getTexture('ed0e8931-2557-4527-bcfc-9071f90d5737'))
moveImg1:any = new engine.Sprite(getTexture('9be94bf5-5dd9-470b-a251-705d9c0ff1b0'))
moveImg2:any = new engine.Sprite(getTexture('9be94bf5-5dd9-470b-a251-705d9c0ff1b0'))
addPercent:number
moveImgContainer:any = new engine.Container();
constructor(){
super();
this.percent = 0;
......@@ -17,7 +22,6 @@ export default class Moist extends engine.Container{
this.moistBg.addChild(this.moist)
this.moist.mask = this.moistCover;
this.txt.text = this.percent*100+'%';
this.txt.size = 30;
this.txt.fillColor = '#7A83C5';
......@@ -28,9 +32,24 @@ export default class Moist extends engine.Container{
this.hintpic.x = -10;
this.hintpic.y = 440;
this.addChild(this.hintpic)
}
// move(x,y){
// engine.Tween.get(this.moveImg1)
// .set({x:x,y:80})
// .to({x:x-this.moveImg1.width * 2,y:80},500)
// engine.Tween.get(this.moveImg2)
// .set({x:x + this.moveImg1.width - 5,y:80})
// .to({x:(x - this.moveImg1.width*2 - 5),y:80},500)
// }
cover(percent){
percent = percent.toPrecision(2);
this.moistCover.anchorY = 416;
this.moistBg.addChild(this.moistCover)
this.moistCover.scaleY = percent;
......
import {getTexture} from './utils'
import {props} from '../props'
export default class TimeCounter extends engine.Container{
timeCounter:engine.Sprite = new engine.Sprite(getTexture('b7d2a60a-9e60-4eca-be80-a991abea47c9'));
......@@ -8,7 +9,7 @@ export default class TimeCounter extends engine.Container{
constructor(){
super()
this.time = 20
this.time = props.GAME_TIME;
this.addChild(this.timeCounter)
this.timeCounter.x = 256;
......
......@@ -17,7 +17,10 @@ function launchWithCustomModule(customModule) {
//engine.registerCustomCodeModule(customModule);
engine.registerCustomModule(customId, window[customId]);
const { props: propsOption, assets } = customModule;
const {
props: propsOption,
assets
} = customModule;
let props = engine.computeProps(customModuleProps, propsOption);
const customModuleIns = {
id: customId,
......@@ -55,8 +58,8 @@ function launchWithCustomModule(customModule) {
});
const d = engine.gameStage.sceneContainer.getChildAt(0);
engine.gameStage.sceneContainer.getChildAt(0).x = (d.stage.width-props.W)/2;
engine.gameStage.sceneContainer.getChildAt(0).y = (d.stage.height-props.H)/2;
engine.gameStage.sceneContainer.getChildAt(0).x = (d.stage.width - props.W) / 2;
engine.gameStage.sceneContainer.getChildAt(0).y = (d.stage.height - props.H) / 2;
}, 1000);
// setTimeout(() => {
......@@ -85,4 +88,4 @@ function getAssetByUUID(uuid) {
function getProps() {
return engine.getProps(customId);
}
}
\ No newline at end of file
......@@ -12,6 +12,7 @@
function injectProps(p) {
engine.injectProp(props, p);
}
//# sourceMappingURL=props.js.map
var picMap = {};
var posMap = {};
......@@ -64,6 +65,7 @@
posMap[url] = pos.concat([]);
return [spr, pos];
});
//# sourceMappingURL=qietu.js.map
function getIndexFromRC(row, col, maxCol) {
var index;
......@@ -75,6 +77,7 @@
return .5 - Math.random();
});
}
//# sourceMappingURL=utils.js.map
var MAX_COL;
var MAX_ROW;
......@@ -95,9 +98,9 @@
}
GameView.prototype.start = function () {
var _this = this;
MAX_COL = props.column || props.MAX_COL;
MAX_ROW = props.row || props.MAX_ROW;
GAME_TIME = props.gameTime || props.GAME_TIME;
MAX_COL = props.MAX_COL;
MAX_ROW = props.MAX_ROW;
GAME_TIME = props.GAME_TIME;
console.log('start', props.column, props.row, props.gameTime);
if (!this.guideHole) {
this.guideHole = new engine.Image();
......@@ -151,7 +154,7 @@
if (GAME_TIME < 10) {
GAME_TIME = '0' + GAME_TIME;
}
console.log(GAME_TIME);
console.log(GAME_TIME, "gametime1");
engine.globalEvent.dispatchEvent('pictures-time-update', {
second: this.getSecond(),
});
......@@ -187,6 +190,7 @@
MAX_COL = props.MAX_COL;
MAX_ROW = props.MAX_ROW;
GAME_TIME = props.GAME_TIME;
console.log(GAME_TIME, 'setuptime');
W = props.W;
H = props.H;
GAP = props.GAP;
......@@ -292,6 +296,7 @@
};
return GameWrapper;
}(engine.Container));
//# sourceMappingURL=GameWrapper.js.map
function index (props) {
prepareProps();
......@@ -299,6 +304,7 @@
var instance = new GameWrapper();
return instance;
}
//# sourceMappingURL=index.js.map
return index;
......
This diff is collapsed.
......@@ -10,7 +10,7 @@
"MAX_ROW": {
"alias": "图片分成几行",
"type": "number",
"default": 4
"default": 3
},
"W": {
"alias": "图片的宽度",
......@@ -40,21 +40,19 @@
"GAME_TIME": {
"alias": "游戏时间",
"type": "number",
"default": 10
"default": 100
}
},
"assets": [
{
"name": "遮罩",
"url": "//yun.duiba.com.cn/aurora/assets/5b3e30496b2d9fdafb0cf3835fd6704ce10e45b4.png",
"uuid": "888",
"ext": ".png"
}
],
"assets": [{
"name": "遮罩",
"url": "//yun.duiba.com.cn/aurora/assets/5b3e30496b2d9fdafb0cf3835fd6704ce10e45b4.png",
"uuid": "888",
"ext": ".png"
}],
"events": {
"in": {
"pictures-start": {
"alias": "开始",
"data": {
......@@ -73,7 +71,7 @@
"pictures-time-update": {
"alias": "倒计时更新",
"data": {
"time":"剩余时间"
"time": "剩余时间"
}
},
"pictures-game-fail": {
......
/**
* Created by rockyl on 2018/8/16.
*/
import { props } from "../props";
//Created by rockyl on 2018/8/16.
import qietu from "./qietu";
import { getIndexFromRC, getRandomArray, getTexture } from "./utils";
import {props} from '../props'
import ObjectPool = engine.ObjectPool;
// let OFFSET_X;
......@@ -27,12 +24,16 @@ export default class GameView extends engine.Container {
private date
start() {
//优先获取start事件接收到的参数
MAX_COL = props.column || props.MAX_COL;
MAX_ROW = props.row || props.MAX_ROW;
GAME_TIME = props.gameTime || props.GAME_TIME;
console.log('start',props.column,props.row,props.gameTime)
// MAX_COL = props.column || props.MAX_COL;
// MAX_ROW = props.row || props.MAX_ROW;
// GAME_TIME = props.gameTime || props.GAME_TIME;
MAX_COL = props.MAX_COL;
MAX_ROW = props.MAX_ROW;
GAME_TIME = props.GAME_TIME;
console.log('start',props.column,props.row,props.gameTime)
if (!this.guideHole) {
this.guideHole = new engine.Image();
this.guideHole.source = 'asset://' + props.blockUrl;
......@@ -106,7 +107,7 @@ export default class GameView extends engine.Container {
if (GAME_TIME < 10) {
GAME_TIME = '0' + GAME_TIME
}
console.log(GAME_TIME);
console.log(GAME_TIME,"gametime1");
engine.globalEvent.dispatchEvent('pictures-time-update', {
......@@ -190,6 +191,7 @@ export default class GameView extends engine.Container {
GAME_TIME = props.GAME_TIME;
// OFFSET_X = props.OFFSET_X;
// OFFSET_Y = props.OFFSET_Y;
console.log(GAME_TIME,'setuptime')
W = props.W;
H = props.H;
GAP = props.GAP;
......
......@@ -19,14 +19,16 @@ export default class TestView extends engine.Container{
this.stageBg = new engine.Sprite(getTexture('308742a0-0ea2-4610-b34a-a230add82021'))
this.addChild(this.stageBg)
this.gameBg = new engine.Sprite(getTexture('76820072-df5a-4ab7-8cb7-10c8cd8605c8'))
/* this.gameBg = new engine.Sprite(getTexture('76820072-df5a-4ab7-8cb7-10c8cd8605c8'))
// 开始按钮
this.startBtn = new engine.Sprite(getTexture('855e3d77-ffff-443d-b884-4f67a2ebe458'))
this.startBtn.x = (750 - this.startBtn.width) / 2;
this.startBtn.y = (this.stage.height - this.startBtn.height) / 2 + 300;
this.stageBg.addChild(this.startBtn)
this.startBtn.addEventListener(engine.MouseEvent.CLICK,this.onClick,this)
this.startBtn.addEventListener(engine.MouseEvent.CLICK,this.onClick,this) */
}
smallBall:SmallPlane
......@@ -63,7 +65,7 @@ export default class TestView extends engine.Container{
score:number = 0;
start(){
// 炮车
this.planeModel = new engine.Sprite(getTexture('32ec481a-3f75-4c36-95ed-ee97aa936517'))
/* this.planeModel = new engine.Sprite(getTexture('32ec481a-3f75-4c36-95ed-ee97aa936517'))
this.planeModel.x = (750 - this.planeModel.width) / 2;
this.planeModel.y = (this.stage.height - this.planeModel.height)
this.planeModel.addEventListener(engine.MouseEvent.MOUSE_DOWN,this.onDown,this)
......@@ -173,13 +175,13 @@ export default class TestView extends engine.Container{
},16)
*/
}
onClick(){
/* onClick(){
this.addChild(this.gameBg);
this.gameBg.addChild(this.planeModel)
}
......@@ -215,6 +217,6 @@ export default class TestView extends engine.Container{
stop(){
}
} */
}
\ No newline at end of file
......@@ -12,7 +12,6 @@
function injectProps(p) {
engine.injectProp(props, p);
}
//# sourceMappingURL=props.js.map
var qietu = (function (parent, url, MAX_COL, MAX_ROW) {
var W = props.W;
......@@ -55,7 +54,6 @@
console.log(spr);
return [spr, pos];
});
//# sourceMappingURL=qietu.js.map
function getIndexFromRC(row, col, maxCol) {
var index;
......@@ -255,7 +253,6 @@
};
return GameView;
}(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super);
......@@ -276,7 +273,6 @@
};
return GameWrapper;
}(engine.Container));
//# sourceMappingURL=GameWrapper.js.map
function index (props) {
prepareProps();
......@@ -284,7 +280,6 @@
var instance = new GameWrapper();
return instance;
}
//# sourceMappingURL=index.js.map
return index;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -95,15 +95,7 @@ export default class GameView extends engine.Container {
this.addChild(tmpRect);
basket_bottom.mask = tmpRect;
let basket_top = this._basket_top = new engine.Sprite(getTextureByName('basket_top'));
basket_top.x = 287;
basket_top.y = 485;
this.addChild(basket_top);
let glass = this._basket_top = new engine.Sprite(getTextureByName('玻璃'));
glass.x = (750-glass.width)/2;
glass.y = 340;
this.addChild(glass);
let gameData = this._gameData = new GameData(contPng,color);
......@@ -114,10 +106,12 @@ export default class GameView extends engine.Container {
countDown.x = 5;
countDown.y = 180;
this.addChild(countDown);
this._curLevelTime = getlevelTime()
let countDownLabel = this._countDownLabel = Tool.getLabel(this._curLevelTime,48,"#ffffff")
countDownLabel.x = (countDown.width-countDownLabel.width)/2
let countDownLabel = this._countDownLabel = Tool.getLabel(this._curLevelTime,48,"#ffffff",false,engine.TEXT_ALIGN.CENTER)
countDownLabel.width = 160
countDownLabel.x = 0
countDownLabel.y = (countDown.height-countDownLabel.height)/2 - 5
countDown.addChild(countDownLabel);
......@@ -142,6 +136,15 @@ export default class GameView extends engine.Container {
// rect.addChild(toast);
this.startHandle();
let basket_top = this._basket_top = new engine.Sprite(getTextureByName('basket_top'));
basket_top.x = 287;
basket_top.y = 485;
this.addChild(basket_top);
let glass = this._basket_top = new engine.Sprite(getTextureByName('玻璃'));
glass.x = (750-glass.width)/2;
glass.y = 340;
this.addChild(glass);
this.levelHint();
}
private _lvbg;
......@@ -241,7 +244,7 @@ export default class GameView extends engine.Container {
this._gameData.levelUpdate();
this._curLevelTime = getlevelTime()
this._countDownLabel.text = this._curLevelTime;
this._countDownLabel.x = (this._countDown.width-this._countDownLabel.width)/2
//this._countDownLabel.x = (this._countDown.width-this._countDownLabel.width)/2
this.runEngine();
}
themeChange(data){
......@@ -395,7 +398,7 @@ export default class GameView extends engine.Container {
updateCountDown(){
this._curLevelTime --
this._countDownLabel.text = this._curLevelTime;
this._countDownLabel.x = (this._countDown.width-this._countDownLabel.width)/2
//this._countDownLabel.x = (this._countDown.width-this._countDownLabel.width)/2
if(this._curLevelTime <= 0)
{
this.end();
......
......@@ -29,7 +29,7 @@ export class GameWrapper extends engine.Container {
//this.start(null);
// setTimeout(() => {
// engine.globalEvent.dispatchEvent('seabed-game-startNextLevel',{level:2});
// engine.globalEvent.dispatchEvent('seabed-game-startNextLevel',{level:1});
// }, 300);
}
start(event: engine.Event) {
......
This 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