You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
153 lines
4.4 KiB
153 lines
4.4 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using System;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.MessageSystem;
|
||
|
using AX.TrackRecord;
|
||
|
using System.Collections.Generic;
|
||
|
public class ZaWuQingLiUI : MonoBehaviour {
|
||
|
|
||
|
/// <summary>
|
||
|
/// 杂物清理界面
|
||
|
/// </summary>
|
||
|
public static ZaWuQingLiUI instance;
|
||
|
[HideInInspector]
|
||
|
public Toggle toggle1;//直接出水灭火
|
||
|
[HideInInspector]
|
||
|
public Toggle toggle2;//边疏散边清理边灭火
|
||
|
[HideInInspector]
|
||
|
public Toggle toggle3;//先灭火在疏散
|
||
|
private GameObject Game;
|
||
|
private float timer = 2;
|
||
|
[HideInInspector]
|
||
|
public GameObject obj_Mask;
|
||
|
|
||
|
void Awake()
|
||
|
{
|
||
|
if (instance == null)
|
||
|
{
|
||
|
instance = this;
|
||
|
}
|
||
|
toggle1 = transform.Find("Group").Find("直接出水灭火").GetComponent<Toggle>();
|
||
|
toggle2 = transform.Find("Group").Find("边疏散边清理边灭火").GetComponent<Toggle>();
|
||
|
toggle3 = transform.Find("Group").Find("先灭火在疏散").GetComponent<Toggle>();
|
||
|
obj_Mask = transform.Find("Mask").gameObject;
|
||
|
|
||
|
}
|
||
|
[HideInInspector]
|
||
|
public bool Can = false;
|
||
|
void OnEnable()
|
||
|
{
|
||
|
Can = false;
|
||
|
toggle1.isOn = false;
|
||
|
toggle2.isOn = false;
|
||
|
toggle3.isOn = false;
|
||
|
timer = 2;
|
||
|
StartCoroutine(delay());
|
||
|
|
||
|
}
|
||
|
IEnumerator delay()
|
||
|
{
|
||
|
yield return new WaitForEndOfFrame();
|
||
|
if (TrackRecordHelpClass.CheckIfCanClickUI())
|
||
|
{
|
||
|
obj_Mask.SetActive(false);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
obj_Mask.SetActive(true);
|
||
|
}
|
||
|
}
|
||
|
void Update()
|
||
|
{
|
||
|
if (Can && LoadManager.Instance.IsPlayBacking && !LoadManager.Instance.IsPause)//只有回放时计时自动关闭
|
||
|
{
|
||
|
if (timer > 0)
|
||
|
{
|
||
|
timer -= Time.deltaTime*LoadManager.Instance.LoadSpeed;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
ColseBtn();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
private ZaWuUIAttri ZaWuAttri;
|
||
|
public ZaWuUIAttri zaWuAttri
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
ZaWuAttri = new ZaWuUIAttri();
|
||
|
ZaWuAttri.Toggle1 = toggle1.isOn;
|
||
|
ZaWuAttri.Toggle2 = toggle2.isOn;
|
||
|
ZaWuAttri.Toggle3 = toggle3.isOn;
|
||
|
return ZaWuAttri;
|
||
|
}
|
||
|
set
|
||
|
{
|
||
|
ZaWuAttri = value;
|
||
|
gameObject.SetActive(true);
|
||
|
transform.Find("Group").Find("直接出水灭火").GetComponent<Toggle>().isOn = ZaWuAttri.Toggle1;
|
||
|
transform.Find("Group").Find("边疏散边清理边灭火").GetComponent<Toggle>().isOn = ZaWuAttri.Toggle2;
|
||
|
transform.Find("Group").Find("先灭火在疏散").GetComponent<Toggle>().isOn = ZaWuAttri.Toggle3;
|
||
|
}
|
||
|
}
|
||
|
public void NewSetLoad()
|
||
|
{
|
||
|
toggle1.isOn = false;
|
||
|
toggle2.isOn = false;
|
||
|
toggle3.isOn = false;
|
||
|
Can = true;
|
||
|
timer = 2;
|
||
|
}
|
||
|
public void GetMessage(GameObject obj)
|
||
|
{
|
||
|
toggle1.isOn = false;
|
||
|
toggle2.isOn = false;
|
||
|
toggle3.isOn = false;
|
||
|
timer = 2;
|
||
|
Can = false;
|
||
|
Game = obj;
|
||
|
if (RecordManager.Instance.IsRecording)
|
||
|
{
|
||
|
TrackRecordHelpClass.RecordOpenUIEvent(obj,this.gameObject.name);
|
||
|
}
|
||
|
}
|
||
|
public void SureBtn()
|
||
|
{
|
||
|
if (toggle1.isOn == false && toggle2.isOn == false && toggle3.isOn == false)
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("Operatinghints", (object)"请选择处理方式");
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
string pName = TrackRecordHelpClass.GetParentName(Game.name);
|
||
|
MessageDispatcher.SendMessage(pName, "DestroyObj", (object)Game.name);
|
||
|
|
||
|
if (RecordManager.Instance.IsRecording)
|
||
|
{
|
||
|
TrackRecordHelpClass.RecordEditZaWuEvent(zaWuAttri);
|
||
|
|
||
|
ZawuList zawu = new ZawuList();
|
||
|
if (toggle2.isOn == false)
|
||
|
{
|
||
|
zawu.Trouble = "未选择正确的处理方式";
|
||
|
}
|
||
|
zawu.Name = Game.name;
|
||
|
TrackRecordHelpClass.RecordQingLiZaWuEvent(zawu);
|
||
|
//TrackRecordHelpClass.RecordCloseUIEvent(this.gameObject, this.gameObject.name);
|
||
|
}
|
||
|
gameObject.SetActive(false);
|
||
|
}
|
||
|
public void ColseBtn()
|
||
|
{
|
||
|
gameObject.SetActive(false);
|
||
|
//if (RecordManager.Instance.IsRecording)
|
||
|
//{
|
||
|
// TrackRecordHelpClass.RecordCloseUIEvent(this.gameObject, this.gameObject.name);
|
||
|
//}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|