void CheckKeyboardInput()
    {
        if (!UIManager.IsInputFocus && GameData.IsInGame && CustomNetworkManager.Instance.IsClientConnected())
        {
            // Perform escape key action
            if (CommonInput.GetKeyDown(KeyCode.Escape))
            {
                EscapeKeyTarget.HandleEscapeKey();
            }

            // Perform the checks for all key actions which have functions defined here
            foreach (KeyValuePair <KeyAction, DualKeyCombo> entry in keybindManager.userKeybinds)
            {
                if (!keyActionFunctions.ContainsKey(entry.Key))
                {
                    continue;
                }
                if (CheckComboEvent(entry.Value.PrimaryCombo) || CheckComboEvent(entry.Value.SecondaryCombo))
                {
                    // Call the function associated with the KeyAction enum
                    keyActionFunctions[entry.Key]();
                }
            }
        }
    }
 void Awake()
 {
     layerMask = LayerMask.GetMask("Furniture", "Machines", "Unshootable Machines", "Items",
                                   "Objects");
     escapeKeyTarget = GetComponent <EscapeKeyTarget>();
     lightingSystem  = Camera.main.GetComponent <LightingSystem>();
     ToState(State.SELECTING);
 }
Exemple #3
0
 /// <summary>
 /// Handles escape key presses. Will close the most recently opened EscapeKeyTarget or will open the main menu if there are none.
 /// </summary>
 public static void HandleEscapeKey()
 {
     if (Targets.Count > 0)
     {
         EscapeKeyTarget escapeKeyTarget = Targets.Last.Value;
         escapeKeyTarget.OnEscapeKey.Invoke();
         if (escapeKeyTarget.DisableOnEscape)
         {
             GUI_IngameMenu.Instance.CloseMenuPanel(escapeKeyTarget.gameObject);
         }
     }
     else
     {
         GUI_IngameMenu.Instance.OpenMenuPanel(GUI_IngameMenu.Instance.mainIngameMenu);
     }
 }
    void CheckKeyboardInput()
    {
        if (!UIManager.IsInputFocus)
        {
            // Perform escape key action
            if (CommonInput.GetKeyDown(KeyCode.Escape))
            {
                EscapeKeyTarget.HandleEscapeKey();
            }

            // Only check for keyboard input once in-game
            if (GameData.IsInGame && Mirror.NetworkClient.active)
            {
                CheckInGameKeybinds();
            }
        }
    }
Exemple #5
0
    void CheckKeyboardInput()
    {
        if (!UIManager.IsInputFocus)
        {
            // Perform escape key action
            if (CommonInput.GetKeyDown(KeyCode.Escape))
            {
                EscapeKeyTarget.HandleEscapeKey();
            }

            // Only check for keyboard input once in-game
            if (GameData.IsInGame && CustomNetworkManager.Instance.IsClientConnected())
            {
                CheckInGameKeybinds();
            }
        }
    }
 /// <summary>
 /// Handles escape key presses. Will close the most recently opened EscapeKeyTarget or will open the main menu if there are none.
 /// </summary>
 public static void HandleEscapeKey()
 {
     if (Targets.Count > 0)
     {
         EscapeKeyTarget escapeKeyTarget = Targets.Last.Value;
         escapeKeyTarget.OnEscapeKey.Invoke();
         if (escapeKeyTarget.DisableOnEscape)
         {
             // Close the escape key target at the top of the stack
             GUI_IngameMenu.Instance.CloseMenuPanel(escapeKeyTarget.gameObject);
         }
     }
     else if (GameData.IsInGame)
     {
         // Player is in-game and no escape key targets on the stack, so open the in-game menu
         GUI_IngameMenu.Instance.OpenMenuPanel();
     }
 }
Exemple #7
0
    void CheckKeyboardInput()
    {
        if (!UIManager.IsInputFocus && GameData.IsInGame && CustomNetworkManager.Instance.IsClientConnected())
        {
            // Perform escape key action
            if (CommonInput.GetKeyDown(KeyCode.Escape))
            {
                if (EscapeKeyTarget.TargetStack.Count > 0)
                {
                    EscapeKeyTarget escapeKeyTarget = EscapeKeyTarget.TargetStack.Peek().GetComponent <EscapeKeyTarget>();
                    escapeKeyTarget.OnEscapeKey.Invoke();
                    if (escapeKeyTarget.DisableOnEscape)
                    {
                        GUI_IngameMenu.Instance.CloseMenuPanel(EscapeKeyTarget.TargetStack.Peek());
                    }
                }
                else
                {
                    GUI_IngameMenu.Instance.OpenMenuPanel(GUI_IngameMenu.Instance.mainIngameMenu);
                }
            }

            // Perform the checks for all key actions which have functions defined here
            foreach (KeyValuePair <KeyAction, DualKeyCombo> entry in keybindManager.userKeybinds)
            {
                if (!keyActionFunctions.ContainsKey(entry.Key))
                {
                    continue;
                }
                if (CheckComboEvent(entry.Value.PrimaryCombo) || CheckComboEvent(entry.Value.SecondaryCombo))
                {
                    // Call the function associated with the KeyAction enum
                    keyActionFunctions[entry.Key]();
                }
            }
        }
    }
Exemple #8
0
 private void OnEnable()
 {
     escapeKeyTarget = GetComponent <EscapeKeyTarget>();
     lightingSystem  = Camera.main.GetComponent <LightingSystem>();
 }
 private void OnEnable()
 {
     escapeKeyTarget = GetComponent <EscapeKeyTarget>();
     lightingSystem  = Camera.main.GetComponent <LightingSystem>();
     UpdateManager.Add(CallbackType.UPDATE, UpdateMe);
 }
 void Awake()
 {
     escapeKeyTarget = GetComponent <EscapeKeyTarget>();
     lightingSystem  = Camera.main.GetComponent <LightingSystem>();
     ToState(State.SELECTING);
 }