diff --git a/xiaofang/Assets/Prefabs/itemPrefabs/SchoolToggle.prefab b/xiaofang/Assets/Prefabs/itemPrefabs/SchoolToggle.prefab index 587619d5..e2d60d86 100644 --- a/xiaofang/Assets/Prefabs/itemPrefabs/SchoolToggle.prefab +++ b/xiaofang/Assets/Prefabs/itemPrefabs/SchoolToggle.prefab @@ -143,6 +143,8 @@ MonoBehaviour: m_EditorClassIdentifier: schoolId: 0 schoolName: {fileID: 8240735975125479954} + maskImage: {fileID: 0} + isOpen: 0 --- !u!1 &8240735974858230823 GameObject: m_ObjectHideFlags: 0 @@ -312,7 +314,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &8240735975124526756 RectTransform: m_ObjectHideFlags: 0 diff --git a/xiaofang/Assets/Resources/JsonAsset/IncidentSite .json b/xiaofang/Assets/Resources/JsonAsset/IncidentSite .json index f5d2eeef..49c7afc9 100644 --- a/xiaofang/Assets/Resources/JsonAsset/IncidentSite .json +++ b/xiaofang/Assets/Resources/JsonAsset/IncidentSite .json @@ -1,8 +1,8 @@ [ { - "ID": 2001, + "ID": "2001", "Note": "厨房起火", - "Name": 2001, + "Name": "2001", "Scene": "9003", "Position": "36,1,2", "Volume": "-1", @@ -12,9 +12,9 @@ "GeneralRole": "8000,8001,8002,8003,8004,8005,8006,8008,8009,8010" }, { - "ID": 2002, + "ID": "2002", "Note": "学生宿舍起火", - "Name": 2002, + "Name": "2002", "Scene": "9002", "Position": "0,0,0", "Volume": "-1", @@ -22,5 +22,29 @@ "SpecialEvent": "-1,-1,-1,-1|1,50,10,20|1,50,20,20", "Role": "8000,8001,8002,8003,8004,8005,8007,8011|8000,8001,8002,8003,8004,8005,8007,8011|8000,8001,8002,8003,8004,8005,8007,8011", "GeneralRole": "8000,8001,8002,8003,8004,8005,8007,8010,8011" + }, + { + "ID": "2003", + "Note": "test1", + "Name": "2003", + "Scene": "9003", + "Position": "1,1,1", + "Volume": "-1", + "Difficulty": "2|3", + "SpecialEvent": "-1,-1,-1,-1|1,50,10,20", + "Role": "8001,8002,8003,8004,8005|8001,8002,8003,8004,8005", + "GeneralRole": "8010" + }, + { + "ID": "2004", + "Note": "test2", + "Name": "2004", + "Scene": "9003", + "Position": "2,2,2", + "Volume": "-1", + "Difficulty": "1|5|6", + "SpecialEvent": "-1,-1,-1,-1|1,50,10,20|1,50,20,20", + "Role": "8000,8001,8002,8003,8004,8005,8006,8008,8009|8000,8001,8002,8003,8004,8005,8006,8008,8009|8000,8001,8002,8003,8004,8005,8006,8008,8009,8010", + "GeneralRole": "8010" } ] \ No newline at end of file diff --git a/xiaofang/Assets/Resources/JsonAsset/PlayScript.json b/xiaofang/Assets/Resources/JsonAsset/PlayScript.json index 96d9f9f2..20cff4a6 100644 --- a/xiaofang/Assets/Resources/JsonAsset/PlayScript.json +++ b/xiaofang/Assets/Resources/JsonAsset/PlayScript.json @@ -4,13 +4,13 @@ "Note": "火灾", "Name": "5001", "Role": "8000|8001|8002|8003|8004|8005|8006|8008|8009|8010", - "DisasterLocation": "2001" + "DisasterLocation": "2001|2002|2003" }, { "ID": "5002", "Note": "塌方", "Name": "5002", "Role": "8000|8001|8002|8003|8004|8005|8006|8008|8009|8010", - "DisasterLocation": "2004|2002" + "DisasterLocation": "2004" } ] \ No newline at end of file diff --git a/xiaofang/Assets/Scenes/Schedule_03.unity b/xiaofang/Assets/Scenes/Schedule_03.unity index 52d8fa45..5e6e8a12 100644 --- a/xiaofang/Assets/Scenes/Schedule_03.unity +++ b/xiaofang/Assets/Scenes/Schedule_03.unity @@ -2133,7 +2133,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &618256459 RectTransform: m_ObjectHideFlags: 0 @@ -8210,6 +8210,7 @@ MonoBehaviour: incidentSiteJosnFile: {fileID: 4900000, guid: 1efa4372b10d4294199638c49173ff4c, type: 3} NPCJosnFile: {fileID: 4900000, guid: 41009f009f0718647a782c7e1aec97dd, type: 3} LanguageJsonFile: {fileID: 4900000, guid: 62a41129c4663ee41a06274114d28feb, type: 3} + SelectJsonFile: {fileID: 4900000, guid: 3efd15f4195557144a45659d2baa1ba3, type: 3} --- !u!4 &1417128758 Transform: m_ObjectHideFlags: 0 @@ -14630,9 +14631,9 @@ RectTransform: m_Father: {fileID: 7468736063934366934} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 334.1322, y: -55} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 187, y: 110} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7468736064122132329 @@ -14913,9 +14914,9 @@ RectTransform: m_Father: {fileID: 7468736063934366934} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 753.3966, y: -55} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 187, y: 110} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7468736064198941274 @@ -15673,7 +15674,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 3.3229} - m_SizeDelta: {x: 1834, y: 1070} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7468736064579811972 GameObject: @@ -15695,7 +15696,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!114 &7468736064579811982 MonoBehaviour: m_ObjectHideFlags: 0 @@ -16153,9 +16154,9 @@ RectTransform: m_Father: {fileID: 7468736063934366934} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 543.7644, y: -55} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 187, y: 110} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7468736064659112359 @@ -16359,9 +16360,9 @@ RectTransform: m_Father: {fileID: 7468736064579811971} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 917, y: -53.335} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 1834, y: 106.67} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7468736064728012045 @@ -16521,9 +16522,9 @@ RectTransform: m_Father: {fileID: 7468736063934366934} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 124.5, y: -55} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 187, y: 110} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7468736064820222392 @@ -16934,9 +16935,9 @@ RectTransform: m_Father: {fileID: 7468736064579811971} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 917, y: -588.33496} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 1834, y: 498.685} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7468736064937661071 diff --git a/xiaofang/Assets/Script/JSONReader/JSONReader.cs b/xiaofang/Assets/Script/JSONReader/JSONReader.cs index 8b23ca0d..498ac08e 100644 --- a/xiaofang/Assets/Script/JSONReader/JSONReader.cs +++ b/xiaofang/Assets/Script/JSONReader/JSONReader.cs @@ -42,9 +42,9 @@ public class JSONReader : MonoBehaviour GetLanguageByID(20008); - foreach (var npc in sceneDictionary) + foreach (var npc in npcDictionary) { - // Debug.Log(npc.Value.ID); + //Debug.Log(npc.Value.ID); //Debug.Log(npc.Value.Name); } GetNpcDataByID(8001); @@ -271,6 +271,16 @@ public class JSONReader : MonoBehaviour else return null; } + public NPCData GetRoleDateById(int id) + { + NPCData info = null; + if (npcDictionary.TryGetValue(id, out info)) + { + return info; + } + else return null; + } + //UIıķ public void SetUIText(Text text, int id) { @@ -356,7 +366,7 @@ public class MatialData public class SceneData { public int ID; - public int Name; + public string Name; public int Type; public string IncidentType; public string ObjList; @@ -374,6 +384,8 @@ public class IncidentSite public int Volume; public string Difficulty; public string SpecialEvent; + public string Role; + public string GeneralRole; } [System.Serializable] diff --git a/xiaofang/Assets/Script/Scheduled_03/Panel.cs b/xiaofang/Assets/Script/Scheduled_03/Panel.cs index 84730b00..a2d83040 100644 --- a/xiaofang/Assets/Script/Scheduled_03/Panel.cs +++ b/xiaofang/Assets/Script/Scheduled_03/Panel.cs @@ -4,6 +4,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; +using System.Threading; using Unity.VisualScripting; using UnityEngine; using UnityEngine.Events; @@ -88,16 +89,11 @@ public class Panel : MonoBehaviour // Start is called before the first frame update void Start() - { - selectedInfo = new SelectedInfo(); - DynamicLoadingPeople(); - DynamicLoadingDuty(); - DynamicLoadingScene(); - for (int i = 1; i < panelToggle.Length; i++) - { - panelToggle[i].interactable = false; - panelToggle[i].gameObject.transform.GetComponent().sprite = toggleImage[0]; - } + { + selectedInfo = new SelectedInfo(); + DynamicLoadingPeople(); + DynamicLoadingScene(); + InstantiateToggle(); } // Update is called once per frame @@ -124,71 +120,84 @@ public class Panel : MonoBehaviour } //ְ̬ - public void DynamicLoadingDuty() + public void DynamicLoadingDuty(int id) { - foreach (var npcData in jsonReader1.npcDictionary) + if (selectScenePanel.difficultyToRoles.ContainsKey(id)) { - string[] nameSections = npcData.Value.Name.Split('|'); - foreach (var section in nameSections) - { - string[] sectionParts = section.Split(','); + List rolesForSelectedDifficulty = selectScenePanel.difficultyToRoles[id]; - //ж¼ȻȷЩְ - if (int.Parse(sectionParts[0]) == 2001) + // ɫش + foreach (var role in rolesForSelectedDifficulty) + { + int roleId = int.Parse(role); + NPCData npcData = jsonReader1.GetRoleDateById(roleId); + if (jsonReader1.npcDictionary.ContainsKey(roleId)) { - int key = int.Parse(sectionParts[1]); - if (jsonReader1.npcDictionary.ContainsKey(key)) + var npcInfo = jsonReader1.npcDictionary[roleId]; + // DutyItemʵ + GameObject item = GameObject.Instantiate(dutyPrefab, dutyCount); + DutyItem dutyItem = item.GetComponent(); + Button dutuybutton = item.transform.Find("TextBtn").GetComponent