最低人员配置

This commit is contained in:
lq 2025-01-03 15:06:23 +08:00
parent 51abcfd89a
commit dd2c810c5e
5 changed files with 144 additions and 138 deletions

View File

@ -2665,6 +2665,8 @@ MonoBehaviour:
sceneLable: {fileID: 5900002971020626571, guid: 297444ab6ae692b4dbcb38d34e0c5716, type: 3}
content: {fileID: 788248231}
closeBtn: {fileID: 349260647}
panel: {fileID: 618256462}
selectScenePanel: {fileID: 7468736064579811982}
jsonReader: {fileID: 1417128757}
--- !u!1 &569417021 stripped
GameObject:

View File

@ -101,7 +101,7 @@ public class Panel : Base
public SelectScenePanel selectScenePanel;
public DatePanel datePanel;
public WarningPopPanel warningPopPanel;
//public RequirementPanel requirementPanel;
public RequirementPanel requirementPanel;
private bool isPersonSelected = false; // 标志是否选择了人员
private bool isDutySelected = false; // 标志是否选择了职责
@ -129,27 +129,27 @@ public class Panel : Base
//动态加载人员
public async void DynamicLoadingPeople()
{
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)
//for (int i = 0; i < 10; i++)
//{
// GameObject item = GameObject.Instantiate<GameObject>(peoplePrefab, peopleCountent);
// PeopleItem peopleItem = item.GetComponent<PeopleItem>();
// peopleItem.nameText.text = player.NickName;
// peopleItem.peopleId = player.UserId;
// 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);
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);// 将每个实例化的角色添加到列表中
}
}
//动态加载职责
@ -808,7 +808,6 @@ public class Panel : Base
public void WhetherToMeet()
{
bool allRequirementsMet = true; // 标记是否所有需求都满足
// 遍历所有的场景数据
foreach (var item in jsonReader1.locationDictionary)
{
@ -868,7 +867,6 @@ public class Panel : Base
{
// 如果没有找到该场景的职业数据,列出所缺职业
Debug.Log($"场景 {item.Key} 的职业数据未找到,列出缺少的职业和人数:");
// 根据 RoleLimit 列出缺少的职业及其要求人数
foreach (var entryInLimit in limit)
{
@ -908,7 +906,7 @@ public class Panel : Base
public void OnclickRequirementsBtn()
{
requirementsPrefab.gameObject.SetActive(true);
//requirementPanel.LoadingSceneLable();
requirementPanel.LoadingSceneLable();
}
}

View File

@ -41,7 +41,7 @@ public class DistributionPanel : MonoBehaviour
{
GameObject managerPanelInstance = Instantiate(personnelLable, personnelContent);
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.CreatePeopleItem(sceneEntry.Value);
foreach(var scene in sceneEntry.Value)

View File

@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
@ -50,4 +51,12 @@ public class PersonnelPanel : MonoBehaviour
{
transform.gameObject.SetActive(false);
}
//动态加载最低配置的人员
public void LoadingpersonelItem(Transform personContent,string name)
{
GameObject gameObject = Instantiate(personelItem, personContent);
PersonnelInfo personnelInfo = gameObject.GetComponent<PersonnelInfo>();
personnelInfo.name = name;
}
}

View File

@ -439,11 +439,8 @@ public class SelectScenePanel : Base
public void SubmitBtn()
{
datePanel.evetId = this.eventId.ToString();
Debug.LogError("datePanel.evetId"+datePanel.evetId);
datePanel.placeId = this.scnenId.ToString();
Debug.LogError("datePanel.placeId" + datePanel.placeId);
datePanel.disasterLocation = this.idcidentId.ToString();
Debug.LogError("datePanel.disasterLocation" + datePanel.disasterLocation);
SelsctDifficulty();
SetDataPanelInfo();
SetPanel();