Json文件读取代码调整,任务相关逻辑的编写
This commit is contained in:
parent
c7cf4332da
commit
980e2e96ac
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
@ -56,26 +56,26 @@ public class JSONReader : MonoBehaviour
|
||||
// 解析 JSON 字符串为 Task 数据
|
||||
public Dictionary<string, Task_> TaskJSON(string json)
|
||||
{
|
||||
NPCData[] npcArray = JsonHelper.FromJson<NPCData>(json);
|
||||
Task_[] npcArray = JsonHelper.FromJson<Task_>(json);
|
||||
Dictionary<string, Task_> selectDictionary = new Dictionary<string, Task_>();
|
||||
|
||||
foreach (var npc in npcArray)
|
||||
{
|
||||
npcDictionary[npc.ID] = npc;
|
||||
TaskDictionary[npc.ID] = npc;
|
||||
}
|
||||
|
||||
return selectDictionary;
|
||||
return TaskDictionary;
|
||||
}
|
||||
|
||||
// 解析 JSON 字符串为 Select 数据
|
||||
public Dictionary<string, Select> SelectJSON(string json)
|
||||
{
|
||||
NPCData[] npcArray = JsonHelper.FromJson<NPCData>(json);
|
||||
Select[] npcArray = JsonHelper.FromJson<Select>(json);
|
||||
Dictionary<string, Select> selectDictionary = new Dictionary<string, Select>();
|
||||
|
||||
foreach (var npc in npcArray)
|
||||
{
|
||||
npcDictionary[npc.ID] = npc;
|
||||
SelectDictionary[npc.ID] = npc;
|
||||
}
|
||||
|
||||
return selectDictionary;
|
||||
@ -239,13 +239,9 @@ public class JSONReader : MonoBehaviour
|
||||
Task_ info = null;
|
||||
if (TaskDictionary.TryGetValue(id.ToString(), out info))
|
||||
{
|
||||
return info; // 返回符合条件的 Task 数据
|
||||
return info;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"No Language found with ID: {id}");
|
||||
}
|
||||
return null; // 如果没有找到符合条件的语言数据,返回 null
|
||||
else return null;
|
||||
}
|
||||
|
||||
public LocationData GetAreaDateById(int id)
|
||||
|
Loading…
Reference in New Issue
Block a user