From 47787b8bfd70bb719501123551e94cb8e8dc7ec5 Mon Sep 17 00:00:00 2001 From: huyulong <1838407198@qq.com> Date: Thu, 5 Dec 2024 20:21:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=8E=A5=E5=8F=A3=E5=92=8C?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xiaofang/Assets/HYLjson/Language.json | 22 -- xiaofang/Assets/HYLjson/Language.json.meta | 7 - xiaofang/Assets/ProtoBuf/test.cs | 1 - xiaofang/Assets/Res/HYLUI/TaskPanel.cs | 27 ++ .../Assets/Resources/JsonAsset/Language.json | 241 +++++++++++++++++- xiaofang/Assets/Scenes/Tmap 1.unity | 28 +- .../Assets/Script/JSONReader/JSONReader.cs | 28 ++ .../Script/UI/PanelUI/SelectScenePanel.cs | 2 +- 8 files changed, 316 insertions(+), 40 deletions(-) delete mode 100644 xiaofang/Assets/HYLjson/Language.json delete mode 100644 xiaofang/Assets/HYLjson/Language.json.meta diff --git a/xiaofang/Assets/HYLjson/Language.json b/xiaofang/Assets/HYLjson/Language.json deleted file mode 100644 index e0d25f0e..00000000 --- a/xiaofang/Assets/HYLjson/Language.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "ID": "11001", - "Text": "测试任务1", - "Note": "测试任务" - }, - { - "ID": "11002", - "Text": "测试任务2", - "Note": "测试任务" - }, - { - "ID": "11003", - "Text": "测试任务3", - "Note": "测试任务" - }, - { - "ID": "11004", - "Text": "测试任务4", - "Note": "测试任务" - } -] \ No newline at end of file diff --git a/xiaofang/Assets/HYLjson/Language.json.meta b/xiaofang/Assets/HYLjson/Language.json.meta deleted file mode 100644 index ef91c10b..00000000 --- a/xiaofang/Assets/HYLjson/Language.json.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: d5e54aa3c34f90f48ac60f40191f2532 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/xiaofang/Assets/ProtoBuf/test.cs b/xiaofang/Assets/ProtoBuf/test.cs index a37c145b..4c0ede57 100644 --- a/xiaofang/Assets/ProtoBuf/test.cs +++ b/xiaofang/Assets/ProtoBuf/test.cs @@ -478,7 +478,6 @@ public class test : MonoBehaviour TaskUpdateRequest taskUpdateRequest = ProtoBufffer.DeSerialize(bytes); Debug.Log(taskUpdateRequest); - break; //󴥷 diff --git a/xiaofang/Assets/Res/HYLUI/TaskPanel.cs b/xiaofang/Assets/Res/HYLUI/TaskPanel.cs index 9a0cba77..89819747 100644 --- a/xiaofang/Assets/Res/HYLUI/TaskPanel.cs +++ b/xiaofang/Assets/Res/HYLUI/TaskPanel.cs @@ -7,6 +7,16 @@ using DG.Tweening; public class TaskPanel : Base { + public List taskId = new List(); + + public Transform contentTrans; + + public GameObject taskPrefab; + + public JSONReader JSONReader; + + public Dictionary taskDic = new Dictionary(); + public Button closeBtn; private bool isOpen = false; @@ -16,8 +26,21 @@ public class TaskPanel : Base { closeBtn.onClick.AddListener(CloseBtn); + + InitTask(); } + + public void InitTask() + { + for(int i = 0; i < taskId.Count;i++) + { + GameObject go = GameObject.Instantiate(taskPrefab, contentTrans); + go.transform.name = "Task_" + i; + } + } + + public void CloseBtn() { if (isOpen)//ر @@ -34,6 +57,10 @@ public class TaskPanel : Base } } + + + + // Update is called once per frame void Update() { diff --git a/xiaofang/Assets/Resources/JsonAsset/Language.json b/xiaofang/Assets/Resources/JsonAsset/Language.json index 1e22d0b7..619e3880 100644 --- a/xiaofang/Assets/Resources/JsonAsset/Language.json +++ b/xiaofang/Assets/Resources/JsonAsset/Language.json @@ -1,4 +1,24 @@ [ + { + "ID": "2001", + "Text": "厨房起火", + "Note": "事故位置" + }, + { + "ID": "2002", + "Text": "学生宿舍起火", + "Note": "事故位置-测试" + }, + { + "ID": "2003", + "Text": "测试位置1", + "Note": "事故位置-测试" + }, + { + "ID": "2004", + "Text": "测试位置2", + "Note": "事故位置-测试" + }, { "ID": "6001", "Text": "小学生", @@ -79,11 +99,31 @@ "Text": "武侯实验小学", "Note": "场景名" }, + { + "ID": "40002", + "Text": "协和医院", + "Note": "场景名" + }, + { + "ID": "40003", + "Text": "2号线地铁工地", + "Note": "场景名" + }, { "ID": "9000", "Text": "学校", "Note": "场景分类" }, + { + "ID": "9001", + "Text": "医院", + "Note": "场景分类" + }, + { + "ID": "9002", + "Text": "建筑工地", + "Note": "场景分类" + }, { "ID": "10001", "Text": "1", @@ -739,25 +779,210 @@ "Text": "131", "Note": "选项文本" }, + { + "ID": "10199", + "Text": "让学生赶紧去操场集合", + "Note": "选项文本" + }, + { + "ID": "10200", + "Text": "“跟在我后面”", + "Note": "选项文本" + }, { "ID": "11001", - "Text": "测试任务1", - "Note": "测试任务" + "Text": "扑灭明火(非困难难度)-总指挥", + "Note": "任务" }, { "ID": "11002", - "Text": "测试任务2", - "Note": "测试任务" + "Text": "扑灭明火(困难难度)-总指挥", + "Note": "任务" }, { "ID": "11003", - "Text": "测试任务3", - "Note": "测试任务" + "Text": "疏散学生(非困难难度)-总指挥", + "Note": "任务" }, { "ID": "11004", - "Text": "测试任务4", - "Note": "测试任务" + "Text": "疏散学生(困难难度)-总指挥", + "Note": "任务" + }, + { + "ID": "11005", + "Text": "处理上报人员受伤-总指挥", + "Note": "任务" + }, + { + "ID": "11006", + "Text": "处理上报请求增援-总指挥", + "Note": "任务" + }, + { + "ID": "11007", + "Text": "穿戴防护服-抢险救援", + "Note": "任务" + }, + { + "ID": "11008", + "Text": "扑灭明火-抢险救援", + "Note": "任务" + }, + { + "ID": "11009", + "Text": "扑灭明火(不用穿防护服)-抢险救援", + "Note": "任务" + }, + { + "ID": "11010", + "Text": "消火栓操作增援-抢险救援-同组增援", + "Note": "任务" + }, + { + "ID": "11011", + "Text": "救助受伤人员-医疗救护", + "Note": "任务" + }, + { + "ID": "11012", + "Text": "紧急救助昏迷人员-医疗救护", + "Note": "任务" + }, + { + "ID": "11013", + "Text": "拨打120报警-医疗救护", + "Note": "任务" + }, + { + "ID": "11014", + "Text": "转移无法移动的学生-医疗救护", + "Note": "任务" + }, + { + "ID": "11015", + "Text": "疏散任务-非困难", + "Note": "任务" + }, + { + "ID": "11045", + "Text": "清点人数-非困难", + "Note": "任务" + }, + { + "ID": "11075", + "Text": "清点教室人数-困难", + "Note": "任务" + }, + { + "ID": "11105", + "Text": "疏散任务-困难", + "Note": "任务" + }, + { + "ID": "11135", + "Text": "断电、切断燃气供应-后勤组", + "Note": "任务" + }, + { + "ID": "11136", + "Text": "运送灭火器给起火点区域的抢险救援组", + "Note": "任务" + }, + { + "ID": "11137", + "Text": "后勤组转移可燃物", + "Note": "任务" + }, + { + "ID": "11138", + "Text": "运送灭火器给起火点区域的抢险救援组", + "Note": "任务" + }, + { + "ID": "11139", + "Text": "转移可燃物-后勤组", + "Note": "任务" + }, + { + "ID": "11140", + "Text": "布置警戒线", + "Note": "任务" + }, + { + "ID": "11141", + "Text": "拨打119报警-后勤组", + "Note": "任务" + }, + { + "ID": "11142", + "Text": "将滞留在楼上的学生带下楼-搜寻组", + "Note": "任务" + }, + { + "ID": "11143", + "Text": "转移疏散通道上的障碍物-后勤组", + "Note": "任务" + }, + { + "ID": "11144", + "Text": "切断燃气-逻辑判定任务-玩家不可见", + "Note": "任务" + }, + { + "ID": "11145", + "Text": "疏散组触发选项用-玩家不可见-非1楼", + "Note": "任务" + }, + { + "ID": "11146", + "Text": "疏散组触发选项用-玩家不可见-1楼", + "Note": "任务" + }, + { + "ID": "11147", + "Text": "困难触发清点教室人数用-玩家不可见", + "Note": "任务" + }, + { + "ID": "11148", + "Text": "困难选择疏散楼梯2楼-总指挥触发选项用-玩家不可见", + "Note": "任务" + }, + { + "ID": "11152", + "Text": "困难总指挥触发广播让疏散用-玩家不可见", + "Note": "任务" + }, + { + "ID": "11153", + "Text": "医疗救护组转移惊颤学生", + "Note": "任务" + }, + { + "ID": "11154", + "Text": "医疗救护组转移负伤学生", + "Note": "任务" + }, + { + "ID": "11155", + "Text": "医疗救护组-转移角色", + "Note": "任务" + }, + { + "ID": "11156", + "Text": "医疗救护组-急救角色", + "Note": "任务" + }, + { + "ID": "11158", + "Text": "医疗救护组-包扎-行动能力受限", + "Note": "任务" + }, + { + "ID": "11159", + "Text": "打开学校大门迎接消防队伍", + "Note": "任务" }, { "ID": "20000", diff --git a/xiaofang/Assets/Scenes/Tmap 1.unity b/xiaofang/Assets/Scenes/Tmap 1.unity index f1d3c144..b221e481 100644 --- a/xiaofang/Assets/Scenes/Tmap 1.unity +++ b/xiaofang/Assets/Scenes/Tmap 1.unity @@ -6804,7 +6804,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 896229b2da4cc204aae01b62e5129e22, type: 3} m_Name: m_EditorClassIdentifier: - button: {fileID: 670223750} + retbutton: {fileID: 0} + ClosureObj: {fileID: 0} + contentTrans: {fileID: 1889829591} + taskPrefab: {fileID: 3645880154619645306, guid: 1a0185fc1549da647943a21145debe29, type: 3} + JSONReader: {fileID: 1526740604} + closeBtn: {fileID: 0} --- !u!1001 &825899810 PrefabInstance: m_ObjectHideFlags: 0 @@ -17903,6 +17908,7 @@ GameObject: - component: {fileID: 1526740602} - component: {fileID: 1526740601} - component: {fileID: 1526740603} + - component: {fileID: 1526740604} m_Layer: 0 m_Name: GameObject (1) m_TagString: Untagged @@ -17954,6 +17960,26 @@ MonoBehaviour: serverIP: ws://124.221.149.22 serverPort: 38445 type: +--- !u!114 &1526740604 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1526740600} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 13fa0701c49727a4c84282a40243e52d, type: 3} + m_Name: + m_EditorClassIdentifier: + npcJsonFile: {fileID: 4900000, guid: a854e20393334f04a8fc75e06404fe4f, type: 3} + locationJsonFile: {fileID: 4900000, guid: 4d6cd655327e27c4b88c2033169c8fed, type: 3} + eventJsonFile: {fileID: 4900000, guid: 2ef075e4830019a42b84d8d05d13d81c, type: 3} + matialJsonFile: {fileID: 4900000, guid: d98cb351d1a87dc4887a37106b9745d4, type: 3} + sceneJsonFile: {fileID: 4900000, guid: 06c09fd1c8b0a0a45951a1065189d922, type: 3} + incidentSiteJosnFile: {fileID: 4900000, guid: 1efa4372b10d4294199638c49173ff4c, type: 3} + NPCJosnFile: {fileID: 4900000, guid: 41009f009f0718647a782c7e1aec97dd, type: 3} + LanguageJsonFile: {fileID: 4900000, guid: 62a41129c4663ee41a06274114d28feb, type: 3} --- !u!1001 &1542437476 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/xiaofang/Assets/Script/JSONReader/JSONReader.cs b/xiaofang/Assets/Script/JSONReader/JSONReader.cs index cd76eb66..f815c329 100644 --- a/xiaofang/Assets/Script/JSONReader/JSONReader.cs +++ b/xiaofang/Assets/Script/JSONReader/JSONReader.cs @@ -4,6 +4,8 @@ using UnityEngine.UI; public class JSONReader : MonoBehaviour { + + // Unity ༭ֱܹͬ JSON ļ public TextAsset npcJsonFile; // NPC public TextAsset locationJsonFile; // Location @@ -193,6 +195,32 @@ public class JSONReader : MonoBehaviour return null; // ûҵݣ null } + + //ȡ + public Language GetTaskByID(int id,Dictionary dic) + { + Language info = null; + if (LanguageDictionary.TryGetValue(id, out info)) + { + // ж Note Ƿ "Ԥ" + if (info.Note == "") + { + Debug.Log($"Found Language: ID = {info.ID}, Text = {info.Text}, Note = {info.Note}"); + dic.Add(id, info); + return info; // ط Language + } + else + { + Debug.Log($"Language with ID {id} found, but Note is not 'Ԥ'."); + } + } + else + { + Debug.Log($"No Language found with ID: {id}"); + } + return null; // ûҵݣ null + } + public SceneData GetSceneById(int id) { SceneData info = null; diff --git a/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs b/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs index 9fd7feec..243410ed 100644 --- a/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs +++ b/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs @@ -447,7 +447,7 @@ public class SelectScenePanel : MonoBehaviour // 鳡ѡ foreach (Toggle toggle in scenetoggleList) { - Debug.Log("++++++++++++++++++++++++=" + scenetoggleList.Count()); + //Debug.Log("++++++++++++++++++++++++=" + scenetoggleList.Count()); if (toggle.isOn) { anyToggleSelected = true;