上海杨浦大连路地铁站单机版电子沙盘
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.
 
 
 
 

138 lines
3.8 KiB

using AX.MessageSystem;
using System;
using System.ComponentModel;
using UnityEngine;
public class TruckSkillSPanel : ResourceLoadPanel<TruckSkillSPanel>
{
private CloneObjType cloneObjType;
private GameObject chooseObj;
public GameObject TruckArmPanel;
void Awake()
{
MessageDispatcher.AddListener("CANCEL_SELECTED_COMMAND", EscCancelSelected);
//MessageDispatcher.AddListener("RADIO_SELECTED_COMMAND", EscCancelSelected);
MessageDispatcher.AddListener("TruckSkillsPanelDraw", setData);
MessageDispatcher.AddListener("SelectChange", SelectChange);
MessageDispatcher.AddListener("DeleteObj", DeleteObj);
}
private void SelectChange(IMessage obj)
{
if (this==null) { return; }
GameObject select = (GameObject)obj.Data;
if (select.GetComponent<TruckMessages>())
{
if (select != chooseObj)
{
gameObject.SetActive(true);
chooseObj = select;
MessageDispatcher.SendMessage("SetTrcukSkills", chooseObj);
}
}
else
gameObject.SetActive(false);
}
private void DeleteObj(IMessage message)
{
if (!gameObject.activeSelf)
return;
var obj = message.Data as GameObject;
if (obj == chooseObj)
gameObject.SetActive(false);
}
private void EscCancelSelected(IMessage obj)
{
gameObject.SetActive(false);
}
void OnDisable()
{
chooseObj = null;
//TruckArmPanel.SetActive(false);
}
void Init()
{
TruckArmPanel = transform.Find("TruckArmPanel").gameObject;
cloneObjType = SelectedObjs.selectedObj.GetComponent<BaseGameObjInfo>().gameObjType;
}
private void setData(IMessage obj)
{
var newChoose = (GameObject)obj.Data;
gameObject.SetActive(true);
chooseObj = newChoose;
MessageDispatcher.SendMessage("SetTrcukSkills", chooseObj);
}
private void OnDestroy()
{
MessageDispatcher.RemoveListener("CANCEL_SELECTED_COMMAND", EscCancelSelected);
//MessageDispatcher.RemoveListener("RADIO_SELECTED_COMMAND", EscCancelSelected);
MessageDispatcher.RemoveListener("SelectChange", SelectChange);
MessageDispatcher.RemoveListener("TruckSkillsPanelDraw", setData);
MessageDispatcher.RemoveListener("DeleteObj", DeleteObj);
}
}
[System.Flags]
public enum TruckSkillsEnum
{
/// <summary>
/// 下车
/// </summary>
[Description("下车")]
Debarkation = 1,// 1 << 0,
/// <summary>
/// 喷水
/// </summary>
[Description("喷水")]
SprayWater = 2,//1 << 2,
/// <summary>
/// 喷泡沫
/// </summary>
[Description("喷泡沫")]
SprayFoam = 4,// 1 << 3,
/// <summary>
/// 固定支架
/// </summary>
[Description("固定支架")]
FixedSupport = 8,// 1 << 4,
/// <summary>
/// 自动举臂
/// </summary>
[Description("自动举臂")]
AutomaticLiftArm = 16,//1 << 5,
/// <summary>
/// 收回举臂
/// </summary>
[Description("收回举臂")]
PackUpTheLiftArm = 32,// 1 << 6,
/// <summary>
/// 破拆
/// </summary>
[Description("破拆")]
ForcibleEntry = 64,// 1 << 7
/// <summary>
/// 照明
/// </summary>
[Description("照明")]
Illumination = 128,
/// <summary>
/// 排烟
/// </summary>
[Description("排烟")]
DischargeSmoke = 256,
/// <summary>
/// 选择目标
/// </summary>
[Description("选择目标")]
SelectTarget = 512,
/// <summary>
/// 自动摇摆
/// </summary>
[Description("自动摇摆")]
AutoSwing = 1024,
/// <summary>
/// 喷干粉
/// </summary>
[Description("喷干粉")]
SprayPowder = 2048,
}