_xiaofang/xiaofang/Assets/Script/UI/PanelUI/SelectScenePanel.cs

105 lines
3.3 KiB
C#
Raw Normal View History

2024-11-25 17:15:16 +08:00
using System.Collections;
using System.Collections.Generic;
using TMPro;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
public class SelectScenePanel : MonoBehaviour
{
public GameObject schoolPrefab;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼԤ<CDBC><D4A4><EFBFBD><EFBFBD>
public Transform schoolList;//Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
public ToggleGroup schooltoggleGroup;
public Toggle[] toggleList;
public GameObject scoolSelectBtn;//ѧУѡ<D0A3><D1A1><EFBFBD><EFBFBD>ť
public GameObject schoolChoiceLable;//ѧУѡ<D0A3><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public GameObject eventChoiceLable;//<2F>¼<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public bool isOpen = false;
public List<SchoolInfo> schoolInfos = new List<SchoolInfo>();//ѧУ<D1A7><D0A3>Ϣ
public List<EventInfo> eventInfos = new List<EventInfo>();//<2F>¼<EFBFBD><C2BC><EFBFBD>Ϣ
public List<Toggle> difficultyList = new List<Toggle>();
//<2F><><EFBFBD><EFBFBD>
public int schoolId;
public string schoolName;
public int eventId;
public string eventName;
public string difficulty;
// Start is called before the first frame update
void Start()
{
schoolChoiceLable.gameObject.SetActive(true);
eventChoiceLable.gameObject.SetActive(false);
//<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>ѧУѡ<D0A3><D1A1>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>
for (int i=0;i<6;i++)
{
GameObject slot = GameObject.Instantiate<GameObject>(schoolPrefab, schoolList);
//schoolPrefab.gameObject.GetComponent<Image>().sprite = Resources.Load("");
}
}
// Update is called once per frame
void Update()
{
}
//ѧУѡ<D0A3><D1A1><><C8B7>ѧУ<D1A7><D0A3>Ϣ
public void SelectSchoolBtn()
{
SchoolInfo gameObject = GetComponentInChildren<SchoolInfo>();
foreach (SchoolInfo item in schoolInfos)
{
if(item.gameObject.transform.GetComponent<Toggle>().isOn)
{
this.schoolId = item.schoolId;
this.schoolName = item.schoolName;
}
}
//Debug.Log("###############1:"+ this.schoolId);
//Debug.Log("###############2:" + this.schoolName);
2024-11-25 17:15:16 +08:00
}
//<2F>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>Ѷ<EFBFBD>ѡ<EFBFBD><D1A1>
public void SelectEvent()
{
EventInfo eventInfo = GetComponentInChildren<EventInfo>();
foreach(EventInfo item in eventInfos)
{
if (item.gameObject.transform.GetComponent<Toggle>().isOn)
{
this.eventId = item.eventId;
this.eventName = item.eventName;
}
}
//Debug.Log("%%%%%%%%%%%%%1:"+ this.eventId);
//Debug.Log("%%%%%%%%%%%%%2:" + this.eventName);
2024-11-25 17:15:16 +08:00
}
//<2F><>Ϸ<EFBFBD>Ѷ<EFBFBD>ѡ<EFBFBD><D1A1>
public void SelsctDifficulty()
{
auth_createTemplate auth_CreateTemplate = new auth_createTemplate();
2024-11-25 17:15:16 +08:00
foreach(Toggle item in difficultyList)
{
if (item.isOn)
{
this.difficulty = item.transform.parent.GetComponentInChildren<Text>().text;
auth_CreateTemplate.mode = this.difficulty;//<2F><><EFBFBD><EFBFBD><EFBFBD>Ѷȡ<D1B6><C8A1><EFBFBD>ֵ
2024-11-25 17:15:16 +08:00
}
}
//Debug.Log("%%%%%%%%%%%%%3:" + this.difficulty);
2024-11-25 17:15:16 +08:00
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>
public void ContinueBtn()
{
SelectSchoolBtn();
schoolChoiceLable.gameObject.SetActive(false);
eventChoiceLable.gameObject.SetActive(true);
}
//<2F><EFBFBD><E1BDBB>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ݺ<EFBFBD><DDBA><EFBFBD><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD>
public void SubmitBtn()
{
SelectEvent();
SelsctDifficulty();
this.gameObject.SetActive(false);
}
}