Пример #1
0
    private void Update()
    {
        if (!HotkeyMaster.s_HotkeysEnabled)
        {
            return;
        }

        if (HotkeyMaster.IsPrimaryModifierHeld() && Input.GetKeyDown(KeyCode.G))
        {
            ToggleGhostMode();
        }
    }
Пример #2
0
    void Update()
    {
        foreach (var hotkey in m_List)
        {
            if (hotkey.m_SubjectToHotkeyDisabling && !HotkeyMaster.s_HotkeysEnabled)
            {
                return;
            }

            if (!hotkey.m_AllowedInPlayMode && GlobalData.IsInPlayMode())
            {
                return;
            }

            switch (hotkey.m_Modifiers)
            {
            case ModifierRequirements.Primary:
                if (HotkeyMaster.IsPrimaryModifierHeld())
                {
                    goto default;
                }
                break;

            case ModifierRequirements.Secondary:
                if (HotkeyMaster.IsSecondaryModifierHeld())
                {
                    goto default;
                }
                break;

            case ModifierRequirements.Paired:
                if (HotkeyMaster.IsPairedModifierHeld())
                {
                    goto default;
                }
                break;

            default: // ModifierRequirements.None
                if (Input.GetButtonDown(hotkey.m_Button))
                {
                    hotkey.m_Event.Invoke();
                }
                break;
            }
        }
    }
Пример #3
0
    private void Update()
    {
        if (GlobalData.IsInPlayMode() || !HotkeyMaster.s_HotkeysEnabled)
        {
            return;
        }

        var modifierKeyHeld = HotkeyMaster.IsPrimaryModifierHeld();
        var undoKeyDown     = Input.GetKeyDown(KeyCode.Z);
        var redoKeyDown     = Input.GetKeyDown(KeyCode.Y);

        if (modifierKeyHeld)
        {
            if (undoKeyDown)
            {
                AttemptUndo();
            }
            else if (redoKeyDown)
            {
                AttemptRedo();
            }
        }
    }
Пример #4
0
    /**
     * FUNCTION NAME: Update
     * DESCRIPTION  : Gets keyboard input for copy/cut/paste.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    private void Update()
    {
        if (!HotkeyMaster.s_HotkeysEnabled || GlobalData.IsInPlayMode())
        {
            return;
        }

        if (!m_ToolsPalette.IsSelectorActive())
        {
            if (Input.GetButtonDown(m_KeyboardShortcut))
            {
                RequestActivate();
            }

            return;
        }

        var modifierKeyHeld = HotkeyMaster.IsPrimaryModifierHeld();

        //Copy.
        if (modifierKeyHeld && Input.GetKeyDown(KeyCode.C))
        {
            CreateClipboard(cutting: false);
        }

        //Cut.
        else if (modifierKeyHeld && Input.GetKeyDown(KeyCode.X))
        {
            CreateClipboard(cutting: true);
        }

        //Paste.
        else if (modifierKeyHeld && Input.GetKeyDown(KeyCode.V) && m_bCanPaste)
        {
            CreateSavedTiles();
        }
    }