From 980e2e96accaf804f460c3f61efc3e4cdf26776b Mon Sep 17 00:00:00 2001 From: huyulong <1838407198@qq.com> Date: Wed, 11 Dec 2024 20:54:34 +0800 Subject: [PATCH] =?UTF-8?q?Json=E6=96=87=E4=BB=B6=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4=EF=BC=8C=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=80=BB=E8=BE=91=E7=9A=84=E7=BC=96=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xiaofang/Assets/Prefabs/HYLPrefabs/TaskItem.cs | 5 +++-- .../Assets/Script/JSONReader/JSONReader.cs | 18 +++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/xiaofang/Assets/Prefabs/HYLPrefabs/TaskItem.cs b/xiaofang/Assets/Prefabs/HYLPrefabs/TaskItem.cs index cfd2193c..365ef2c0 100644 --- a/xiaofang/Assets/Prefabs/HYLPrefabs/TaskItem.cs +++ b/xiaofang/Assets/Prefabs/HYLPrefabs/TaskItem.cs @@ -58,6 +58,7 @@ public class TaskItem : MonoBehaviour { taskId = id; jr = js; + UpdateTxt(); } @@ -65,8 +66,8 @@ public class TaskItem : MonoBehaviour { Task_ info = jr.GetTaskByID(taskId); - - tasktxt.text = info.Name; + Debug.Log(info); + tasktxt.text = info.Note; } diff --git a/xiaofang/Assets/Script/JSONReader/JSONReader.cs b/xiaofang/Assets/Script/JSONReader/JSONReader.cs index c955bb6f..b114d1df 100644 --- a/xiaofang/Assets/Script/JSONReader/JSONReader.cs +++ b/xiaofang/Assets/Script/JSONReader/JSONReader.cs @@ -56,26 +56,26 @@ public class JSONReader : MonoBehaviour // 解析 JSON 字符串为 Task 数据 public Dictionary TaskJSON(string json) { - NPCData[] npcArray = JsonHelper.FromJson(json); + Task_[] npcArray = JsonHelper.FromJson(json); Dictionary selectDictionary = new Dictionary(); foreach (var npc in npcArray) { - npcDictionary[npc.ID] = npc; + TaskDictionary[npc.ID] = npc; } - return selectDictionary; + return TaskDictionary; } // 解析 JSON 字符串为 Select 数据 public Dictionary SelectJSON(string json) { - NPCData[] npcArray = JsonHelper.FromJson(json); + Select[] npcArray = JsonHelper.FromJson