网演高层钦州
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.
 
 
 

87 lines
3.0 KiB

using AX.MessageSystem;
using AX.NetworkSystem;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 火警信息界面
/// </summary>
public class FireAlarmInformationPanel : MonoBehaviour {
private Transform mCallMan;
private Transform mPhone;
private Transform mFirePlace;
private Transform mFireArea;
private Transform mFireReason;
private Transform mTrapped;
private Transform mFireLevel;
private Transform mDangerous;
//private Button mCloseBtn;
private Toggle mTgl;
private void Awake()
{
MessageDispatcher.AddListener(FireInfoMessage.AlarmMessage.ToString(),ShowFireAlarmInfoPanel);
Init();
if (GameSettings.disasterSetting.policeCallData != null)
{
ReceiveFireAlarmData(GameSettings.disasterSetting.policeCallData);
}
this.gameObject.SetActive(false);
}
private void OnEnable()
{
ReceiveFireAlarmData(GameSettings.disasterSetting.policeCallData);
}
private void OnDisable()
{
MessageDispatcher.AddListener(FireInfoMessage.AlarmMessage.ToString(), ShowFireAlarmInfoPanel);
}
/// <summary>
/// 打开,显示火警信息面板
/// </summary>
/// <param name="obj"></param>
private void ShowFireAlarmInfoPanel(IMessage obj)
{
bool b = (bool)obj.Data;
gameObject.SetActive(b);
}
void Init()
{
//mCloseBtn = transform.Find("Title/CloseBtn").GetComponent<Button>();
mTgl = transform.parent.transform.Find("TopPanel/Tool/FireInfo/FireSiteInfoPopup/Background/Item (0)/0").GetComponent<Toggle>();
mCallMan = transform.Find("Body/Messages/Line1/Row1/BaoJingRen");
mPhone = transform.Find("Body/Messages/Line1/Row2/Phone");
mFirePlace = transform.Find("Body/Messages/Line2/Row1/ZhaoHuoDian");
mFireArea = transform.Find("Body/Messages/Line2/Row2/ZhaoHuoMianJi");
mFireReason = transform.Find("Body/Messages/Line3/Row1/ZhaoHuoYuanYin");
mTrapped = transform.Find("Body/Messages/Line3/Row2/BeiKunRenYuan");
mFireLevel = transform.Find("Body/Messages/Line4/Row1/WeiXianDengJi");
mDangerous = transform.Find("Body/Messages/Line5/Row1/WeiXianPin");
}
/// <summary>
/// 接收火警信息
/// </summary>
private void ReceiveFireAlarmData(PoliceCallData data)
{
mCallMan.GetComponent<Text>().text = data.Name;
mPhone.GetComponent<Text>().text = data.Phone;
mFirePlace.GetComponent<Text>().text = data.FirePlace;
mFireArea.GetComponent<Text>().text = data.FireArea;
mFireReason.GetComponent<Text>().text = data.FireReason;
mTrapped.GetComponent<Text>().text = data.HasTrapped;
mFireLevel.GetComponent<Text>().text = data.FireLevel;
mDangerous.GetComponent<Text>().text = data.HasDangerous;
}
/// <summary>
/// 关闭面板
/// </summary>
public void CloseFireAlarmInfoPanel()
{
gameObject.SetActive(false);
mTgl.isOn = false;
}
}