protected virtual void Update() { // Mouse Click To Drag. if (isClickDrag) { if (!inDrag) { inDrag = true; } // 滑鼠移動時,單點擊拖曳位置變換為滑鼠游標位置 if (lastMousePos != GetMousePositionOnScreen()) { lastMousePos = GetMousePositionOnScreen(); slotBeginDrag.icon.transform.position = lastMousePos; inMouseMoving = true; } else { if (inMouseMoving) { inMouseMoving = false; } } // Cancel Click Drag. if ((Input.GetKeyDown(KeyCode.Mouse0) && !mouseOnSlotChecked) || Input.GetKeyDown(KeyCode.Mouse1) || Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.EscMenuKey))) { ResetImagePosition(slotBeginDrag.icon); isClickDrag = false; inDrag = false; } } }
private void Start() { representHotKey.key = HotKeyController.GetHotKey(representHotKey.type); canChangeHotKey = false; ResetIfKeyDirty(true); GetComponent <Button>().onClick.AddListener(delegate { StartCoroutine(PopUpDialogToChangeHotKey()); }); }
public Utilities() { KeyController = new HotKeyController(); KeyController.RegisterHotKeyEvent += KeyController_RegisterHotKeyEvent; // loads everything on startup ftpConnectionStatus = FTPParameters.LoadServerInfoFromFile(out testString); }
private void Update() { if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.AttackKey1)) || Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.AttackKey2))) { } }
private void Update() { if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.AttackKey1)) || Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.AttackKey2))) { StartAttack(AttackType.Attack, data.attackElement); } }
private void Update() { if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.EscMenuKey))) { if (menu.activeSelf && menuEscStack.Count > 0) { // When User click [ESC] button. // Is current is sub-menu, just pop. (Because this action would not close any window.) // Is current is main-menu, just peek. (User can use another way to close window, like mouse click, so need to pop stack manually with menuEscEvent. // Ex: pop stack by [Back to previous step button click].) if (menuEscStack.Peek().CheckIsSubMenu()) { menuEscStack.Pop().menuEscEvent.Invoke(); } else { menuEscStack.Peek().menuEscEvent.Invoke(); } } else { OpenMainMenu(); } } }
private void Update() { if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.SkillKey1))) { player.UseSkill(SkillSlot1.skill); } if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.SkillKey2))) { player.UseSkill(SkillSlot2.skill); } if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.SkillKey3))) { player.UseSkill(SkillSlot3.skill); } if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.SkillKey4))) { player.UseSkill(SkillSlot4.skill); } if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.SkillKey5))) { } if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.SkillKey6))) { } if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.SkillKey7))) { } if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.SkillKey8))) { } }
private void Jump() { if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.JumpKey)) && player.jump.CanDo && player.opc.isGrounding) // 或有多段跳躍 { player.StartJumpAnim(); } }
private void Update() { if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.EscMenuKey))) { if (options.activeSelf) { menuEscStack.Pop().menuEscEvent.Invoke(); } } }
/// <summary> /// Register a hotkey or not, depending on the properties /// </summary> internal void HotKeyModifier(WindowInteropHelper helper) { _logController?.AddLog(new ApplicationLog("Initializing hotkey hook")); try { if (Properties.Settings.Default.UseHotKey) { _hotKeyController?.Dispose(); if (Properties.Settings.Default.HotKey == Key.None) { return; } _hotKeyController = new HotKeyController(helper, _logController); _hotKeyController.HotKeyPressedEvent += HotKeyPressed; string[] mods = Properties.Settings.Default.HotKeyModifiers.Split('+'); uint values = 0; foreach (string s in mods) { // ReSharper disable once SwitchStatementMissingSomeCases switch (s) { case "Ctrl": values |= (uint)ModifierKeys.Control; break; case "Alt": values |= (uint)ModifierKeys.Alt; break; case "Shift": values |= (uint)ModifierKeys.Shift; break; } } _hotKeyController.RegisterHotKey(values, (Keys)KeyInterop.VirtualKeyFromKey(Properties.Settings.Default.HotKey)); } else { _hotKeyController?.Dispose(); } } catch (Exception ex) { _logController?.AddLog(new ErrorLog(ex.Message)); MessageBox.Show(ex.Message, "MemPlus", MessageBoxButton.OK, MessageBoxImage.Error); } _logController?.AddLog(new ApplicationLog("Done initializing hotkey hook")); }
public void ResetIfKeyDirty(bool forceReset = false) { if (representHotKey.isKeyDirty || forceReset) { displayKeyText.text = representHotKey.key.ToString(); // Reset Display Text. representHotKey.isKeyDirty = false; } else if (!representHotKey.isKeyDirty && representHotKey.key != HotKeyController.GetHotKey(representHotKey.type)) { representHotKey.key = HotKeyController.GetHotKey(representHotKey.type); // Reset Key (Basically happened with two keys changed). displayKeyText.text = representHotKey.key.ToString(); // Reset Display Text. } }
private void Evade() { if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.EvadeKey)) && player.evade.CanDo) { // Start Evade player.StartEvadeAnim(); // Stamina Exhaust(fillAmount to 0). player.staminaBarUI.fillAmount = 0; // Stamina Regen(fillAmount to 1). float originCoolDown = player.data.evadeCoolDown.Value; Counter.Instance.StartCountDown(originCoolDown, false, (x) => player.staminaBarUI.fillAmount = (originCoolDown - x) / originCoolDown); } }
private void BetterJump() { if (player.opc.isPreAttacking || player.opc.isAttacking) { SkyWalk(); return; } if (rb.velocity.y > 0 && !Input.GetKey(HotKeyController.GetHotKey(HotKeyType.JumpKey))) { rb.velocity += Vector2.up * Physics2D.gravity.y * (lowJumpMultiplier - 1) * Time.deltaTime; } else if (rb.velocity.y < 0) { rb.velocity += Vector2.up * Physics2D.gravity.y * (fallMultiplier - 1) * Time.deltaTime; } }
private void Update() { if (inEndGame) { if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.AttackKey1)) || Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.AttackKey2)) || Input.GetMouseButtonDown(0)) { if (endGameTextIndex >= endGameUITextList.Length) { inEndGame = false; endGameUI.SetActive(false); endGameTextIndex = 0; return; } endGameUIText.text = endGameUITextList[endGameTextIndex++]; } } }