This commit is contained in:
HuangZiBo 2024-11-30 10:27:25 +08:00
commit ed1187fa11
7 changed files with 59 additions and 14331 deletions

View File

@ -523,6 +523,9 @@ MonoBehaviour:
personnelItem: {fileID: 6026028542083999128, guid: 93710d87e1c578748b4ef94ce0d38198, type: 3}
personelPanelText: {fileID: 5900002971283911308}
personelNumText: {fileID: 5900002969924403207}
personelContent: {fileID: 5900002971599260874}
panelInfo: {fileID: 0}
personelItem: {fileID: 6026028542083999128, guid: 93710d87e1c578748b4ef94ce0d38198, type: 3}
--- !u!1 &5900002971283911298
GameObject:
m_ObjectHideFlags: 0
@ -639,7 +642,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: -109}
m_AnchoredPosition: {x: 560.5, y: -44}
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

View File

@ -102,13 +102,9 @@ public class Panel : MonoBehaviour
Debug.Log($"³¡¾°: {sceneEntry.Key}£¬ÈËÊý: {sceneEntry.Value.Count}");
GameObject managerPanelInstance = Instantiate(ManagerPanelPrefab, panelContent);
//ManagerPanel managerPanelScript = managerPanelInstance.GetComponentInParent<ManagerPanel>();
Text sceneText= managerPanelInstance.transform.Find("top/sceneName").GetComponent<Text>();
sceneText.text = sceneEntry.Key;
managerPanel1.CreateScenePanel(sceneEntry.Key, sceneEntry.Value, managerPanelInstance);
//managerPanel1.SetPlate();
ManagerPanel.gameObject.SetActive(true);
}

View File

@ -24,7 +24,8 @@ public class ManagerPanel : MonoBehaviour
private GameObject currentSelectedItem = null; // 当前选中的项
private Vector3 originalScale; // 记录选中项的原始大小
public Panel panelInfo;
public PersonnelPanel personnelPanel;
public PersonnelPanel personnelPanel2;
// Start is called before the first frame update
void Start()
{
@ -111,7 +112,7 @@ public class ManagerPanel : MonoBehaviour
transform.gameObject.SetActive(false);
}
//人员弹窗
//人员弹窗及加载人员面板
public void OnClickPeopleWindows()
{
peopleWindowsPrefab.gameObject.SetActive(true);
@ -122,14 +123,12 @@ public class ManagerPanel : MonoBehaviour
}
foreach (var sceneEntry in panelInfo.sceneDataDictionary)
{
Debug.Log($"场景: {sceneEntry.Key},人数: {sceneEntry.Value.Count}");
GameObject managerPanelInstance = Instantiate(personnelPanel, personnelPanelCount);
Text scenetext = managerPanelInstance.transform.Find("top/Image/scene").GetComponent<Text>();
Text numtext = managerPanelInstance.transform.Find("top/Image (1)/count").GetComponent<Text>();
scenetext.text = sceneEntry.Key;
numtext.text = sceneEntry.Value.Count.ToString();
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);
}
//CreatePeopleItem();
}
@ -141,9 +140,8 @@ public class ManagerPanel : MonoBehaviour
{
Destroy(child.gameObject);
}
foreach (var sceneEntry in panelInfo.sceneDataDictionary)
foreach (var sceneEntry in peopleList)
{
Debug.Log($"场景: {sceneEntry.Key},人数: {sceneEntry.Value.Count}");
GameObject managerPanelInstance = Instantiate(personnelPanel, personnelPanelCount);
}
}

View File

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PersonnelInfo : MonoBehaviour
{
public Text nameText;
public Image image;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8286d5fe7a9d6a94aaa5ba0615a3275e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -8,6 +8,9 @@ public class PersonnelPanel : MonoBehaviour
public GameObject personnelItem;
public Text personelPanelText;
public Text personelNumText;
public Transform personelContent;
public Panel panelInfo;
public GameObject personelItem;
// Start is called before the first frame update
void Start()
{
@ -19,8 +22,12 @@ public class PersonnelPanel : MonoBehaviour
{
}
public void CreatePersonelItem(string sceneName, List<SelectedInfo> peopleList, GameObject parentTransform)
public void CreatePersonelItem(SelectedInfo person, GameObject parentTransform)
{
Transform contentTransform = parentTransform.transform.Find("Scroll View/Viewport/Content");
// 实例化一个人员项并将其作为场景面板的子物体
GameObject item = Instantiate(personelItem, contentTransform);
PersonnelInfo personnelItem = item.GetComponent<PersonnelInfo>();
personnelItem.nameText.text = person.name; // 设置姓名
}
}