_xiaofang/xiaofang/Assets/Script/Scheduled_03/Panel.cs

311 lines
10 KiB
C#
Raw Normal View History

2024-11-25 16:33:54 +08:00
using System.Collections;
using System.Collections.Generic;
using System.Linq;
2024-11-27 02:11:27 +08:00
using System.Runtime.InteropServices;
2024-11-27 23:59:00 +08:00
using Unity.VisualScripting;
2024-11-25 16:33:54 +08:00
using UnityEngine;
2024-11-25 17:16:41 +08:00
using UnityEngine.EventSystems;
2024-11-25 16:33:54 +08:00
using UnityEngine.SceneManagement;
using UnityEngine.UI;
2024-11-27 02:11:27 +08:00
public class SelectedInfo
{
public string name;
public string duty;
public string scene;
}
2024-11-25 17:16:41 +08:00
2024-11-25 16:33:54 +08:00
public class Panel : MonoBehaviour
{
2024-11-27 02:11:27 +08:00
[Header("<22><><EFBFBD><EFBFBD>")]
2024-11-25 16:33:54 +08:00
public Button choseJuBenSettingBtn;
public Button emergencySettingBtn;
public Button peoplePublishBtn;
public Button materialReserveBtn;
public Button dateSelectionBtn;
2024-11-26 15:36:02 +08:00
public Button personnelmanagementBtn;
2024-11-25 17:16:41 +08:00
public Button setName;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա
public Button setDuty;//<2F><><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0>
public Button setScene;//<2F><><EFBFBD>ó<EFBFBD><C3B3><EFBFBD>
2024-11-26 15:36:02 +08:00
public Text arrangeText;//<2F><><EFBFBD><EFBFBD><E5B0B2>
2024-11-25 16:33:54 +08:00
public Button sureBtn;//ȷ<><C8B7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ť
2024-11-27 02:11:27 +08:00
public ToggleGroup scenetoggleGroup;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ToggleGroup
public InputField shaixuaninputField;//ɸѡ<C9B8><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-11-25 17:16:41 +08:00
public GraphicRaycaster raycaster; // <20><><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD><EFBFBD>
public EventSystem eventSystem; // <20>¼<EFBFBD>ϵͳ
2024-11-27 02:11:27 +08:00
[Header("<22><><EFBFBD><EFBFBD>")]
public GameObject ManagerPanel;//<2F><>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public Transform peopleCountent;//<2F><>Ա<EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
public GameObject peoplePrefab;//<2F><>Ա<EFBFBD><D4B1>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>
2024-11-27 23:59:00 +08:00
public Transform panelContent;
public GameObject ManagerPanelPrefab; // Ԥ<><D4A4><EFBFBD><EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-11-27 02:11:27 +08:00
[Header("<22><><EFBFBD><EFBFBD>")]
public string name, duty, scene;
private List<GameObject> peopleList = new List<GameObject>(); // <20><EFBFBD><E6B4A2><EFBFBD><EFBFBD><EFBFBD>Ѽ<EFBFBD><D1BC>ص<EFBFBD><D8B5><EFBFBD>ԱԤ<D4B1><D4A4><EFBFBD><EFBFBD>
private List<GameObject> filteredPeopleList = new List<GameObject>(); // <20>洢ɸѡ<C9B8><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>б<EFBFBD>
private GameObject selectedPerson = null; // <20><>ǰѡ<C7B0>еĽ<D0B5>ɫ
public SelectedInfo selectedInfo;
2024-11-27 16:54:09 +08:00
public Dictionary<string, List<SelectedInfo>> sceneDataDictionary = new Dictionary<string, List<SelectedInfo>>();//<2F><>ͬ<EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>
public ManagerPanel managerPanel1;
private bool isPersonSelected = false; // <20><>־<EFBFBD>Ƿ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա
private bool isDutySelected = false; // <20><>־<EFBFBD>Ƿ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0>
private bool isSceneSelected = false; // <20><>־<EFBFBD>Ƿ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>
2024-11-27 02:11:27 +08:00
2024-11-25 16:33:54 +08:00
// Start is called before the first frame update
void Start()
{
2024-11-27 02:11:27 +08:00
selectedInfo = new SelectedInfo();
DynamicLoadingPeople();
2024-11-25 16:33:54 +08:00
}
// Update is called once per frame
void Update()
{
GetData();
2024-11-26 15:36:02 +08:00
SetText();
2024-11-27 02:11:27 +08:00
//SetInputFile();
}
2024-11-27 02:11:27 +08:00
//<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա
public void DynamicLoadingPeople()
2024-11-25 16:33:54 +08:00
{
2024-11-27 02:11:27 +08:00
for (int i = 0; i < 20; i++)
{
GameObject item = GameObject.Instantiate<GameObject>(peoplePrefab, peopleCountent);
peopleList.Add(item); // <20><>ÿ<EFBFBD><C3BF>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ӵ<EFBFBD><D3B5>б<EFBFBD><D0B1><EFBFBD>
}
2024-11-27 23:59:00 +08:00
}
2024-11-27 23:59:00 +08:00
//<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0>
public void DynamicLoadingDuty()
{
}
2024-11-27 23:59:00 +08:00
//<2F><>̬<EFBFBD><CCAC><EFBFBD>س<EFBFBD><D8B3><EFBFBD>
public void DynamicLoadingScene()
{
2024-11-25 16:33:54 +08:00
}
2024-11-26 15:36:02 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
public void ClickPersonnelManagement()
{
foreach (Transform child in panelContent)
{
Destroy(child.gameObject);
}
2024-11-27 23:59:00 +08:00
foreach (var sceneEntry in sceneDataDictionary)
{
Debug.Log($"<22><><EFBFBD><EFBFBD>: {sceneEntry.Key}<7D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: {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);
2024-11-27 23:59:00 +08:00
//managerPanel1.SetPlate();
ManagerPanel.gameObject.SetActive(true);
}
2024-11-26 15:36:02 +08:00
}
2024-11-25 16:33:54 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>ϰ<EFBFBD>ť
public void ClickSureBtn()
{
// ֻ<><D6BB><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>ְ<EFBFBD><D6B0><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><C2A3>Ż<EFBFBD>ִ<EFBFBD>к<EFBFBD><D0BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (isPersonSelected && isDutySelected && isSceneSelected)
2024-11-27 02:11:27 +08:00
{
// <20><><EFBFBD><EFBFBD>ѡ<EFBFBD>е<EFBFBD><D0B5><EFBFBD>Ա<EFBFBD><D4B1>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>
string sceneName = selectedInfo.scene;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
if (!sceneDataDictionary.ContainsKey(sceneName))
{
sceneDataDictionary[sceneName] = new List<SelectedInfo>();
}
// <20><>Ҫ<EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFB5BD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>
bool isLimitReached = false;
// <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>Ϣ
List<SelectedInfo> currentSceneInfo = sceneDataDictionary[sceneName];
// <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ˡ<EFBFBD><CBA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD><CBA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9B3A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ1
if (selectedInfo.duty == "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" || selectedInfo.duty == "<22>鳤" || selectedInfo.duty == "<22><>ָ<EFBFBD><D6B8>")
{
int count = currentSceneInfo.Count(info => info.duty == selectedInfo.duty); // ͳ<>Ƶ<EFBFBD>ǰְ<C7B0><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (count >= 1) // <20><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ
{
Debug.LogError($"{selectedInfo.duty} <20>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>");
isLimitReached = true; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>
}
}
// <20><><EFBFBD><EFBFBD>û<EFBFBD>дﵽ<D0B4><EFB5BD><EFBFBD>ޣ<EFBFBD><DEA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>Ϣ
if (!isLimitReached)
{
// <20><><EFBFBD><EFBFBD>ǰѡ<C7B0>е<EFBFBD><D0B5><EFBFBD>Ա<EFBFBD><D4B1>Ϣ<EFBFBD><CFA2><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>б<EFBFBD><D0B1><EFBFBD>
currentSceneInfo.Add(selectedInfo);
// <20><>ӡ<EFBFBD><D3A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>Ϣ
Debug.Log($"<22><><EFBFBD><EFBFBD>: {sceneName}<7D><>ѡ<EFBFBD>е<EFBFBD><D0B5><EFBFBD>Ա: {selectedInfo.name}<7D><>ְ<EFBFBD><D6B0>: {selectedInfo.duty}");
sureBtn.interactable = false; // <20><><EFBFBD><EFBFBD>ȷ<EFBFBD>ϰ<EFBFBD>ť
isPersonSelected = false;
isDutySelected = false;
isSceneSelected = false;
}
}
2024-11-27 16:54:09 +08:00
else
{
Debug.LogError("<22><>ȷ<EFBFBD><C8B7>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>ְ<EFBFBD><D6B0><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD>");
2024-11-27 16:54:09 +08:00
}
2024-11-27 02:11:27 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
2024-11-25 16:33:54 +08:00
}
2024-11-27 02:11:27 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رհ<D8B1>ť
2024-11-26 18:24:12 +08:00
public void ClickCloseBtn()
{
transform.gameObject.SetActive(false);
}
2024-11-25 16:33:54 +08:00
2024-11-25 17:58:45 +08:00
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Ϣ
public void GetData()
2024-11-25 16:33:54 +08:00
{
2024-11-26 15:36:02 +08:00
ManagerPanel managerPanel = new ManagerPanel();
2024-11-27 02:11:27 +08:00
2024-11-25 17:16:41 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>м<EFBFBD><D0BC><EFBFBD>
if (Input.GetMouseButtonDown(0))
{
// ȷ<><C8B7> raycaster <20><> eventSystem <20><>Ϊ<EFBFBD><CEAA>
if (raycaster == null || eventSystem == null)
{
Debug.LogError("Raycaster <20><> EventSystem δ<><CEB4>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><E4A3AC><EFBFBD><EFBFBD> Inspector <20>н<EFBFBD><D0BD>з<EFBFBD><D0B7>䡣");
return;
}
// <20><><EFBFBD><EFBFBD> PointerEventData <20><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-11-25 17:16:41 +08:00
PointerEventData pointerData = new PointerEventData(eventSystem);
pointerData.position = Input.mousePosition; // <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
2024-11-25 17:16:41 +08:00
// <20><><EFBFBD>ڴ洢<DAB4><E6B4A2><EFBFBD>߼<EFBFBD><DFBC><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
List<RaycastResult> results = new List<RaycastResult>();
// <20><><EFBFBD>߼<EFBFBD><DFBC><EFBFBD> UI
2024-11-25 17:16:41 +08:00
raycaster.Raycast(pointerData, results);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߼<EFBFBD><DFBC><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
foreach (RaycastResult result in results)
{
// <20><><EFBFBD><EFBFBD><E2B5BD><EFBFBD><EFBFBD><EFBFBD>˰<EFBFBD>ť
Button clickedButton = result.gameObject.GetComponent<Button>();
2024-11-25 17:16:41 +08:00
if (clickedButton != null)
{
Text buttonText = clickedButton.GetComponentInChildren<Text>();
if (buttonText != null && buttonText.tag == Tags.people) // <20><>ȡ<EFBFBD><C8A1>ǩΪ<C7A9><CEAA>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>Ϣ
2024-11-25 17:16:41 +08:00
{
name = buttonText.text;
Debug.Log(name);
2024-11-27 02:11:27 +08:00
selectedInfo.name = name;
isPersonSelected = true; // ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա
}
else if (buttonText != null && buttonText.tag == Tags.scene) // <20><>ȡ<EFBFBD><C8A1>ǩΪ<C7A9><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
{
scene = buttonText.text;
Debug.Log(scene);
2024-11-27 02:11:27 +08:00
selectedInfo.scene = scene;
isSceneSelected = true; // ѡ<><D1A1><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>
}
else if (buttonText != null && buttonText.tag == Tags.duty) // <20><>ȡ<EFBFBD><C8A1>ǩΪְ<CEAA><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
{
duty = buttonText.text;
Debug.Log(duty);
2024-11-27 02:11:27 +08:00
selectedInfo.duty = duty;
isDutySelected = true; // ѡ<><D1A1><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0>
2024-11-25 17:16:41 +08:00
}
}
}
// <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>ϰ<EFBFBD>ť
UpdateConfirmButtonState();
2024-11-25 17:16:41 +08:00
}
2024-11-25 16:33:54 +08:00
}
//<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7>ܹ<EFBFBD><DCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
private void UpdateConfirmButtonState()
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>ְ<EFBFBD><D6B0><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>ϰ<EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sureBtn.interactable = isPersonSelected && isDutySelected && isSceneSelected;
}
2024-11-26 15:36:02 +08:00
//<2F><><EFBFBD>ð<EFBFBD><C3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public void SetText()
{
arrangeText.text = "[" + name + "]<5D><><EFBFBD><EFBFBD>[" + duty + "],λ<><CEBB>[" + scene + "]";
}
2024-11-27 02:11:27 +08:00
//ɸѡ
public void SetInputFile()
{
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
string filterText = shaixuaninputField.text.Trim();
2024-11-27 02:11:27 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԱԤ<D4B1><D4A4><EFBFBD><EFBFBD>
foreach (Transform child in peopleCountent)
{
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD> Text <20><><EFBFBD><EFBFBD>
2024-11-27 02:11:27 +08:00
Text personNameText = child.GetComponentInChildren<Text>();
2024-11-27 02:11:27 +08:00
if (personNameText != null)
{
// <20>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>
if (personNameText.text.Contains(filterText))
{
// <20><><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD><E4A3AC>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Ա
child.gameObject.SetActive(true);
}
else
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD><E4A3AC><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>Ա
child.gameObject.SetActive(false);
}
}
}
}
// <20><><EFBFBD><EFBFBD>ѡ<EFBFBD>н<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ı<EFBFBD><C4B1>Ӿ<EFBFBD>Ч<EFBFBD><D0A7>(<28>ɸ<EFBFBD><C9B8><EFBFBD>)
2024-11-27 02:11:27 +08:00
public void OnPeopleItemClicked(GameObject clickedItem)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰѡ<C7B0>еĽ<D0B5>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӿ<EFBFBD>Ч<EFBFBD><D0A7>
if (selectedPerson != null)
{
Text prevText = selectedPerson.GetComponentInChildren<Text>();
if (prevText != null)
{
prevText.fontSize = 32; // <20>ָ<EFBFBD>ԭʼ<D4AD>ֺ<EFBFBD>
prevText.color = Color.white; // <20>ָ<EFBFBD>ԭʼ<D4AD><CABC>ɫ
}
}
// <20><><EFBFBD>õ<EFBFBD>ǰѡ<C7B0>еĽ<D0B5>ɫΪѡ<CEAA><D1A1>״̬
selectedPerson = clickedItem;
Text personText = clickedItem.GetComponentInChildren<Text>();
if (personText != null)
{
// <20>ֺű<D6BA><C5B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>״̬<D7B4><CCAC>
personText.fontSize = 36;
personText.color = Color.yellow; // ѡ<><D1A1><EFBFBD><EFBFBD>ɫ
}
}
2024-11-25 16:33:54 +08:00
}
2024-11-27 02:11:27 +08:00