Commit a8f4e7df by Mike Zhu

房间里准备增加头像

parent 6d265e88
......@@ -2,6 +2,7 @@ class RoomScene extends egret.Sprite {
private startLabel: egret.TextField
private players: Array<any>
private playerContainer: egret.DisplayObjectContainer
public constructor() {
super();
......@@ -13,8 +14,10 @@ class RoomScene extends egret.Sprite {
console.log('RoomScene.init')
this.initBg()
this.initStartLabel()
this.initPlayerContainer()
this.addChild(this.startLabel);
// var sound: egret.Sound = RES.getRes("catched_0_mp3");
// sound.play();
// put display object to this scene
}
......@@ -22,14 +25,7 @@ class RoomScene extends egret.Sprite {
switch (data.type) {
case 'entry':
const payload = data.payload
if (payload.seat == 0) {
this.startLabel.text = '开始'
this.startLabel.touchEnabled = true
this.startLabel.addEventListener(egret.TouchEvent.TOUCH_TAP, this.startHandler, this)
} else {
this.startLabel.text = '等待房主点击开始'
this.startLabel.touchEnabled = false
}
this.updateStartLabelAndPlayers(payload)
break;
case 'game_ready':
this.countDown(payload)
......@@ -39,6 +35,18 @@ class RoomScene extends egret.Sprite {
}
private updateStartLabelAndPlayers(payload) {
if (payload.seat == 0) {
this.startLabel.text = '开始'
this.startLabel.touchEnabled = true
this.startLabel.addEventListener(egret.TouchEvent.TOUCH_TAP, this.startHandler, this)
} else {
this.startLabel.text = '等待房主点击开始'
this.startLabel.touchEnabled = false
}
const members = payload.members
this.addChild(this.playerContainer)
}
private countDown(res) {
this.startLabel.text = '3'
const timer = setInterval(() => {
......@@ -77,6 +85,11 @@ class RoomScene extends egret.Sprite {
this.startLabel.textAlign = egret.HorizontalAlign.CENTER;
this.startLabel.y = 1136 / 2
}
private initPlayerContainer() {
this.playerContainer = new egret.DisplayObjectContainer()
this.playerContainer.width = 600
this.playerContainer.height = 200
}
private startHandler() {
console.log('starthandler')
......
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