Exemplo n.º 1
0
 private void OnValidate()
 {
     if (!inputSystem)
     {
         inputSystem = GetComponent <InputSystemUIInputModule>();
     }
 }
Exemplo n.º 2
0
 private void Awake()
 {
     _controls = new Controls();
     _controls.Enable();
     _inputModule = FindObjectOfType <InputSystemUIInputModule>();
     _canOpenBox  = true;
 }
Exemplo n.º 3
0
 private void Start()
 {
     uiCamera.SetActive(true);
     mainMenu.SetActive(false);
     DontDestroyOnLoad(gameObject);
     uiInputModule = GetComponent <InputSystemUIInputModule>();
 }
Exemplo n.º 4
0
 /// <summary>
 /// Pause the game
 /// </summary>
 /// <param name="playerObject">Game object of the player that paused the game</param>
 public void PauseGame(GameObject playerObject)
 {
     if (IsPaused)
     {
         Debug.LogWarning("Game is already paused");
         return;
     }
     Time.timeScale = 0;
     // Set pause menu active
     IsPaused          = true;
     playerEventSystem = playerObject.GetComponent <MultiplayerEventSystem>();
     if (playerEventSystem == null)
     {
         Debug.LogError("Player object does not have an Multiplayer Event System component attached to it.");
         return;
     }
     playerInput = playerObject.GetComponent <PlayerInput>();
     if (playerInput == null)
     {
         Debug.LogError("Player object does not have an Player Input component attached to it.");
         return;
     }
     uIInputModule = playerObject.GetComponent <InputSystemUIInputModule>();
     if (uIInputModule == null)
     {
         Debug.LogError("Player object does not have an Input System UI Input Module component attached to it.");
         return;
     }
     PushMenu(activeMenu);
     SwitchCurrentActionMap("UI");
 }
Exemplo n.º 5
0
 // Start is called before the first frame update
 void Start()
 {
     manager     = FindObjectOfType <PlayerInputManager>();
     usedIDs     = new List <PLAYERID>();
     inputModule = FindObjectOfType <InputSystemUIInputModule>();
     players     = new List <RawPlayerInput>();
 }
Exemplo n.º 6
0
 /// <summary>
 /// On start, we grab references and prepare our hotbar list
 /// </summary>
 protected virtual void Start()
 {
     inputModule = FindObjectOfType <InputSystemUIInputModule>();
     _currentInventoryDisplay = TargetInventoryDisplay;
     InventoryOpen            = false;
     _targetInventoryHotbars  = new List <InventoryHotbar>();
     _canvasGroup             = GetComponent <CanvasGroup>();
     foreach (InventoryHotbar go in FindObjectsOfType(typeof(InventoryHotbar)) as InventoryHotbar[])
     {
         _targetInventoryHotbars.Add(go);
     }
     if (HideContainerOnStart)
     {
         if (TargetInventoryContainer != null)
         {
             TargetInventoryContainer.alpha = 0;
         }
         if (Overlay != null)
         {
             Overlay.alpha = 0;
         }
         // Found the culprit
         //EventSystem.current.sendNavigationEvents = false;
         if (_canvasGroup != null)
         {
             _canvasGroup.blocksRaycasts = false;
         }
     }
 }
Exemplo n.º 7
0
    async void Awake()
    {
        inputSystemUIInputModule = GetComponent <InputSystemUIInputModule>();
        playerManager            = await PlayerManager.GetPlayerAsync(playerIndex);

        playerManager.SetupInputSystemUI(inputSystemUIInputModule);
        Init();
    }
Exemplo n.º 8
0
 private void Awake()
 {
     _controls = new Controls();
     _controls.Enable();
     _inputModule          = FindObjectOfType <InputSystemUIInputModule>();
     _canOpenBox           = true;
     _canCheckPartyMembers = false;
     _checkingPartyMembers = false;
 }
Exemplo n.º 9
0
        void Awake()
        {
#if ENABLE_INPUT_SYSTEM
            StandaloneInputModule tempModule = gameObject.GetComponent <StandaloneInputModule>();
            Destroy(tempModule);
            InputSystemUIInputModule newModule = gameObject.AddComponent <InputSystemUIInputModule>();
            newModule.enabled = false;
            newModule.enabled = true;
#endif
        }
Exemplo n.º 10
0
    public void ShowGameOverMenu()
    {
        GameObject playerObject = PlayerManager.Instance.Players[0];

        Time.timeScale    = 0;
        playerEventSystem = playerObject.GetComponent <MultiplayerEventSystem>();
        playerInput       = playerObject.GetComponent <PlayerInput>();
        uIInputModule     = playerObject.GetComponent <InputSystemUIInputModule>();
        PushMenu(gameOverMenu);
        SwitchCurrentActionMap("UI");
        GameManager.Instance.SetPausedState();
    }
Exemplo n.º 11
0
    private void OnDisable()
    {
        InputSystemUIInputModule inputSystem = UnityEngine.EventSystems.EventSystem.current?.GetComponent <InputSystemUIInputModule>();

        if (inputSystem)
        {
            inputSystem.cancel.action.started -= OnCancelStarted;
        }
        else
        {
            Debug.LogWarning("[BackButton] Attempted to register actions to current EventSystem but couldn't find one.");
        }
    }
 /// <summary>
 /// Description: Pause the game
 /// Rationale: Players should be able to pause the game and navigate menu options
 /// </summary>
 /// <param name="playerObject">Game object of the player that paused the game</param>
 public void PauseGame(GameObject playerObject)
 {
     if (IsPaused)
     {
         return;
     }
     Time.timeScale    = 0;
     IsPaused          = true;
     playerEventSystem = playerObject.GetComponent <MultiplayerEventSystem>();
     playerInput       = playerObject.GetComponent <PlayerInput>();
     uIInputModule     = playerObject.GetComponent <InputSystemUIInputModule>();
     PushMenu(activeMenu);
     SwitchCurrentActionMap("UI");
     GameManager.Instance.SetPausedState();
 }
    private void OnDisable()
    {
        scrollRectStack.Remove(this);

        InputSystemUIInputModule inputSystem = UnityEngine.EventSystems.EventSystem.current?.GetComponent <InputSystemUIInputModule>();

        if (inputSystem)
        {
            inputSystem.scrollWheel.action.started   -= OnScroll;
            inputSystem.scrollWheel.action.performed -= OnScroll;
            inputSystem.scrollWheel.action.canceled  -= OnScroll;
        }
        else
        {
            Debug.LogWarning("[BackButton] Attempted to register actions to current EventSystem but couldn't find one.");
        }
    }
Exemplo n.º 14
0
        public static void ReassignActions(InputSystemUIInputModule module, InputActionAsset action)
        {
            module.actionsAsset = action;
            var assets = GetAllActionsFromAsset(action);

            if (assets != null)
            {
                module.point       = GetActionReferenceFromAssets(assets, module.point?.action?.name, "Point", "MousePosition", "Mouse Position");
                module.leftClick   = GetActionReferenceFromAssets(assets, module.leftClick?.action?.name, "Click", "LeftClick", "Left Click");
                module.rightClick  = GetActionReferenceFromAssets(assets, module.rightClick?.action?.name, "RightClick", "Right Click", "ContextClick", "Context Click", "ContextMenu", "Context Menu");
                module.middleClick = GetActionReferenceFromAssets(assets, module.middleClick?.action?.name, "MiddleClick", "Middle Click");
                module.scrollWheel = GetActionReferenceFromAssets(assets, module.scrollWheel?.action?.name, "ScrollWheel", "Scroll Wheel", "Scroll", "Wheel");
                module.move        = GetActionReferenceFromAssets(assets, module.move?.action?.name, "Navigate", "Move");
                module.submit      = GetActionReferenceFromAssets(assets, module.submit?.action?.name, "Submit");
                module.cancel      = GetActionReferenceFromAssets(assets, module.cancel?.action?.name, "Cancel", "Esc", "Escape");
            }
        }
    // Start is called before the first frame update
    void Start()
    {
        //
        // Retrieve the player UI
        m_playerUI = GameObject.FindWithTag("PlayerUI").GetComponent <PlayerUI>();
        Assert.IsNotNull(m_playerUI, "Can't find the PlayerUI ! ");

        //
        // Retrieve the input system ui input module that is on the EventSystem object
        m_inputSystemUIInputModule = GameObject.FindWithTag("EventSystem").GetComponent <InputSystemUIInputModule>();
        Assert.IsNotNull(m_playerUI, "Can't find the EventSystem (so the InputSystemUIInputModule is null) ! ");

        //
        // Retrieve the player input
        m_playerInput = GetComponent <PlayerInput>();

        //
        // Replace the input reference in the input navigation
        m_inputSystemUIInputModule.enabled = false;
        m_inputSystemUIInputModule.move    = m_navigationInGameReference;
        m_inputSystemUIInputModule.enabled = true;
    }
Exemplo n.º 16
0
 private void Awake()
 {
     inputModule = inputMod;
     submit      = inputMod.submit.action;
 }
    public void SetInputUser(InputUser inputUser, InputDevice controller)
    {
        m_CurrentController = (Gamepad)controller;

        m_Controls = (Controls)inputUser.actions;

        InputSystemUIInputModule inputModule = transform.parent.parent.GetComponentInChildren <InputSystemUIInputModule>();

        m_CharacterControl = GetComponentInChildren <CharacterControl>();

        foreach (InputAction action in inputUser.actions)
        {
            PlayerInput.ActionEvent newEvent = new PlayerInput.ActionEvent(action);


            /* ADD one of these to the case to invoke the action
             * action.performed += newEvent.Invoke;
             * action.canceled += newEvent.Invoke;
             * action.started += newEvent.Invoke;
             */
            switch (action.name)
            {
            case "Selection":

                if (inputModule != null)
                {
                    InputActionReference selectionRef = ScriptableObject.CreateInstance <InputActionReference>();
                    selectionRef.Set(action);

                    inputModule.move = selectionRef;
                }
                break;

            case "Select":
                action.performed += newEvent.Invoke;
                if (inputModule != null)
                {
                    InputActionReference selectRef = ScriptableObject.CreateInstance <InputActionReference>();
                    selectRef.Set(action);

                    inputModule.submit = selectRef;
                }
                break;

            case "Start":
                break;

            case "Rotate":
                newEvent.AddListener(Rotate);
                action.started   += newEvent.Invoke;
                action.performed += newEvent.Invoke;
                action.canceled  += newEvent.Invoke;
                break;

            case "Movement":
                newEvent.AddListener(m_CharacterControl.Movement);
                action.started   += newEvent.Invoke;
                action.performed += newEvent.Invoke;
                action.canceled  += newEvent.Invoke;
                break;

            case "Jump":
                m_SkipEvents.Add(newEvent);

                newEvent.AddListener(m_CharacterControl.Jump);
                action.performed += newEvent.Invoke;
                break;

            case "Push":
                newEvent.AddListener(m_CharacterControl.Push);
                action.performed += newEvent.Invoke;
                break;

            case "Interact":
                newEvent.AddListener(m_CharacterControl.Interact);
                action.performed += newEvent.Invoke;
                break;

            default:
                Debug.Log("There is no functionality yet for action: " + action.name + " in action map: " + action.actionMap);
                break;
            }
        }
    }
Exemplo n.º 18
0
 public void SetupInputSystemUI(InputSystemUIInputModule uiInputModule)
 {
     _playerInput.uiInputModule = uiInputModule;
 }
Exemplo n.º 19
0
 //Assign control over the menu
 public void assignMenuControls(InputSystemUIInputModule module)
 {
     GetComponent <PlayerInput>().uiInputModule = module;
 }
Exemplo n.º 20
0
 public static void BindUIActions(this InputSystemUIInputModule uiInputModule, DemoControls.MenuActions menuActions)
 {
     uiInputModule.move      = InputActionReference.Create(menuActions.navigate);
     uiInputModule.leftClick = InputActionReference.Create(menuActions.click);
 }
Exemplo n.º 21
0
 protected override void Awake()
 {
     base.Awake();
     UIInputModule         = GetComponent <InputSystemUIInputModule>();
     UIInputModule.enabled = false;
 }
 void Awake()
 {
     UIStateManager.stateChanged += OnStateDataChanged;
     m_InputSystemUIInputModule   = GetComponent <InputSystemUIInputModule>();
     m_XruiInputModule            = GetComponent <XRUIInputModule>();
 }
Exemplo n.º 23
0
 public WorldObjectReferenceService(InputSystemUIInputModule inputSystem, Camera mainCamera)
 {
     InputSystem = inputSystem;
     MainCamera  = mainCamera;
 }
 void Awake()
 {
     m_InputSystemUIInputModule = GetComponent <InputSystemUIInputModule>();
     m_XRUIInputModule          = GetComponent <XRUIInputModule>();
     m_VREnableSelector         = UISelectorFactory.createSelector <bool>(VRContext.current, nameof(IVREnableDataProvider.VREnable), OnVREnableChanged);
 }
Exemplo n.º 25
0
 private void Awake()
 {
     EventSystem = GetComponent <EventSystem>();
     UIModule    = GetComponent <InputSystemUIInputModule>();
 }
Exemplo n.º 26
0
 private void Start()
 {
     _inputSystemUIInputModule = GetComponentInParent <InputSystemUIInputModule>();
 }
Exemplo n.º 27
0
 private void Awake()
 {
     _inputUIModule       = GetComponent <InputSystemUIInputModule>();
     _inputReferenceToNav = _inputUIModule.move;
 }