最低人员配置
This commit is contained in:
parent
51abcfd89a
commit
dd2c810c5e
@ -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:
|
||||
|
@ -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,31 +129,31 @@ 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);// 将每个实例化的角色添加到列表中
|
||||
}
|
||||
}
|
||||
|
||||
//动态加载职责
|
||||
public void DynamicLoadingDuty(int id,int idcidentId)
|
||||
public void DynamicLoadingDuty(int id, int idcidentId)
|
||||
{
|
||||
if (selectScenePanel.difficultyToRoles.ContainsKey(id))
|
||||
{
|
||||
@ -169,12 +169,12 @@ public class Panel : Base
|
||||
var npcInfo = jsonReader1.npcDictionary[roleId];
|
||||
// 创建DutyItem实例
|
||||
string[] roleLimitSections = npcData.Name.Split('|');
|
||||
foreach(string plopleInfo in roleLimitSections)
|
||||
foreach (string plopleInfo in roleLimitSections)
|
||||
{
|
||||
|
||||
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);
|
||||
DutyItem dutyItem = item.GetComponent<DutyItem>();
|
||||
@ -183,7 +183,7 @@ public class Panel : Base
|
||||
dutuybutton.onClick.AddListener(() =>
|
||||
{
|
||||
OnDutyItemClicked(item, Color.red, selectedDuty);
|
||||
if(dutyItem.dutyNameText.text=="主持人")
|
||||
if (dutyItem.dutyNameText.text == "主持人")
|
||||
{
|
||||
peopleList.Clear();
|
||||
foreach (Transform child in sceneCount)
|
||||
@ -216,7 +216,7 @@ public class Panel : Base
|
||||
foreach (var region in jsonReader1.sceneDictionary)
|
||||
{
|
||||
string[] roleLimitSections = region.Value.AreaList.Split('|');
|
||||
foreach(string npcData in roleLimitSections)
|
||||
foreach (string npcData in roleLimitSections)
|
||||
{
|
||||
GameObject item = GameObject.Instantiate<GameObject>(scenePrefab, sceneCount);
|
||||
SceneItem sceneItem = item.GetComponent<SceneItem>();
|
||||
@ -224,7 +224,7 @@ public class Panel : Base
|
||||
scenebutton.onClick.AddListener(() => OnSceneItemClicked(item, Color.green, selectedScene));
|
||||
// 设置limitNum
|
||||
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());
|
||||
//Debug.LogError(sceneItem.sceneId);
|
||||
// 将每个实例化的角色添加到列表中
|
||||
@ -335,7 +335,7 @@ public class Panel : Base
|
||||
public void SetScene(int id)
|
||||
{
|
||||
peopleList.Clear();
|
||||
foreach(Transform child in sceneCount)
|
||||
foreach (Transform child in sceneCount)
|
||||
{
|
||||
Destroy(child.gameObject);
|
||||
}
|
||||
@ -348,7 +348,7 @@ public class Panel : Base
|
||||
// 按“|”分隔不同的角色限制部分
|
||||
string[] roleLimitSections = npcData.Value.RoleLimit.Split('|');
|
||||
bool shouldInstantiate = true;
|
||||
if(npcData.Value.RoleLimit=="-1")
|
||||
if (npcData.Value.RoleLimit == "-1")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -561,14 +561,14 @@ public class Panel : Base
|
||||
scene = buttonText.text;
|
||||
SceneItem sceneItem = buttonText.gameObject.GetComponentInParent<SceneItem>();
|
||||
selectedInfo.scene = scene;
|
||||
selectedInfo.sceneId= sceneItem.sceneId;
|
||||
selectedInfo.sceneId = sceneItem.sceneId;
|
||||
isSceneSelected = true; // 选择了场景
|
||||
}
|
||||
else if (buttonText != null && buttonText.tag == Tags.duty) // 获取标签为职责的信息
|
||||
{
|
||||
duty = buttonText.text;
|
||||
DutyItem item = clickedButton.GetComponentInParent<DutyItem>();
|
||||
if(duty=="主持人")
|
||||
if (duty == "主持人")
|
||||
{
|
||||
isDutySelected = true; // 选择了职责
|
||||
isSceneSelected = true;
|
||||
@ -595,7 +595,7 @@ public class Panel : Base
|
||||
//判断是否能够点击按钮
|
||||
public void PanelToggelSet()
|
||||
{
|
||||
if(selectScenePanel.isSure)
|
||||
if (selectScenePanel.isSure)
|
||||
{
|
||||
panelToggle[1].interactable = selectScenePanel.isSure; // 启用第二个Toggle
|
||||
panelToggle[1].gameObject.transform.GetComponent<Image>().sprite = toggleImage[1];
|
||||
@ -617,7 +617,7 @@ public class Panel : Base
|
||||
//判断确认按钮是否可以点击
|
||||
private void UpdateConfirmButtonState()
|
||||
{
|
||||
if(isDutySelected)
|
||||
if (isDutySelected)
|
||||
// 如果人员、职责和场景都已选择,则启用确认按钮,否则禁用
|
||||
sureBtn.interactable = isPersonSelected && isDutySelected && isSceneSelected;
|
||||
ChangeImage(sureBtn.interactable);
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user