最低人员配置
This commit is contained in:
parent
51abcfd89a
commit
dd2c810c5e
@ -2665,6 +2665,8 @@ MonoBehaviour:
|
|||||||
sceneLable: {fileID: 5900002971020626571, guid: 297444ab6ae692b4dbcb38d34e0c5716, type: 3}
|
sceneLable: {fileID: 5900002971020626571, guid: 297444ab6ae692b4dbcb38d34e0c5716, type: 3}
|
||||||
content: {fileID: 788248231}
|
content: {fileID: 788248231}
|
||||||
closeBtn: {fileID: 349260647}
|
closeBtn: {fileID: 349260647}
|
||||||
|
panel: {fileID: 618256462}
|
||||||
|
selectScenePanel: {fileID: 7468736064579811982}
|
||||||
jsonReader: {fileID: 1417128757}
|
jsonReader: {fileID: 1417128757}
|
||||||
--- !u!1 &569417021 stripped
|
--- !u!1 &569417021 stripped
|
||||||
GameObject:
|
GameObject:
|
||||||
|
@ -29,25 +29,25 @@ public class SelectedInfo
|
|||||||
public class Panel : Base
|
public class Panel : Base
|
||||||
{
|
{
|
||||||
[Header("组件")]
|
[Header("组件")]
|
||||||
[Header("设置人员")]
|
[Header("设置人员")]
|
||||||
public Button setName;//设置人员
|
public Button setName;//设置人员
|
||||||
[Header("设置职责")]
|
[Header("设置职责")]
|
||||||
public Button setDuty;//设置职责
|
public Button setDuty;//设置职责
|
||||||
[Header("设置场景")]
|
[Header("设置场景")]
|
||||||
public Button setScene;//设置场景
|
public Button setScene;//设置场景
|
||||||
[Header("整体安排")]
|
[Header("整体安排")]
|
||||||
public Text arrangeText;//整体安排
|
public Text arrangeText;//整体安排
|
||||||
[Header("确认信息按钮")]
|
[Header("确认信息按钮")]
|
||||||
public Button sureBtn;//确认信息按钮
|
public Button sureBtn;//确认信息按钮
|
||||||
[Header("最少人员要求警告")]
|
[Header("最少人员要求警告")]
|
||||||
public Button requirementsBtn;
|
public Button requirementsBtn;
|
||||||
[Header("场景的ToggleGroup")]
|
[Header("场景的ToggleGroup")]
|
||||||
public ToggleGroup scenetoggleGroup;//场景的ToggleGroup
|
public ToggleGroup scenetoggleGroup;//场景的ToggleGroup
|
||||||
[Header("筛选输入框")]
|
[Header("筛选输入框")]
|
||||||
public InputField shaixuaninputField;//筛选输入框
|
public InputField shaixuaninputField;//筛选输入框
|
||||||
[Header("画布上的射线投射器")]
|
[Header("画布上的射线投射器")]
|
||||||
public GraphicRaycaster raycaster; // 画布上的射线投射器
|
public GraphicRaycaster raycaster; // 画布上的射线投射器
|
||||||
[Header("事件系统")]
|
[Header("事件系统")]
|
||||||
public EventSystem eventSystem; // 事件系统
|
public EventSystem eventSystem; // 事件系统
|
||||||
public ToggleGroup chooseGroup;
|
public ToggleGroup chooseGroup;
|
||||||
[Header("面板选择")]
|
[Header("面板选择")]
|
||||||
@ -60,23 +60,23 @@ public class Panel : Base
|
|||||||
|
|
||||||
|
|
||||||
[Header("物体")]
|
[Header("物体")]
|
||||||
[Header("人员管理界面")]
|
[Header("人员管理界面")]
|
||||||
public GameObject ManagerPanel;//人员管理界面
|
public GameObject ManagerPanel;//人员管理界面
|
||||||
[Header("人员的窗口")]
|
[Header("人员的窗口")]
|
||||||
public Transform peopleCountent;//人员的窗口
|
public Transform peopleCountent;//人员的窗口
|
||||||
[Header("人员的预制体")]
|
[Header("人员的预制体")]
|
||||||
public GameObject peoplePrefab;//人员的预制体
|
public GameObject peoplePrefab;//人员的预制体
|
||||||
[Header("物体")]
|
[Header("物体")]
|
||||||
public Transform panelContent;
|
public Transform panelContent;
|
||||||
[Header("职责预制体")]
|
[Header("职责预制体")]
|
||||||
public GameObject dutyPrefab;//职责预制体
|
public GameObject dutyPrefab;//职责预制体
|
||||||
[Header("职责的窗口")]
|
[Header("职责的窗口")]
|
||||||
public Transform dutyCount;//职责的窗口
|
public Transform dutyCount;//职责的窗口
|
||||||
[Header("场景预制体")]
|
[Header("场景预制体")]
|
||||||
public GameObject scenePrefab;//场景预制体
|
public GameObject scenePrefab;//场景预制体
|
||||||
[Header("存放场景预制体")]
|
[Header("存放场景预制体")]
|
||||||
public Transform sceneCount;//存放场景预制体的地方
|
public Transform sceneCount;//存放场景预制体的地方
|
||||||
[Header("人员管理面板")]
|
[Header("人员管理面板")]
|
||||||
public GameObject ManagerPanelPrefab; // 预制体,包含人员管理面板
|
public GameObject ManagerPanelPrefab; // 预制体,包含人员管理面板
|
||||||
[Header("最低配置面板")]
|
[Header("最低配置面板")]
|
||||||
public GameObject requirementsPrefab; // 预制体,最低配置面板
|
public GameObject requirementsPrefab; // 预制体,最低配置面板
|
||||||
@ -101,7 +101,7 @@ public class Panel : Base
|
|||||||
public SelectScenePanel selectScenePanel;
|
public SelectScenePanel selectScenePanel;
|
||||||
public DatePanel datePanel;
|
public DatePanel datePanel;
|
||||||
public WarningPopPanel warningPopPanel;
|
public WarningPopPanel warningPopPanel;
|
||||||
//public RequirementPanel requirementPanel;
|
public RequirementPanel requirementPanel;
|
||||||
|
|
||||||
private bool isPersonSelected = false; // 标志是否选择了人员
|
private bool isPersonSelected = false; // 标志是否选择了人员
|
||||||
private bool isDutySelected = false; // 标志是否选择了职责
|
private bool isDutySelected = false; // 标志是否选择了职责
|
||||||
@ -126,34 +126,34 @@ public class Panel : Base
|
|||||||
//SetInputFile();
|
//SetInputFile();
|
||||||
}
|
}
|
||||||
//==================================================================动态加载=======================================================
|
//==================================================================动态加载=======================================================
|
||||||
//动态加载人员
|
//动态加载人员
|
||||||
public async void DynamicLoadingPeople()
|
public async void DynamicLoadingPeople()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 10; i++)
|
//for (int i = 0; i < 10; i++)
|
||||||
{
|
|
||||||
GameObject item = GameObject.Instantiate<GameObject>(peoplePrefab, peopleCountent);
|
|
||||||
PeopleItem peopleItem = item.GetComponent<PeopleItem>();
|
|
||||||
peopleItem.nameText.text = "角色1";
|
|
||||||
peopleItem.peopleId = "0";
|
|
||||||
Button peoplebutton = item.transform.Find("TextBtn").GetComponent<Button>();
|
|
||||||
peoplebutton.onClick.AddListener(() => OnPeopleItemClicked(item, Color.yellow, selectedPerson));
|
|
||||||
peopleList.Add(item);// 将每个实例化的角色添加到列表中
|
|
||||||
}
|
|
||||||
//PlayerListResponse playerListResponse = await userInfo.GetPlayerList();
|
|
||||||
//foreach (PlayerListData player in playerListResponse.data)
|
|
||||||
//{
|
//{
|
||||||
// GameObject item = GameObject.Instantiate<GameObject>(peoplePrefab, peopleCountent);
|
// GameObject item = GameObject.Instantiate<GameObject>(peoplePrefab, peopleCountent);
|
||||||
// PeopleItem peopleItem = item.GetComponent<PeopleItem>();
|
// PeopleItem peopleItem = item.GetComponent<PeopleItem>();
|
||||||
// peopleItem.nameText.text = player.NickName;
|
// peopleItem.nameText.text = "角色1";
|
||||||
// peopleItem.peopleId = player.UserId;
|
// peopleItem.peopleId = "0";
|
||||||
// Button peoplebutton = item.transform.Find("TextBtn").GetComponent<Button>();
|
// Button peoplebutton = item.transform.Find("TextBtn").GetComponent<Button>();
|
||||||
// peoplebutton.onClick.AddListener(() => OnPeopleItemClicked(item, Color.yellow, selectedPerson));
|
// peoplebutton.onClick.AddListener(() => OnPeopleItemClicked(item, Color.yellow, selectedPerson));
|
||||||
// peopleList.Add(item);// 将每个实例化的角色添加到列表中
|
// peopleList.Add(item);// 将每个实例化的角色添加到列表中
|
||||||
//}
|
//}
|
||||||
|
PlayerListResponse playerListResponse = await userInfo.GetPlayerList();
|
||||||
|
foreach (PlayerListData player in playerListResponse.data)
|
||||||
|
{
|
||||||
|
GameObject item = GameObject.Instantiate<GameObject>(peoplePrefab, peopleCountent);
|
||||||
|
PeopleItem peopleItem = item.GetComponent<PeopleItem>();
|
||||||
|
peopleItem.nameText.text = player.NickName;
|
||||||
|
peopleItem.peopleId = player.UserId;
|
||||||
|
Button peoplebutton = item.transform.Find("TextBtn").GetComponent<Button>();
|
||||||
|
peoplebutton.onClick.AddListener(() => OnPeopleItemClicked(item, Color.yellow, selectedPerson));
|
||||||
|
peopleList.Add(item);// 将每个实例化的角色添加到列表中
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//动态加载职责
|
//动态加载职责
|
||||||
public void DynamicLoadingDuty(int id,int idcidentId)
|
public void DynamicLoadingDuty(int id, int idcidentId)
|
||||||
{
|
{
|
||||||
if (selectScenePanel.difficultyToRoles.ContainsKey(id))
|
if (selectScenePanel.difficultyToRoles.ContainsKey(id))
|
||||||
{
|
{
|
||||||
@ -169,12 +169,12 @@ public class Panel : Base
|
|||||||
var npcInfo = jsonReader1.npcDictionary[roleId];
|
var npcInfo = jsonReader1.npcDictionary[roleId];
|
||||||
// 创建DutyItem实例
|
// 创建DutyItem实例
|
||||||
string[] roleLimitSections = npcData.Name.Split('|');
|
string[] roleLimitSections = npcData.Name.Split('|');
|
||||||
foreach(string plopleInfo in roleLimitSections)
|
foreach (string plopleInfo in roleLimitSections)
|
||||||
{
|
{
|
||||||
|
|
||||||
string[] peopleLimit = plopleInfo.Split(',');
|
string[] peopleLimit = plopleInfo.Split(',');
|
||||||
|
|
||||||
if (peopleLimit[0] == idcidentId.ToString() && peopleLimit[1]==id.ToString())
|
if (peopleLimit[0] == idcidentId.ToString() && peopleLimit[1] == id.ToString())
|
||||||
{
|
{
|
||||||
GameObject item = GameObject.Instantiate(dutyPrefab, dutyCount);
|
GameObject item = GameObject.Instantiate(dutyPrefab, dutyCount);
|
||||||
DutyItem dutyItem = item.GetComponent<DutyItem>();
|
DutyItem dutyItem = item.GetComponent<DutyItem>();
|
||||||
@ -183,7 +183,7 @@ public class Panel : Base
|
|||||||
dutuybutton.onClick.AddListener(() =>
|
dutuybutton.onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
OnDutyItemClicked(item, Color.red, selectedDuty);
|
OnDutyItemClicked(item, Color.red, selectedDuty);
|
||||||
if(dutyItem.dutyNameText.text=="主持人")
|
if (dutyItem.dutyNameText.text == "主持人")
|
||||||
{
|
{
|
||||||
peopleList.Clear();
|
peopleList.Clear();
|
||||||
foreach (Transform child in sceneCount)
|
foreach (Transform child in sceneCount)
|
||||||
@ -200,11 +200,11 @@ public class Panel : Base
|
|||||||
dutyItem.dutyNameText.text = showText;
|
dutyItem.dutyNameText.text = showText;
|
||||||
dutyItem.leader = npcData.GroupLeader;
|
dutyItem.leader = npcData.GroupLeader;
|
||||||
dutyItem.dutyId = npcData.ID;
|
dutyItem.dutyId = npcData.ID;
|
||||||
dutyItem.dutyImage.sprite = Resources.Load<Sprite>(npcData.ICON);
|
dutyItem.dutyImage.sprite = Resources.Load<Sprite>(npcData.ICON);
|
||||||
peopleList.Add(item);
|
peopleList.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ public class Panel : Base
|
|||||||
foreach (var region in jsonReader1.sceneDictionary)
|
foreach (var region in jsonReader1.sceneDictionary)
|
||||||
{
|
{
|
||||||
string[] roleLimitSections = region.Value.AreaList.Split('|');
|
string[] roleLimitSections = region.Value.AreaList.Split('|');
|
||||||
foreach(string npcData in roleLimitSections)
|
foreach (string npcData in roleLimitSections)
|
||||||
{
|
{
|
||||||
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
|
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
|
||||||
SceneItem sceneItem = item.GetComponent<SceneItem>();
|
SceneItem sceneItem = item.GetComponent<SceneItem>();
|
||||||
@ -224,7 +224,7 @@ public class Panel : Base
|
|||||||
scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
|
scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
|
||||||
// 设置limitNum
|
// 设置limitNum
|
||||||
sceneItem.sceneId = npcData.ToString();
|
sceneItem.sceneId = npcData.ToString();
|
||||||
LocationData locationData= jsonReader1.GetAreaDateById(int.Parse(npcData));
|
LocationData locationData = jsonReader1.GetAreaDateById(int.Parse(npcData));
|
||||||
sceneItem.sceneName.text = jsonReader1.SetUIText(locationData.Name.ToString());
|
sceneItem.sceneName.text = jsonReader1.SetUIText(locationData.Name.ToString());
|
||||||
//Debug.LogError(sceneItem.sceneId);
|
//Debug.LogError(sceneItem.sceneId);
|
||||||
// 将每个实例化的角色添加到列表中
|
// 将每个实例化的角色添加到列表中
|
||||||
@ -251,60 +251,60 @@ public class Panel : Base
|
|||||||
// // 将每个实例化的角色添加到列表中
|
// // 将每个实例化的角色添加到列表中
|
||||||
// peopleList.Add(item);
|
// peopleList.Add(item);
|
||||||
// }
|
// }
|
||||||
//if (!string.IsNullOrEmpty(roleLimit))
|
//if (!string.IsNullOrEmpty(roleLimit))
|
||||||
//{
|
//{
|
||||||
// // 先按“|”分隔
|
// // 先按“|”分隔
|
||||||
// string[] roleLimitSections = roleLimit.Split('|');
|
// string[] roleLimitSections = roleLimit.Split('|');
|
||||||
// // 遍历每个部分(按“|”分隔后得到的数组)
|
// // 遍历每个部分(按“|”分隔后得到的数组)
|
||||||
// bool shouldInstantiate = true; // 用于判断是否需要实例化
|
// bool shouldInstantiate = true; // 用于判断是否需要实例化
|
||||||
// foreach (string section in roleLimitSections)
|
// foreach (string section in roleLimitSections)
|
||||||
// {
|
// {
|
||||||
// string[] roleLimits = section.Split(',');
|
// string[] roleLimits = section.Split(',');
|
||||||
// // 判断当前部分是否包含 "-1" 来决定是否跳过实例化
|
// // 判断当前部分是否包含 "-1" 来决定是否跳过实例化
|
||||||
// if (section.Contains("-1"))
|
// if (section.Contains("-1"))
|
||||||
// {
|
// {
|
||||||
|
|
||||||
// if (roleLimits[0] == "-1")
|
// if (roleLimits[0] == "-1")
|
||||||
// {
|
// {
|
||||||
// shouldInstantiate = false; // 不实例化该NPC
|
// shouldInstantiate = false; // 不实例化该NPC
|
||||||
// break; // 跳出循环,直接处理下一个NPC
|
// break; // 跳出循环,直接处理下一个NPC
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// if (selectScenePanel.scnenId== sceneLimit)
|
// if (selectScenePanel.scnenId== sceneLimit)
|
||||||
// {
|
// {
|
||||||
// if(selectScenePanel.difficultyId == int.Parse(roleLimits[1]))
|
// if(selectScenePanel.difficultyId == int.Parse(roleLimits[1]))
|
||||||
// {
|
// {
|
||||||
// Debug.LogWarning("roleLimits[0]"+ roleLimits[0]);
|
// Debug.LogWarning("roleLimits[0]"+ roleLimits[0]);
|
||||||
// Debug.LogWarning("roleLimits[1]" + roleLimits[1]);
|
// Debug.LogWarning("roleLimits[1]" + roleLimits[1]);
|
||||||
// Debug.LogWarning("roleLimits[2]" + roleLimits[2]);
|
// Debug.LogWarning("roleLimits[2]" + roleLimits[2]);
|
||||||
// Debug.LogWarning("roleLimits[3]" + roleLimits[3]);
|
// Debug.LogWarning("roleLimits[3]" + roleLimits[3]);
|
||||||
// GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
|
// GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
|
||||||
// SceneItem sceneItem = item.GetComponent<SceneItem>();
|
// SceneItem sceneItem = item.GetComponent<SceneItem>();
|
||||||
// Button scenebutton = item.transform.Find("TextBtn").GetComponent<Button>();
|
// Button scenebutton = item.transform.Find("TextBtn").GetComponent<Button>();
|
||||||
// scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
|
// scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
|
||||||
// // 设置limitNum
|
// // 设置limitNum
|
||||||
// sceneItem.sceneId = npcData.Key.ToString();
|
// sceneItem.sceneId = npcData.Key.ToString();
|
||||||
// sceneItem.dutyId = roleLimits[1];
|
// sceneItem.dutyId = roleLimits[1];
|
||||||
// sceneItem.limitNum = int.Parse(roleLimits[2]);
|
// sceneItem.limitNum = int.Parse(roleLimits[2]);
|
||||||
// sceneItem.sceneName.text = npcData.Value.Note;
|
// sceneItem.sceneName.text = npcData.Value.Note;
|
||||||
// // 将每个实例化的角色添加到列表中
|
// // 将每个实例化的角色添加到列表中
|
||||||
// peopleList.Add(item);
|
// peopleList.Add(item);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// // 如果不满足实例化条件,跳过当前NPC的实例化
|
// // 如果不满足实例化条件,跳过当前NPC的实例化
|
||||||
// if (!shouldInstantiate)
|
// if (!shouldInstantiate)
|
||||||
// {
|
// {
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================按钮和点击事件==================================================
|
//=============================================================按钮和点击事件==================================================
|
||||||
//处理人员管理按钮
|
//处理人员管理按钮
|
||||||
public void ClickPersonnelManagement()
|
public void ClickPersonnelManagement()
|
||||||
{
|
{
|
||||||
if (sceneDataDictionary.Count != 0)
|
if (sceneDataDictionary.Count != 0)
|
||||||
@ -335,7 +335,7 @@ public class Panel : Base
|
|||||||
public void SetScene(int id)
|
public void SetScene(int id)
|
||||||
{
|
{
|
||||||
peopleList.Clear();
|
peopleList.Clear();
|
||||||
foreach(Transform child in sceneCount)
|
foreach (Transform child in sceneCount)
|
||||||
{
|
{
|
||||||
Destroy(child.gameObject);
|
Destroy(child.gameObject);
|
||||||
}
|
}
|
||||||
@ -348,7 +348,7 @@ public class Panel : Base
|
|||||||
// 按“|”分隔不同的角色限制部分
|
// 按“|”分隔不同的角色限制部分
|
||||||
string[] roleLimitSections = npcData.Value.RoleLimit.Split('|');
|
string[] roleLimitSections = npcData.Value.RoleLimit.Split('|');
|
||||||
bool shouldInstantiate = true;
|
bool shouldInstantiate = true;
|
||||||
if(npcData.Value.RoleLimit=="-1")
|
if (npcData.Value.RoleLimit == "-1")
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -356,7 +356,7 @@ public class Panel : Base
|
|||||||
{
|
{
|
||||||
foreach (var section in roleLimitSections)
|
foreach (var section in roleLimitSections)
|
||||||
{
|
{
|
||||||
|
|
||||||
// 按“,”分隔出事故位置ID、职业ID和最低要求人数
|
// 按“,”分隔出事故位置ID、职业ID和最低要求人数
|
||||||
string[] roleLimits = section.Split(',');
|
string[] roleLimits = section.Split(',');
|
||||||
string accidentLocationId = roleLimits[0]; // 事故位置ID
|
string accidentLocationId = roleLimits[0]; // 事故位置ID
|
||||||
@ -390,13 +390,13 @@ public class Panel : Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 遍历每个角色限制部分
|
// 遍历每个角色限制部分
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取当前该位置该职业的已添加人数
|
// 获取当前该位置该职业的已添加人数
|
||||||
private int GetCurrentPeopleCount(string accidentLocationId, string roleId)
|
private int GetCurrentPeopleCount(string accidentLocationId, string roleId)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
// 遍历场景数据字典,统计该事故位置和职业的人员数量
|
// 遍历场景数据字典,统计该事故位置和职业的人员数量
|
||||||
@ -517,9 +517,9 @@ public class Panel : Base
|
|||||||
//获取鼠标点击位置的信息
|
//获取鼠标点击位置的信息
|
||||||
public void GetData()
|
public void GetData()
|
||||||
{
|
{
|
||||||
ManagerPanel managerPanel = new ManagerPanel();
|
ManagerPanel managerPanel = new ManagerPanel();
|
||||||
|
|
||||||
// 当鼠标左键按下时进行检测
|
// 当鼠标左键按下时进行检测
|
||||||
if (Input.GetMouseButtonDown(0))
|
if (Input.GetMouseButtonDown(0))
|
||||||
{
|
{
|
||||||
// 确保 raycaster 和 eventSystem 不为空
|
// 确保 raycaster 和 eventSystem 不为空
|
||||||
@ -544,7 +544,7 @@ public class Panel : Base
|
|||||||
{
|
{
|
||||||
// 检测到点击了按钮
|
// 检测到点击了按钮
|
||||||
Button clickedButton = result.gameObject.GetComponent<Button>();
|
Button clickedButton = result.gameObject.GetComponent<Button>();
|
||||||
|
|
||||||
if (clickedButton != null)
|
if (clickedButton != null)
|
||||||
{
|
{
|
||||||
Text buttonText = clickedButton.GetComponentInChildren<Text>();
|
Text buttonText = clickedButton.GetComponentInChildren<Text>();
|
||||||
@ -561,14 +561,14 @@ public class Panel : Base
|
|||||||
scene = buttonText.text;
|
scene = buttonText.text;
|
||||||
SceneItem sceneItem = buttonText.gameObject.GetComponentInParent<SceneItem>();
|
SceneItem sceneItem = buttonText.gameObject.GetComponentInParent<SceneItem>();
|
||||||
selectedInfo.scene = scene;
|
selectedInfo.scene = scene;
|
||||||
selectedInfo.sceneId= sceneItem.sceneId;
|
selectedInfo.sceneId = sceneItem.sceneId;
|
||||||
isSceneSelected = true; // 选择了场景
|
isSceneSelected = true; // 选择了场景
|
||||||
}
|
}
|
||||||
else if (buttonText != null && buttonText.tag == Tags.duty) // 获取标签为职责的信息
|
else if (buttonText != null && buttonText.tag == Tags.duty) // 获取标签为职责的信息
|
||||||
{
|
{
|
||||||
duty = buttonText.text;
|
duty = buttonText.text;
|
||||||
DutyItem item = clickedButton.GetComponentInParent<DutyItem>();
|
DutyItem item = clickedButton.GetComponentInParent<DutyItem>();
|
||||||
if(duty=="主持人")
|
if (duty == "主持人")
|
||||||
{
|
{
|
||||||
isDutySelected = true; // 选择了职责
|
isDutySelected = true; // 选择了职责
|
||||||
isSceneSelected = true;
|
isSceneSelected = true;
|
||||||
@ -595,7 +595,7 @@ public class Panel : Base
|
|||||||
//判断是否能够点击按钮
|
//判断是否能够点击按钮
|
||||||
public void PanelToggelSet()
|
public void PanelToggelSet()
|
||||||
{
|
{
|
||||||
if(selectScenePanel.isSure)
|
if (selectScenePanel.isSure)
|
||||||
{
|
{
|
||||||
panelToggle[1].interactable = selectScenePanel.isSure; // 启用第二个Toggle
|
panelToggle[1].interactable = selectScenePanel.isSure; // 启用第二个Toggle
|
||||||
panelToggle[1].gameObject.transform.GetComponent<Image>().sprite = toggleImage[1];
|
panelToggle[1].gameObject.transform.GetComponent<Image>().sprite = toggleImage[1];
|
||||||
@ -617,46 +617,46 @@ public class Panel : Base
|
|||||||
//判断确认按钮是否可以点击
|
//判断确认按钮是否可以点击
|
||||||
private void UpdateConfirmButtonState()
|
private void UpdateConfirmButtonState()
|
||||||
{
|
{
|
||||||
if(isDutySelected)
|
if (isDutySelected)
|
||||||
// 如果人员、职责和场景都已选择,则启用确认按钮,否则禁用
|
// 如果人员、职责和场景都已选择,则启用确认按钮,否则禁用
|
||||||
sureBtn.interactable = isPersonSelected && isDutySelected && isSceneSelected;
|
sureBtn.interactable = isPersonSelected && isDutySelected && isSceneSelected;
|
||||||
ChangeImage(sureBtn.interactable);
|
ChangeImage(sureBtn.interactable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置安排文字
|
//设置安排文字
|
||||||
public void SetText()
|
public void SetText()
|
||||||
{
|
{
|
||||||
arrangeText.text = "[" + name + "]担任[" + duty + "],位于[" + scene + "]";
|
arrangeText.text = "[" + name + "]担任[" + duty + "],位于[" + scene + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
//筛选
|
//筛选
|
||||||
public void SetInputFile()
|
public void SetInputFile()
|
||||||
|
{
|
||||||
|
// 获取输入框内容
|
||||||
|
string filterText = shaixuaninputField.text.Trim();
|
||||||
|
|
||||||
|
// 遍历所有已实例化的人员预制体
|
||||||
|
foreach (Transform child in peopleCountent)
|
||||||
{
|
{
|
||||||
// 获取输入框内容
|
// 获取该子物体上的 Text 组件
|
||||||
string filterText = shaixuaninputField.text.Trim();
|
Text personNameText = child.GetComponentInChildren<Text>();
|
||||||
|
|
||||||
// 遍历所有已实例化的人员预制体
|
if (personNameText != null)
|
||||||
foreach (Transform child in peopleCountent)
|
|
||||||
{
|
{
|
||||||
// 获取该子物体上的 Text 组件
|
// 比较输入框中的内容与人员姓名
|
||||||
Text personNameText = child.GetComponentInChildren<Text>();
|
if (personNameText.text.Contains(filterText))
|
||||||
|
|
||||||
if (personNameText != null)
|
|
||||||
{
|
{
|
||||||
// 比较输入框中的内容与人员姓名
|
// 如果匹配,显示该人员
|
||||||
if (personNameText.text.Contains(filterText))
|
child.gameObject.SetActive(true);
|
||||||
{
|
}
|
||||||
// 如果匹配,显示该人员
|
else
|
||||||
child.gameObject.SetActive(true);
|
{
|
||||||
}
|
// 如果不匹配,隐藏该人员
|
||||||
else
|
child.gameObject.SetActive(false);
|
||||||
{
|
|
||||||
// 如果不匹配,隐藏该人员
|
|
||||||
child.gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//==========================================================点击变色============================================================
|
//==========================================================点击变色============================================================
|
||||||
|
|
||||||
public void OnPeopleItemClicked(GameObject clickedItem, Color color, GameObject select)
|
public void OnPeopleItemClicked(GameObject clickedItem, Color color, GameObject select)
|
||||||
@ -749,7 +749,7 @@ public class Panel : Base
|
|||||||
// 如果该人员已经被添加到场景,改变颜色为灰色
|
// 如果该人员已经被添加到场景,改变颜色为灰色
|
||||||
if (isPersonAdded)
|
if (isPersonAdded)
|
||||||
{
|
{
|
||||||
|
|
||||||
personText.color = Color.blue; // 已添加人员的颜色
|
personText.color = Color.blue; // 已添加人员的颜色
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -808,7 +808,6 @@ public class Panel : Base
|
|||||||
public void WhetherToMeet()
|
public void WhetherToMeet()
|
||||||
{
|
{
|
||||||
bool allRequirementsMet = true; // 标记是否所有需求都满足
|
bool allRequirementsMet = true; // 标记是否所有需求都满足
|
||||||
|
|
||||||
// 遍历所有的场景数据
|
// 遍历所有的场景数据
|
||||||
foreach (var item in jsonReader1.locationDictionary)
|
foreach (var item in jsonReader1.locationDictionary)
|
||||||
{
|
{
|
||||||
@ -868,7 +867,6 @@ public class Panel : Base
|
|||||||
{
|
{
|
||||||
// 如果没有找到该场景的职业数据,列出所缺职业
|
// 如果没有找到该场景的职业数据,列出所缺职业
|
||||||
Debug.Log($"场景 {item.Key} 的职业数据未找到,列出缺少的职业和人数:");
|
Debug.Log($"场景 {item.Key} 的职业数据未找到,列出缺少的职业和人数:");
|
||||||
|
|
||||||
// 根据 RoleLimit 列出缺少的职业及其要求人数
|
// 根据 RoleLimit 列出缺少的职业及其要求人数
|
||||||
foreach (var entryInLimit in limit)
|
foreach (var entryInLimit in limit)
|
||||||
{
|
{
|
||||||
@ -908,7 +906,7 @@ public class Panel : Base
|
|||||||
public void OnclickRequirementsBtn()
|
public void OnclickRequirementsBtn()
|
||||||
{
|
{
|
||||||
requirementsPrefab.gameObject.SetActive(true);
|
requirementsPrefab.gameObject.SetActive(true);
|
||||||
//requirementPanel.LoadingSceneLable();
|
requirementPanel.LoadingSceneLable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public class DistributionPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
GameObject managerPanelInstance = Instantiate(personnelLable, personnelContent);
|
GameObject managerPanelInstance = Instantiate(personnelLable, personnelContent);
|
||||||
PersonnelPanel scenetext = managerPanelInstance.GetComponent<PersonnelPanel>();
|
PersonnelPanel scenetext = managerPanelInstance.GetComponent<PersonnelPanel>();
|
||||||
scenetext.personelPanelText.text = sceneEntry.Key;
|
scenetext.personelPanelText.text = jsonReader.SetUIText(sceneEntry.Key);
|
||||||
scenetext.personelNumText.text = sceneEntry.Value.Count.ToString();
|
scenetext.personelNumText.text = sceneEntry.Value.Count.ToString();
|
||||||
scenetext.CreatePeopleItem(sceneEntry.Value);
|
scenetext.CreatePeopleItem(sceneEntry.Value);
|
||||||
foreach(var scene in sceneEntry.Value)
|
foreach(var scene in sceneEntry.Value)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
@ -50,4 +51,12 @@ public class PersonnelPanel : MonoBehaviour
|
|||||||
{
|
{
|
||||||
transform.gameObject.SetActive(false);
|
transform.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//动态加载最低配置的人员
|
||||||
|
public void LoadingpersonelItem(Transform personContent,string name)
|
||||||
|
{
|
||||||
|
GameObject gameObject = Instantiate(personelItem, personContent);
|
||||||
|
PersonnelInfo personnelInfo = gameObject.GetComponent<PersonnelInfo>();
|
||||||
|
personnelInfo.name = name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -439,11 +439,8 @@ public class SelectScenePanel : Base
|
|||||||
public void SubmitBtn()
|
public void SubmitBtn()
|
||||||
{
|
{
|
||||||
datePanel.evetId = this.eventId.ToString();
|
datePanel.evetId = this.eventId.ToString();
|
||||||
Debug.LogError("datePanel.evetId"+datePanel.evetId);
|
|
||||||
datePanel.placeId = this.scnenId.ToString();
|
datePanel.placeId = this.scnenId.ToString();
|
||||||
Debug.LogError("datePanel.placeId" + datePanel.placeId);
|
|
||||||
datePanel.disasterLocation = this.idcidentId.ToString();
|
datePanel.disasterLocation = this.idcidentId.ToString();
|
||||||
Debug.LogError("datePanel.disasterLocation" + datePanel.disasterLocation);
|
|
||||||
SelsctDifficulty();
|
SelsctDifficulty();
|
||||||
SetDataPanelInfo();
|
SetDataPanelInfo();
|
||||||
SetPanel();
|
SetPanel();
|
||||||
|
Loading…
Reference in New Issue
Block a user