_xiaofang/xiaofang/Assets/Script/UI/PanelUI/DatePanel.cs
2024-12-12 19:14:48 +08:00

85 lines
2.3 KiB
C#

using JetBrains.Annotations;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class DatePanel : MonoBehaviour
{
[Header("组件")]
public Button calendarBtn; // 日历按钮
public GameObject calendarPanel; // 日历面板
public GameObject submitPanel;//模板面板
public Toggle preservationToggle;//保存Toggle
public Text SchoolText; //事故校区文本
public Text PlaceText; //事故地点文本
public Text NumberText; //参与人数文本
public InputField submitInputField;
public Text submitText;
public Text inputText;
public Text dataText;
public int placeId;
public createTemplateInterface createTemplateInterface=new createTemplateInterface();
// Start is called before the first frame update
void Start()
{
// 确保初始时面板是关闭的
calendarPanel.SetActive(false);
preservationToggle.isOn = false;
}
// Update is called once per frame
void Update()
{
}
// 切换日历面板显示/隐藏
public void ClickCalendarBtn()
{
// 切换日历面板的激活状态
bool isActive = calendarPanel.activeSelf;
calendarPanel.SetActive(!isActive);
}
//提交按钮
public void OnClickSubmitPanel()
{
createTemplateInfo.Instance.auth_CreateTemplate.subjectId = placeId.ToString();
if(preservationToggle.isOn)
{
createTemplateInfo.Instance.auth_CreateTemplate.isTemplate = "0";
}
else
{
createTemplateInfo.Instance.auth_CreateTemplate.isTemplate = "1";
}
createTemplateInterface.createTemplate(dataText.text);
}
//模板面板确定按钮
public void OnClickSurePanel()
{
submitPanel.gameObject.SetActive(false);
}
//判断是否保存为模板
public void OnClickSureToggle()
{
if (preservationToggle.isOn == true)
{
submitPanel.gameObject.SetActive(true);
submitText.text = "演练模板" + dataText.text;
if (inputText == null)
{
createTemplateInfo.Instance.auth_CreateTemplate.templateName = submitInputField.text;
}
else
{
createTemplateInfo.Instance.auth_CreateTemplate.templateName = inputText.text;
}
}
}
}