|
|
|
using AX.MessageSystem;
|
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
public class FourthGLookOver : BaseToggle {
|
|
|
|
public CloneGameObjInfo selectedInfo;
|
|
|
|
public Toggle toggle;
|
|
|
|
public static bool lookingOver = false;
|
|
|
|
public override void RespondFun(bool value)
|
|
|
|
{
|
|
|
|
LookOver(value);
|
|
|
|
lookingOver = value;
|
|
|
|
}
|
|
|
|
// Use this for initialization
|
|
|
|
void Start () {
|
|
|
|
toggle = GetComponent<Toggle>();
|
|
|
|
MessageDispatcher.AddListener("FourthGLookOver",SetSelectedPerson);
|
|
|
|
MessageDispatcher.AddListener("4GNobodySelected", ClearSelectedPerson);
|
|
|
|
MessageDispatcher.AddListener("QuadrupleMode", ControlLookOverMode);
|
|
|
|
}
|
|
|
|
public override void OnDestroy()
|
|
|
|
{
|
|
|
|
base.OnDestroy();
|
|
|
|
MessageDispatcher.RemoveListener("FourthGLookOver", SetSelectedPerson);
|
|
|
|
MessageDispatcher.RemoveListener("4GNobodySelected", ClearSelectedPerson);
|
|
|
|
MessageDispatcher.RemoveListener("QuadrupleMode", ControlLookOverMode);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// 开启四分屏模式时,查看模式不可用
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
private void ControlLookOverMode(IMessage obj)
|
|
|
|
{
|
|
|
|
//开启或关闭四分屏,都取消查看模式
|
|
|
|
toggle.isOn = false;
|
|
|
|
lookingOver = false; //查看模式取消
|
|
|
|
var isQuading = (bool)obj.Data;
|
|
|
|
toggle.interactable = !isQuading;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ClearSelectedPerson(IMessage obj)
|
|
|
|
{
|
|
|
|
selectedInfo = null;
|
|
|
|
toggle.isOn = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SetSelectedPerson(IMessage obj)
|
|
|
|
{
|
|
|
|
selectedInfo = (CloneGameObjInfo)obj.Data;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void LookOver(bool isOn)
|
|
|
|
{
|
|
|
|
if (isOn == true)
|
|
|
|
{
|
|
|
|
if(selectedInfo != null) //有人员被选中
|
|
|
|
{
|
|
|
|
//通知4G相机切换视角 FourthGCamCtrl.LookOverTarget()
|
|
|
|
MessageDispatcher.SendMessage("4GLookOver", selectedInfo);
|
|
|
|
}
|
|
|
|
else //没有人员被选中
|
|
|
|
{
|
|
|
|
LoadPromptWin.Instance.LoadTextPromptWindow("请先选择要查看的消防员", 1);
|
|
|
|
toggle.isOn = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//取消查看视角 FourthGCamCtrl.CancelLookOver()
|
|
|
|
MessageDispatcher.SendMessage("4GCancelLookOver");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|