Exemple #1
0
    public void Open()
    {
        // reset the text of the drop down
        dropDown.GetComponentInChildren <TMP_Text>().text = "SET RESOLUTION";

        rectPauseMenu.gameObject.SetActive(true);
        EffectController.TweenFade(rectPauseMenu.GetComponent <CanvasGroup>(), 0f, 1f, fadeSpeed, () => {});

        Time.timeScale            = 0;
        GameController.GAME_STATE = GameController.GameState.PAUSED;
    }
        public void ClearInputTextBoxListeners()
        {
            TMP_InputField elementUiInputField = fieldType.GetComponentInChildren <TMP_InputField>();

            if (elementUiInputField != null)
            {
                //elementUiInputField.onValueChanged.RemoveAllListeners();
                // not enough to remove all listeners apparently.
                elementUiInputField.onValueChanged = new TMP_InputField.OnChangeEvent();
                //Show.Log("unbind from "+elementUiInputField.name);
            }
            scriptValue.onValueChanged.RemoveAllListeners();
            columnLabel.onValueChanged.RemoveAllListeners();
            columnWidth.onValueChanged.RemoveAllListeners();
            columnIndex.onValueChanged.RemoveAllListeners();
            defaultValue.onValueChanged.RemoveAllListeners();
            trashColumn.onClick.RemoveAllListeners();
        }
    public void SetResolution()
    {
        TextMeshProUGUI SelectedText = ResolutionDropdown.GetComponentInChildren <TextMeshProUGUI>();

        string[] ResolutionArray  = SelectedText.text.Split(' ');
        int      resolutionWidth  = System.Convert.ToInt32(ResolutionArray[0]);
        int      resolutionHeight = System.Convert.ToInt32(ResolutionArray[2]);

        Screen.SetResolution(resolutionWidth, resolutionHeight, Screen.fullScreen);
    }
Exemple #4
0
    // Start is called before the first frame update
    void Start()
    {
        // set the button text for switching between full screen and windowed
        string buttonText = Screen.fullScreen ? "SET WINDOWED" : "SET FULL SCREEN";

        GameObject.Find("btn_fullscreen").GetComponentInChildren <TMP_Text>().text = buttonText;

        // the drop down for changing resolutions
        dropDown = GameObject.Find("dropdown_resolution").GetComponent <TMP_Dropdown>();

        // set the inital text of our dropdown
        dropDown.GetComponentInChildren <TMP_Text>().text = "SET RESOLUTION";
    }
    // Initialize Monitor Dropdown Value
    private void InitializeMonitorDropdown()
    {
        if (monitorDropdown == null)
        {
            return;
        }

        monitorDropdown.ClearOptions();

        int unityMonitor   = PlayerPrefs.GetInt("");
        int currentMonitor = unityMonitor == 0 ? GlobalSettings.iMonitor : unityMonitor;

        for (int i = 0; i < Display.displays.Length; i++)
        {
            monitorDropdown.options.Add(new TMP_Dropdown.OptionData("Monitor " + (i + 1)));
        }

        if (currentMonitor < Display.displays.Length)
        {
            monitorDropdown.value = currentMonitor;
        }
        else
        {
            monitorDropdown.value   = 0;
            GlobalSettings.iMonitor = 0;
        }

        if (monitorDropdown.options.Count == 1)
        {
            Toggle option = monitorDropdown.GetComponentInChildren <Toggle>(true);

            if (option != null)
            {
                Navigation nav = new Navigation()
                {
                    mode = Navigation.Mode.None
                };
                option.navigation = nav;
            }
        }

        monitorDropdown.RefreshShownValue();
    }
Exemple #6
0
    // Gets the Currently Connected Gamepads
    private void GetGamepads()
    {
        if (gamepadDropdown != null)
        {
            gamepadDropdown.ClearOptions();
            gamepadDropdown.options.Add(new TMP_Dropdown.OptionData("None"));
            gamepadDropdown.RefreshShownValue();

            if (gamepadDropdown.options.Count == 1)
            {
                Toggle option = gamepadDropdown.GetComponentInChildren <Toggle>(true);

                if (option != null)
                {
                    Navigation nav = new Navigation()
                    {
                        mode = Navigation.Mode.None
                    };
                    option.navigation = nav;
                }
            }
        }

        Joystick[] gamepads = ReInput.controllers.GetJoysticks();

        if (gamepads != null && gamepads.Length > 0)
        {
            Joystick playerPad = null;

            if (playerInput.controllers.joystickCount > 0)
            {
                Joystick currentAssignedPad = playerInput.controllers.GetController <Joystick>(0);

                if (currentAssignedPad != null)
                {
                    playerPad = ReInput.controllers.GetController <Joystick>(currentAssignedPad.id);
                }
            }

            int padArrayPos   = 0;
            int connectedPads = 0;

            for (int i = 0; i < gamepads.Length; i++)
            {
                Joystick gamepad = gamepads[i];

                if (gamepadDropdown != null)
                {
                    gamepadDropdown.options.Add(new TMP_Dropdown.OptionData(gamepad.name));
                }

                if (gamepad.isConnected)
                {
                    connectedPads++;
                }

                if (playerPad != null && gamepad == playerPad)
                {
                    padArrayPos = i;
                }
            }

            if (connectedPads > 0)
            {
                if (gamepadDropdown != null)
                {
                    if (ReInput.configuration.autoAssignJoysticks)
                    {
                        gamepadDropdown.value = padArrayPos + 1;
                    }
                    else
                    {
                        gamepadDropdown.value = 0;
                    }

                    gamepadDropdown.RefreshShownValue();
                }

                if (ControllerStatusManager.iGamepadID != -1)
                {
                    calibrateGamepadButton.interactable = true;
                }
                else
                {
                    calibrateGamepadButton.interactable = false;
                }
            }
            else
            {
                calibrateGamepadButton.interactable = false;
            }
        }
        else
        {
            calibrateGamepadButton.interactable = false;
        }
    }