Merge branch 'main' of http://shu.sheziwanglo.cn:3000/wulongxiao/_xiaofang
This commit is contained in:
commit
a63fa4959a
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
|
using UnityEditor.SearchService;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
@ -38,6 +39,8 @@ public class Panel : Base
|
|||||||
public Text arrangeText;//整体安排
|
public Text arrangeText;//整体安排
|
||||||
[Header("确认信息按钮")]
|
[Header("确认信息按钮")]
|
||||||
public Button sureBtn;//确认信息按钮
|
public Button sureBtn;//确认信息按钮
|
||||||
|
[Header("最少人员要求警告")]
|
||||||
|
public Button requirementsBtn;
|
||||||
[Header("场景的ToggleGroup")]
|
[Header("场景的ToggleGroup")]
|
||||||
public ToggleGroup scenetoggleGroup;//场景的ToggleGroup
|
public ToggleGroup scenetoggleGroup;//场景的ToggleGroup
|
||||||
[Header("筛选输入框")]
|
[Header("筛选输入框")]
|
||||||
@ -75,6 +78,9 @@ public class Panel : Base
|
|||||||
public Transform sceneCount;//存放场景预制体的地方
|
public Transform sceneCount;//存放场景预制体的地方
|
||||||
[Header("人员管理面板")]
|
[Header("人员管理面板")]
|
||||||
public GameObject ManagerPanelPrefab; // 预制体,包含人员管理面板
|
public GameObject ManagerPanelPrefab; // 预制体,包含人员管理面板
|
||||||
|
[Header("最低配置面板")]
|
||||||
|
public GameObject requirementsPrefab; // 预制体,最低配置面板
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[Header("数据")]
|
[Header("数据")]
|
||||||
@ -95,7 +101,8 @@ 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;
|
||||||
|
|
||||||
private bool isPersonSelected = false; // 标志是否选择了人员
|
private bool isPersonSelected = false; // 标志是否选择了人员
|
||||||
private bool isDutySelected = false; // 标志是否选择了职责
|
private bool isDutySelected = false; // 标志是否选择了职责
|
||||||
private bool isSceneSelected = false; // 标志是否选择了场景
|
private bool isSceneSelected = false; // 标志是否选择了场景
|
||||||
@ -106,6 +113,7 @@ public class Panel : Base
|
|||||||
sureBtn.interactable = false;
|
sureBtn.interactable = false;
|
||||||
ChangeImage(sureBtn.interactable);
|
ChangeImage(sureBtn.interactable);
|
||||||
selectedInfo = new SelectedInfo();
|
selectedInfo = new SelectedInfo();
|
||||||
|
requirementsBtn.onClick.AddListener(() => OnclickRequirementsBtn());
|
||||||
InstantiateToggle();
|
InstantiateToggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,27 +129,27 @@ public class Panel : Base
|
|||||||
//动态加载人员
|
//动态加载人员
|
||||||
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);// 将每个实例化的角色添加到列表中
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//动态加载职责
|
//动态加载职责
|
||||||
@ -477,21 +485,13 @@ public class Panel : Base
|
|||||||
|
|
||||||
// 将当前选中的人员信息添加到对应场景的人员列表中
|
// 将当前选中的人员信息添加到对应场景的人员列表中
|
||||||
currentSceneInfo.Add(newSelectedInfo);
|
currentSceneInfo.Add(newSelectedInfo);
|
||||||
|
|
||||||
// 禁用确认按钮并清空选择标志
|
// 禁用确认按钮并清空选择标志
|
||||||
sureBtn.interactable = false;
|
sureBtn.interactable = false;
|
||||||
ChangeImage(sureBtn.interactable);
|
ChangeImage(sureBtn.interactable);
|
||||||
|
WhetherToMeet();
|
||||||
isPersonSelected = false;
|
isPersonSelected = false;
|
||||||
isDutySelected = false;
|
isDutySelected = false;
|
||||||
isSceneSelected = false;
|
isSceneSelected = false;
|
||||||
|
|
||||||
// 上传数据
|
|
||||||
//UploadData(selectedInfo.peopleId, selectedInfo.dutyId.ToString(), selectedInfo.sceneId.ToString());
|
|
||||||
|
|
||||||
// 更新已添加人员的显示颜色
|
|
||||||
//UpdatePeopleListVisual();
|
|
||||||
|
|
||||||
Debug.Log($"Added new person: {newSelectedInfo.name} to scene: {sceneName}");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -807,7 +807,108 @@ public class Panel : Base
|
|||||||
//判断是否满足最低配置要求
|
//判断是否满足最低配置要求
|
||||||
public void WhetherToMeet()
|
public void WhetherToMeet()
|
||||||
{
|
{
|
||||||
|
bool allRequirementsMet = true; // 标记是否所有需求都满足
|
||||||
|
|
||||||
|
// 遍历所有的场景数据
|
||||||
|
foreach (var item in jsonReader1.locationDictionary)
|
||||||
|
{
|
||||||
|
string[] limit = item.Value.RoleLimit.Split('|'); // 拆分角色限制
|
||||||
|
foreach (var entry in limit)
|
||||||
|
{
|
||||||
|
string[] limitDetails = entry.Split(',');
|
||||||
|
if (limitDetails.Length == 4)
|
||||||
|
{
|
||||||
|
string sceneLimitId = limitDetails[0]; // 事故位置ID
|
||||||
|
string difficultyLimitId = limitDetails[1]; // 处置难度ID
|
||||||
|
string dutyId = limitDetails[2]; // 职业ID
|
||||||
|
string dutyNum = limitDetails[3]; // 最低要求人数
|
||||||
|
|
||||||
|
if (dutyNum == "-1")
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (sceneLimitId == selectScenePanel.idcidentId.ToString() && difficultyLimitId == selectScenePanel.difficultyId.ToString())
|
||||||
|
{
|
||||||
|
List<SelectedInfo> sceneData = null;
|
||||||
|
if (sceneDataDictionary.TryGetValue(item.Key.ToString(), out sceneData)) // 获取该场景的职业信息
|
||||||
|
{
|
||||||
|
var dutyCount = new Dictionary<string, int>();
|
||||||
|
foreach (var npc in sceneData)
|
||||||
|
{
|
||||||
|
if (dutyCount.ContainsKey(npc.dutyId))
|
||||||
|
{
|
||||||
|
dutyCount[npc.dutyId]++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dutyCount[npc.dutyId] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int requiredDutyNum = int.Parse(dutyNum);
|
||||||
|
if (!dutyCount.ContainsKey(dutyId))
|
||||||
|
{
|
||||||
|
// 该职业不在场景数据中,直接打印出缺少的职业
|
||||||
|
int missingNum = requiredDutyNum;
|
||||||
|
Debug.Log($"缺少职业 {dutyId},需求人数: {missingNum}");
|
||||||
|
allRequirementsMet = false; // 标记为需求未满足
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 该职业在场景数据中,判断是否缺少人数
|
||||||
|
int currentDutyCount = dutyCount[dutyId];
|
||||||
|
if (currentDutyCount < requiredDutyNum)
|
||||||
|
{
|
||||||
|
int missingNum = requiredDutyNum - currentDutyCount;
|
||||||
|
Debug.Log($"缺少职业 {dutyId},缺少人数: {missingNum}");
|
||||||
|
allRequirementsMet = false; // 标记为需求未满足
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果没有找到该场景的职业数据,列出所缺职业
|
||||||
|
Debug.Log($"场景 {item.Key} 的职业数据未找到,列出缺少的职业和人数:");
|
||||||
|
|
||||||
|
// 根据 RoleLimit 列出缺少的职业及其要求人数
|
||||||
|
foreach (var entryInLimit in limit)
|
||||||
|
{
|
||||||
|
string[] limitDetailsInner = entryInLimit.Split(',');
|
||||||
|
if (limitDetailsInner.Length == 4)
|
||||||
|
{
|
||||||
|
string innerDutyId = limitDetailsInner[2]; // 职业ID
|
||||||
|
string innerDutyNum = limitDetailsInner[3]; // 最低要求人数
|
||||||
|
|
||||||
|
// 如果要求人数不为 -1,输出缺少的职业及数量
|
||||||
|
if (innerDutyNum != "-1")
|
||||||
|
{
|
||||||
|
int requiredDutyNum = int.Parse(innerDutyNum);
|
||||||
|
Debug.Log($"缺少职业 {innerDutyId},需求人数: {requiredDutyNum}");
|
||||||
|
allRequirementsMet = false; // 标记为需求未满足
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据是否满足所有需求来显示或隐藏按钮
|
||||||
|
if (!allRequirementsMet)
|
||||||
|
{
|
||||||
|
requirementsBtn.transform.gameObject.SetActive(true); // 显示按钮
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
requirementsBtn.transform.gameObject.SetActive(false); // 隐藏按钮
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//打开最低要求面板
|
||||||
|
public void OnclickRequirementsBtn()
|
||||||
|
{
|
||||||
|
requirementsPrefab.gameObject.SetActive(true);
|
||||||
|
requirementPanel.LoadingSceneLable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,6 @@ public class DatePanel : MonoBehaviour
|
|||||||
createTemplateInfo.Instance.auth_CreateTemplate.isTemplate = "1";
|
createTemplateInfo.Instance.auth_CreateTemplate.isTemplate = "1";
|
||||||
}
|
}
|
||||||
panel.UploadData();
|
panel.UploadData();
|
||||||
Debug.LogError("+++++++++");
|
|
||||||
createTemplateInterface.createTemplate(dataText.text);
|
createTemplateInterface.createTemplate(dataText.text);
|
||||||
SceneManager.LoadScene("yhj");
|
SceneManager.LoadScene("yhj");
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,6 @@ public class DistributionPanel : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 输出缺少的职业ID并返回
|
// 输出缺少的职业ID并返回
|
||||||
if (missingDutyIds.Count > 0)
|
if (missingDutyIds.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -697,10 +697,9 @@ public class SelectScenePanel : Base
|
|||||||
{
|
{
|
||||||
if(!transform.gameObject.activeInHierarchy)
|
if(!transform.gameObject.activeInHierarchy)
|
||||||
{
|
{
|
||||||
Debug.LogError("++++++++++++++++++++++++++++++");
|
|
||||||
}
|
}
|
||||||
transform.gameObject.SetActive(false);
|
transform.gameObject.SetActive(false);
|
||||||
panel.gameObject.SetActive(true);
|
panel.gameObject.SetActive(true);
|
||||||
Debug.Log("111111111111111111111111111111");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -96,7 +96,6 @@ public class JueseChoicePop : MonoBehaviour
|
|||||||
string test = a;
|
string test = a;
|
||||||
button.onClick.AddListener(() =>
|
button.onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
Debug.LogError("zzzzzzzzzzzzzzzzzzzzzzzzzz" + test);
|
|
||||||
SetClassMate(classMate, test);
|
SetClassMate(classMate, test);
|
||||||
});
|
});
|
||||||
classMate.name = info.name;
|
classMate.name = info.name;
|
||||||
|
Loading…
Reference in New Issue
Block a user