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.
159 lines
6.0 KiB
159 lines
6.0 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using System;
|
||
|
using AX.TrackRecord;
|
||
|
using UnityEngine.UI;
|
||
|
using UnityEngine.EventSystems;
|
||
|
using AX.MessageSystem;
|
||
|
|
||
|
public class ShowOilTankDisasterSetWin : MonoBehaviour
|
||
|
{
|
||
|
public OilTank oilTank = new OilTank();
|
||
|
private DateTime t1, t2;
|
||
|
private GameObject oilTankInfoImage;
|
||
|
private RaycastHit hit;
|
||
|
|
||
|
private InputField storage;
|
||
|
private InputField reserves;
|
||
|
private Toggle isExplode;
|
||
|
private Toggle isTwist;
|
||
|
private InputField startTime;
|
||
|
private InputField happenTime;
|
||
|
private Text TiShiText;
|
||
|
|
||
|
public GameObject messageBox;
|
||
|
|
||
|
public float radius = 8f;
|
||
|
|
||
|
public OilTank OilTankAttri
|
||
|
{
|
||
|
set
|
||
|
{
|
||
|
oilTank = value;
|
||
|
|
||
|
//this.transform.parent.FindChild("Canvas1").FindChild("Slider").GetComponent<OilTankDisasterControl>().RandomCloneFire();
|
||
|
|
||
|
//MessageDispatcher.SendMessage(this.name,"SETOILTANK", oilTank);
|
||
|
|
||
|
this.transform.parent.Find("Canvas1").Find("Slider").GetComponent<OilTankDisasterControl>().oilTank = oilTank;
|
||
|
this.transform.parent.Find("Canvas1").Find("Slider").GetComponent<OilTankDisasterControl>().LoadOilTankData();
|
||
|
}
|
||
|
get
|
||
|
{
|
||
|
return oilTank;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void Awake()
|
||
|
{//初始化测试值
|
||
|
//if (this.name == "QiuGuan")
|
||
|
//{
|
||
|
// oilTank.IsExplode = true;
|
||
|
// //oilTank.IsTwist = true;
|
||
|
// oilTank.StartTime = 0;
|
||
|
// oilTank.HappenTime = 30;
|
||
|
//}
|
||
|
|
||
|
//if (this.name == "WaiFuDingGuan")
|
||
|
//{
|
||
|
// oilTank.IsExplode = true;
|
||
|
// //oilTank.IsTwist = true;
|
||
|
// oilTank.StartTime = 0;
|
||
|
// oilTank.HappenTime = 30;
|
||
|
//}
|
||
|
|
||
|
//if (this.name == "GongDingGuan")
|
||
|
//{
|
||
|
// oilTank.IsExplode = true;
|
||
|
// //oilTank.IsTwist = true;
|
||
|
// oilTank.StartTime = 0;
|
||
|
// oilTank.HappenTime = 30;
|
||
|
//}
|
||
|
|
||
|
radius = transform.GetComponentInChildren<MeshCollider>().bounds.extents.x;
|
||
|
|
||
|
Debug.Log(transform.GetComponentInChildren<MeshCollider>().gameObject.name);
|
||
|
|
||
|
}
|
||
|
|
||
|
// Use this for initialization
|
||
|
void Start()
|
||
|
{
|
||
|
t1 = DateTime.Now;
|
||
|
oilTankInfoImage = GameObject.Find("Canvas").transform.Find("OilTankInfoImage").gameObject;
|
||
|
|
||
|
storage = oilTankInfoImage.transform.Find("ChuWuInputField").GetComponent<InputField>();
|
||
|
reserves = oilTankInfoImage.transform.Find("ChuLiangInputField").GetComponent<InputField>();
|
||
|
isExplode = oilTankInfoImage.transform.Find("Image").Find("Toggle").GetComponent<Toggle>();
|
||
|
isTwist = oilTankInfoImage.transform.Find("Image").Find("Toggle1").GetComponent<Toggle>();
|
||
|
startTime = oilTankInfoImage.transform.Find("StartTimeInputField").GetComponent<InputField>();
|
||
|
happenTime = oilTankInfoImage.transform.Find("HappenTimeInputField").GetComponent<InputField>();
|
||
|
TiShiText = oilTankInfoImage.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 (hit.transform.parent.tag == "OilTank" && this.name == hit.transform.parent.name)
|
||
|
{
|
||
|
if (!this.transform.parent.Find("Canvas1").Find("Slider").GetComponent<OilTankDisasterControl>().happening)
|
||
|
{
|
||
|
oilTankInfoImage.SetActive(true);
|
||
|
oilTankInfoImage.GetComponent<OilTankDisasterSetting>().OilTankObj = this.gameObject;
|
||
|
GetExplosionSetInfo();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
messageBox.GetComponent<MessageTool>().showMessage(ShowMessageType.prompt, "提示信息", "爆炸(变形)在预警到发生过程中不能重新设置");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
t1 = t2;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void GetExplosionSetInfo()
|
||
|
{
|
||
|
Debug.Log(this.transform.parent.position.z + "," + oilTank.HappenTime);
|
||
|
storage.text = oilTank.Storage;
|
||
|
|
||
|
reserves.text = oilTank.Reserves.ToString();
|
||
|
|
||
|
isExplode.isOn = oilTank.IsExplode;
|
||
|
|
||
|
isTwist.isOn = oilTank.IsTwist;
|
||
|
|
||
|
startTime.text = oilTank.StartTime.ToString();
|
||
|
happenTime.text = oilTank.HappenTime.ToString();
|
||
|
TiShiText.text = "";
|
||
|
}
|
||
|
}
|