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.
152 lines
6.4 KiB
152 lines
6.4 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using AX.TrackRecord;
|
||
|
using System;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.MessageSystem;
|
||
|
using UnityEngine.EventSystems;
|
||
|
|
||
|
public class ShowFireSetWin : MonoBehaviour
|
||
|
{
|
||
|
private DateTime t1, t2;
|
||
|
private GameObject FireInfoImage;
|
||
|
private RaycastHit hit;
|
||
|
|
||
|
private InputField Comburent;//燃烧物
|
||
|
private InputField Position;//着火位置
|
||
|
private Toggle StraightSpread;//直线蔓延
|
||
|
private Toggle AreaSpread;//区域蔓延
|
||
|
private Toggle AroundSpread;//四周蔓延
|
||
|
private InputField StartTime;//开始蔓延时间
|
||
|
private Text TiShiText;//提示信息
|
||
|
|
||
|
private GameObject fireSpreadParent;
|
||
|
|
||
|
public OtherArrribute_Fire fireAttri = new OtherArrribute_Fire();
|
||
|
public GameObject messageBox;
|
||
|
public OtherArrribute_Fire FireAttri
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return fireAttri;
|
||
|
}
|
||
|
set
|
||
|
{
|
||
|
fireAttri = value;
|
||
|
|
||
|
//if (LoadManager.Instance.IsPlayBacking)
|
||
|
//{
|
||
|
// MessageDispatcher.SendMessage((object)this.name, "REGISTERSPEEDCHANGEEVENT");
|
||
|
//}
|
||
|
|
||
|
//if (!fireAttri.isStartSpread)
|
||
|
//{
|
||
|
// MessageDispatcher.SendMessage(this.name, "SETFIRE", fireAttri);
|
||
|
//}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void Awake()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
// Use this for initialization
|
||
|
void Start()
|
||
|
{
|
||
|
t1 = DateTime.Now;
|
||
|
|
||
|
FireInfoImage = GameObject.Find("Canvas").transform.Find("FireInfoImage").gameObject;
|
||
|
|
||
|
Comburent = FireInfoImage.transform.Find("ComburentInputField").GetComponent<InputField>();
|
||
|
Position = FireInfoImage.transform.Find("PosInputField").GetComponent<InputField>();
|
||
|
StraightSpread = FireInfoImage.transform.Find("Image").Find("Toggle").GetComponent<Toggle>();
|
||
|
AreaSpread = FireInfoImage.transform.Find("Image").Find("Toggle1").GetComponent<Toggle>();
|
||
|
AroundSpread = FireInfoImage.transform.Find("Image").Find("Toggle2").GetComponent<Toggle>();
|
||
|
StartTime = FireInfoImage.transform.Find("StartTimeInputField").GetComponent<InputField>();
|
||
|
TiShiText = FireInfoImage.transform.Find("TiShiText").GetComponent<Text>();
|
||
|
|
||
|
messageBox = GameObject.Find("Canvas").transform.Find("MessageBox").gameObject;
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
//创建考题,备课中新建课件,自学
|
||
|
if (ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CreatQuestion
|
||
|
|| ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.EditQuestion
|
||
|
|| ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CopyQuestion
|
||
|
|| ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.PrepareMode
|
||
|
|| ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.EditCourceware
|
||
|
|| ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.SelfStudyMode)
|
||
|
{
|
||
|
//新建节点,既没有新建节点也没有加载节点两种情况下允许弹出设置窗口(加载节点不允许弹出灾情设置编辑窗口)
|
||
|
if (RecordManager.Instance.IsRecording
|
||
|
||(!RecordManager.Instance.IsRecording && !LoadManager.Instance.IsPlayBacking) )
|
||
|
{
|
||
|
if (Input.GetMouseButtonDown(0)&& !EventSystem.current.IsPointerOverGameObject())
|
||
|
{
|
||
|
t2 = DateTime.Now;
|
||
|
if (t2 - t1 < new TimeSpan(0, 0, 0, 0, 249))
|
||
|
{
|
||
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||
|
|
||
|
if (Physics.Raycast(ray, out hit, Mathf.Infinity))
|
||
|
{
|
||
|
if (!FireInfoImage.activeSelf && hit.transform.name == this.name)
|
||
|
{
|
||
|
if (!this.GetComponent<FireSpreadCtrl>().isSpreading)
|
||
|
{
|
||
|
FireInfoImage.SetActive(true);
|
||
|
FireInfoImage.GetComponent<FireDisasterSetting>().FireName = this.name;
|
||
|
GetFireProperties();
|
||
|
|
||
|
FireInfoImage.GetComponent<FireDisasterSetting>().startPosition = this.transform.position;
|
||
|
if (!GameObject.Find("pfirespreadline").transform.Find(this.name))
|
||
|
{
|
||
|
fireSpreadParent = Instantiate(new GameObject()) as GameObject;
|
||
|
fireSpreadParent.name = this.name;
|
||
|
fireSpreadParent.transform.parent = GameObject.Find("pfirespreadline").transform;
|
||
|
|
||
|
FireInfoImage.GetComponent<FireDisasterSetting>().lineObj = fireSpreadParent;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
FireInfoImage.GetComponent<FireDisasterSetting>().lineObj
|
||
|
= GameObject.Find("pfirespreadline").transform.Find(this.name).gameObject;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
messageBox.GetComponent<MessageTool>().showMessage(ShowMessageType.prompt, "提示信息", "蔓延过程中不能重新设置");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
t1 = t2;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void GetFireProperties()
|
||
|
{
|
||
|
Comburent.text = fireAttri.Comburent;
|
||
|
Position.text = fireAttri.Position;
|
||
|
StraightSpread.isOn = fireAttri.StraightSpread;
|
||
|
AreaSpread.isOn = fireAttri.AreaSpread;
|
||
|
AroundSpread.isOn = fireAttri.AroundSpread;
|
||
|
StartTime.text = fireAttri.StartTime.ToString();
|
||
|
TiShiText.text = "";
|
||
|
|
||
|
FireInfoImage.GetComponent<FireDisasterSetting>().PathPointList.Clear();
|
||
|
FireInfoImage.GetComponent<FireDisasterSetting>().PathPointList.AddRange(fireAttri.PathPointList);
|
||
|
|
||
|
if (GameObject.Find("pfirespreadline").transform.Find(this.name))
|
||
|
{
|
||
|
GameObject.Find("pfirespreadline").transform.Find(this.name).gameObject.SetActive(true);
|
||
|
}
|
||
|
}
|
||
|
}
|