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.
116 lines
4.2 KiB
116 lines
4.2 KiB
4 years ago
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using AX.MessageSystem;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.InputSystem;
|
||
|
|
||
|
/// <summary>
|
||
|
/// 克隆作战部署各种工具
|
||
|
/// </summary>
|
||
|
public class CloneFireDeployToolBtn : BaseToggle
|
||
|
{
|
||
|
public CloneObjType cloneObjType;
|
||
|
|
||
|
public override void OnEnable()
|
||
|
{
|
||
|
base.OnEnable();
|
||
|
MessageDispatcher.AddListener("CANCEL_CLONEBTN_SELECTED_COMMAND", CancelSelected);
|
||
|
}
|
||
|
|
||
|
public override void OnDisable()
|
||
|
{
|
||
|
base.OnDisable();
|
||
|
MessageDispatcher.RemoveListener("CANCEL_CLONEBTN_SELECTED_COMMAND", CancelSelected);
|
||
|
}
|
||
|
|
||
|
public override void OnDestroy()
|
||
|
{
|
||
|
base.OnDestroy();
|
||
|
MessageDispatcher.RemoveListener("CANCEL_CLONEBTN_SELECTED_COMMAND", CancelSelected);
|
||
|
}
|
||
|
|
||
|
public override void RespondFun(bool isOn)
|
||
|
{
|
||
|
var group = GetComponent<Toggle>().group;
|
||
|
if (group)
|
||
|
{//因为是排他的选择框,只执行主动改值的事件
|
||
|
var anyIsOn = group.AnyTogglesOn();
|
||
|
if ((anyIsOn && isOn) || (!anyIsOn))
|
||
|
{
|
||
|
if (isOn)
|
||
|
{
|
||
|
if (transform.parent.name.Contains("Engine"))
|
||
|
{//作战部署消防力量
|
||
|
InputManager.cloneObjType = cloneObjType;
|
||
|
InputManager.org = transform.parent.GetComponent<EngineItem>().org;
|
||
|
InputManager.fireCarEngine = transform.parent.GetComponent<EngineItem>().tpyeCar.Key;
|
||
|
InputManager.color = transform.Find("Background").GetComponent<Image>().color;
|
||
|
|
||
|
MessageDispatcher.SendMessage("CloneSelected");//克隆按钮选中,取消技能触发
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
InputManager.cloneObjType = cloneObjType;
|
||
|
|
||
|
MessageDispatcher.SendMessage("CloneSelected");//克隆按钮选中,取消技能触发
|
||
|
|
||
|
if (transform.GetComponent<PrivateToolType>())
|
||
|
{
|
||
|
InputManager.fireDeployPrivateToolType =
|
||
|
transform.GetComponent<PrivateToolType>().fireDeployPrivateToolType;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (transform.parent.name.Contains("Engine"))
|
||
|
{
|
||
|
InputManager.cloneObjType = CloneObjType.None;
|
||
|
InputManager.org = null;
|
||
|
InputManager.fireCarEngine = null;
|
||
|
InputManager.color = new Color();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
InputManager.cloneObjType = CloneObjType.None;
|
||
|
|
||
|
if (transform.GetComponent<PrivateToolType>())
|
||
|
{
|
||
|
InputManager.fireDeployPrivateToolType = FireDeployPrivateToolType.None;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (!isOn
|
||
|
&& (cloneObjType == CloneObjType.DirectWaterSupply
|
||
|
|| cloneObjType == CloneObjType.RelayWaterSupply
|
||
|
|| cloneObjType == CloneObjType.CouplingWaterSupply
|
||
|
|| cloneObjType == CloneObjType.WaterLineWaterSupply
|
||
|
|| cloneObjType == CloneObjType.SuctionFeedWaterSupply
|
||
|
|| cloneObjType == CloneObjType.HandPumpWaterSupply
|
||
|
|| cloneObjType == CloneObjType.FloatingFirePumpWaterSupply))
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("RESET_WATERSUPPLY_PREVPOS");
|
||
|
}
|
||
|
|
||
|
//if (!isOn && DrawLineBase.CheckCloneObjTypeLine())
|
||
|
//{
|
||
|
// MessageDispatcher.SendMessage("CLEAR_LINE_DATA", null);//没有绑脚本注册消息,先注释掉
|
||
|
//}
|
||
|
}
|
||
|
|
||
|
private void CancelSelected(IMessage obj)
|
||
|
{
|
||
|
var arg = (CloneCmdArgs)obj.Data;
|
||
|
if (GetComponent<Toggle>().isOn)
|
||
|
{
|
||
|
GetComponent<Toggle>().isOn = arg.selected;
|
||
|
//MessageDispatcher.SendMessage("CLEAR_LINE_DATA", null);//没有绑脚本注册消息,先注释掉
|
||
|
}
|
||
|
}
|
||
|
}
|