using UnityEngine;
using System.Collections;
using System;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using AX.MessageSystem;
///
/// 1、鼠标通过射线点击对应的UI,实现实例化灾情物体
/// 2、挂载在Canvas下DomeView下DisasterButtonPicture;
/// 3、核心方法:GetObj();
///
public class InstantiationDisaster : MonoBehaviour
{
public static InstantiationDisaster Instance;
public LayerMask m_layerMask = -1;
private LayerMask ground_layerMask = -1;
public LayerMask yg_layerMask = -1;
public LayerMask fire_layerMask = -1;
[HideInInspector]
public Vector3 Pos1_late = new Vector3(0, 0, 0);//第一碰撞点原来的位置
[HideInInspector]
public Vector3 Pos2_late = new Vector3(0, 0, 0);//第二碰撞点原来的位置
private GameObject XieLou;
private RaycastHit hit;
private GameObject DisasterGrid;
private LayerMask indoor_layerMask = -1;//室内层
DateTime t1, t2;
[HideInInspector]
public string DisasterName;
void Awake()
{
if (Instance == null)
{
Instance = this;
}
MessageDispatcher.AddListener("ResettingButton", ResettingButton);
MessageDispatcher.AddListener("InstantiateButton", GetObj);
if (ExamInfoHelpClass.applicationMode == ExamInfoHelpClass.ApplicationMode.SANDTABLE)
{
this.transform.Find("ScrollRect/DisasterGrid/PoChaiDian").gameObject.SetActive(false);
}
#region 查找灾情按钮对象
//XieLou = GameObject.Find("DomeView/BroweMenu/DisasterButtonPicture/ScrollRect/DisasterGrid").transform.FindChild("Fluvio").gameObject;
DisasterGrid = GameObject.Find("DomeView/BroweMenu/DisasterButtonPicture/ScrollRect").transform.Find("DisasterGrid").gameObject;
indoor_layerMask = 1 << 29 | 1 << 25 | 1 << 26;
ground_layerMask = 1 << 25 | 1 << 26;
#endregion
HideOilParticle();
}
void OnDestroy()
{
MessageDispatcher.RemoveListener("ResettingButton", ResettingButton);
MessageDispatcher.RemoveListener("InstantiateButton", GetObj);
Wounded.wounded1Index = 0;
PCD.pcdIndex = 0;
Wounded.wounded1Index = 0;
Fire.fireIndex = 0;
DangerGoods.wxpIndex = 0;
ZWD.zwdIndex = 0;
InsiDe.insiderIndex = 0;
YGXL.ygxlIndex = 0;
}
//重置方法
public void ResettingButton(IMessage message)
{
foreach (Transform child in DisasterGrid.transform)
{
if (child.gameObject.GetComponent