2024-11-30 18:15:51 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
using System.Collections.Generic;
|
2024-12-05 15:39:10 +08:00
|
|
|
|
using UnityEngine.UI;
|
2024-12-09 11:56:53 +08:00
|
|
|
|
using Google.Protobuf.WellKnownTypes;
|
2024-11-30 18:15:51 +08:00
|
|
|
|
|
|
|
|
|
public class JSONReader : MonoBehaviour
|
|
|
|
|
{
|
2024-12-05 20:21:15 +08:00
|
|
|
|
|
|
|
|
|
|
2024-11-30 18:15:51 +08:00
|
|
|
|
// <20><> Unity <20>༭<EFBFBD><E0BCAD><EFBFBD>ܹ<EFBFBD><DCB9>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC> JSON <20>ļ<EFBFBD>
|
|
|
|
|
public TextAsset npcJsonFile; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NPC <20><><EFBFBD><EFBFBD>
|
|
|
|
|
public TextAsset locationJsonFile; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Location <20><><EFBFBD><EFBFBD>
|
2024-11-30 23:32:17 +08:00
|
|
|
|
public TextAsset eventJsonFile;
|
2024-12-01 04:58:16 +08:00
|
|
|
|
public TextAsset matialJsonFile;
|
|
|
|
|
public TextAsset sceneJsonFile;
|
2024-12-01 22:36:41 +08:00
|
|
|
|
public TextAsset incidentSiteJosnFile;
|
2024-12-01 23:00:40 +08:00
|
|
|
|
public TextAsset NPCJosnFile;
|
2024-12-04 22:58:31 +08:00
|
|
|
|
public TextAsset LanguageJsonFile;
|
2024-12-09 11:56:53 +08:00
|
|
|
|
public TextAsset SelectJsonFile;
|
2024-12-11 16:05:50 +08:00
|
|
|
|
public TextAsset TaskJsonFile;
|
2024-11-30 23:32:17 +08:00
|
|
|
|
public Dictionary<int, NPCData> npcDictionary = new Dictionary<int, NPCData>();
|
|
|
|
|
public Dictionary<int, LocationData> locationDictionary = new Dictionary<int, LocationData>();
|
|
|
|
|
public Dictionary<int, EventData> eventDictionary = new Dictionary<int, EventData>();
|
2024-12-01 04:58:16 +08:00
|
|
|
|
public Dictionary<int, MatialData> matialDictionary = new Dictionary<int, MatialData>();
|
|
|
|
|
public Dictionary<int, SceneData> sceneDictionary = new Dictionary<int, SceneData>();
|
2024-12-01 22:36:41 +08:00
|
|
|
|
public Dictionary<int, IncidentSite> incidentSiteDictionary = new Dictionary<int, IncidentSite>();
|
2024-12-01 23:00:40 +08:00
|
|
|
|
public Dictionary<int, NPC> NPCDictionary = new Dictionary<int, NPC>();
|
2024-12-04 22:58:31 +08:00
|
|
|
|
public Dictionary<int, Language> LanguageDictionary = new Dictionary<int, Language>();
|
2024-12-09 11:56:53 +08:00
|
|
|
|
private Dictionary<string, Select> SelectDictionary = new Dictionary<string, Select>();
|
2024-12-11 16:05:50 +08:00
|
|
|
|
private Dictionary<string, Task_> TaskDictionary = new Dictionary<string, Task_>();
|
2024-11-30 18:15:51 +08:00
|
|
|
|
|
2024-11-30 23:32:17 +08:00
|
|
|
|
void Awake()
|
2024-11-30 18:15:51 +08:00
|
|
|
|
{
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> NPC <20><> Location <20><><EFBFBD><EFBFBD>
|
2024-11-30 23:32:17 +08:00
|
|
|
|
npcDictionary = ParseJSON(npcJsonFile.text);
|
|
|
|
|
locationDictionary = LocationParseJSON(locationJsonFile.text);
|
|
|
|
|
eventDictionary = EventParseJSON(eventJsonFile.text);
|
2024-12-01 04:58:16 +08:00
|
|
|
|
matialDictionary = MatialParseJSON(matialJsonFile.text);
|
|
|
|
|
sceneDictionary = SceneParseJSON(sceneJsonFile.text);
|
2024-12-01 22:36:41 +08:00
|
|
|
|
incidentSiteDictionary = IncidentSiteParseJSON(incidentSiteJosnFile.text);
|
2024-12-01 23:00:40 +08:00
|
|
|
|
NPCDictionary = NPCParseJSON(incidentSiteJosnFile.text);
|
2024-12-09 11:56:53 +08:00
|
|
|
|
LanguageDictionary = LanguageParseJSON(LanguageJsonFile.text);
|
|
|
|
|
SelectDictionary = SelectJSON(SelectJsonFile.text);
|
2024-12-11 16:05:50 +08:00
|
|
|
|
TaskDictionary = TaskJSON(TaskJsonFile.text);
|
2024-12-09 11:56:53 +08:00
|
|
|
|
|
|
|
|
|
|
2024-12-04 22:58:31 +08:00
|
|
|
|
GetLanguageByID(20008);
|
2024-12-09 23:53:38 +08:00
|
|
|
|
foreach (var npc in npcDictionary)
|
2024-11-30 23:32:17 +08:00
|
|
|
|
{
|
2024-12-09 23:53:38 +08:00
|
|
|
|
//Debug.Log(npc.Value.ID);
|
2024-12-05 15:39:10 +08:00
|
|
|
|
//Debug.Log(npc.Value.Name);
|
2024-11-30 23:32:17 +08:00
|
|
|
|
}
|
2024-12-04 16:37:51 +08:00
|
|
|
|
GetNpcDataByID(8001);
|
2024-11-30 18:15:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-12-11 16:05:50 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD> JSON <20>ַ<EFBFBD><D6B7><EFBFBD>Ϊ Task <20><><EFBFBD><EFBFBD>
|
|
|
|
|
public Dictionary<string, Task_> TaskJSON(string json)
|
|
|
|
|
{
|
|
|
|
|
NPCData[] npcArray = JsonHelper.FromJson<NPCData>(json);
|
|
|
|
|
Dictionary<string, Task_> selectDictionary = new Dictionary<string, Task_>();
|
|
|
|
|
|
|
|
|
|
foreach (var npc in npcArray)
|
|
|
|
|
{
|
|
|
|
|
npcDictionary[npc.ID] = npc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return selectDictionary;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-09 11:56:53 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD> JSON <20>ַ<EFBFBD><D6B7><EFBFBD>Ϊ Select <20><><EFBFBD><EFBFBD>
|
|
|
|
|
public Dictionary<string, Select> SelectJSON(string json)
|
|
|
|
|
{
|
|
|
|
|
NPCData[] npcArray = JsonHelper.FromJson<NPCData>(json);
|
|
|
|
|
Dictionary<string, Select> selectDictionary = new Dictionary<string, Select>();
|
|
|
|
|
|
|
|
|
|
foreach (var npc in npcArray)
|
|
|
|
|
{
|
|
|
|
|
npcDictionary[npc.ID] = npc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return selectDictionary;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-30 18:15:51 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD> JSON <20>ַ<EFBFBD><D6B7><EFBFBD>Ϊ NPC <20><><EFBFBD><EFBFBD>
|
2024-11-30 23:32:17 +08:00
|
|
|
|
public Dictionary<int, NPCData> ParseJSON(string json)
|
2024-11-30 18:15:51 +08:00
|
|
|
|
{
|
|
|
|
|
NPCData[] npcArray = JsonHelper.FromJson<NPCData>(json);
|
|
|
|
|
Dictionary<int, NPCData> npcDictionary = new Dictionary<int, NPCData>();
|
|
|
|
|
|
|
|
|
|
foreach (var npc in npcArray)
|
|
|
|
|
{
|
|
|
|
|
npcDictionary[npc.ID] = npc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return npcDictionary;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> JSON <20>ַ<EFBFBD><D6B7><EFBFBD>Ϊ Location <20><><EFBFBD><EFBFBD>
|
2024-11-30 23:32:17 +08:00
|
|
|
|
public Dictionary<int, LocationData> LocationParseJSON(string json)
|
2024-11-30 18:15:51 +08:00
|
|
|
|
{
|
|
|
|
|
LocationData[] locationArray = JsonHelper.FromJson<LocationData>(json);
|
|
|
|
|
Dictionary<int, LocationData> locationDictionary = new Dictionary<int, LocationData>();
|
|
|
|
|
|
|
|
|
|
foreach (var location in locationArray)
|
|
|
|
|
{
|
|
|
|
|
locationDictionary[location.ID] = location;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return locationDictionary;
|
|
|
|
|
}
|
2024-12-04 16:37:51 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD> JSON <20>ַ<EFBFBD><D6B7><EFBFBD>Ϊ Event <20><><EFBFBD><EFBFBD>
|
2024-11-30 23:32:17 +08:00
|
|
|
|
public Dictionary<int, EventData> EventParseJSON(string json)
|
2024-11-30 18:15:51 +08:00
|
|
|
|
{
|
2024-11-30 23:32:17 +08:00
|
|
|
|
EventData[] locationArray = JsonHelper.FromJson<EventData>(json);
|
|
|
|
|
Dictionary<int, EventData> locationDictionary = new Dictionary<int, EventData>();
|
2024-11-30 18:15:51 +08:00
|
|
|
|
|
2024-11-30 23:32:17 +08:00
|
|
|
|
foreach (var location in locationArray)
|
2024-11-30 18:15:51 +08:00
|
|
|
|
{
|
2024-11-30 23:32:17 +08:00
|
|
|
|
locationDictionary[location.ID] = location;
|
2024-11-30 18:15:51 +08:00
|
|
|
|
}
|
2024-11-30 23:32:17 +08:00
|
|
|
|
|
|
|
|
|
return locationDictionary;
|
2024-11-30 18:15:51 +08:00
|
|
|
|
}
|
2024-11-30 23:32:17 +08:00
|
|
|
|
|
2024-12-01 04:58:16 +08:00
|
|
|
|
public Dictionary<int, MatialData> MatialParseJSON(string json)
|
|
|
|
|
{
|
|
|
|
|
MatialData[] locationArray = JsonHelper.FromJson<MatialData>(json);
|
|
|
|
|
Dictionary<int, MatialData> locationDictionary = new Dictionary<int, MatialData>();
|
|
|
|
|
|
|
|
|
|
foreach (var location in locationArray)
|
|
|
|
|
{
|
|
|
|
|
locationDictionary[location.ID] = location;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return locationDictionary;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Dictionary<int, SceneData> SceneParseJSON(string json)
|
|
|
|
|
{
|
|
|
|
|
SceneData[] locationArray = JsonHelper.FromJson<SceneData>(json);
|
|
|
|
|
Dictionary<int, SceneData> locationDictionary = new Dictionary<int, SceneData>();
|
|
|
|
|
|
|
|
|
|
foreach (var location in locationArray)
|
|
|
|
|
{
|
|
|
|
|
locationDictionary[location.ID] = location;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return locationDictionary;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-01 22:36:41 +08:00
|
|
|
|
public Dictionary<int, IncidentSite> IncidentSiteParseJSON(string json)
|
|
|
|
|
{
|
|
|
|
|
IncidentSite[] locationArray = JsonHelper.FromJson<IncidentSite>(json);
|
|
|
|
|
Dictionary<int, IncidentSite> locationDictionary = new Dictionary<int, IncidentSite>();
|
|
|
|
|
|
|
|
|
|
foreach (var location in locationArray)
|
|
|
|
|
{
|
|
|
|
|
locationDictionary[location.ID] = location;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return locationDictionary;
|
|
|
|
|
}
|
2024-12-05 17:56:33 +08:00
|
|
|
|
|
2024-12-01 23:00:40 +08:00
|
|
|
|
public Dictionary<int, NPC> NPCParseJSON(string json)
|
|
|
|
|
{
|
|
|
|
|
NPC[] locationArray = JsonHelper.FromJson<NPC>(json);
|
|
|
|
|
Dictionary<int, NPC> locationDictionary = new Dictionary<int, NPC>();
|
|
|
|
|
|
|
|
|
|
foreach (var location in locationArray)
|
|
|
|
|
{
|
|
|
|
|
locationDictionary[location.ID] = location;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return locationDictionary;
|
|
|
|
|
}
|
2024-12-01 22:36:41 +08:00
|
|
|
|
|
2024-12-04 22:58:31 +08:00
|
|
|
|
public Dictionary<int, Language> LanguageParseJSON(string json)
|
|
|
|
|
{
|
|
|
|
|
Language[] locationArray = JsonHelper.FromJson<Language>(json);
|
|
|
|
|
Dictionary<int, Language> locationDictionary = new Dictionary<int, Language>();
|
|
|
|
|
|
|
|
|
|
foreach (var location in locationArray)
|
|
|
|
|
{
|
|
|
|
|
locationDictionary[location.ID] = location;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return locationDictionary;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-04 16:37:51 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
// <20><><EFBFBD>ݸ<EFBFBD><DDB8><EFBFBD><EFBFBD><EFBFBD>ID<49><44>ȡ<EFBFBD><C8A1>Ӧ<EFBFBD><D3A6>NPC<50><43><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public void GetNpcDataByID(int id)
|
|
|
|
|
{
|
|
|
|
|
// <20><><EFBFBD>磬<EFBFBD><E7A3AC>ȡ NPC <20>ֵ<EFBFBD><D6B5>ж<EFBFBD>Ӧ ID <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (npcDictionary.ContainsKey(id))
|
|
|
|
|
{
|
|
|
|
|
NPCData npcData = npcDictionary[id];
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
foreach (var npc in npcDictionary)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.Log($"No NPC found with ID: {id}");
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-04 22:58:31 +08:00
|
|
|
|
|
2024-12-05 15:39:10 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>id<69><64>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
2024-12-04 22:58:31 +08:00
|
|
|
|
public Language GetLanguageByID(int id)
|
|
|
|
|
{
|
|
|
|
|
Language info = null;
|
|
|
|
|
if (LanguageDictionary.TryGetValue(id, out info))
|
|
|
|
|
{
|
|
|
|
|
// <20>ж<EFBFBD> Note <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD> "Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
if (info.Note == "Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
|
|
|
|
|
{
|
|
|
|
|
Debug.Log($"Found Language: ID = {info.ID}, Text = {info.Text}, Note = {info.Note}");
|
|
|
|
|
return info; // <20><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Language <20><><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.Log($"Language with ID {id} found, but Note is not 'Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.Log($"No Language found with ID: {id}");
|
|
|
|
|
}
|
|
|
|
|
return null; // <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD> null
|
2024-12-05 20:21:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|
|
|
|
public Language GetTaskByID(int id,Dictionary<int,Language> dic)
|
|
|
|
|
{
|
|
|
|
|
Language info = null;
|
|
|
|
|
if (LanguageDictionary.TryGetValue(id, out info))
|
|
|
|
|
{
|
|
|
|
|
// <20>ж<EFBFBD> Note <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD> "Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
if (info.Note == "<22><><EFBFBD><EFBFBD>")
|
|
|
|
|
{
|
|
|
|
|
Debug.Log($"Found Language: ID = {info.ID}, Text = {info.Text}, Note = {info.Note}");
|
2024-12-06 11:29:20 +08:00
|
|
|
|
//dic.Add(id, info);
|
2024-12-05 20:21:15 +08:00
|
|
|
|
return info; // <20><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Language <20><><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.Log($"Language with ID {id} found, but Note is not 'Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.Log($"No Language found with ID: {id}");
|
|
|
|
|
}
|
|
|
|
|
return null; // <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD> null
|
2024-12-04 22:58:31 +08:00
|
|
|
|
}
|
2024-12-05 15:39:10 +08:00
|
|
|
|
|
2024-12-10 08:05:28 +08:00
|
|
|
|
public LocationData GetAreaDateById(int id)
|
|
|
|
|
{
|
|
|
|
|
LocationData info = null;
|
|
|
|
|
if (locationDictionary.TryGetValue(id, out info))
|
|
|
|
|
{
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
else return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-12-05 15:39:10 +08:00
|
|
|
|
public SceneData GetSceneById(int id)
|
|
|
|
|
{
|
|
|
|
|
SceneData info = null;
|
|
|
|
|
if (sceneDictionary.TryGetValue(id, out info))
|
|
|
|
|
{
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
else return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public EventData GetEvenById(int id)
|
|
|
|
|
{
|
|
|
|
|
EventData info = null;
|
|
|
|
|
if (eventDictionary.TryGetValue(id, out info))
|
|
|
|
|
{
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
else return null;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-06 11:37:41 +08:00
|
|
|
|
public IncidentSite GetIncidentSiteById(int id)
|
|
|
|
|
{
|
|
|
|
|
IncidentSite info = null;
|
|
|
|
|
if (incidentSiteDictionary.TryGetValue(id, out info))
|
|
|
|
|
{
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
else return null;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-09 23:53:38 +08:00
|
|
|
|
public NPCData GetRoleDateById(int id)
|
|
|
|
|
{
|
|
|
|
|
NPCData info = null;
|
|
|
|
|
if (npcDictionary.TryGetValue(id, out info))
|
|
|
|
|
{
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
else return null;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-05 15:39:10 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>UI<55>ı<EFBFBD><C4B1>ķ<EFBFBD><C4B7><EFBFBD>
|
|
|
|
|
public void SetUIText(Text text, int id)
|
|
|
|
|
{
|
|
|
|
|
Language languageinfo = GetLanguageByID(id);
|
|
|
|
|
text.text = languageinfo.Text;
|
|
|
|
|
}
|
2024-11-30 18:15:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD> JSON <20><><EFBFBD><EFBFBD>
|
|
|
|
|
public static class JsonHelper
|
|
|
|
|
{
|
|
|
|
|
public static T[] FromJson<T>(string json)
|
|
|
|
|
{
|
|
|
|
|
json = "{\"items\":" + json + "}";
|
|
|
|
|
Wrapper<T> wrapper = JsonUtility.FromJson<Wrapper<T>>(json);
|
|
|
|
|
return wrapper.items;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
|
private class Wrapper<T>
|
|
|
|
|
{
|
|
|
|
|
public T[] items;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
|
public class NPCData
|
|
|
|
|
{
|
|
|
|
|
public int ID;
|
|
|
|
|
public string Note;
|
|
|
|
|
public string Name;
|
|
|
|
|
public int ActionMode;
|
|
|
|
|
public int Group;
|
|
|
|
|
public int GroupLeader;
|
|
|
|
|
public int IsLeadingNPC;
|
|
|
|
|
public string ICON;
|
|
|
|
|
public int WeightLimit;
|
|
|
|
|
public string Stats;
|
|
|
|
|
public string Skills;
|
|
|
|
|
public string ResPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
|
public class LocationData
|
|
|
|
|
{
|
|
|
|
|
public int ID;
|
|
|
|
|
public string Note;
|
|
|
|
|
public int Name;
|
|
|
|
|
public int Scene;
|
|
|
|
|
public string NpcRatio;
|
|
|
|
|
public string Oversee;
|
|
|
|
|
public string RoleLimit;
|
|
|
|
|
public int Level;
|
|
|
|
|
}
|
2024-11-30 23:32:17 +08:00
|
|
|
|
[System.Serializable]
|
|
|
|
|
public class EventData
|
|
|
|
|
{
|
|
|
|
|
public int ID;
|
|
|
|
|
public string Note;
|
|
|
|
|
public int Name;
|
|
|
|
|
public string Role;
|
|
|
|
|
public string DisasterLocation;
|
|
|
|
|
}
|
2024-12-01 04:58:16 +08:00
|
|
|
|
[System.Serializable]
|
|
|
|
|
public class MatialData
|
|
|
|
|
{
|
|
|
|
|
public int ID;
|
|
|
|
|
public string Note;
|
|
|
|
|
public int Type;
|
|
|
|
|
public int Name;
|
|
|
|
|
public int Weight;
|
|
|
|
|
public int Scene;
|
|
|
|
|
public string RoleLimit;
|
|
|
|
|
public string Icon;
|
|
|
|
|
public string ResPath;
|
|
|
|
|
public int ConsumableType;
|
|
|
|
|
public int Durations;
|
|
|
|
|
public string Attribute;
|
|
|
|
|
public string IsPickup;
|
|
|
|
|
public int PutInStore;
|
|
|
|
|
}
|
|
|
|
|
[System.Serializable]
|
|
|
|
|
public class SceneData
|
|
|
|
|
{
|
|
|
|
|
public int ID;
|
2024-12-09 23:53:38 +08:00
|
|
|
|
public string Name;
|
2024-12-01 04:58:16 +08:00
|
|
|
|
public int Type;
|
|
|
|
|
public string IncidentType;
|
|
|
|
|
public string ObjList;
|
|
|
|
|
public string AreaList;
|
|
|
|
|
public int Storeroom;
|
|
|
|
|
}
|
2024-12-01 22:36:41 +08:00
|
|
|
|
[System.Serializable]
|
|
|
|
|
public class IncidentSite
|
|
|
|
|
{
|
|
|
|
|
public int ID;
|
|
|
|
|
public string Note;
|
|
|
|
|
public int Name;
|
|
|
|
|
public int Scene;
|
|
|
|
|
public string Position;
|
|
|
|
|
public int Volume;
|
|
|
|
|
public string Difficulty;
|
|
|
|
|
public string SpecialEvent;
|
2024-12-09 23:53:38 +08:00
|
|
|
|
public string Role;
|
|
|
|
|
public string GeneralRole;
|
2024-12-01 22:36:41 +08:00
|
|
|
|
}
|
2024-12-01 04:58:16 +08:00
|
|
|
|
|
2024-12-01 23:00:40 +08:00
|
|
|
|
[System.Serializable]
|
|
|
|
|
public class NPC
|
|
|
|
|
{
|
|
|
|
|
public int ID;
|
|
|
|
|
public string Note;
|
|
|
|
|
public string Name;
|
|
|
|
|
public string PlayScript;
|
|
|
|
|
public string ResPath;
|
|
|
|
|
public string State1;
|
|
|
|
|
public string StateRes1;
|
|
|
|
|
public string State2;
|
|
|
|
|
public string StateRes2;
|
|
|
|
|
public string Stats1;
|
|
|
|
|
public string Stats2;
|
|
|
|
|
}
|
2024-12-04 22:58:31 +08:00
|
|
|
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
|
public class Language
|
|
|
|
|
{
|
|
|
|
|
public int ID;
|
|
|
|
|
public string Text;
|
|
|
|
|
public string Note;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-09 11:56:53 +08:00
|
|
|
|
[System.Serializable]
|
|
|
|
|
public class Select
|
|
|
|
|
{
|
|
|
|
|
public string ID;
|
|
|
|
|
public string Note;
|
|
|
|
|
public string PlayScript;
|
|
|
|
|
public string Group;
|
|
|
|
|
public string ShowText;
|
|
|
|
|
public string Icon;
|
|
|
|
|
public string Precondition;
|
|
|
|
|
public string Exclusive;
|
|
|
|
|
public string TakeTime;
|
|
|
|
|
public string TimeLimit;
|
|
|
|
|
public string NextSelect;
|
|
|
|
|
public string TaskLink;
|
|
|
|
|
public string TaskLinkDetails;
|
|
|
|
|
public string CallMode;
|
|
|
|
|
public string CallRecipient;
|
|
|
|
|
public string CorrectOption;
|
|
|
|
|
public string Reward;
|
|
|
|
|
public string Result;
|
|
|
|
|
public string Route;
|
|
|
|
|
public string TimingChange;
|
|
|
|
|
public string AppliedUI;
|
|
|
|
|
public string UIDetails;
|
|
|
|
|
public string Seq;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ֶοɸ<CEBF><C9B8><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>
|
2024-12-11 16:05:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
|
public class Task_
|
|
|
|
|
{
|
|
|
|
|
public string ID;
|
|
|
|
|
public string Note;
|
|
|
|
|
public string Name;
|
|
|
|
|
public string Type;
|
|
|
|
|
public string PlayScript;
|
|
|
|
|
public string Trigger;
|
|
|
|
|
public string TriggerLogic;
|
|
|
|
|
public string OverseeCond;
|
|
|
|
|
public string TimeLimit;
|
|
|
|
|
public string Role;
|
|
|
|
|
public string Selects;
|
|
|
|
|
public string TargetType;
|
|
|
|
|
public string Targets1;
|
|
|
|
|
public string Targets2;
|
|
|
|
|
public string Targets2Logic;
|
|
|
|
|
public string ExtraValue;
|
|
|
|
|
public string Sort;
|
|
|
|
|
public string IsShow;
|
|
|
|
|
public string Exclusive;
|
|
|
|
|
public string Reward;
|
2024-12-09 11:56:53 +08:00
|
|
|
|
}
|