public override bool OnKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status) { if (m_wndView == null) { return(false); } if (index == FuntionShortCutSlotIndex.DragonBall && status == KeyStatus.Down) { if (IsForbitBall()) { return(false); } if (!m_wndView.IsVisible()) { m_wndView.SetVisible(true); } else { m_wndView.SetVisible(false); m_wndView.ChangeDragonBallToFirstPage(); } } return(true); }
// 订阅按键消息 public bool RegisterKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status, IUIWnd wnd) { if (m_keyMessageList == null || m_keyMessageList[(int)status] == null || wnd == null) { return(false); } List <IUIWnd> list; if (m_keyMessageList[(int)status].TryGetValue(index, out list)) { for (int i = 0; i < list.Count; ++i) { if (list[i] == wnd) { return(false); } } list.Add(wnd); } else { list = new List <IUIWnd>(); list.Add(wnd); m_keyMessageList[(int)status][index] = list; } return(true); }
/// <summary> /// 检测功能按键是否有按下 /// </summary> /// <param name="keyCtrlIndex">功能按键槽位序号</param> /// <returns></returns> public static bool CheckFunctionShortcutKeyDown(FuntionShortCutSlotIndex keyCtrlIndex) { if (!FuntionShortCutCtrl.GetInstance().dicCombinationShortcutKey.ContainsKey((int)keyCtrlIndex)) { return(false); } //获取此槽位权限Flag, 如果为0代表全局开启,不限制 //不为0则与场景保姆中的快捷键方案标识做&运算,判断当前是否有权限使用该槽位 //如果无权限使用,则直接return掉 int flag = SlotKeyCodeConfig.Instance.GetSlotFlag((int)SlotType.Function, (int)keyCtrlIndex); if (flag != 0 && (flag & GameLogicAPI.getHotkeyIndex()) == 0) { return(false); } if (FuntionShortCutCtrl.GetInstance().dicCombinationShortcutKey[(int)keyCtrlIndex].ModifierKeyCodeList.Count <= 0)//((int)keyCtrlIndex < (int)FuntionShortCutSlotIndex.Com_UpgradeSpellSlot0) { return(FuntionShortCutCtrl.GetInstance().CheckKeyCodeKeyStatus(keyCtrlIndex, KeyStatus.Down)); } else { return(FuntionShortCutCtrl.GetInstance().CheckCombinationKeyStatus(keyCtrlIndex, KeyStatus.Down)); } }
// 按键消息 public bool OnKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status) { if (m_keyMessageList == null) { return(false); } if (index == FuntionShortCutSlotIndex.Exit && status == KeyStatus.Down) { OnPressCloseKey(); return(true); } List <IUIWnd> list; if (m_keyMessageList[(int)status].TryGetValue(index, out list)) { // 先复制一份以防目标在OnKeyMessage中改变订阅list IUIWnd[] tempList = new IUIWnd[list.Count]; list.CopyTo(tempList); for (int i = 0; i < tempList.Length; ++i) { if (tempList[i].OnKeyMessage(index, status)) { return(true); } } } return(false); }
public override bool OnKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status) { if (index == FuntionShortCutSlotIndex.OpenMailBox && status == KeyStatus.Down) { UpdateMailBox(); } return(true); }
// 外界通过单实例,通过脚本中的槽位id获取键值 public KeyCode GetKeyCodeByIndex(FuntionShortCutSlotIndex keyCtrIndex) { if (dicCombinationShortcutKey.ContainsKey((int)keyCtrIndex) && dicCombinationShortcutKey[(int)keyCtrIndex].KeyCodeList.Count > 0) { return(dicCombinationShortcutKey[(int)keyCtrIndex].KeyCodeList[0]); } else { return(KeyCode.None); } }
public override bool OnKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status) { if (m_wndView == null) { return(false); } if (index == FuntionShortCutSlotIndex.OpenGoodStore && status == KeyStatus.Down) { SetVisible(!IsVisible()); } return(true); }
// 取消订阅按键消息 public void UnregisterKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status, IUIWnd wnd) { if (m_keyMessageList == null || m_keyMessageList[(int)status] == null || wnd == null) { return; } List <IUIWnd> list; if (m_keyMessageList[(int)status].TryGetValue(index, out list)) { list.Remove(wnd); } }
public override bool OnKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status) { if (m_wndView == null) { return(false); } if (status == KeyStatus.Up && (index == FuntionShortCutSlotIndex.ChatBoxActiveKey1 || index == FuntionShortCutSlotIndex.ChatBoxActiveKey2)) { m_wndView.SelectableNavigation(false); } return(base.OnKeyMessage(index, status)); }
public override bool OnKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status) { switch (index) { case FuntionShortCutSlotIndex.UseWing: { if (status == KeyStatus.Down) { KeyState++; SetVisible(KeyState % 2 == 1); } } break; } return(base.OnKeyMessage(index, status)); }
public override bool OnKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status) { base.OnKeyMessage(index, status); if (m_wndView == null) { return(false); } if ((status == KeyStatus.Up) && (index == FuntionShortCutSlotIndex.EnterLeft || index == FuntionShortCutSlotIndex.EnterRight)) { m_wndView.OnClickEnterKey(); } return(true); }
public override bool OnKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status) { if (!m_isInit) { return(true); } if (index == FuntionShortCutSlotIndex.OpenFriend && status == KeyStatus.Down) { SetVisible(true); //m_wndView.switchMainPanel(); UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_SNS_SWITCH_MAINPANEL, null); } return(true); }
// 接受按键消息 public override bool OnKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status) { if (m_wndView == null) { return(base.OnKeyMessage(index, status)); } if (status == KeyStatus.Down) { if ((index == FuntionShortCutSlotIndex.ChatBoxActiveKey1 || index == FuntionShortCutSlotIndex.ChatBoxActiveKey2)) { return(m_wndView.OnPressReturn()); } } return(base.OnKeyMessage(index, status)); }
private bool CheckKeyCodeKeyStatus(FuntionShortCutSlotIndex keyCtrlIndex, KeyStatus status) { if (dicCombinationShortcutKey.Count <= 0) { return(false); } if (!dicCombinationShortcutKey.ContainsKey((int)keyCtrlIndex)) { return(false); } //这个只能是配一个按键 if (dicCombinationShortcutKey[(int)keyCtrlIndex].KeyCodeList.Count > 1 || dicCombinationShortcutKey[(int)keyCtrlIndex].ModifierKeyCodeList.Count > 0) { Trace.LogWarning("功能按键槽位为:" + keyCtrlIndex + " 配置上是否有问题?这里只能配一个按键,不能是组合键"); } if (!dicCombinationShortcutKey.ContainsKey((int)keyCtrlIndex) || dicCombinationShortcutKey[(int)keyCtrlIndex].KeyCodeList.Count < 1) { return(false); } KeyCode keycode = dicCombinationShortcutKey[(int)keyCtrlIndex].KeyCodeList[0]; if (status == KeyStatus.Down) { return(InputManager.GetKeyDown(keycode)); } else if (status == KeyStatus.Up) { return(InputManager.GetKeyUp(keycode)); } else if (status == KeyStatus.Pressing) { return(InputManager.GetKey(keycode)); } else { return(false); } }
// 接受按键消息 public override bool OnKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status) { if (m_wndView == null || StageManager.Instance.getCurrentState() != EStage_State.ESS_BATTLE) { return(false); } if (index == FuntionShortCutSlotIndex.WarRecordInfoPannel) { if (status == KeyStatus.Down) { openTabWnd(); } else if (status == KeyStatus.Up) { closeTabWnd(); } } return(base.OnKeyMessage(index, status)); }
// 接受按键消息 public override bool OnKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status) { if (m_wndView == null) { return(false); } if (index == FuntionShortCutSlotIndex.PropertyPannel && status == KeyStatus.Down) { if (!m_wndView.IsVisible()) { m_wndView.SetVisible(true); m_wndView.SetHeroProperty(); m_wndView.SaveHeroPrperty(); } else { m_wndView.SetVisible(false); } } return(true); }
public override bool OnKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status) { if (m_wndView == null) { return(false); } if (index == FuntionShortCutSlotIndex.OpenWarVSInfo) { if (status == KeyStatus.Down) { m_wndView.UpdatePlayerVSViewShow(); } else if (status == KeyStatus.Up) { m_wndView.HideMainView(); } } return(true); }
private bool CheckCombinationKeyStatus(FuntionShortCutSlotIndex keyCtrlIndex, KeyStatus status) { if (dicCombinationShortcutKey.Count <= 0) { return(false); } if (!dicCombinationShortcutKey.ContainsKey((int)keyCtrlIndex)) { return(false); } foreach (var keycode in dicCombinationShortcutKey[(int)keyCtrlIndex].KeyCodeList) { if (status == KeyStatus.Down && !InputManager.GetKeyDown(keycode)) { return(false); } else if (status == KeyStatus.Up && !InputManager.GetKeyUp(keycode)) { return(false); } else if (status == KeyStatus.Pressing && !InputManager.GetKey(keycode)) { return(false); } } foreach (var combKey in dicCombinationShortcutKey[(int)keyCtrlIndex].ModifierKeyCodeList) { if (GetMyHeroCtrl() == null || !GetMyHeroCtrl().GetKeyStatus(combKey, status)) { return(false); } } return(true); }
/// <summary> /// 检测功能按键是否按住 /// </summary> /// <param name="keyCtrlIndex">功能按键槽位序号</param> /// <returns></returns> public static bool CheckFunctionShortcutKeyPressing(FuntionShortCutSlotIndex keyCtrlIndex) { if (!FuntionShortCutCtrl.GetInstance().dicCombinationShortcutKey.ContainsKey((int)keyCtrlIndex)) { return(false); } int flag = SlotKeyCodeConfig.Instance.GetSlotFlag((int)SlotType.Function, (int)keyCtrlIndex); if (flag != 0 && (flag & GameLogicAPI.getHotkeyIndex()) == 0) { return(false); } if (FuntionShortCutCtrl.GetInstance().dicCombinationShortcutKey[(int)keyCtrlIndex].ModifierKeyCodeList.Count <= 0)//((int)keyCtrlIndex < (int)FuntionShortCutSlotIndex.Com_UpgradeSpellSlot0) { return(FuntionShortCutCtrl.GetInstance().CheckKeyCodeKeyStatus(keyCtrlIndex, KeyStatus.Pressing)); } else { return(FuntionShortCutCtrl.GetInstance().CheckCombinationKeyStatus(keyCtrlIndex, KeyStatus.Pressing)); } }
/// <summary> /// /// </summary> /// <param name="_eShortCutIndex">快捷键标示</param> /// <param name="_bInputMgrEnableAffected">是否受 InputManager.enable 影响</param> /// <param name="_eCheckKeyCode">KeyCode标示</param> public CON_IsKeyDown(FuntionShortCutSlotIndex _eShortCutIndex = FuntionShortCutSlotIndex.None, bool _bInputMgrEnableAffected = false, params KeyCode[] _eCheckKeyCode) { m_eCheckKeyCode = _eCheckKeyCode; m_eShortCutIndex = _eShortCutIndex; m_bInputMgrEnableAffected = _bInputMgrEnableAffected; }
// 接受按键消息 public virtual bool OnKeyMessage(FuntionShortCutSlotIndex index, KeyStatus status) { return(false); }