using AX.MessageSystem; using System; using System.ComponentModel; using UnityEngine; public class TruckSkillSPanel : ResourceLoadPanel { 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()) { 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().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 { /// /// 下车 /// [Description("下车")] Debarkation = 1,// 1 << 0, /// /// 喷水 /// [Description("喷水")] SprayWater = 2,//1 << 2, /// /// 喷泡沫 /// [Description("喷泡沫")] SprayFoam = 4,// 1 << 3, /// /// 固定支架 /// [Description("固定支架")] FixedSupport = 8,// 1 << 4, /// /// 自动举臂 /// [Description("自动举臂")] AutomaticLiftArm = 16,//1 << 5, /// /// 收回举臂 /// [Description("收回举臂")] PackUpTheLiftArm = 32,// 1 << 6, /// /// 破拆 /// [Description("破拆")] ForcibleEntry = 64,// 1 << 7 /// /// 照明 /// [Description("照明")] Illumination = 128, /// /// 排烟 /// [Description("排烟")] DischargeSmoke = 256, /// /// 选择目标 /// [Description("选择目标")] SelectTarget = 512, /// /// 自动摇摆 /// [Description("自动摇摆")] AutoSwing = 1024, /// /// 喷干粉 /// [Description("喷干粉")] SprayPowder = 2048, }