/// <summary> /// 某个装备入口被点击 /// </summary> /// <param name="sender">触发对象</param> /// <param name="args">装备入口索引</param> private void OnEquipmentClick(GameObject sender, params object[] args) { m_BeforeToggle = sender.GetComponent <Toggle>(); //sender.GetComponent<Animator>().SetBool("IsOn", true); m_CanvasGroup.interactable = false; MsgWarshipPanelState msg = MessageSingleton.Get <MsgWarshipPanelState>(); msg.State = WarshipPanelState.ListEquip; msg.CurrentShip = m_CurrentShip; msg.CurrentWeaponData = null; msg.CurrentModData = null; msg.CurrentReformerData = null; int pos = (int)args[0]; msg.CurrentEquipmentData = new MsgWarshipPanelState.DataBase <IEquipment>( m_Equipment[pos], m_CurrentShip.GetEquipmentContainer().GetUID(), pos); // GameFacade.Instance.SendNotification(NotificationName.MSG_3DVIEWER_CHANGE); GameFacade.Instance.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, msg); UIManager.Instance.ClosePanel(OwnerView); }
/// <summary> /// 刷新数据 /// </summary> /// <param name="msg"></param> public void OnRefresh() { m_CanvasGroup.interactable = true; if (m_CurrentShip == null) { return; } SendViewerChange(); SetData(); RefreshHotKey(); if (m_BeforeToggle && m_BeforeToggle.gameObject) { OnToggleValueChange(m_BeforeToggle.gameObject); EventSystemUtils.SetFocus(m_BeforeToggle); } else { OnToggleValueChange(m_WeaponCellList[0].gameObject); EventSystemUtils.SetFocus(m_WeaponCellList[0].GetComponent <Toggle>()); } MsgWarshipPanelState msg = MessageSingleton.Get <MsgWarshipPanelState>(); msg.State = WarshipPanelState.Main; GameFacade.Instance.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, msg); }
/// <summary> /// 打开mod List /// </summary> private void OpenModList() { if (m_CurrentSelectedCell == null) { return; } MsgWarshipPanelState msg = MessageSingleton.Get <MsgWarshipPanelState>(); msg.BeforeState = m_CurrentState; msg.State = WarshipPanelState.ListMod; msg.CurrentWeaponData = new MsgWarshipPanelState.DataBase <IWeapon>( m_CurrentWeapon, m_WeaponContainerUID, m_WeaponContainerPOS); msg.CurrentModData = new MsgWarshipPanelState.ModData( m_CurrentSelectedCell.GetData(), m_CurrentSelectedCell.GetContainerUID(), m_CurrentSelectedCell.GetContainerPOS()); msg.CurrentModData.ModType1 = m_CurrentSelectedCell.GetEquipmentModL1(); msg.CurrentModData.ModType2 = m_CurrentSelectedCell.GetEquipmentModL2(); UIManager.Instance.ClosePanel(OwnerView); // GameFacade.Instance.SendNotification(NotificationName.MSG_3DVIEWER_CHANGE); GameFacade.Instance.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, msg); UIManager.Instance.OpenPanel(UIPanel.WarshipChipPanel, msg); }
/// <summary> /// 子面板切换 /// </summary> /// <param name="state"></param> private void PanelOnChange(WarshipPanelState state, MsgWarshipPanelState data = null) { m_CurrentState = state; switch (state) { case WarshipPanelState.Main: break; case WarshipPanelState.ModMainShip: case WarshipPanelState.ModMainWeapon: UIManager.Instance.OpenPanel(UIPanel.WarshipModPanel, data); break; case WarshipPanelState.ListWeapon: UIManager.Instance.OpenPanel(UIPanel.WarshipListPanel, data); break; case WarshipPanelState.ListMod: UIManager.Instance.OpenPanel(UIPanel.WarshipChipPanel, data); break; case WarshipPanelState.ListReformer: UIManager.Instance.OpenPanel(UIPanel.WarshipReformerPanel, data); break; case WarshipPanelState.ListEquip: switch ((EquipmentL1)data.CurrentEquipmentData.ContainerPOS + 1) { case EquipmentL1.Processor: UIManager.Instance.OpenPanel(UIPanel.WarshipProcessorPanel, data); break; case EquipmentL1.Armor: UIManager.Instance.OpenPanel(UIPanel.WarshipArmorPanel, data); break; case EquipmentL1.Reactor: UIManager.Instance.OpenPanel(UIPanel.WarshipReactorPanel, data); break; case EquipmentL1.AuxiliaryUnit: UIManager.Instance.OpenPanel(UIPanel.WarshipAuxiliaryUnitPanel, data); break; case EquipmentL1.Nanobot: UIManager.Instance.OpenPanel(UIPanel.WarshipNanobotPanel, data); break; case EquipmentL1.SignalGenerator: UIManager.Instance.OpenPanel(UIPanel.WarshipSignalGeneratorPanel, data); break; default: break; } break; } }
private void OnModClick(HotkeyCallback callback) { if (callback.performed) { UIManager.Instance.ClosePanel(Parent); MsgWarshipPanelState msg = MessageSingleton.Get <MsgWarshipPanelState>(); msg.BeforeState = Parent.Data.State; msg.State = WarshipPanelState.ModMainWeapon; msg.CurrentShip = Parent.Data.CurrentShip; msg.CurrentModData = null; msg.CurrentWeaponData = new MsgWarshipPanelState.DataBase <IWeapon>( m_CurrentItemData as IWeapon, m_ContainerUID, m_ContainerPOS); Parent.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, msg); UIManager.Instance.OpenPanel(UIPanel.WarshipModPanel, msg); } }
/// <summary> /// 进入舰船mod页面 /// </summary> /// <param name="callback"></param> private void OnModClick(HotkeyCallback callback) { if (callback.performed) { m_CanvasGroup.interactable = false; MsgWarshipPanelState msg = MessageSingleton.Get <MsgWarshipPanelState>(); msg.State = WarshipPanelState.ModMainShip; msg.CurrentShip = m_CurrentShip; msg.CurrentEquipmentData = null; msg.CurrentModData = null; msg.CurrentReformerData = null; msg.CurrentWeaponData = null; // GameFacade.Instance.SendNotification(NotificationName.MSG_3DVIEWER_CHANGE); GameFacade.Instance.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, msg); UIManager.Instance.ClosePanel(OwnerView); } }
public void OnRefresh(object msg) { MsgWarshipPanelState data = msg as MsgWarshipPanelState; m_BeforeState = data.BeforeState; m_CurrentState = data.State; m_CurrentShip = data.CurrentShip; uint count = 0; uint modPosId = 0; switch (m_CurrentState) { case WarshipPanelState.ModMainShip: count = m_CurrentShip.GetGeneralModContainer().GetCurrentSizeMax() + m_CurrentShip.GetExclusivelyModContainer().GetCurrentSizeMax(); modPosId = (uint)m_CurrentShip.GetConfig().ModPosition; break; case WarshipPanelState.ModMainWeapon: m_CurrentWeapon = data.CurrentWeaponData.Data; m_WeaponContainerUID = data.CurrentWeaponData.ContainerUID; m_WeaponContainerPOS = data.CurrentWeaponData.ContainerPOS; count = data.CurrentWeaponData.Data.GetGeneralModContainer().GetCurrentSizeMax() + data.CurrentWeaponData.Data.GetExclusivelyModContainer().GetCurrentSizeMax(); modPosId = (uint)data.CurrentWeaponData.Data.GetConfig().ModPosition; break; } SendViewerChange(); // SetTips(); CheckModBtnCount(count, modPosId); if (data.CurrentModData != null) { //SelectMod(data.CurrentModData.ContainerUID, data.CurrentModData.ContainerPOS); } else { //SelectMod(m_ModCellList[0]); } State.SetTipData(null); EventSystem.current.SetSelectedGameObject(null); }
/// <summary> /// esc操作 /// </summary> /// <param name="callback"></param> private void OnEscClick(HotkeyCallback callback) { if (callback.performed) { GameFacade.Instance.SendNotification(NotificationName.MSG_3DVIEWER_CHANGE); UIManager.Instance.ClosePanel(OwnerView); MsgWarshipPanelState msg = MessageSingleton.Get <MsgWarshipPanelState>(); msg.CurrentWeaponData = null; if (m_CurrentState == WarshipPanelState.ModMainShip) { msg.State = WarshipPanelState.Main; } else { msg.State = WarshipPanelState.ListWeapon; msg.CurrentWeaponData = new MsgWarshipPanelState.DataBase <IWeapon>( m_CurrentWeapon, m_WeaponContainerUID, m_WeaponContainerPOS); } UIManager.Instance.OpenPanel(UIPanel.WarshipDialogPanel, m_CurrentShip); GameFacade.Instance.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, msg); } }
/// <summary> /// esc /// </summary> /// <param name="callback"></param> private void OnEscClick(HotkeyCallback callback) { if (callback.performed) { MsgWarshipPanelState data = MessageSingleton.Get <MsgWarshipPanelState>(); data.CurrentShip = Parent.Data.CurrentShip; if (Parent.Data.State == WarshipPanelState.ListMod) { data.State = Parent.Data.BeforeState; data.CurrentWeaponData = new MsgWarshipPanelState.DataBase <IWeapon>( m_CurrentWeapon, m_CurrentWeaponContainerUID, m_CurrentWeaponContainerPOS); data.CurrentModData = new MsgWarshipPanelState.ModData( m_CurrentItemData as IMod, m_ContainerUID, m_ContainerPOS); switch (data.State) { case WarshipPanelState.Main: break; case WarshipPanelState.ModMainShip: case WarshipPanelState.ModMainWeapon: UIManager.Instance.OpenPanel(UIPanel.WarshipModPanel, data); break; case WarshipPanelState.ListWeapon: UIManager.Instance.OpenPanel(UIPanel.WarshipListPanel, data); break; case WarshipPanelState.ListMod: UIManager.Instance.OpenPanel(UIPanel.WarshipChipPanel, data); break; case WarshipPanelState.ListReformer: UIManager.Instance.OpenPanel(UIPanel.WarshipReformerPanel, data); break; case WarshipPanelState.ListEquip: switch ((EquipmentL1)data.CurrentEquipmentData.ContainerPOS + 1) { case EquipmentL1.Processor: UIManager.Instance.OpenPanel(UIPanel.WarshipProcessorPanel, data); break; case EquipmentL1.Armor: UIManager.Instance.OpenPanel(UIPanel.WarshipArmorPanel, data); break; case EquipmentL1.Reactor: UIManager.Instance.OpenPanel(UIPanel.WarshipReactorPanel, data); break; case EquipmentL1.AuxiliaryUnit: UIManager.Instance.OpenPanel(UIPanel.WarshipAuxiliaryUnitPanel, data); break; case EquipmentL1.Nanobot: UIManager.Instance.OpenPanel(UIPanel.WarshipNanobotPanel, data); break; case EquipmentL1.SignalGenerator: UIManager.Instance.OpenPanel(UIPanel.WarshipSignalGeneratorPanel, data); break; default: break; } break; } Parent.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, data); } else { data.State = WarshipPanelState.Main; data.CurrentEquipmentData = null; data.CurrentModData = null; data.CurrentReformerData = null; data.CurrentWeaponData = null; data.CurrentShip = Parent.Data.CurrentShip; UIManager.Instance.OpenPanel(UIPanel.WarshipDialogPanel, Parent.Data.CurrentShip); } UIManager.Instance.ClosePanel(Parent); } }
public override void OnHide(object msg) { base.OnHide(msg); Data = null; }
public override void OnShow(object msg) { Data = (MsgWarshipPanelState)msg; // State.SetHotkeyBox(GetHotkeyBox()); base.OnShow(msg); }