コード例 #1
0
    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;
            }
        }
    }
コード例 #2
0
ファイル: HotKeyBinder.cs プロジェクト: threedaysX/SoulEater_
 private void Start()
 {
     representHotKey.key = HotKeyController.GetHotKey(representHotKey.type);
     canChangeHotKey     = false;
     ResetIfKeyDirty(true);
     GetComponent <Button>().onClick.AddListener(delegate { StartCoroutine(PopUpDialogToChangeHotKey()); });
 }
コード例 #3
0
ファイル: Utilities.cs プロジェクト: lixunrui/JIRA_Utilities
 public Utilities()
 {
     KeyController = new HotKeyController();
     KeyController.RegisterHotKeyEvent += KeyController_RegisterHotKeyEvent;
     // loads everything on startup
     ftpConnectionStatus = FTPParameters.LoadServerInfoFromFile(out testString);
 }
コード例 #4
0
 private void Update()
 {
     if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.AttackKey1)) ||
         Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.AttackKey2)))
     {
     }
 }
コード例 #5
0
ファイル: Player.cs プロジェクト: threedaysX/SoulEater_
 private void Update()
 {
     if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.AttackKey1)) || Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.AttackKey2)))
     {
         StartAttack(AttackType.Attack, data.attackElement);
     }
 }
コード例 #6
0
ファイル: MenuControl.cs プロジェクト: threedaysX/SoulEater_
 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();
         }
     }
 }
コード例 #7
0
 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)))
     {
     }
 }
コード例 #8
0
 private void Jump()
 {
     if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.JumpKey)) &&
         player.jump.CanDo &&
         player.opc.isGrounding)      // 或有多段跳躍
     {
         player.StartJumpAnim();
     }
 }
コード例 #9
0
 private void Update()
 {
     if (Input.GetKeyDown(HotKeyController.GetHotKey(HotKeyType.EscMenuKey)))
     {
         if (options.activeSelf)
         {
             menuEscStack.Pop().menuEscEvent.Invoke();
         }
     }
 }
コード例 #10
0
        /// <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"));
        }
コード例 #11
0
ファイル: HotKeyBinder.cs プロジェクト: threedaysX/SoulEater_
 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.
     }
 }
コード例 #12
0
 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);
     }
 }
コード例 #13
0
    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;
        }
    }
コード例 #14
0
 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++];
         }
     }
 }