소스 검색

新增测谎仪和个人资料ui以及名单ui完善

sanyueqi1 1 주 전
부모
커밋
e45d842dd2

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 387 - 322
assets/Scenes/MainScene.scene


+ 0 - 0
assets/resources/avatars/4/avatar_11_1.png → assets/resources/avatars/4/avatar_4_1.png


+ 2 - 2
assets/resources/avatars/4/avatar_11_1.png.meta → assets/resources/avatars/4/avatar_4_1.png.meta

@@ -11,7 +11,7 @@
     "6c48a": {
       "importer": "texture",
       "uuid": "a4aaab4e-069a-43fe-8ad6-29adbd625c97@6c48a",
-      "displayName": "avatar_11_1",
+      "displayName": "avatar_4_1",
       "id": "6c48a",
       "name": "texture",
       "userData": {
@@ -35,7 +35,7 @@
     "f9941": {
       "importer": "sprite-frame",
       "uuid": "a4aaab4e-069a-43fe-8ad6-29adbd625c97@f9941",
-      "displayName": "avatar_11_1",
+      "displayName": "avatar_4_1",
       "id": "f9941",
       "name": "spriteFrame",
       "userData": {

+ 0 - 0
assets/resources/avatars/4/avatar_11_2.png → assets/resources/avatars/4/avatar_4_2.png


+ 2 - 2
assets/resources/avatars/4/avatar_11_2.png.meta → assets/resources/avatars/4/avatar_4_2.png.meta

@@ -11,7 +11,7 @@
     "6c48a": {
       "importer": "texture",
       "uuid": "11b96a12-1062-4074-b8ed-3da9b0865c31@6c48a",
-      "displayName": "avatar_11_2",
+      "displayName": "avatar_4_2",
       "id": "6c48a",
       "name": "texture",
       "userData": {
@@ -35,7 +35,7 @@
     "f9941": {
       "importer": "sprite-frame",
       "uuid": "11b96a12-1062-4074-b8ed-3da9b0865c31@f9941",
-      "displayName": "avatar_11_2",
+      "displayName": "avatar_4_2",
       "id": "f9941",
       "name": "spriteFrame",
       "userData": {

+ 0 - 0
assets/resources/avatars/4/avatar_11_3.png → assets/resources/avatars/4/avatar_4_3.png


+ 2 - 2
assets/resources/avatars/4/avatar_11_3.png.meta → assets/resources/avatars/4/avatar_4_3.png.meta

@@ -11,7 +11,7 @@
     "6c48a": {
       "importer": "texture",
       "uuid": "6d88e772-1ad4-4472-bd0f-5a0ff038f926@6c48a",
-      "displayName": "avatar_11_3",
+      "displayName": "avatar_4_3",
       "id": "6c48a",
       "name": "texture",
       "userData": {
@@ -35,7 +35,7 @@
     "f9941": {
       "importer": "sprite-frame",
       "uuid": "6d88e772-1ad4-4472-bd0f-5a0ff038f926@f9941",
-      "displayName": "avatar_11_3",
+      "displayName": "avatar_4_3",
       "id": "f9941",
       "name": "spriteFrame",
       "userData": {

+ 0 - 0
assets/resources/avatars/4/avatar_11_4.png → assets/resources/avatars/4/avatar_4_4.png


+ 2 - 2
assets/resources/avatars/4/avatar_11_4.png.meta → assets/resources/avatars/4/avatar_4_4.png.meta

@@ -11,7 +11,7 @@
     "6c48a": {
       "importer": "texture",
       "uuid": "da053c52-9f59-44e2-873e-3af3336b2bbd@6c48a",
-      "displayName": "avatar_11_4",
+      "displayName": "avatar_4_4",
       "id": "6c48a",
       "name": "texture",
       "userData": {
@@ -35,7 +35,7 @@
     "f9941": {
       "importer": "sprite-frame",
       "uuid": "da053c52-9f59-44e2-873e-3af3336b2bbd@f9941",
-      "displayName": "avatar_11_4",
+      "displayName": "avatar_4_4",
       "id": "f9941",
       "name": "spriteFrame",
       "userData": {

+ 0 - 0
assets/resources/avatars/4/avatar_11_5.png → assets/resources/avatars/4/avatar_4_5.png


+ 2 - 2
assets/resources/avatars/4/avatar_11_5.png.meta → assets/resources/avatars/4/avatar_4_5.png.meta

@@ -11,7 +11,7 @@
     "6c48a": {
       "importer": "texture",
       "uuid": "50be3b2c-a127-495d-a385-2c7e1d1318e9@6c48a",
-      "displayName": "avatar_11_5",
+      "displayName": "avatar_4_5",
       "id": "6c48a",
       "name": "texture",
       "userData": {
@@ -35,7 +35,7 @@
     "f9941": {
       "importer": "sprite-frame",
       "uuid": "50be3b2c-a127-495d-a385-2c7e1d1318e9@f9941",
-      "displayName": "avatar_11_5",
+      "displayName": "avatar_4_5",
       "id": "f9941",
       "name": "spriteFrame",
       "userData": {

+ 400 - 0
assets/resources/prefabs.prefab

@@ -0,0 +1,400 @@
+[
+  {
+    "__type__": "cc.Prefab",
+    "_name": "prefabs",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_native": "",
+    "data": {
+      "__id__": 1
+    },
+    "optimizationPolicy": 0,
+    "persistent": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "prefabs",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      },
+      {
+        "__id__": 8
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 14
+      }
+    ],
+    "_prefab": {
+      "__id__": 16
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Sprite",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 3
+      },
+      {
+        "__id__": 5
+      }
+    ],
+    "_prefab": {
+      "__id__": 7
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 4
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 40,
+      "height": 36
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "fe4OnTW4pExZI5wy2VP+5R"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 6
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "57520716-48c8-4a19-8acf-41c9f8777fb0@f9941",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 1,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "52ktgBdw5FWKL5KsFgTgBl"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "6c0URqW8dEcqpcr7kAqqwO",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Label",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 9
+      },
+      {
+        "__id__": 11
+      }
+    ],
+    "_prefab": {
+      "__id__": 13
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 8
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 10
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 42.255859375,
+      "height": 50.4
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "dfIVWrRW9BDJt2XOI5E6Ju"
+  },
+  {
+    "__type__": "cc.Label",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 8
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 12
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_string": "label",
+    "_horizontalAlign": 1,
+    "_verticalAlign": 1,
+    "_actualFontSize": 20,
+    "_fontSize": 20,
+    "_fontFamily": "Arial",
+    "_lineHeight": 40,
+    "_overflow": 0,
+    "_enableWrapText": true,
+    "_font": null,
+    "_isSystemFontUsed": true,
+    "_spacingX": 0,
+    "_isItalic": false,
+    "_isBold": false,
+    "_isUnderline": false,
+    "_underlineHeight": 2,
+    "_cacheMode": 0,
+    "_enableOutline": false,
+    "_outlineColor": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_outlineWidth": 2,
+    "_enableShadow": false,
+    "_shadowColor": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_shadowOffset": {
+      "__type__": "cc.Vec2",
+      "x": 2,
+      "y": 2
+    },
+    "_shadowBlur": 2,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "97igAwKtVAuLiXVQikje9i"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "54DpevuttKFKGv6whUervp",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 15
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 100,
+      "height": 100
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "a6uYiFauJOf4FHkY1YiKps"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "b3AGVdtClPdK3VQV9TeVW4",
+    "targetOverrides": null
+  }
+]

+ 13 - 0
assets/resources/prefabs.prefab.meta

@@ -0,0 +1,13 @@
+{
+  "ver": "1.1.50",
+  "importer": "prefab",
+  "imported": true,
+  "uuid": "2414cbdd-c52f-4534-ab9c-4331461e5e0a",
+  "files": [
+    ".json"
+  ],
+  "subMetas": {},
+  "userData": {
+    "syncNodeName": "prefabs"
+  }
+}

+ 227 - 0
assets/scripts/GameFlowManager.ts

@@ -3,6 +3,11 @@ import { DataManager } from './DataManager';
 import { CharacterManager } from './CharacterManager';
 import { QuestionAnswerManager } from './QuestionAnswerManager';
 import { AvatarManager } from './AvatarManager';
+import { PassCardManager } from './PassCardManager';
+import { PhoneManager } from './PhoneManager';
+import { RosterManager } from './RosterManager';
+import { PersonalInfoManager } from './PersonalInfoManager';
+import { LieDetectorManager } from './LieDetectorManager';
 
 const { ccclass, property } = _decorator;
 
@@ -44,6 +49,36 @@ export class GameFlowManager extends Component {
     })
     avatarManager: AvatarManager = null;
 
+    @property({
+        type: PassCardManager,
+        tooltip: '通行证管理器引用'
+    })
+    passCardManager: PassCardManager = null;
+
+    @property({
+        type: PhoneManager,
+        tooltip: '电话管理器引用'
+    })
+    phoneManager: PhoneManager = null;
+
+    @property({
+        type: RosterManager,
+        tooltip: '名单管理器引用'
+    })
+    rosterManager: RosterManager = null;
+
+    @property({
+        type: PersonalInfoManager,
+        tooltip: '个人资料管理器引用'
+    })
+    personalInfoManager: PersonalInfoManager = null;
+
+    @property({
+        type: LieDetectorManager,
+        tooltip: '测谎仪管理器引用'
+    })
+    lieDetectorManager: LieDetectorManager = null;
+
     // 当前关卡中的NPC索引
     private currentNpcIndex: number = -1;
     
@@ -51,6 +86,9 @@ export class GameFlowManager extends Component {
     private currentNpcs: any[] = [];
 
     start() {
+        // 初始化UI管理器
+        this.initUIManagers();
+        
         // 注册按钮事件
         this.registerButtonEvents();
         
@@ -58,6 +96,38 @@ export class GameFlowManager extends Component {
         this.startGameFlow();
     }
 
+    /**
+     * 初始化UI管理器
+     */
+    private initUIManagers(): void {
+        // 检查通行证管理器是否被正确引用
+        if (!this.passCardManager) {
+            console.error('通行证管理器未设置');
+        }
+        
+        // 检查电话管理器是否被正确引用
+        if (!this.phoneManager) {
+            console.error('电话管理器未设置');
+        }
+        
+        // 检查名单管理器是否被正确引用
+        if (!this.rosterManager) {
+            console.error('名单管理器未设置');
+        }
+        
+        // 检查个人资料管理器是否被正确引用
+        if (!this.personalInfoManager) {
+            console.error('个人资料管理器未设置');
+        }
+        
+        // 检查测谎仪管理器是否被正确引用
+        if (!this.lieDetectorManager) {
+            console.error('测谎仪管理器未设置');
+        }
+        
+        console.log('所有UI管理器已初始化');
+    }
+
     /**
      * 注册按钮事件
      */
@@ -212,6 +282,163 @@ export class GameFlowManager extends Component {
         return this.currentNpcs[this.currentNpcIndex];
     }
 
+    /**
+     * 获取通行证管理器
+     * @returns 通行证管理器实例
+     */
+    public getPassCardManager(): PassCardManager {
+        return this.passCardManager;
+    }
+
+    /**
+     * 获取电话管理器
+     * @returns 电话管理器实例
+     */
+    public getPhoneManager(): PhoneManager {
+        return this.phoneManager;
+    }
+
+    /**
+     * 获取名单管理器
+     * @returns 名单管理器实例
+     */
+    public getRosterManager(): RosterManager {
+        return this.rosterManager;
+    }
+    
+    /**
+     * 获取个人资料管理器
+     * @returns 个人资料管理器实例
+     */
+    public getPersonalInfoManager(): PersonalInfoManager {
+        return this.personalInfoManager;
+    }
+    
+    /**
+     * 获取测谎仪管理器
+     * @returns 测谎仪管理器实例
+     */
+    public getLieDetectorManager(): LieDetectorManager {
+        return this.lieDetectorManager;
+    }
+    
+    /**
+     * 显示通行证
+     * @param passData 通行证数据
+     */
+    public showPassCard(passData: any): void {
+        if (this.passCardManager) {
+            this.passCardManager.showPassCard(passData);
+        } else {
+            console.error('通行证管理器未设置,无法显示通行证');
+        }
+    }
+    
+    /**
+     * 显示电话对话框
+     */
+    public showPhoneUI(): void {
+        if (this.phoneManager) {
+            this.phoneManager.showPhonePanel();
+        } else {
+            console.error('电话管理器未设置,无法显示电话UI');
+        }
+    }
+    
+    /**
+     * 显示名单面板
+     */
+    public showRosterPanel(): void {
+        if (this.rosterManager) {
+            this.rosterManager.showRosterPanel();
+        } else {
+            console.error('名单管理器未设置,无法显示名单面板');
+        }
+    }
+
+    /**
+     * 获取当前关卡名单数据并显示
+     */
+    public showCurrentLevelRoster(): void {
+        console.log("准备显示角色名单...");
+        
+        // 1. 从DataManager获取当前关卡数据
+        const currentLevel = this.dataManager.getCurrentLevel();
+        console.log("当前关卡数据:", currentLevel);
+        
+        if (!currentLevel || !currentLevel.npcs) {
+            console.error('无法获取当前关卡数据');
+            return;
+        }
+        
+        // 2. 构建人员数据,包括完整的头像路径
+        const personnelData = currentLevel.npcs.map(npc => {
+            return {
+                name: npc.characterName,
+                avatarPath: `avatars/${npc.characterId}/avatar_${npc.characterId}_5/spriteFrame` // 第5张头像
+            };
+        });
+        console.log("构建的人员数据:", personnelData);
+        
+        // 3. 调用RosterManager显示数据
+        if (this.rosterManager) {
+            console.log("RosterManager存在,准备显示人员列表");
+            this.rosterManager.displayLevelPersonnel(personnelData);
+            this.rosterManager.showRosterPanel();
+        } else {
+            console.error('名单管理器未设置,无法显示名单');
+        }
+    }
+
+    /**
+     * 显示当前NPC的个人资料
+     */
+    public showCurrentNpcPersonalInfo(): void {
+        // 获取当前NPC数据
+        const npcData = this.getCurrentNpcData();
+        if (!npcData) {
+            console.error('无法获取当前NPC数据');
+            return;
+        }
+        
+        // 显示个人资料
+        if (this.personalInfoManager) {
+            this.personalInfoManager.displayCharacterInfo({
+                characterId: npcData.characterId,
+                info: npcData.personal?.info || "无个人资料",
+                avatarPath: `avatars/${npcData.characterId}/avatar_${npcData.characterId}_5/spriteFrame`
+            });
+        } else {
+            console.error('个人资料管理器未设置');
+        }
+    }
+
+    /**
+     * 显示测谎仪面板
+     */
+    public showLieDetectorPanel(): void {
+        // 获取当前NPC数据
+        const npcData = this.getCurrentNpcData();
+        if (!npcData) {
+            console.error('无法获取当前NPC数据');
+            return;
+        }
+        
+        // 设置测谎仪状态并显示
+        if (this.lieDetectorManager) {
+            // 从NPC数据中获取是否为伪装者的状态
+            const isFake = npcData.type === 'fake';
+            
+            // 设置当前角色状态
+            this.lieDetectorManager.setCharacterStatus(isFake);
+            
+            // 显示测谎仪面板
+            this.lieDetectorManager.showLieDetectorPanel();
+        } else {
+            console.error('测谎仪管理器未设置');
+        }
+    }
+
     /**
      * 组件销毁时清理事件监听
      */

+ 92 - 164
assets/scripts/LieDetectorManager.ts

@@ -1,10 +1,8 @@
 import { _decorator, Component, Node, Button, Sprite, SpriteFrame, resources } from 'cc';
-import { GameFlowManager } from './GameFlowManager';
-import { DataManager } from './DataManager';
 const { ccclass, property } = _decorator;
 
 /**
- * 测谎仪管理器,控制测谎仪UI的显示和隐藏,并处理测谎功能
+ * 测谎仪管理器,负责测谎仪UI的显示和功能实现
  */
 @ccclass('LieDetectorManager')
 export class LieDetectorManager extends Component {
@@ -12,7 +10,7 @@ export class LieDetectorManager extends Component {
         type: Node,
         tooltip: '测谎仪UI面板'
     })
-    detectorPanel: Node = null;
+    lieDetectorPanel: Node = null;
     
     @property({
         type: Button,
@@ -22,229 +20,159 @@ export class LieDetectorManager extends Component {
     
     @property({
         type: Button,
-        tooltip: '测谎按钮(红色按钮)'
+        tooltip: '测谎按钮'
     })
-    testButton: Button = null;
+    detectButton: Button = null;
     
     @property({
         type: Sprite,
-        tooltip: '结果显示图片'
+        tooltip: '结果显示'
     })
     resultDisplay: Sprite = null;
     
-    @property({
-        type: GameFlowManager,
-        tooltip: '游戏流程管理器引用'
-    })
-    gameFlowManager: GameFlowManager = null;
-    
-    @property({
-        type: DataManager,
-        tooltip: '数据管理器引用'
-    })
-    dataManager: DataManager = null;
-    
     @property({
         type: SpriteFrame,
-        tooltip: '真结果图片'
+        tooltip: '真实结果图片'
     })
-    trueResultImage: SpriteFrame = null;
+    trueResultFrame: SpriteFrame = null;
     
     @property({
         type: SpriteFrame,
-        tooltip: '伪人结果图片'
-    })
-    fakeResultImage: SpriteFrame = null;
-    
-    // 添加默认资源路径属性
-    @property({
-        tooltip: '真人结果图片资源路径(可选)',
+        tooltip: '虚假结果图片'
     })
-    trueResultPath: string = 'ui/liedetector/true_result';
+    falseResultFrame: SpriteFrame = null;
     
     @property({
-        tooltip: '伪人结果图片资源路径(可选)',
+        type: Node,
+        tooltip: '提示信息Label节点'
     })
-    fakeResultPath: string = 'ui/liedetector/false_result';
+    hintLabel: Node = null;
     
-    private imagesLoaded: boolean = false;
+    // 当前角色是否为伪装者
+    private isCharacterFake: boolean = false;
     
     start() {
-        // 初始化隐藏测谎仪面板
-        if (this.detectorPanel) {
-            this.detectorPanel.active = false;
+        // 初始化隐藏面板
+        if (this.lieDetectorPanel) {
+            this.lieDetectorPanel.active = false;
         }
         
-        // 隐藏结果显示
-        if (this.resultDisplay) {
-            this.resultDisplay.node.active = false;
-        }
+        // 隐藏结果
+        this.hideResult();
         
-        // 注册按钮点击事件
+        // 注册按钮事件
         this.setupButtons();
-        
-        // 预加载结果图片
-        this.preloadResultImages();
     }
     
-    /**
-     * 预加载结果图片
-     */
-    private preloadResultImages() {
-        // 如果已经直接设置了SpriteFrame,则不需要加载
-        if (this.trueResultImage && this.fakeResultImage) {
-            this.imagesLoaded = true;
-            return;
-        }
-        
-        let loadedCount = 0;
-        const totalToLoad = 2;
-        
-        // 加载真人结果图片
-        if (!this.trueResultImage && this.trueResultPath) {
-            resources.load(this.trueResultPath, SpriteFrame, (err, spriteFrame) => {
-                if (err) {
-                    console.error(`加载真人结果图片失败: ${this.trueResultPath}`, err);
-                } else {
-                    console.log(`加载真人结果图片成功: ${this.trueResultPath}`);
-                    this.trueResultImage = spriteFrame;
-                }
-                
-                loadedCount++;
-                if (loadedCount >= totalToLoad) {
-                    this.imagesLoaded = true;
-                }
-            });
-        } else {
-            loadedCount++;
-        }
-        
-        // 加载伪人结果图片
-        if (!this.fakeResultImage && this.fakeResultPath) {
-            resources.load(this.fakeResultPath, SpriteFrame, (err, spriteFrame) => {
-                if (err) {
-                    console.error(`加载伪人结果图片失败: ${this.fakeResultPath}`, err);
-                } else {
-                    console.log(`加载伪人结果图片成功: ${this.fakeResultPath}`);
-                    this.fakeResultImage = spriteFrame;
-                }
-                
-                loadedCount++;
-                if (loadedCount >= totalToLoad) {
-                    this.imagesLoaded = true;
-                }
-            });
-        } else {
-            loadedCount++;
-        }
-    }
-    
-    /**
-     * 设置按钮事件
-     */
     private setupButtons() {
-        // 设置关闭按钮
+        // 关闭按钮
         if (this.closeButton) {
-            this.closeButton.node.off('click');
-            this.closeButton.node.on('click', () => {
-                console.log('测谎仪关闭按钮被点击');
-                this.hideDetectorPanel();
-            }, this);
+            this.closeButton.node.on(Button.EventType.CLICK, this.hideLieDetectorPanel, this);
         } else {
             console.error('测谎仪关闭按钮未设置');
         }
         
-        // 设置测谎按钮
-        if (this.testButton) {
-            this.testButton.node.off('click');
-            this.testButton.node.on('click', () => {
-                console.log('测谎按钮被点击');
-                this.performLieTest();
-            }, this);
+        // 测谎按钮
+        if (this.detectButton) {
+            this.detectButton.node.on(Button.EventType.CLICK, this.detectLie, this);
         } else {
             console.error('测谎按钮未设置');
         }
     }
     
+    /**
+     * 设置当前角色的真实性
+     * @param isFake 当前角色是否是伪装者
+     */
+    public setCharacterStatus(isFake: boolean) {
+        this.isCharacterFake = isFake;
+        // 重置结果显示
+        this.hideResult();
+        // 显示提示信息
+        this.showHint();
+    }
+    
     /**
      * 显示测谎仪面板
      */
-    public showDetectorPanel() {
-        if (this.detectorPanel) {
-            this.detectorPanel.active = true;
-            
-            // 确保面板在最前面
-            this.detectorPanel.setSiblingIndex(999);
-            
-            // 隐藏结果显示,重置状态
-            if (this.resultDisplay) {
-                this.resultDisplay.node.active = false;
-            }
-            
-            // 如果图片还没加载完成,再次尝试加载
-            if (!this.imagesLoaded) {
-                this.preloadResultImages();
-            }
+    public showLieDetectorPanel() {
+        if (this.lieDetectorPanel) {
+            this.lieDetectorPanel.active = true;
+            this.lieDetectorPanel.setSiblingIndex(999); // 确保显示在最前面
+            // 初始隐藏结果
+            this.hideResult();
+            // 显示提示信息
+            this.showHint();
         } else {
             console.error('测谎仪面板未设置');
         }
     }
     
     /**
-     * 执行测谎检测
+     * 隐藏测谎仪面板
      */
-    private performLieTest() {
-        if (!this.gameFlowManager || !this.dataManager || !this.resultDisplay) {
-            console.error('游戏流程管理器、数据管理器或结果显示未设置');
-            return;
+    public hideLieDetectorPanel() {
+        if (this.lieDetectorPanel) {
+            this.lieDetectorPanel.active = false;
         }
-        
-        // 获取当前NPC数据
-        const currentNpc = this.gameFlowManager.getCurrentNpcData();
-        
-        if (!currentNpc) {
-            console.error('无法获取当前NPC数据');
-            return;
+    }
+    
+    /**
+     * 执行测谎操作
+     */
+    private detectLie() {
+        // 显示测谎结果
+        if (this.resultDisplay) {
+            if (this.isCharacterFake) {
+                // 显示"假"结果
+                this.resultDisplay.spriteFrame = this.falseResultFrame;
+            } else {
+                // 显示"真"结果
+                this.resultDisplay.spriteFrame = this.trueResultFrame;
+            }
+            
+            this.resultDisplay.node.active = true;
         }
         
-        // 判断是否为真人
-        const isRealHuman = currentNpc.type === 'real';
-        
-        console.log(`测谎结果: 角色${currentNpc.characterId} 是${isRealHuman ? '真人' : '伪人'}`);
-        
-        // 确保有结果图片可用
-        if (isRealHuman && !this.trueResultImage) {
-            console.error('真人结果图片未设置');
-            return;
+        // 隐藏提示信息
+        this.hideHint();
+    }
+    
+    /**
+     * 隐藏测谎结果
+     */
+    private hideResult() {
+        if (this.resultDisplay) {
+            this.resultDisplay.node.active = false;
         }
-        
-        if (!isRealHuman && !this.fakeResultImage) {
-            console.error('伪人结果图片未设置');
-            return;
+    }
+    
+    /**
+     * 显示提示信息
+     */
+    private showHint() {
+        if (this.hintLabel) {
+            this.hintLabel.active = true;
         }
-        
-        // 显示对应结果图片
-        this.resultDisplay.spriteFrame = isRealHuman ? this.trueResultImage : this.fakeResultImage;
-        this.resultDisplay.node.active = true;
     }
     
     /**
-     * 隐藏测谎仪面板
+     * 隐藏提示信息
      */
-    public hideDetectorPanel() {
-        if (this.detectorPanel) {
-            this.detectorPanel.active = false;
+    private hideHint() {
+        if (this.hintLabel) {
+            this.hintLabel.active = false;
         }
     }
     
     onDestroy() {
-        // 移除按钮事件监听
+        // 清理按钮事件
         if (this.closeButton) {
-            this.closeButton.node.off('click');
+            this.closeButton.node.off(Button.EventType.CLICK, this.hideLieDetectorPanel, this);
         }
         
-        if (this.testButton) {
-            this.testButton.node.off('click');
+        if (this.detectButton) {
+            this.detectButton.node.off(Button.EventType.CLICK, this.detectLie, this);
         }
     }
 } 

+ 1 - 1
assets/scripts/LieDetectorManager.ts.meta

@@ -2,7 +2,7 @@
   "ver": "4.0.24",
   "importer": "typescript",
   "imported": true,
-  "uuid": "895c4785-6822-40ec-a1d0-bcd1eabd95d8",
+  "uuid": "0fb9b257-b021-47f6-a7c9-257873f65fb0",
   "files": [],
   "subMetas": {},
   "userData": {}

+ 27 - 15
assets/scripts/LieDetectorTrigger.ts

@@ -1,5 +1,5 @@
 import { _decorator, Component, Node } from 'cc';
-import { LieDetectorManager } from './LieDetectorManager';
+import { GameFlowManager } from './GameFlowManager';
 const { ccclass, property } = _decorator;
 
 /**
@@ -8,36 +8,48 @@ const { ccclass, property } = _decorator;
 @ccclass('LieDetectorTrigger')
 export class LieDetectorTrigger extends Component {
     @property({
-        type: LieDetectorManager,
-        tooltip: '测谎仪管理器引用'
+        type: Node,
+        tooltip: '游戏流程管理器所在的节点'
     })
-    detectorManager: LieDetectorManager = null;
+    gameFlowManagerNode: Node | null = null;
     
     @property({
         tooltip: '是否启用触发器'
     })
     isEnabled: boolean = true;
     
+    // 游戏流程管理器引用
+    private gameFlowManager: GameFlowManager | null = null;
+    
     start() {
-        // 注册节点点击事件
-        this.node.on(Node.EventType.TOUCH_END, this.onDetectorClicked, this);
+        // 注册点击事件
+        this.node.on(Node.EventType.TOUCH_END, this.onLieDetectorClicked, this);
+        
+        // 获取GameFlowManager引用
+        if (this.gameFlowManagerNode) {
+            this.gameFlowManager = this.gameFlowManagerNode.getComponent(GameFlowManager);
+            if (!this.gameFlowManager) {
+                console.error('游戏流程管理器节点上没有GameFlowManager组件');
+            }
+        } else {
+            console.error('未设置游戏流程管理器节点');
+        }
     }
     
     /**
-     * 测谎仪被点击时的处理
+     * 测谎仪点击回调
      */
-    private onDetectorClicked() {
+    private onLieDetectorClicked() {
         if (!this.isEnabled) {
+            console.log('测谎仪触发器已禁用');
             return;
         }
         
-        console.log('测谎仪图片被点击');
-        
-        // 如果有测谎仪管理器引用,则显示测谎仪UI
-        if (this.detectorManager) {
-            this.detectorManager.showDetectorPanel();
+        if (this.gameFlowManager) {
+            // 调用游戏流程管理器显示测谎仪UI
+            this.gameFlowManager.showLieDetectorPanel();
         } else {
-            console.error('未设置测谎仪管理器引用,无法显示测谎仪UI');
+            console.error('游戏流程管理器未设置,无法显示测谎仪');
         }
     }
     
@@ -57,6 +69,6 @@ export class LieDetectorTrigger extends Component {
     
     onDestroy() {
         // 移除事件监听
-        this.node.off(Node.EventType.TOUCH_END, this.onDetectorClicked, this);
+        this.node.off(Node.EventType.TOUCH_END, this.onLieDetectorClicked, this);
     }
 } 

+ 1 - 1
assets/scripts/LieDetectorTrigger.ts.meta

@@ -2,7 +2,7 @@
   "ver": "4.0.24",
   "importer": "typescript",
   "imported": true,
-  "uuid": "e9d26379-e3c1-49e7-877d-cf35d5b454e8",
+  "uuid": "5a58307c-0c3f-4487-aea9-dfb22761e6af",
   "files": [],
   "subMetas": {},
   "userData": {}

+ 110 - 0
assets/scripts/PersonalInfoManager.ts

@@ -0,0 +1,110 @@
+import { _decorator, Component, Node, Button, Sprite, Label, SpriteFrame, resources } from 'cc';
+const { ccclass, property } = _decorator;
+
+@ccclass('PersonalInfoManager')
+export class PersonalInfoManager extends Component {
+    @property({
+        type: Node,
+        tooltip: '个人资料UI面板'
+    })
+    personalInfoPanel: Node = null;
+    
+    @property({
+        type: Button,
+        tooltip: '关闭按钮'
+    })
+    closeButton: Button = null;
+    
+    @property({
+        type: Sprite,
+        tooltip: '角色头像显示'
+    })
+    characterAvatar: Sprite = null;
+    
+    @property({
+        type: Label, 
+        tooltip: '角色信息文本'
+    })
+    infoText: Label = null;
+    
+    // 当前显示的角色ID
+    private currentCharacterId: number = -1;
+    
+    start() {
+        // 初始化隐藏面板
+        if (this.personalInfoPanel) {
+            this.personalInfoPanel.active = false;
+        }
+        
+        // 注册关闭按钮事件
+        this.setupCloseButton();
+    }
+    
+    private setupCloseButton() {
+        if (this.closeButton) {
+            this.closeButton.node.off('click');
+            this.closeButton.node.on('click', () => {
+                this.hidePersonalInfoPanel();
+            }, this);
+        }
+    }
+    
+    /**
+     * 显示个人资料面板
+     */
+    public showPersonalInfoPanel() {
+        if (this.personalInfoPanel) {
+            this.personalInfoPanel.active = true;
+            this.personalInfoPanel.setSiblingIndex(999);
+        }
+    }
+    
+    /**
+     * 隐藏个人资料面板
+     */
+    public hidePersonalInfoPanel() {
+        if (this.personalInfoPanel) {
+            this.personalInfoPanel.active = false;
+        }
+    }
+    
+    /**
+     * 显示角色资料
+     * @param data 角色资料数据
+     */
+    public displayCharacterInfo(data: any) {
+        if (!data) {
+            console.error('角色资料数据为空');
+            return;
+        }
+        
+        // 保存当前显示的角色ID
+        this.currentCharacterId = data.characterId;
+        
+        // 设置文本信息
+        if (this.infoText && data.info) {
+            this.infoText.string = data.info;
+        }
+        
+        // 加载并设置头像
+        if (this.characterAvatar && data.avatarPath) {
+            resources.load(data.avatarPath, SpriteFrame, (err, spriteFrame) => {
+                if (err) {
+                    console.error(`加载头像失败: ${data.avatarPath}`, err);
+                    return;
+                }
+                
+                this.characterAvatar.spriteFrame = spriteFrame;
+            });
+        }
+        
+        // 显示面板
+        this.showPersonalInfoPanel();
+    }
+    
+    onDestroy() {
+        if (this.closeButton) {
+            this.closeButton.node.off('click');
+        }
+    }
+}

+ 9 - 0
assets/scripts/PersonalInfoManager.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.24",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "bc98ce07-8df6-42cc-9cdd-cdec7b349ec6",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 74 - 0
assets/scripts/PersonalInfoTrigger.ts

@@ -0,0 +1,74 @@
+import { _decorator, Component, Node } from 'cc';
+import { GameFlowManager } from './GameFlowManager';
+const { ccclass, property } = _decorator;
+
+/**
+ * 个人资料触发器,用于点击场景中的个人资料按钮时激活个人资料UI
+ */
+@ccclass('PersonalInfoTrigger')
+export class PersonalInfoTrigger extends Component {
+    @property({
+        type: Node,
+        tooltip: '游戏流程管理器所在的节点'
+    })
+    gameFlowManagerNode: Node | null = null;
+    
+    @property({
+        tooltip: '是否启用触发器'
+    })
+    isEnabled: boolean = true;
+    
+    // 游戏流程管理器引用
+    private gameFlowManager: GameFlowManager | null = null;
+    
+    start() {
+        // 注册点击事件
+        this.node.on(Node.EventType.TOUCH_END, this.onPersonalInfoClicked, this);
+        
+        // 获取GameFlowManager引用
+        if (this.gameFlowManagerNode) {
+            this.gameFlowManager = this.gameFlowManagerNode.getComponent(GameFlowManager);
+            if (!this.gameFlowManager) {
+                console.error('游戏流程管理器节点上没有GameFlowManager组件');
+            }
+        } else {
+            console.error('未设置游戏流程管理器节点');
+        }
+    }
+    
+    /**
+     * 个人资料点击回调
+     */
+    private onPersonalInfoClicked() {
+        if (!this.isEnabled) {
+            console.log('个人资料触发器已禁用');
+            return;
+        }
+        
+        if (this.gameFlowManager) {
+            // 调用游戏流程管理器显示当前NPC的个人资料
+            this.gameFlowManager.showCurrentNpcPersonalInfo();
+        } else {
+            console.error('游戏流程管理器未设置,无法显示个人资料');
+        }
+    }
+    
+    /**
+     * 启用触发器
+     */
+    public enable() {
+        this.isEnabled = true;
+    }
+    
+    /**
+     * 禁用触发器
+     */
+    public disable() {
+        this.isEnabled = false;
+    }
+    
+    onDestroy() {
+        // 移除事件监听
+        this.node.off(Node.EventType.TOUCH_END, this.onPersonalInfoClicked, this);
+    }
+}

+ 9 - 0
assets/scripts/PersonalInfoTrigger.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.24",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "4b775622-3c9b-4de3-be85-b2a64aa75240",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 30 - 3
assets/scripts/PhoneTrigger.ts

@@ -1,5 +1,6 @@
 import { _decorator, Component, Node } from 'cc';
 import { PhoneManager } from './PhoneManager';
+import { GameFlowManager } from './GameFlowManager';
 const { ccclass, property } = _decorator;
 
 /**
@@ -9,18 +10,41 @@ const { ccclass, property } = _decorator;
 export class PhoneTrigger extends Component {
     @property({
         type: PhoneManager,
-        tooltip: '电话管理器引用'
+        tooltip: '电话管理器引用 (已弃用,请使用GameFlowManager中的电话管理器)'
     })
     phoneManager: PhoneManager = null;
     
+    @property({
+        type: Node,
+        tooltip: '游戏流程管理器所在的节点'
+    })
+    gameFlowManagerNode: Node = null;
+    
     @property({
         tooltip: '是否启用触发器'
     })
     isEnabled: boolean = true;
     
+    // 游戏流程管理器引用
+    private gameFlowManager: GameFlowManager = null;
+    
     start() {
         // 注册节点点击事件
         this.node.on(Node.EventType.TOUCH_END, this.onPhoneClicked, this);
+        
+        // 从节点获取GameFlowManager组件
+        if (this.gameFlowManagerNode) {
+            this.gameFlowManager = this.gameFlowManagerNode.getComponent(GameFlowManager);
+            if (!this.gameFlowManager) {
+                console.error('游戏流程管理器节点上没有GameFlowManager组件');
+            }
+        } else {
+            // 尝试在场景中查找
+            this.gameFlowManager = this.node.scene.getComponentInChildren(GameFlowManager);
+            if (!this.gameFlowManager) {
+                console.error('无法在场景中找到GameFlowManager组件');
+            }
+        }
     }
     
     /**
@@ -33,8 +57,11 @@ export class PhoneTrigger extends Component {
         
         console.log('电话被点击');
         
-        // 如果有电话管理器引用,则显示电话UI和对话
-        if (this.phoneManager) {
+        // 优先通过GameFlowManager获取电话管理器
+        if (this.gameFlowManager) {
+            this.gameFlowManager.showPhoneUI();
+        } else if (this.phoneManager) {
+            // 兼容:如果直接设置了phoneManager属性,则使用它
             this.phoneManager.showPhonePanel();
         } else {
             console.error('未设置电话管理器引用,无法显示电话UI');

+ 34 - 36
assets/scripts/QuestionAnswerManager.ts

@@ -40,7 +40,7 @@ export class QuestionAnswerManager extends Component {
 
     @property({
         type: PassCardManager,
-        tooltip: '通行证管理器引用'
+        tooltip: '通行证管理器引用 (已弃用,请使用GameFlowManager中的通行证管理器)'
     })
     passCardManager: PassCardManager = null;
 
@@ -195,51 +195,49 @@ export class QuestionAnswerManager extends Component {
         console.log(`问题: "${qa.question}", 选择的回答: "${selectedAnswer}", 显示通行证: ${qa.showPassCard}`);
         
         // 检查是否需要显示通行证
-        if (qa.showPassCard && this.passCardManager) {
+        if (qa.showPassCard) {
             console.log('准备显示通行证');
+            // 通过GameFlowManager获取通行证管理器
+            if (this.gameFlowManager && this.gameFlowManager.passCardManager) {
+                // 使用GameFlowManager提供的PassCardManager
+                const passCardManager = this.gameFlowManager.passCardManager;
+                
             // 获取当前NPC数据
-            const npcData = this.gameFlowManager ? this.gameFlowManager.getCurrentNpcData() : null;
-            console.log('当前NPC数据:', npcData);
-            
-            if (npcData) {
-                // 显示通行证,使用NPC数据
-                try {
-                    this.passCardManager.showPassCard({
-                        name: npcData.characterName || '未知',
-                        room: `${Math.floor(Math.random() * 900) + 100}`, // 随机房间号,可以替换为实际数据
-                        id: `ID-${npcData.characterId}-${Math.floor(Math.random() * 1000)}`, // 随机ID,可以替换为实际数据
-                        reason: npcData.type === 'real' ? '合法居民' : '访客',
-                        characterId: npcData.characterId
-                    });
-                    console.log('通行证显示成功');
-                } catch (error) {
-                    console.error('显示通行证时出错:', error);
+                if (this.gameFlowManager.getCurrentNpcData) {
+                    const npcData = this.gameFlowManager.getCurrentNpcData();
+                    if (npcData && npcData.pass) {
+                        console.log('显示通行证:', npcData.pass);
+                        passCardManager.showPassCard(npcData.pass);
+                    } else {
+                        console.error('当前NPC没有通行证数据');
+                    }
+                } else {
+                    console.error('GameFlowManager没有getCurrentNpcData方法');
                 }
+            } else if (this.passCardManager) {
+                // 兼容:如果直接设置了passCardManager属性,则使用它
+                // 获取当前NPC数据
+                if (this.gameFlowManager && this.gameFlowManager.getCurrentNpcData) {
+                    const npcData = this.gameFlowManager.getCurrentNpcData();
+                    if (npcData && npcData.pass) {
+                        console.log('显示通行证:', npcData.pass);
+                        this.passCardManager.showPassCard(npcData.pass);
             } else {
-                console.error('无法获取NPC数据');
-                // 尝试使用默认数据显示通行证
-                if (this.passCardManager) {
-                    try {
-                        this.passCardManager.showPassCard({
-                            name: '测试角色',
-                            room: '101',
-                            id: 'ID-TEST-001',
-                            reason: '测试',
-                            characterId: 1
-                        });
-                        console.log('使用默认数据显示通行证');
-                    } catch (error) {
-                        console.error('使用默认数据显示通行证时出错:', error);
+                        console.error('当前NPC没有通行证数据');
                     }
-                }
+                } else {
+                    console.error('无法获取NPC通行证数据');
             }
         } else {
-            console.log(`不显示通行证,原因: showPassCard=${qa.showPassCard}, passCardManager=${!!this.passCardManager}`);
+                console.error('无法获取通行证管理器');
+            }
         }
         
-        // 使用对话管理器显示回答,包含表情
-        if (this.dialogueManager && selectedAnswer) {
+        // 显示对话
+        if (this.dialogueManager) {
             this.dialogueManager.showDialogue(selectedAnswer);
+        } else {
+            console.error('对话管理器未设置,无法显示回答');
         }
     }
 

+ 81 - 8
assets/scripts/RosterManager.ts

@@ -1,4 +1,4 @@
-import { _decorator, Component, Node, Button, Animation, Sprite, SpriteFrame, resources, assetManager } from 'cc';
+import { _decorator, Component, Node, Button, Animation, Sprite, SpriteFrame, resources, assetManager, Label, Layout, instantiate } from 'cc';
 const { ccclass, property } = _decorator;
 
 /**
@@ -26,18 +26,26 @@ export class RosterManager extends Component {
     
     @property({
         type: Node,
-        tooltip: '学生头像容器(可选,用于未来功能)'
+        tooltip: '学生头像容器'
     })
     avatarContainer: Node = null;
     
     @property({
-        tooltip: '头像资源路径(可选,用于未来功能)'
+        tooltip: '头像资源路径'
     })
     avatarResourcePath: string = "avatars/";
     
-    // 保存头像引用的字典,用于未来功能
+    // 保存头像引用的字典
     private avatarMap: Map<string, SpriteFrame> = new Map();
     
+
+    // 头像项预制体
+    @property({
+        type: Node,
+        tooltip: '头像项预制体'
+    })
+    avatarItemPrefab: Node = null;
+    
     start() {
         // 初始化隐藏名单面板
         if (this.rosterPanel) {
@@ -109,7 +117,7 @@ export class RosterManager extends Component {
     }
     
     /**
-     * 预加载头像资源(用于未来功能)
+     * 预加载头像资源
      * @param avatarIds 头像ID数组
      */
     public preloadAvatars(avatarIds: string[]) {
@@ -118,7 +126,7 @@ export class RosterManager extends Component {
         }
         
         avatarIds.forEach(id => {
-            const path = `${this.avatarResourcePath}avatar_${id}`;
+            const path = `${this.avatarResourcePath}avatar_${id}/spriteFrame`;
             resources.load(path, SpriteFrame, (err, spriteFrame) => {
                 if (err) {
                     console.error(`加载头像 ${id} 失败:`, err);
@@ -131,7 +139,7 @@ export class RosterManager extends Component {
     }
     
     /**
-     * 显示头像(用于未来功能)
+     * 显示头像
      * @param slotId 头像位置ID
      * @param avatarId 头像资源ID
      */
@@ -156,7 +164,7 @@ export class RosterManager extends Component {
             }
         } else {
             // 如果头像未预加载,则即时加载
-            const path = `${this.avatarResourcePath}avatar_${avatarId}`;
+            const path = `${this.avatarResourcePath}avatar_${avatarId}/spriteFrame`;
             resources.load(path, SpriteFrame, (err, spriteFrame) => {
                 if (err) {
                     console.error(`加载头像 ${avatarId} 失败:`, err);
@@ -173,6 +181,71 @@ export class RosterManager extends Component {
         }
     }
     
+
+    // 在RosterManager中添加处理关卡人员头像的方法
+    public displayLevelPersonnel(personnelData: any[]) {
+        console.log("开始显示人员列表...");
+        console.log("avatarContainer:", this.avatarContainer);
+        console.log("personnelData:", personnelData);
+        
+        if (!this.avatarContainer) {
+            console.error('无法显示人员列表:avatarContainer未设置');
+            return;
+        }
+        
+        if (!personnelData || personnelData.length === 0) {
+            console.error('无法显示人员列表:人员数据为空');
+            return;
+        }
+        
+        // 检查预制体
+        if (!this.avatarItemPrefab) {
+            console.error('头像项预制体未设置');
+            return;
+        }
+        
+        console.log("准备清空容器并创建新头像项");
+        // 清空现有内容
+        this.avatarContainer.removeAllChildren();
+        
+        // 遍历所有人员数据,创建头像项
+        personnelData.forEach((person, index) => {
+            // 创建新的头像项
+            const avatarItem = instantiate(this.avatarItemPrefab);
+            this.avatarContainer.addChild(avatarItem);
+            
+            // 设置姓名
+            const nameLabel = avatarItem.getComponentInChildren(Label);
+            if (nameLabel && person.name) {
+                nameLabel.string = person.name;
+            }
+            
+            // 使用完整的头像路径 - 直接从数据中获取
+            if (person.avatarPath) {
+                resources.load(person.avatarPath, SpriteFrame, (err, spriteFrame) => {
+                    if (err) {
+                        console.error(`加载头像失败: ${person.avatarPath}`, err);
+                        return;
+                    }
+                    
+                    // 查找头像显示组件
+                    const sprite = avatarItem.getComponentInChildren(Sprite);
+                    if (sprite) {
+                        sprite.spriteFrame = spriteFrame;
+                    }
+                });
+            }
+        });
+        
+        // 更新布局
+        const layout = this.avatarContainer.getComponent(Layout);
+        if (layout) {
+            this.scheduleOnce(() => {
+                layout.updateLayout();
+            }, 0.1);
+        }
+    }
+    
     onDestroy() {
         // 移除按钮事件监听
         if (this.closeButton) {

+ 29 - 11
assets/scripts/RosterTrigger.ts

@@ -1,5 +1,6 @@
 import { _decorator, Component, Node } from 'cc';
 import { RosterManager } from './RosterManager';
+import { GameFlowManager } from './GameFlowManager';
 const { ccclass, property } = _decorator;
 
 /**
@@ -9,35 +10,52 @@ const { ccclass, property } = _decorator;
 export class RosterTrigger extends Component {
     @property({
         type: RosterManager,
-        tooltip: '名单管理器引用'
+        tooltip: '名单管理器引用 (已弃用,请使用GameFlowManager中的名单管理器)'
     })
     rosterManager: RosterManager = null;
     
+    @property({
+        type: Node,
+        tooltip: '游戏流程管理器所在的节点'
+    })
+    gameFlowManagerNode: Node = null;
+    
     @property({
         tooltip: '是否启用触发器'
     })
     isEnabled: boolean = true;
     
+    // 游戏流程管理器引用
+    private gameFlowManager: GameFlowManager = null;
+    
     start() {
         // 注册节点点击事件
         this.node.on(Node.EventType.TOUCH_END, this.onRosterClicked, this);
+        
+        // 从节点获取GameFlowManager组件
+        if (this.gameFlowManagerNode) {
+            this.gameFlowManager = this.gameFlowManagerNode.getComponent(GameFlowManager);
+            if (!this.gameFlowManager) {
+                console.error('游戏流程管理器节点上没有GameFlowManager组件');
+            }
+        } else {
+            // 尝试在场景中查找
+            this.gameFlowManager = this.node.scene.getComponentInChildren(GameFlowManager);
+            if (!this.gameFlowManager) {
+                console.error('无法在场景中找到GameFlowManager组件');
+            }
+        }
     }
     
     /**
      * 名单被点击时的处理
      */
     private onRosterClicked() {
-        if (!this.isEnabled) {
-            return;
-        }
+        if (!this.isEnabled) return;
         
-        console.log('名单图片被点击');
-        
-        // 如果有名单管理器引用,则显示名单UI
-        if (this.rosterManager) {
-            this.rosterManager.showRosterPanel();
-        } else {
-            console.error('未设置名单管理器引用,无法显示名单UI');
+        if (this.gameFlowManager) {
+            // 调用GameFlowManager的方法显示名单
+            this.gameFlowManager.showCurrentLevelRoster();
         }
     }
     

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.