Merge branch 'main' of http://shu.sheziwanglo.cn:3000/wulongxiao/_xiaofang
This commit is contained in:
commit
d19e6c9e41
File diff suppressed because it is too large
Load Diff
@ -20,16 +20,5 @@
|
||||
"Storeroom": "1011",
|
||||
"ConfigText": "20034|20035|20036",
|
||||
"": ""
|
||||
},
|
||||
{
|
||||
"ID": "9004",
|
||||
"Name": "40003",
|
||||
"Type": "3",
|
||||
"IncidentType": "5002",
|
||||
"ObjList": "7001,7002,7003|7001,7003|7001,7002,7003",
|
||||
"AreaList": "1012|1013|1014|1015|1017|1018|1019|1020|1021|1022|1023|1024|1025|1026|1027|1028|1029|1030|1076|1031|1032|1033|1034|1036|1037|1038|1039|1040|1041|1077|1078|1079|1080|1081|1082|1083|1084|1085|1086",
|
||||
"Storeroom": "1011",
|
||||
"ConfigText": "10039|10040|10039",
|
||||
"": ""
|
||||
}
|
||||
]
|
@ -48,9 +48,9 @@ public class JSONReader : MonoBehaviour
|
||||
SelectsDictionary = SelectsJSON(SelectsJsonFile.text);
|
||||
|
||||
GetLanguageByID(20008);
|
||||
foreach (var npc in npcDictionary)
|
||||
foreach (var npc in sceneDictionary)
|
||||
{
|
||||
//Debug.Log(npc.Value.ID);
|
||||
Debug.Log(npc.Value.ID);
|
||||
//Debug.Log(npc.Value.Name);
|
||||
}
|
||||
GetNpcDataByID(8001);
|
||||
|
@ -183,55 +183,96 @@ public class Panel : MonoBehaviour
|
||||
//动态加载场景
|
||||
public void DynamicLoadingScene()
|
||||
{
|
||||
foreach (var npcData in jsonReader1.locationDictionary)
|
||||
foreach (var region in jsonReader1.sceneDictionary)
|
||||
{
|
||||
// 解析角色限制字段
|
||||
string roleLimit = npcData.Value.RoleLimit;
|
||||
int sceneLimit = npcData.Value.Scene;
|
||||
if (!string.IsNullOrEmpty(roleLimit))
|
||||
{
|
||||
// 先按“|”分隔
|
||||
string[] roleLimitSections = roleLimit.Split('|');
|
||||
// 遍历每个部分(按“|”分隔后得到的数组)
|
||||
bool shouldInstantiate = true; // 用于判断是否需要实例化
|
||||
foreach (string section in roleLimitSections)
|
||||
{
|
||||
string[] roleLimits = section.Split(',');
|
||||
// 判断当前部分是否包含 "-1" 来决定是否跳过实例化
|
||||
if (section.Contains("-1"))
|
||||
{
|
||||
if (roleLimits[0] == "-1")
|
||||
{
|
||||
shouldInstantiate = false; // 不实例化该NPC
|
||||
break; // 跳出循环,直接处理下一个NPC
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(selectScenePanel.scnenId== sceneLimit)
|
||||
string[] roleLimitSections = region.Value.AreaList.Split('|');
|
||||
foreach(string npcData in roleLimitSections)
|
||||
{
|
||||
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
|
||||
SceneItem sceneItem = item.GetComponent<SceneItem>();
|
||||
Button scenebutton = item.transform.Find("TextBtn").GetComponent<Button>();
|
||||
scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
|
||||
// 设置limitNum
|
||||
sceneItem.sceneId = npcData.Key.ToString();
|
||||
sceneItem.dutyId = roleLimits[1];
|
||||
sceneItem.limitNum = int.Parse(roleLimits[2]);
|
||||
sceneItem.sceneName.text = npcData.Value.Note;
|
||||
sceneItem.sceneId = npcData.ToString();
|
||||
LocationData locationData= jsonReader1.GetAreaDateById(int.Parse(npcData));
|
||||
sceneItem.sceneName.text = jsonReader1.SetUIText(locationData.Name);
|
||||
Debug.LogError(sceneItem.sceneId);
|
||||
// 将每个实例化的角色添加到列表中
|
||||
peopleList.Add(item);
|
||||
}
|
||||
}
|
||||
//foreach (var npcData in jsonReader1.locationDictionary)
|
||||
//{
|
||||
// // 解析角色限制字段
|
||||
// string roleLimit = npcData.Value.RoleLimit;
|
||||
// int sceneLimit = npcData.Value.Scene;
|
||||
// Debug.Log("npcData.Value.Scene"+ npcData.Value.Scene);
|
||||
// if(selectScenePanel.scnenId== sceneLimit)
|
||||
// {
|
||||
// GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
|
||||
// SceneItem sceneItem = item.GetComponent<SceneItem>();
|
||||
// Button scenebutton = item.transform.Find("TextBtn").GetComponent<Button>();
|
||||
// scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
|
||||
// // 设置limitNum
|
||||
// sceneItem.sceneId = npcData.Key.ToString();
|
||||
// //sceneItem.dutyId = roleLimits[1];
|
||||
// //sceneItem.limitNum = int.Parse(roleLimits[2]);
|
||||
// sceneItem.sceneName.text = npcData.Value.Note;
|
||||
// // 将每个实例化的角色添加到列表中
|
||||
// peopleList.Add(item);
|
||||
// }
|
||||
//if (!string.IsNullOrEmpty(roleLimit))
|
||||
//{
|
||||
// // 先按“|”分隔
|
||||
// string[] roleLimitSections = roleLimit.Split('|');
|
||||
// // 遍历每个部分(按“|”分隔后得到的数组)
|
||||
// bool shouldInstantiate = true; // 用于判断是否需要实例化
|
||||
// foreach (string section in roleLimitSections)
|
||||
// {
|
||||
// string[] roleLimits = section.Split(',');
|
||||
// // 判断当前部分是否包含 "-1" 来决定是否跳过实例化
|
||||
// if (section.Contains("-1"))
|
||||
// {
|
||||
|
||||
// if (roleLimits[0] == "-1")
|
||||
// {
|
||||
// shouldInstantiate = false; // 不实例化该NPC
|
||||
// break; // 跳出循环,直接处理下一个NPC
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (selectScenePanel.scnenId== sceneLimit)
|
||||
// {
|
||||
// if(selectScenePanel.difficultyId == int.Parse(roleLimits[1]))
|
||||
// {
|
||||
// Debug.LogWarning("roleLimits[0]"+ roleLimits[0]);
|
||||
// Debug.LogWarning("roleLimits[1]" + roleLimits[1]);
|
||||
// Debug.LogWarning("roleLimits[2]" + roleLimits[2]);
|
||||
// Debug.LogWarning("roleLimits[3]" + roleLimits[3]);
|
||||
// GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
|
||||
// SceneItem sceneItem = item.GetComponent<SceneItem>();
|
||||
// Button scenebutton = item.transform.Find("TextBtn").GetComponent<Button>();
|
||||
// scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
|
||||
// // 设置limitNum
|
||||
// sceneItem.sceneId = npcData.Key.ToString();
|
||||
// sceneItem.dutyId = roleLimits[1];
|
||||
// sceneItem.limitNum = int.Parse(roleLimits[2]);
|
||||
// sceneItem.sceneName.text = npcData.Value.Note;
|
||||
// // 将每个实例化的角色添加到列表中
|
||||
// peopleList.Add(item);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// // 如果不满足实例化条件,跳过当前NPC的实例化
|
||||
// if (!shouldInstantiate)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
// 如果不满足实例化条件,跳过当前NPC的实例化
|
||||
if (!shouldInstantiate)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================按钮和点击事件==================================================
|
||||
//处理人员管理按钮
|
||||
public void ClickPersonnelManagement()
|
||||
@ -286,9 +327,10 @@ public class Panel : MonoBehaviour
|
||||
else
|
||||
{
|
||||
string accidentLocationId = roleLimits[0]; // 事故位置ID
|
||||
string roleId = roleLimits[1]; // 职业ID
|
||||
int minRequired = int.Parse(roleLimits[2]); // 最低要求人数
|
||||
if (accidentLocationId == selectScenePanel.idcidentId.ToString() && roleId == id.ToString())
|
||||
string difficultyId = roleLimits[1];
|
||||
string roleId = roleLimits[2]; // 职业ID
|
||||
int minRequired = int.Parse(roleLimits[3]); // 最低要求人数
|
||||
if (accidentLocationId == selectScenePanel.idcidentId.ToString() && roleId == id.ToString()&&difficultyId==selectScenePanel.difficultyId.ToString())
|
||||
{
|
||||
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
|
||||
SceneItem sceneItem = item.GetComponent<SceneItem>();
|
||||
|
@ -101,6 +101,7 @@ public class EvacuationPanel : MonoBehaviour
|
||||
panel.panelToggle[4].gameObject.transform.GetComponent<Image>().sprite = panel.toggleImage[1];
|
||||
}
|
||||
|
||||
//ノ靹テNpcタ獎ヘ
|
||||
public void SetNpcType()
|
||||
{
|
||||
foreach (var scene in panel.sceneDataDictionary)
|
||||
@ -271,6 +272,7 @@ public class EvacuationPanel : MonoBehaviour
|
||||
// 返回符合条件的区域 ID 列表
|
||||
return nonZeroAreas;
|
||||
}
|
||||
|
||||
//设置左侧场景显示
|
||||
public void SetPersonnel()
|
||||
{
|
||||
@ -350,6 +352,7 @@ public class EvacuationPanel : MonoBehaviour
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 判断重新分配按钮是否可以点击
|
||||
public void IsRedistribution()
|
||||
{
|
||||
@ -507,6 +510,4 @@ public class EvacuationPanel : MonoBehaviour
|
||||
classCount.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user