zc 2 yıl önce
ebeveyn
işleme
ba4c055b4f

+ 22 - 3
assets/scence/game.scene

@@ -2066,7 +2066,7 @@
         "__id__": 447
       }
     ],
-    "_active": false,
+    "_active": true,
     "_components": [
       {
         "__id__": 482
@@ -20104,7 +20104,26 @@
     "textLiveRank": {
       "__id__": 486
     },
-    "rankNods": [],
+    "rankNods": [
+      {
+        "__id__": 497
+      },
+      {
+        "__id__": 521
+      },
+      {
+        "__id__": 533
+      },
+      {
+        "__id__": 545
+      },
+      {
+        "__id__": 557
+      },
+      {
+        "__id__": 509
+      }
+    ],
     "textPointsRank": {
       "__id__": 489
     },
@@ -21787,7 +21806,7 @@
         "__id__": 620
       }
     ],
-    "_active": true,
+    "_active": false,
     "_components": [
       {
         "__id__": 623

+ 2 - 2
assets/scripts/RoleCtr.ts

@@ -111,8 +111,7 @@ export class RoleCtr extends Component {
         for (let i = 0; i < this.deathNodes.length; i++) {
             const node = roleNodes[this.deathNodes[i].name]
             if (node) {
-                let hp = node.getChildByName("progressbar_hp").getComponent(ProgressBar).progress
-                hp = 0
+                node.getChildByName("progressbar_hp").getComponent(ProgressBar).progress = 0
                 const imgMask: Node = node.getChildByName("icon_mask")
                 const default_icon: Node = node.getChildByName("img_icon")
                 const imgNode: Node = imgMask.getChildByName("user_icon")
@@ -155,6 +154,7 @@ export class RoleCtr extends Component {
         const effect: Node = node.getChildByName("effect_pannel")
         const default_icon: Node = node.getChildByName("img_icon")
 
+
         //新角色席位刷新头像
         if (nameNode.active) {
             //已存在则只更新hp

+ 23 - 8
assets/scripts/gameCtr.ts

@@ -66,6 +66,7 @@ export class GameCtr extends Component {
 
     public roomId: number = 1
     public gameId: number = 1
+    public resetNum: number = 1
 
     private gameInfo: any = null
     private historyInfo: any[] = []
@@ -112,6 +113,16 @@ export class GameCtr extends Component {
 
     init() {
 
+        let roomId = (new URLSearchParams(location.search)).get('roomId')
+        if(roomId != null)
+        {
+            this.roomId = Number(roomId)
+            console.log('get roomId from URL:'+roomId)
+        }else
+        {
+            console.log('use defult roomId')
+        }
+
         const roomUrl = `https://airpg1.izouma.com/api/room/${this.roomId}`
 
         fetch(roomUrl)
@@ -146,6 +157,8 @@ export class GameCtr extends Component {
                         console.log(data)
                         const historyUrl = `https://airpg1.izouma.com/api/game/${this.gameId}/history`
                         this.gameInfo = data
+                        this.resetNum = data.resetNum
+
                         fetch(historyUrl)
                             .then((response) => {
                                 if (!response.ok) {
@@ -200,7 +213,7 @@ export class GameCtr extends Component {
 
 
     start() {
-        // this.startResetAnimation()
+        this.startResetAnimation()
         // this.scheduleOnce(() => { this.accessTargetComponent() }, 0.1)
         this.scheduleOnce(() => { this.init() }, 1)
         this.processCtr.init(this)
@@ -331,8 +344,9 @@ export class GameCtr extends Component {
         this.storyPannelCtr.storyContent = data.data
         this.storyPannelCtr.isOnProcess = true;
 
-        //初始化后第一次收到剧情,直接展示剧情
-        if (this.storyActionStatus == 0) {
+        //0:初始化后第一次收到剧情,直接展示剧情
+        //3:接收到了最后一次剧情展示后清除队列
+        if (this.storyActionStatus == 0 ||this.storyActionStatus == 3 ) {
             if (this.storyPannelCtr) {
                 this.storyPannelCtr.updateStory(data.data)
             } else {
@@ -342,7 +356,7 @@ export class GameCtr extends Component {
             this.noticeCtr.updateText(this.noticeStr)
         } else if (this.storyActionStatus == 2) {
             this.optionsAppearAction()
-        }
+        } 
     }
 
     //处理收到选项事件
@@ -385,7 +399,7 @@ export class GameCtr extends Component {
     handleNewPlayer(data: any) {
 
         this.player.push(data.data)
-        let playerIndex = this.player.length
+        let playerIndex = this.player.length -1
 
         if (playerIndex === 8) {
             return
@@ -394,6 +408,7 @@ export class GameCtr extends Component {
         const role: Node = this.roleCtr.node.getChildByName(rolePannelName)
         role.active = true
 
+        console.log('new player@!!!!!!:'+data.data)
         this.roleCtr.newPlayer(role, this.player[playerIndex])
 
         this.roleNodes[data.data.name] = role
@@ -466,7 +481,7 @@ export class GameCtr extends Component {
                     }
                 }
 
-                //隐藏剧情面板
+                //隐藏上边剧情面板
                 tween(this.storyPannelCtr.node.parent.getComponent(UIOpacity))
                     .to(1, { opacity: 0 })
                     .call(() => {
@@ -614,7 +629,7 @@ export class GameCtr extends Component {
         }
 
         this.titlePannel.getChildByName("text_title").getComponent(Label).string = this.gameInfo.name
-        this.titlePannel.getChildByName("text_gameNo").getComponent(Label).string = "No." + this.gameId
+        this.titlePannel.getChildByName("text_gameNo").getComponent(Label).string = "No." + (this.resetNum+1)
         // 计算日期差(结果单位为毫秒)
         const lastHistoryDate = new Date(lastHistory.date)
         const firstHistoryDate = new Date(firstHistory.date)
@@ -636,7 +651,7 @@ export class GameCtr extends Component {
             this.exchangeTime()
         }
         this.titlePannel.getChildByName("text_title").getComponent(Label).string = this.gameInfo.name
-        this.titlePannel.getChildByName("text_gameNo").getComponent(Label).string = "No." + this.gameId
+        this.titlePannel.getChildByName("text_gameNo").getComponent(Label).string = "No." + (this.resetNum+1)
         // 计算日期差(结果单位为毫秒)
         const lastHistoryDate = new Date(data.data.date)
         const firstHistoryDate = new Date(this.historyInfo[0].date)

+ 2 - 2
assets/scripts/socket/SocketClient.ts

@@ -33,7 +33,7 @@ export class SocketClient extends Component {
         })
 
         this.socket.on(`${this.gameId}`, (data) => {
-            console.log(data.type)
+            console.log('接收到消息:'+data.type)
 
             if (typeof data === "string") {
                 try {
@@ -45,7 +45,7 @@ export class SocketClient extends Component {
             }
 
             if (data && data.type) {
-                console.log(data.type)
+                console.log('加入处理队列:'+data.type)
                 this.processCtr.messageQueue.push(data) // Push the message to the queue
                 this.processCtr.processNextMessage() // Attempt to process the next message
             }

+ 3 - 3
assets/scripts/socket/processCtr.ts

@@ -25,13 +25,13 @@ export class processCtr extends Component {
 
 
     processNextMessage = function () {
-        console.log("processDoing:" + this.isProcessing + "   " + this.messageQueue.length)
         if (this.isProcessing || this.messageQueue.length === 0) {
             return;  // If a message is currently being processed or there's no message in the queue, exit
         }
-
+        
         const data = this.messageQueue.shift();  // Dequeue the next message
         this.isProcessing = true;
+        console.log("processDoing 处理消息:" + data.type + "   消息队列剩余:" + this.messageQueue.length)
 
         switch (data.type) {
             case "plot":
@@ -112,7 +112,7 @@ export class processCtr extends Component {
     }
 
     private handleNewPalyerMessage(data: any) {
-        console.log("Received timeChange message:", data)
+        console.log("Received newPlayer message:", data)
         // 在这里处理 "time change" 类型的消息.
         this.gameCtr.handleNewPlayer(data);
     }