socket收到消息通过this.GameWaitRoom.message1(data)将数据发到GameWaitRoom页面,页面收到消息直接赋值不展示
页面中定义:
public message(data) {
console.log(data, "首页拿到的数据")
this.tostText = data
this.noticetext.text = data.detail.msg
}
public GameWaitRoom: GameWaitRoom = new GameWaitRoom();
public StartScene: StartScene = new StartScene()
//socket消息
public onReceiveMessage(): any {
//读取数据
console.log("mysocket通知的消息")
let data = JSON.parse(this.socket.readUTF());
console.log(data, "mysocket的数据")
this.socketData = data
if (data.action == "update_match_enroll" || data.action == "update_match_time") {
this.GameWaitRoom.message1(data)
}
if (data.action == "system_information") {
this.StartScene.message(data)
}
}
|
|