Commit b35a62d8 by Shawn Wang

asldjoasd

parent 48a42560
class Controller extends egret.Sprite { class Controller extends egret.Sprite {
private myPosition = {} private myPosition = {}
public constructor() { public constructor(isCatcher) {
super(); super();
this.init() this.init(isCatcher)
} }
private control = new egret.Bitmap() private control = new egret.Bitmap()
...@@ -14,13 +14,14 @@ class Controller extends egret.Sprite { ...@@ -14,13 +14,14 @@ class Controller extends egret.Sprite {
private right = new egret.Shape() private right = new egret.Shape()
// 初始化(给开始按钮绑定点击事件) // 初始化(给开始按钮绑定点击事件)
private init() { private init(isCatcher) {
this.panel.graphics.beginFill(0x353E5D, 1) this.panel.graphics.beginFill(0x00ff00, 1)
this.panel.graphics.drawRect(1008, 0, 326, 750) this.panel.graphics.drawRect(1008, 0, 326, 750)
this.panel.graphics.endFill() this.panel.graphics.endFill()
this.addChild(this.panel) this.addChild(this.panel)
if(!isCatcher){
let texture: egret.Texture = RES.getRes("control_jpg") let texture: egret.Texture = RES.getRes("control_jpg")
this.control.texture = texture this.control.texture = texture
...@@ -29,7 +30,6 @@ class Controller extends egret.Sprite { ...@@ -29,7 +30,6 @@ class Controller extends egret.Sprite {
controlContainer.x = 1040 controlContainer.x = 1040
controlContainer.y = 450 controlContainer.y = 450
controlContainer.addChild(this.control) controlContainer.addChild(this.control)
this.up.graphics.beginFill(0xFF00FF, 1) this.up.graphics.beginFill(0xFF00FF, 1)
this.up.graphics.drawRect(93, 0, 80, 80) this.up.graphics.drawRect(93, 0, 80, 80)
this.up.graphics.endFill() this.up.graphics.endFill()
...@@ -62,6 +62,7 @@ class Controller extends egret.Sprite { ...@@ -62,6 +62,7 @@ class Controller extends egret.Sprite {
controlContainer.addChild(this.down) controlContainer.addChild(this.down)
controlContainer.addChild(this.left) controlContainer.addChild(this.left)
controlContainer.addChild(this.right) controlContainer.addChild(this.right)
}
const me = Store.getState().runners.find(runner => runner.t_cid === Store.getState().cid) const me = Store.getState().runners.find(runner => runner.t_cid === Store.getState().cid)
......
...@@ -16,11 +16,10 @@ class GameScene extends egret.Sprite { ...@@ -16,11 +16,10 @@ class GameScene extends egret.Sprite {
bg.graphics.drawRect(0,0,1334, 750) bg.graphics.drawRect(0,0,1334, 750)
bg.graphics.endFill() bg.graphics.endFill()
this.addChild(bg) this.addChild(bg)
if (!Store.isCatcher()) { // if (!Store.isCatcher()) {
this.controller = new Controller() this.controller = new Controller(Store.isCatcher())
this.addChild(this.controller) this.addChild(this.controller)
// }
}
this.map = new Map() this.map = new Map()
this.map.y = 15 this.map.y = 15
this.map.x = 10 this.map.x = 10
......
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