地区-1判断
This commit is contained in:
parent
033f1f00b1
commit
161b95deda
@ -321,44 +321,33 @@ public class Panel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
// 按“,”分隔出事故位置ID、职业ID和最低要求人数
|
// 按“,”分隔出事故位置ID、职业ID和最低要求人数
|
||||||
string[] roleLimits = section.Split(',');
|
string[] roleLimits = section.Split(',');
|
||||||
if (section.Contains("-1"))
|
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())
|
||||||
{
|
{
|
||||||
if (roleLimits[0] == "-1")
|
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
|
||||||
{
|
SceneItem sceneItem = item.GetComponent<SceneItem>();
|
||||||
shouldInstantiate = false; // 不实例化该NPC
|
// 获取当前该位置该职业的人数
|
||||||
break; // 跳出循环,直接处理下一个NPC
|
int currentPeopleCount = GetCurrentPeopleCount(accidentLocationId, roleId);
|
||||||
}
|
|
||||||
}
|
|
||||||
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())
|
|
||||||
{
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,48 @@ public class EvacuationPanel : MonoBehaviour
|
|||||||
string[] limit = npcLimit.Split(',');
|
string[] limit = npcLimit.Split(',');
|
||||||
if (limit[0] == selectScene.scnenId.ToString()&& limit[1] == selectScene.difficultyId.ToString())
|
if (limit[0] == selectScene.scnenId.ToString()&& limit[1] == selectScene.difficultyId.ToString())
|
||||||
{
|
{
|
||||||
|
//GameObject sceneitem = GameObject.Instantiate(personnelPrefabs, personnelContent);
|
||||||
|
//PersonnelItem personnelItem = sceneitem.GetComponent<PersonnelItem>();
|
||||||
|
//Button button = personnelItem.transform.Find("sceneText").GetComponent<Button>();
|
||||||
|
|
||||||
|
//personnelItem.sceneText.text = sceneEntry.Key;
|
||||||
|
//personnelItem.sceneId = area.ID;
|
||||||
|
//personnelItem.Num = 1; // 设置初始值为 1
|
||||||
|
//// 点击事件监听
|
||||||
|
//button.onClick.AddListener(() =>
|
||||||
|
//{
|
||||||
|
// // 标记当前选择的区域
|
||||||
|
// OnSceneItemClicked(item, Color.yellow, selectedScene);
|
||||||
|
// // 如果被点击的区域已经有人员
|
||||||
|
// if (personnelItem.NpcNum > 0)
|
||||||
|
// {
|
||||||
|
// redistributeBtn.onClick.AddListener(() => {
|
||||||
|
// // 清除选定区域的人员数据
|
||||||
|
// RedistributeLogic(personnelItem.sceneId, personnelItem.NpcNum);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// // 清空现有场景下的所有人员UI
|
||||||
|
// foreach (Transform child in sceneCount)
|
||||||
|
// {
|
||||||
|
// Destroy(child.gameObject);
|
||||||
|
// }
|
||||||
|
// // 执行后续的场景级别配置
|
||||||
|
// LocationData locationData = js.GetAreaDateById(personnelItem.sceneId);
|
||||||
|
// if (locationData.Level.ToString() != "0")
|
||||||
|
// {
|
||||||
|
// GameObject levelItem = GameObject.Instantiate(scenePrefab, sceneCount);
|
||||||
|
// Button levelBtn = levelItem.transform.Find("chooseBtn2").GetComponent<Button>();
|
||||||
|
// levelBtn.onClick.AddListener(() =>
|
||||||
|
// {
|
||||||
|
// JueseChoicePop jueseChoicePop = jueseChoicePanel.GetComponent<JueseChoicePop>();
|
||||||
|
// jueseChoicePop.SetClass(personnelItem.sceneId);
|
||||||
|
// jueseChoicePanel.gameObject.SetActive(true);
|
||||||
|
// });
|
||||||
|
// ClassItem classItem = levelItem.GetComponent<ClassItem>();
|
||||||
|
// classItem.classname.text = locationData.Level.ToString();
|
||||||
|
// }
|
||||||
|
//});
|
||||||
|
//personnelItems.Add(personnelItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user