2024-11-29 09:47:47 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
public class EvacuationPanel : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public Transform personnelContent;
|
|
|
|
|
public Panel panel;
|
|
|
|
|
public GameObject personnelPrefabs;
|
2024-11-29 16:20:58 +08:00
|
|
|
|
public GameObject classPrefab;
|
|
|
|
|
public Transform content;
|
2024-11-30 17:43:21 +08:00
|
|
|
|
public Text topText;
|
2024-12-01 04:58:16 +08:00
|
|
|
|
|
2024-11-30 17:43:21 +08:00
|
|
|
|
[Header("ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")]
|
|
|
|
|
public InputField StuCountInputField;
|
|
|
|
|
public Button CountsubmitBtn;
|
|
|
|
|
public Sprite rsprite;
|
|
|
|
|
public Sprite fsprite;
|
|
|
|
|
public GameObject JuesechoicePop;
|
|
|
|
|
|
|
|
|
|
[Header("<22>ܰ<EFBFBD>ť")]
|
|
|
|
|
public Button redistributeBtn;
|
|
|
|
|
public Button submitBtn;
|
2024-11-29 16:20:58 +08:00
|
|
|
|
|
2024-11-29 09:47:47 +08:00
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
2024-11-30 17:43:21 +08:00
|
|
|
|
StuCountInputField.onEndEdit.AddListener(CheckInput);
|
|
|
|
|
SetClass();
|
2024-11-29 09:47:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
2024-11-30 17:43:21 +08:00
|
|
|
|
CheckInput(StuCountInputField.text);
|
2024-11-29 09:47:47 +08:00
|
|
|
|
}
|
|
|
|
|
public void SetPersonnel()
|
|
|
|
|
{
|
|
|
|
|
foreach (Transform child in personnelContent)
|
|
|
|
|
{
|
|
|
|
|
Destroy(child.gameObject);
|
|
|
|
|
}
|
|
|
|
|
foreach (var sceneEntry in panel.sceneDataDictionary)
|
|
|
|
|
{
|
|
|
|
|
GameObject item = GameObject.Instantiate<GameObject>(personnelPrefabs, personnelContent);
|
|
|
|
|
PersonnelItem personnelItem=item.GetComponent<PersonnelItem>();
|
|
|
|
|
personnelItem.sceneText.text = sceneEntry.Key;
|
|
|
|
|
personnelItem.personnelNum.text = sceneEntry.Value.Count.ToString();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-11-30 17:43:21 +08:00
|
|
|
|
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>1
|
|
|
|
|
void CheckInput(string input)
|
|
|
|
|
{
|
|
|
|
|
// <20><><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
|
|
|
|
|
if (float.TryParse(input, out float result))
|
|
|
|
|
{
|
|
|
|
|
// <20>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>1
|
|
|
|
|
if (result > 1)
|
|
|
|
|
{
|
|
|
|
|
CountsubmitBtn.GetComponent<Image>().sprite = rsprite;
|
|
|
|
|
CountsubmitBtn.onClick.AddListener(Countsubmit);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public void Countsubmit()
|
|
|
|
|
{
|
|
|
|
|
//<2F><>ť<EFBFBD>û<EFBFBD>
|
|
|
|
|
CountsubmitBtn.GetComponent<Image>().sprite = fsprite;
|
|
|
|
|
StuCountInputField.text = string.Empty;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Npc<70><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CountsubmitBtn.onClick.RemoveAllListeners();
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public void SettopText()
|
|
|
|
|
{
|
|
|
|
|
topText.text = "<22><><EFBFBD>°༶<C2B0><E0BCB6>Ҫ<EFBFBD>趨<EFBFBD><E8B6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʦ<EFBFBD><CAA6>";
|
|
|
|
|
topText.text = "<22><><EFBFBD><EFBFBD>¥<EFBFBD><C2A5><EFBFBD><EFBFBD>Ҫ<EFBFBD>趨<EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD>ʦ<EFBFBD><CAA6>";
|
|
|
|
|
}
|
|
|
|
|
//ʵ<><CAB5><EFBFBD><EFBFBD>ClassItem
|
|
|
|
|
public void SetClass()
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
GameObject item = GameObject.Instantiate<GameObject>(classPrefab, content);
|
|
|
|
|
ClassItem classItem = item.GetComponent<ClassItem>();
|
|
|
|
|
classItem.JuesechoicePop = JuesechoicePop;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-01 04:58:16 +08:00
|
|
|
|
|
2024-11-29 09:47:47 +08:00
|
|
|
|
}
|