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-12-16 17:13:26 +08:00
|
|
|
|
using System;
|
2024-11-30 18:15:51 +08:00
|
|
|
|
|
|
|
|
|
public class JSONReader : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
// <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 15:53:49 +08:00
|
|
|
|
public TextAsset TaskJsonFile;
|
2024-12-15 17:11:33 +08:00
|
|
|
|
public TextAsset GlobalJsonFile;
|
|
|
|
|
public TextAsset SelectsJsonFile;
|
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-11 15:53:49 +08:00
|
|
|
|
public Dictionary<string, Select> SelectDictionary = new Dictionary<string, Select>();
|
|
|
|
|
public Dictionary<string, Task_> TaskDictionary = new Dictionary<string, Task_>();
|
2024-12-18 23:13:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//С<><D0A1>ר<EFBFBD><D7A8>
|
|
|
|
|
//<2F><>ȡְҵ<D6B0><D2B5><EFBFBD><EFBFBD>
|
|
|
|
|
public Dictionary<int, GlobalJson> GlobalDictionary = new Dictionary<int, GlobalJson>();
|
|
|
|
|
public Dictionary<string, Select> ZZSelectsDictionary = new Dictionary<string, Select>();
|
|
|
|
|
public Dictionary<int, NPCData> OpcNameDictionary=new Dictionary<int, NPCData>();
|
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 15:53:49 +08:00
|
|
|
|
TaskDictionary = TaskJSON(TaskJsonFile.text);
|
2024-12-18 23:13:30 +08:00
|
|
|
|
|
|
|
|
|
//С<><D0A1>ר<EFBFBD><D7A8>
|
|
|
|
|
OpcNameDictionary = SelectOpcName(npcJsonFile.text);
|
|
|
|
|
GlobalDictionary = GlobelJSON(GlobalJsonFile.text);
|
|
|
|
|
ZZSelectsDictionary = SelectsJSON(SelectsJsonFile.text);
|
2024-12-09 11:56:53 +08:00
|
|
|
|
|
2024-12-04 22:58:31 +08:00
|
|
|
|
GetLanguageByID(20008);
|
2024-12-16 15:57:15 +08:00
|
|
|
|
foreach (var npc in sceneDictionary)
|
2024-11-30 23:32:17 +08:00
|
|
|
|
{
|
2024-12-16 15:57:15 +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)
|
|
|
|
|
{
|
2024-12-11 20:54:34 +08:00
|
|
|
|
Task_[] npcArray = JsonHelper.FromJson<Task_>(json);
|
2024-12-11 16:05:50 +08:00
|
|
|
|
Dictionary<string, Task_> selectDictionary = new Dictionary<string, Task_>();
|
|
|
|
|
|
|
|
|
|
foreach (var npc in npcArray)
|
|
|
|
|
{
|
2024-12-11 20:54:34 +08:00
|
|
|
|
TaskDictionary[npc.ID] = npc;
|
2024-12-11 16:05:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-12-11 20:54:34 +08:00
|
|
|
|
return TaskDictionary;
|
2024-12-11 16:05:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
2024-12-11 20:54:34 +08:00
|
|
|
|
Select[] npcArray = JsonHelper.FromJson<Select>(json);
|
2024-12-09 11:56:53 +08:00
|
|
|
|
Dictionary<string, Select> selectDictionary = new Dictionary<string, Select>();
|
|
|
|
|
|
|
|
|
|
foreach (var npc in npcArray)
|
|
|
|
|
{
|
2024-12-11 20:54:34 +08:00
|
|
|
|
SelectDictionary[npc.ID] = npc;
|
2024-12-09 11:56:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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-15 17:11:33 +08:00
|
|
|
|
public Dictionary<int, GlobalJson> GlobelJSON(string json)
|
|
|
|
|
{
|
|
|
|
|
GlobalJson[] locationArray = JsonHelper.FromJson<GlobalJson>(json);
|
|
|
|
|
Dictionary<int, GlobalJson> locationDictionary = new Dictionary<int, GlobalJson>();
|
|
|
|
|
|
|
|
|
|
foreach (var location in locationArray)
|
|
|
|
|
{
|
|
|
|
|
locationDictionary[location.ID] = location;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return locationDictionary;
|
|
|
|
|
}
|
|
|
|
|
public Dictionary<string, Select> SelectsJSON(string json)
|
|
|
|
|
{
|
|
|
|
|
Select[] locationArray = JsonHelper.FromJson<Select>(json);
|
|
|
|
|
Dictionary<string, Select> locationDictionary = new Dictionary<string,Select>();
|
|
|
|
|
|
|
|
|
|
foreach (var location in locationArray)
|
|
|
|
|
{
|
|
|
|
|
locationDictionary[location.ID] = location;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return locationDictionary;
|
|
|
|
|
}
|
2024-12-18 23:13:30 +08:00
|
|
|
|
//С<><D0A1>ר<EFBFBD><D7A8>
|
|
|
|
|
//<2F><>ȡְҵ<D6B0><D2B5><EFBFBD><EFBFBD>
|
|
|
|
|
public Dictionary<int, NPCData> SelectOpcName(string json)
|
|
|
|
|
{
|
|
|
|
|
NPCData[] npcArray = JsonHelper.FromJson<NPCData>(json);
|
|
|
|
|
Dictionary<int, NPCData> OpcNameDictionary = new Dictionary<int, NPCData>();
|
|
|
|
|
|
|
|
|
|
foreach (var npc in npcArray)
|
|
|
|
|
{
|
|
|
|
|
OpcNameDictionary[npc.ID]= npc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return OpcNameDictionary;
|
|
|
|
|
}
|
2024-12-15 17:11:33 +08:00
|
|
|
|
|
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>
|
2024-12-11 20:16:45 +08:00
|
|
|
|
public Task_ GetTaskByID(int id)
|
2024-12-05 20:21:15 +08:00
|
|
|
|
{
|
2024-12-11 20:16:45 +08:00
|
|
|
|
Task_ info = null;
|
|
|
|
|
if (TaskDictionary.TryGetValue(id.ToString(), out info))
|
2024-12-05 20:21:15 +08:00
|
|
|
|
{
|
2024-12-11 20:54:34 +08:00
|
|
|
|
return info;
|
2024-12-05 20:21:15 +08:00
|
|
|
|
}
|
2024-12-11 20:54:34 +08:00
|
|
|
|
else return 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>
|
2024-12-12 19:58:55 +08:00
|
|
|
|
public string SetUIText(int id)
|
2024-12-05 15:39:10 +08:00
|
|
|
|
{
|
2024-12-12 19:58:55 +08:00
|
|
|
|
Language info = null;
|
|
|
|
|
if (LanguageDictionary.TryGetValue(id, out info))
|
|
|
|
|
{
|
|
|
|
|
return info.Text;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.Log($"No Language found with ID: {id}");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2024-12-05 15:39:10 +08:00
|
|
|
|
}
|
2024-12-15 17:11:33 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-12-18 23:13:30 +08:00
|
|
|
|
/// <20>ж<EFBFBD>ָ<EFBFBD>ӹ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ѡ<EFBFBD><D1A1>(չʾ<D5B9>ϳ<EFBFBD>)
|
2024-12-15 17:11:33 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="a">a=1ѡ<31><D1A1><EFBFBD>˵<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>a=2,a=3</param>
|
|
|
|
|
/// <param name="id">ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>̶<EFBFBD>90016</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public string GetGlobal(int a,int id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
GlobalJson temp=null ;
|
|
|
|
|
switch(a)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
if (GlobalDictionary.TryGetValue(id, out temp))
|
|
|
|
|
return temp.VectorInt1;
|
|
|
|
|
else
|
|
|
|
|
return null;
|
|
|
|
|
case 2:
|
|
|
|
|
if (GlobalDictionary.TryGetValue(id, out temp))
|
|
|
|
|
return temp.VectorInt2;
|
|
|
|
|
else
|
|
|
|
|
return null;
|
|
|
|
|
case 3:
|
|
|
|
|
if (GlobalDictionary.TryGetValue(id, out temp))
|
|
|
|
|
return temp.VectorInt3;
|
|
|
|
|
else
|
|
|
|
|
return null;
|
|
|
|
|
default:
|
|
|
|
|
return "<22><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD>";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//GlobalJson info = null;
|
|
|
|
|
//if (GlobalDictionary.TryGetValue(id,out info))
|
|
|
|
|
//{
|
|
|
|
|
// return info.Int1.ToString();
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// Debug.Log($"No Language found with ID: {id}");
|
|
|
|
|
// return null;
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
public string GetEvacuate(string id)
|
|
|
|
|
{
|
|
|
|
|
Select info = null;
|
2024-12-18 23:13:30 +08:00
|
|
|
|
if (ZZSelectsDictionary.TryGetValue(id.ToString(), out info))
|
|
|
|
|
{
|
|
|
|
|
return info.Note;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.Log($"No Select found with ID: {id}");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>ȡְҵ<D6B0><D2B5><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">ְҵIDȥRole<6C><65><EFBFBD><EFBFBD>ȡ</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public string GetOcpName(int id)
|
|
|
|
|
{
|
|
|
|
|
NPCData info = null;
|
|
|
|
|
if (OpcNameDictionary.TryGetValue(id, out info))
|
2024-12-15 17:11:33 +08:00
|
|
|
|
{
|
|
|
|
|
return info.Note;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.Log($"No Select found with ID: {id}");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
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-16 17:13:26 +08:00
|
|
|
|
[Serializable]
|
2024-12-09 11:56:53 +08:00
|
|
|
|
public class Select
|
|
|
|
|
{
|
|
|
|
|
public string ID;
|
|
|
|
|
public string Note;
|
|
|
|
|
public string PlayScript;
|
|
|
|
|
public string Group;
|
2024-12-16 17:13:26 +08:00
|
|
|
|
public string UnDisplay;
|
2024-12-09 11:56:53 +08:00
|
|
|
|
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;
|
2024-12-11 15:53:49 +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-15 17:11:33 +08:00
|
|
|
|
}
|
|
|
|
|
[System.Serializable]
|
|
|
|
|
public class GlobalJson
|
|
|
|
|
{
|
|
|
|
|
public int ID;
|
|
|
|
|
public string Note;
|
|
|
|
|
public int Scene;
|
|
|
|
|
public int PlayScript;
|
|
|
|
|
public int Int1;
|
|
|
|
|
public int Int2;
|
|
|
|
|
public int Int3;
|
|
|
|
|
public float Float1;
|
|
|
|
|
public float Float2;
|
|
|
|
|
public float Float3;
|
|
|
|
|
public string VectorInt1;
|
|
|
|
|
public string VectorInt2;
|
|
|
|
|
public string VectorInt3;
|
|
|
|
|
public string VectorInt4;
|
|
|
|
|
public string VectorInt5;
|
|
|
|
|
public string String1;
|
|
|
|
|
public string String2;
|
|
|
|
|
public string String3;
|
|
|
|
|
}
|