This commit is contained in:
lq 2024-11-30 16:19:19 +08:00
parent 2e16b88891
commit e644437eb2
13 changed files with 17852 additions and 8584 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d060467cf9c7b0b4ba5feec6db1c61ac
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 90919b88a71f0054bb1cf84429cb3a1e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 6026028542083999133}
- component: {fileID: 6026028542083999134}
- component: {fileID: 6026028542083999132}
- component: {fileID: 5048549416373763293}
m_Layer: 5
m_Name: personnelItem
m_TagString: Untagged
@ -101,6 +102,20 @@ MonoBehaviour:
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!114 &5048549416373763293
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6026028542083999128}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8286d5fe7a9d6a94aaa5ba0615a3275e, type: 3}
m_Name:
m_EditorClassIdentifier:
nameText: {fileID: 6026028542301398201}
image: {fileID: 6026028542396921311}
--- !u!1 &6026028542301398203
GameObject:
m_ObjectHideFlags: 0

View File

@ -520,7 +520,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6e6b4aedf9cd8da4dbf020e9156d9875, type: 3}
m_Name:
m_EditorClassIdentifier:
personnelItem: {fileID: 6026028542083999128, guid: 93710d87e1c578748b4ef94ce0d38198, type: 3}
personelPanelText: {fileID: 5900002971283911308}
personelNumText: {fileID: 5900002969924403207}
personelContent: {fileID: 5900002971599260874}
@ -642,7 +641,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 560.5, y: -44}
m_AnchoredPosition: {x: 560.5, y: -109}
m_SizeDelta: {x: 1121, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &5900002971599260725

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -152,10 +152,14 @@ public class Panel : MonoBehaviour
// 打印当前场景人员信息
Debug.Log($"场景: {sceneName},选中的人员: {selectedInfo.name},职责: {selectedInfo.duty}");
// 禁用确认按钮并清空选择标志
sureBtn.interactable = false; // 禁用确认按钮
isPersonSelected = false;
isDutySelected = false;
isSceneSelected = false;
// 改变已添加人员的显示颜色
UpdatePeopleListVisual();
}
}
@ -302,5 +306,32 @@ public class Panel : MonoBehaviour
personText.color = Color.yellow; // 选中颜色
}
}
// 更新人员列表的显示颜色
private void UpdatePeopleListVisual()
{
// 遍历所有已加载的人员预制体,检查是否已添加到场景
foreach (GameObject personItem in peopleList)
{
// 获取人员的名字和显示文本
Text personText = personItem.GetComponentInChildren<Text>();
if (personText != null)
{
// 检查该人员是否已经添加到当前场景
bool isPersonAdded = sceneDataDictionary[selectedInfo.scene].Any(info => info.name == personText.text);
// 如果该人员已经被添加到场景,改变颜色为灰色
if (isPersonAdded)
{
personText.color = Color.blue; // 已添加人员的颜色
}
else
{
personText.color = Color.white; // 未添加人员的颜色
}
}
}
}
}

View File

@ -127,22 +127,11 @@ public class ManagerPanel : MonoBehaviour
PersonnelPanel scenetext = managerPanelInstance.GetComponent<PersonnelPanel>();
scenetext.personelPanelText.text = sceneEntry.Key;
scenetext.personelNumText.text = sceneEntry.Value.Count.ToString();
Debug.Log("<<<<<<<<<<<<<<<<<<<<<<" + scenetext.personelPanelText.text);
CreatePeopleItem(scenetext.personelPanelText.text, sceneEntry.Value, managerPanelInstance);
scenetext.CreatePeopleItem(sceneEntry.Value);
}
//CreatePeopleItem();
}
//加载人员弹窗的子物体
public void CreatePeopleItem(string sceneName, List<SelectedInfo> peopleList, GameObject parentTransform)
{
foreach (Transform child in personnelPanelCount)
{
Destroy(child.gameObject);
}
foreach (var sceneEntry in peopleList)
{
GameObject managerPanelInstance = Instantiate(personnelPanel, personnelPanelCount);
}
}
}

View File

@ -5,7 +5,6 @@ using UnityEngine.UI;
public class PersonnelPanel : MonoBehaviour
{
public GameObject personnelItem;
public Text personelPanelText;
public Text personelNumText;
public Transform personelContent;
@ -22,11 +21,24 @@ public class PersonnelPanel : MonoBehaviour
{
}
public void CreatePersonelItem(SelectedInfo person, GameObject parentTransform)
public void CreatePeopleItem(List<SelectedInfo> peopleList)
{
Transform contentTransform = parentTransform.transform.Find("Scroll View/Viewport/Content");
foreach (Transform child in personelContent)
{
Destroy(child.gameObject);
}
foreach (var personel in peopleList)
{
CreatePersonelItem(personel, personelContent);
}
}
public void CreatePersonelItem(SelectedInfo person, Transform parentTransform)
{
//Transform contentTransform = parentTransform.transform.Find("Scroll View/Viewport/Content");
Debug.Log("============"+ parentTransform == null);
// 实例化一个人员项并将其作为场景面板的子物体
GameObject item = Instantiate(personelItem, contentTransform);
GameObject item = Instantiate(personelItem, parentTransform);
PersonnelInfo personnelItem = item.GetComponent<PersonnelInfo>();
personnelItem.nameText.text = person.name; // 设置姓名
}

View File

@ -21,6 +21,7 @@ public class SelectScenePanel : MonoBehaviour
public GameObject scoolSelectBtn;//学校选择按钮
public GameObject schoolChoiceLable;//学校选择界面
public GameObject eventChoiceLable;//事件选择界面
public GameObject mainPanel;
public List<SchoolInfo> schoolInfoList = new List<SchoolInfo>();//学校信息
public List<EventInfo> eventInfoList = new List<EventInfo>();//事件信息
public List<SceneItem> sceneItemList = new List<SceneItem>();//场景信息
@ -32,6 +33,7 @@ public class SelectScenePanel : MonoBehaviour
public ToggleGroup toggleGroup;
[Header("数据")]
public DatePanel datePanel;
public int schoolId;
public string schoolName;
public string sceneName;
@ -172,6 +174,7 @@ public class SelectScenePanel : MonoBehaviour
break; // 找到选中的场景后退出循环
}
}
Debug.Log("###############3:" + this.schoolId);
//IsClick();
}
@ -284,9 +287,16 @@ public class SelectScenePanel : MonoBehaviour
SelectEvent();
SelsctDifficulty();
SelectEvnentBtn();
SetDataPanelInfo();
this.gameObject.SetActive(false);
}
//关闭按钮
public void OnClickCloseBtn()
{
transform.gameObject.SetActive(false);
}
//通过判断Toggle的IsOn是否被打开来判断继续按钮是否置灰
public void IsClick()
{
@ -346,6 +356,7 @@ public class SelectScenePanel : MonoBehaviour
}
//学校Toggle
public void SetScloolToggleOpenorClose(List<SchoolInfo> sceneItems)
{
foreach (SchoolInfo item in sceneItems)
@ -367,6 +378,7 @@ public class SelectScenePanel : MonoBehaviour
}
//事件Toggle
public void SetEventToggleOpenorClose(List<EventInfo> sceneItems)
{
foreach (EventInfo item in sceneItems)
@ -387,4 +399,11 @@ public class SelectScenePanel : MonoBehaviour
}
//设置日期界面的数据
public void SetDataPanelInfo()
{
datePanel.SchoolText.text = schoolName;
datePanel.PlaceText.text = eventName;
}
}