Compare commits

..

No commits in common. "e7fc35f2b798563323b9e8180799a2ce130e1617" and "d19e6c9e41cc3cc668e4d0a2d34aac321d19cdb0" have entirely different histories.

3 changed files with 40 additions and 79 deletions

View File

@ -260,6 +260,7 @@ public class JSONReader : MonoBehaviour
return null; // 如果没有找到符合条件的语言数据,返回 null return null; // 如果没有找到符合条件的语言数据,返回 null
} }
//获取任务 //获取任务
public Task_ GetTaskByID(int id) public Task_ GetTaskByID(int id)
{ {

View File

@ -311,59 +311,51 @@ public class Panel : MonoBehaviour
// 按“|”分隔不同的角色限制部分 // 按“|”分隔不同的角色限制部分
string[] roleLimitSections = npcData.Value.RoleLimit.Split('|'); string[] roleLimitSections = npcData.Value.RoleLimit.Split('|');
bool shouldInstantiate = true; bool shouldInstantiate = true;
if(npcData.Value.RoleLimit=="-1") // 遍历每个角色限制部分
foreach (var section in roleLimitSections)
{ {
break; // 按“,”分隔出事故位置ID、职业ID和最低要求人数
} string[] roleLimits = section.Split(',');
else if (section.Contains("-1"))
{
foreach (var section in roleLimitSections)
{ {
// 按“,”分隔出事故位置ID、职业ID和最低要求人数 if (roleLimits[0] == "-1")
string[] roleLimits = section.Split(',');
if (section.Contains("-1"))
{ {
if (roleLimits[0] == "-1") shouldInstantiate = false; // 不实例化该NPC
{ break; // 跳出循环直接处理下一个NPC
shouldInstantiate = false; // 不实例化该NPC
break; // 跳出循环直接处理下一个NPC
}
} }
else }
else
{
string accidentLocationId = roleLimits[0]; // 事故位置ID
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())
{ {
string accidentLocationId = roleLimits[0]; // 事故位置ID GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
string difficultyId = roleLimits[1]; SceneItem sceneItem = item.GetComponent<SceneItem>();
string roleId = roleLimits[2]; // 职业ID // 获取当前该位置该职业的人数
int minRequired = int.Parse(roleLimits[3]); // 最低要求人数 int currentPeopleCount = GetCurrentPeopleCount(accidentLocationId, roleId);
if (accidentLocationId == selectScenePanel.idcidentId.ToString() && roleId == id.ToString() && difficultyId == selectScenePanel.difficultyId.ToString())
{
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
SceneItem sceneItem = item.GetComponent<SceneItem>();
// 获取当前该位置该职业的人数
int currentPeopleCount = GetCurrentPeopleCount(accidentLocationId, roleId);
// 设置推荐标记(如果人数不足) // 设置推荐标记(如果人数不足)
if (minRequired > currentPeopleCount) if (minRequired > currentPeopleCount)
{ {
sceneItem.sceneImage.gameObject.SetActive(true); // 显示推荐标记 sceneItem.sceneImage.gameObject.SetActive(true); // 显示推荐标记
}
else
{
sceneItem.sceneImage.gameObject.SetActive(false); // 隐藏推荐标记
}
Button scenebutton = item.transform.Find("TextBtn").GetComponent<Button>();
scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
sceneItem.sceneId = npcData.Key.ToString();
sceneItem.dutyId = accidentLocationId;
sceneItem.limitNum = minRequired;
sceneItem.sceneName.text = npcData.Value.Note;
peopleList.Add(item);
} }
else
{
sceneItem.sceneImage.gameObject.SetActive(false); // 隐藏推荐标记
}
Button scenebutton = item.transform.Find("TextBtn").GetComponent<Button>();
scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
sceneItem.sceneId = npcData.Key.ToString();
sceneItem.dutyId = accidentLocationId;
sceneItem.limitNum = minRequired;
sceneItem.sceneName.text = npcData.Value.Note;
peopleList.Add(item);
} }
} }
} }
// 遍历每个角色限制部分
} }
} }
} }

View File

@ -273,38 +273,6 @@ public class EvacuationPanel : MonoBehaviour
return nonZeroAreas; return nonZeroAreas;
} }
//设置左侧场景显示2.0
public void SetScene()
{
// 清空现有的UI项
foreach (Transform child in personnelContent)
{
Destroy(child.gameObject);
}
// 清空人员列表
personnelItems.Clear();
foreach (var item in js.locationDictionary)
{
if(item.Value.NpcRatio=="-1")
{
break;
}
else
{
string[] npcratio = item.Value.NpcRatio.Split('|');
foreach(var npcLimit in npcratio)
{
string[] limit = npcLimit.Split(',');
if (limit[0] == selectScene.scnenId.ToString()&& limit[1] == selectScene.difficultyId.ToString())
{
}
}
}
}
}
//ÉèÖÃ×ó²à³¡¾°ÏÔʾ //ÉèÖÃ×ó²à³¡¾°ÏÔʾ
public void SetPersonnel() public void SetPersonnel()
{ {