Exemplo n.º 1
0
 public void EyeChange(TMP_Dropdown eyeSelection)
 {
     eyes.sprite = eyeShapes[eyeSelection.value];
 }
Exemplo n.º 2
0
        void Start()
        {
            instance = this;
            Settings.Load();
            //Mods.Load(FilePaths.mods);

            List <string> localizationPaths = new List <string>();

            localizationPaths.Add(FilePaths.language);

            //foreach(Mod mod in Mods.list)
            //{
            //    localizationPaths.Add(FilePaths.mods + "/" + mod.Identifier + "/Language/{0}.ini");

            //}

            foreach (string path in localizationPaths)
            {
                Localization.Load(string.Format(path, Settings.GetString("language")));
            }


            player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();

            confirmSelectionTextDisplay = confirmSelectionPanel.transform.Find("Text").GetComponent <TextMeshProUGUI>();
            confirmSelectionDefaultText = Localization.Get("confirmSelectionText");
            confirmSelectionPanel.SetActive(false);

            infoTextDisplay = infoPanel.transform.Find("Text").GetComponent <TextMeshProUGUI>();
            infoDefaultText = infoTextDisplay.text;
            infoPanel.SetActive(true);

            eventTitleDisplay      = eventPanel.transform.Find("Title").GetComponent <TextMeshProUGUI>();
            eventDefaultTitle      = eventTitleDisplay.text;
            eventTextDisplay       = eventPanel.transform.Find("Text").GetComponent <TextMeshProUGUI>();
            eventDefaultText       = eventTextDisplay.text;
            eventButtonText        = eventPanel.transform.Find("Button").transform.Find("Text").GetComponent <TextMeshProUGUI>();
            eventButtonDefaultText = eventButtonText.text;

            creationPanelTitle        = creationPanel.transform.Find("Title").GetComponent <TextMeshProUGUI>();
            creationPanelDefaultTitle = Localization.Get("creationPanelTitle");
            creationPanelText         = creationPanel.transform.Find("Text").GetComponent <TextMeshProUGUI>();
            creationPanelDefaultText  = Localization.Get("creationPanelText");
            creationPanelStartButton  = creationPanel.transform.Find("StartButton").GetComponent <Button>();

            // News Info Area
            newsInfoArea        = creationPanel.transform.Find("NewsInfoArea").gameObject;
            newsInfoText        = newsInfoArea.transform.Find("Text").GetComponent <TextMeshProUGUI>();
            newsInfoDefaultText = Localization.Get("newsInfoDefaultText");

            newsNameInput = newsInfoArea.transform.Find("NewsNameInput").GetComponent <TMP_InputField>();
            newsNameInput.transform.Find("TextArea").Find("Placeholder").GetComponent <TextMeshProUGUI>().text = Localization.Get("newsFieldName");
            newsNameInputText        = newsNameInput.transform.Find("Text").GetComponent <TextMeshProUGUI>();
            newsNameInputDefaultText = Localization.Get("newsNameInputText");

            newsAdjectiveInput = newsInfoArea.transform.Find("NewsAdjectiveInput").GetComponent <TMP_InputField>();
            newsAdjectiveInput.transform.Find("TextArea").Find("Placeholder").GetComponent <TextMeshProUGUI>().text = Localization.Get("newsFieldAdjective");
            newsAdjectiveInputText        = newsAdjectiveInput.transform.Find("Text").GetComponent <TextMeshProUGUI>();
            newsAdjectiveInputDefaultText = Localization.Get("newsAdjectiveInputText");

            newsBeliverInput = newsInfoArea.transform.Find("NewsBeliverInput").GetComponent <TMP_InputField>();
            newsBeliverInput.transform.Find("TextArea").Find("Placeholder").GetComponent <TextMeshProUGUI>().text = Localization.Get("newsFieldBeliver");
            newsBeliverInputText        = newsBeliverInput.transform.Find("Text").GetComponent <TextMeshProUGUI>();
            newsBeliverInputDefaultText = Localization.Get("newsBeliverInputText");

            newsDisbeliverInput = newsInfoArea.transform.Find("NewsDisbeliverInput").GetComponent <TMP_InputField>();
            newsDisbeliverInput.transform.Find("TextArea").Find("Placeholder").GetComponent <TextMeshProUGUI>().text = Localization.Get("newsFieldDisbeliver");
            newsDisbeliverInputText        = newsDisbeliverInput.transform.Find("Text").GetComponent <TextMeshProUGUI>();
            newsDisbeliverInputDefaultText = Localization.Get("newsDisbeliverInputText");

            // News Type Area
            newsTypeArea     = creationPanel.transform.Find("NewsTypeArea").gameObject;
            newsTypeText     = newsTypeArea.transform.Find("NewsTypeText").GetComponent <TextMeshProUGUI>();
            newsTypeDropdown = newsTypeArea.transform.Find("NewsTypeDropdown").GetComponent <TMP_Dropdown>();
        }
Exemplo n.º 3
0
 private void Awake()
 {
     _dropdown = GetComponent <TMP_Dropdown>();
     _revertWindow.SetActive(false);
 }
Exemplo n.º 4
0
 public static void UpdateDropdown(TMP_Dropdown dropdown, List <string> dropdownContent)
 {
     dropdown.ClearOptions();
     dropdown.AddOptions(dropdownContent);
     dropdown.RefreshShownValue();
 }
Exemplo n.º 5
0
 // Start is called before the first frame update
 void Start()
 {
     dropdown = GetComponent <TMP_Dropdown>();
     expandedOnPreviousFrame = false;
 }
Exemplo n.º 6
0
 // Start is called before the first frame update
 void Start()
 {
     taskSelector = GameObject.Find("Dropdown_selectTask").GetComponent <TMP_Dropdown>();
     editScenario = GameObject.Find("EditScenario").GetComponent <Button>();
 }
Exemplo n.º 7
0
    /// <summary>
    ///
    /// Adds the stat modifier to the enchantment for a particular stat type dropdown and an input
    ///
    /// </summary>
    private void GetStatModifier(UnitEnchantment enchantment, Unit.StatTypes statType, TMP_Dropdown statModTypeDropdown, TMP_InputField statValueInput)
    {
        var statModType = (StatModifierTypes)Enum.Parse(typeof(StatModifierTypes), statModTypeDropdown.captionText.text);

        if (statModType != StatModifierTypes.None)
        {
            if (string.IsNullOrWhiteSpace(statValueInput.text))
            {
                statValueInput.text = "0";
            }
            var statValue = int.Parse(statValueInput.text);

            enchantment.AddStatModifier(statType, statModType, statValue);
        }
    }
Exemplo n.º 8
0
        public void HandleDropdown_Options(int index)
        {
            TMP_Dropdown dd = GetComponent <TMP_Dropdown>();

            HandleDropdown(index, options, dd, ref lastValue);
        }
Exemplo n.º 9
0
        public static void HandleDropdown(int index, IList <ModalConfirmation.Entry> options, TMP_Dropdown dd, ref int lastDropdownValue)
        {
            ModalConfirmation.Entry e = (options != null && index < options.Count) ? options[index] : null;
            UnityEvent ue             = e != null ? e.selectionAction : null;

            if (ue != null)
            {
                ue.Invoke();
            }
            if (e != null && e.eventOnly)
            {
                dd.SetValueWithoutNotify(lastDropdownValue);
            }
            else
            {
                lastDropdownValue = index;
                UiTextUpdate(dd);
            }
        }
Exemplo n.º 10
0
 public void ClickDropdownMenu(TMP_Dropdown dropdown)
 {
     gameManager.GameState = GameState.DropdownMenu;
     dropdown.Show();
 }
Exemplo n.º 11
0
 void Start()
 {
     difficultyDropdown       = GetComponent <TMP_Dropdown>();
     difficultyDropdown.value = PlayerPrefs.GetInt("difficulty");
 }
Exemplo n.º 12
0
 public void FaceChange(TMP_Dropdown faceSelection)
 {
     face.sprite = faceShapes[faceSelection.value];
 }
Exemplo n.º 13
0
 public void HairChange(TMP_Dropdown hairSelection)
 {
     hair.sprite = hairShapes[hairSelection.value];
 }
Exemplo n.º 14
0
 public void MouthChange(TMP_Dropdown mouthSelection)
 {
     mouth.sprite = mouthShapes[mouthSelection.value];
 }
        private void Start()
        {
            dropdown = GetComponent <TMP_Dropdown>();

            InitializeLeapfrog();
        }
Exemplo n.º 16
0
        public void Refresh_OnSelection()
        {
            TMP_Dropdown dd = GetComponent <TMP_Dropdown>();

            HandleDropdown_OnSelection(dd.value);
        }
 private void Awake()
 {
     _mapDropdown = this.GetComponent <TMP_Dropdown>();
 }
Exemplo n.º 18
0
        public void PopulateDropdown()
        {
            TMP_Dropdown dd = GetComponent <TMP_Dropdown>();

            PopulateDropdown(dd, options, this, HandleDropdown_Options);
        }
 private void Awake()
 {
     dropdown = GetComponent <TMP_Dropdown>();
     dropdown.onValueChanged.AddListener(OnDropdownChanged);
 }
Exemplo n.º 20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dd"></param>
        /// <param name="options"></param>
        /// <param name="ownerOfDropdownHandler"></param>
        /// <param name="action"></param>
        /// <param name="currentIndex">sets the dropdown to this value. if negative value, this is ignored</param>
        public static void PopulateDropdown(TMP_Dropdown dd, IList <ModalConfirmation.Entry> options, object ownerOfDropdownHandler, Action <int> action, int currentIndex = -1, bool customTextField = false)
        {
            int o = (customTextField ? 1 : 0);

            PopulateDropdown(dd, () => options.Count + o, i => (i >= o) ? options[i - o].text : CustomValueMarker, ownerOfDropdownHandler, action, currentIndex, null);
        }
Exemplo n.º 21
0
        public static void UpdateDropdownValue(TMP_Dropdown dropdown, string optionName)
        {
            var data = dropdown.options.Select(option => option.text).ToList();

            dropdown.value = data.IndexOf(optionName);
        }
Exemplo n.º 22
0
        // Token: 0x06002135 RID: 8501 RVA: 0x0009BDD0 File Offset: 0x00099FD0
        public void Update()
        {
            EventSystem eventSystem = MPEventSystemManager.FindEventSystem(ReInput.players.GetPlayer(0));

            if (eventSystem && eventSystem.currentSelectedGameObject == this.inputField.gameObject)
            {
                ConsoleWindow.InputFieldState inputFieldState = ConsoleWindow.InputFieldState.Neutral;
                if (this.autoCompleteDropdown && this.autoCompleteInUse)
                {
                    inputFieldState = ConsoleWindow.InputFieldState.AutoComplete;
                }
                else if (this.historyIndex != -1)
                {
                    inputFieldState = ConsoleWindow.InputFieldState.History;
                }
                bool keyDown  = Input.GetKeyDown(KeyCode.UpArrow);
                bool keyDown2 = Input.GetKeyDown(KeyCode.DownArrow);
                switch (inputFieldState)
                {
                case ConsoleWindow.InputFieldState.Neutral:
                    if (keyDown)
                    {
                        if (Console.userCmdHistory.Count > 0)
                        {
                            this.historyIndex        = Console.userCmdHistory.Count - 1;
                            this.preventHistoryReset = true;
                            this.inputField.text     = Console.userCmdHistory[this.historyIndex];
                            this.inputField.MoveToEndOfLine(false, false);
                            this.preventHistoryReset = false;
                        }
                    }
                    else if (keyDown2 && this.autoCompleteDropdown)
                    {
                        this.autoCompleteDropdown.Show();
                        this.autoCompleteDropdown.value = 0;
                        this.autoCompleteDropdown.onValueChanged.Invoke(this.autoCompleteDropdown.value);
                    }
                    break;

                case ConsoleWindow.InputFieldState.History:
                {
                    int num = 0;
                    if (keyDown)
                    {
                        num--;
                    }
                    if (keyDown2)
                    {
                        num++;
                    }
                    if (num != 0)
                    {
                        this.historyIndex += num;
                        if (this.historyIndex < 0)
                        {
                            this.historyIndex = 0;
                        }
                        if (this.historyIndex >= Console.userCmdHistory.Count)
                        {
                            this.historyIndex = -1;
                        }
                        else
                        {
                            this.preventHistoryReset = true;
                            this.inputField.text     = Console.userCmdHistory[this.historyIndex];
                            this.inputField.MoveToEndOfLine(false, false);
                            this.preventHistoryReset = false;
                        }
                    }
                    break;
                }

                case ConsoleWindow.InputFieldState.AutoComplete:
                    if (keyDown2)
                    {
                        TMP_Dropdown tmp_Dropdown = this.autoCompleteDropdown;
                        int          value        = tmp_Dropdown.value + 1;
                        tmp_Dropdown.value = value;
                    }
                    if (keyDown)
                    {
                        if (this.autoCompleteDropdown.value > 0)
                        {
                            TMP_Dropdown tmp_Dropdown2 = this.autoCompleteDropdown;
                            int          value         = tmp_Dropdown2.value - 1;
                            tmp_Dropdown2.value = value;
                        }
                        else
                        {
                            this.autoCompleteDropdown.Hide();
                        }
                    }
                    break;
                }
                eventSystem.SetSelectedGameObject(this.inputField.gameObject);
            }
        }
Exemplo n.º 23
0
 public static string GetDropdownSelectedOption(TMP_Dropdown dropdown)
 {
     return(dropdown.options[dropdown.value].text);
 }
Exemplo n.º 24
0
    void Start()
    {
        saveMenu     = GameObject.Find("SaveMenu");
        loadMenu     = GameObject.Find("LoadMenu");
        settingsMenu = GameObject.Find("SettingsMenu");
        controlsMenu = GameObject.Find("ControlsMenu");
        saveWarning  = GameObject.Find("SaveWarning");
        exitWarning  = GameObject.Find("ExitWarning");

        saveButton     = GameObject.Find("SaveButton");
        loadButton     = GameObject.Find("LoadButton");
        settingsButton = GameObject.Find("SettingsButton");
        controlsButton = GameObject.Find("KeysButton");

        qualityDropdown    = settingsMenu.transform.Find("QualityDropdown").GetComponent <TMP_Dropdown>();
        resolutionDropdown = settingsMenu.transform.Find("ResolutionDropdown").GetComponent <TMP_Dropdown>();
        fullscreenDropdown = settingsMenu.transform.Find("FullscreenDropdown").GetComponent <TMP_Dropdown>();
        //screenAADropdown = settingsMenu.transform.Find("ScreenAADropdown").GetComponent<TMP_Dropdown>();
        cameraResDropdown = settingsMenu.transform.Find("CameraResDropdown").GetComponent <TMP_Dropdown>();

        forwardKey     = controlsMenu.transform.Find("Forward").GetComponentInChildren <TMP_Text>();
        backwardKey    = controlsMenu.transform.Find("Backward").GetComponentInChildren <TMP_Text>();
        leftKey        = controlsMenu.transform.Find("Left").GetComponentInChildren <TMP_Text>();
        rightKey       = controlsMenu.transform.Find("Right").GetComponentInChildren <TMP_Text>();
        interactKey    = controlsMenu.transform.Find("Interact").GetComponentInChildren <TMP_Text>();
        monitor1Key    = controlsMenu.transform.Find("Monitor1").GetComponentInChildren <TMP_Text>();
        monitor2Key    = controlsMenu.transform.Find("Monitor2").GetComponentInChildren <TMP_Text>();
        monitor3Key    = controlsMenu.transform.Find("Monitor3").GetComponentInChildren <TMP_Text>();
        monitor4Key    = controlsMenu.transform.Find("Monitor4").GetComponentInChildren <TMP_Text>();
        monitorBackKey = controlsMenu.transform.Find("MonitorBack").GetComponentInChildren <TMP_Text>();

        changeKeyDialogue = controlsMenu.transform.Find("ChangeKey").GetComponentInChildren <TMP_Text>();

        save1 = saveMenu.transform.Find("Slot1").GetComponentInChildren <TMP_Text>();
        save2 = saveMenu.transform.Find("Slot2").GetComponentInChildren <TMP_Text>();
        save3 = saveMenu.transform.Find("Slot3").GetComponentInChildren <TMP_Text>();
        load1 = loadMenu.transform.Find("Slot1").GetComponentInChildren <TMP_Text>();
        load2 = loadMenu.transform.Find("Slot2").GetComponentInChildren <TMP_Text>();
        load3 = loadMenu.transform.Find("Slot3").GetComponentInChildren <TMP_Text>();

        PGM.Instance.monitorKeyList = new List <KeyCode>()
        {
            PGM.Instance.keyBinds["Monitor1"], PGM.Instance.keyBinds["Monitor2"], PGM.Instance.keyBinds["Monitor3"], PGM.Instance.keyBinds["Monitor4"]
        };

        Resolution tempResolution = PGM.Instance.currentResolution;

        for (int index = 0; index < PGM.Instance.resolutions.Length; index++)
        {
            resolutionDropdown.AddOptions(new List <string> {
                PGM.Instance.resolutions[index].x + "x" + PGM.Instance.resolutions[index].y
            });
        }

        if (resolutionDropdown.options.ToString().Contains(tempResolution.x + "x" + tempResolution.y))
        {
            resolutionDropdown.AddOptions(new List <string> {
                tempResolution.x + "x" + tempResolution.y
            });
        }

        PGM.Instance.currentResolution = tempResolution;
        //Screen.SetResolution(PGM.Instance.currentResolution.x, PGM.Instance.currentResolution.y, Screen.fullScreenMode);

        if (File.Exists(Application.persistentDataPath + "/savedata1.gd"))
        {
            save1.text = "Used";
            load1.text = "Used";
        }
        else
        {
            save1.text = "Empty";
            load1.text = "Empty";
        }
        if (File.Exists(Application.persistentDataPath + "/savedata2.gd"))
        {
            save2.text = "Used";
            load2.text = "Used";
        }
        else
        {
            save2.text = "Empty";
            load2.text = "Empty";
        }
        if (File.Exists(Application.persistentDataPath + "/savedata3.gd"))
        {
            save3.text = "Used";
            load3.text = "Used";
        }
        else
        {
            save3.text = "Empty";
            load3.text = "Empty";
        }

        saveMenu.SetActive(false);
        loadMenu.SetActive(false);
        settingsMenu.SetActive(false);
        controlsMenu.SetActive(false);
        saveWarning.SetActive(false);
        exitWarning.SetActive(false);



        // Finds the current fullscreen mode and sets the dropdown to represent that
        List <string> fullscreenList = fullscreenDropdown.options.Select(option => option.text).ToList();

        switch (Screen.fullScreenMode)
        {
        case FullScreenMode.ExclusiveFullScreen:
            fullscreenDropdown.value = fullscreenList.IndexOf("Exclusive Fullscreen");
            break;

        case FullScreenMode.FullScreenWindow:
            fullscreenDropdown.value = fullscreenList.IndexOf("Windowed Fullscreen");
            break;

        case FullScreenMode.MaximizedWindow:
            fullscreenDropdown.value = fullscreenList.IndexOf("Maximised Window");
            break;

        case FullScreenMode.Windowed:
            fullscreenDropdown.value = fullscreenList.IndexOf("Windowed");
            break;
        }

        // finds a the matching height and width in PGM and sets the active dropdown value to match

        /*foreach (int value in PGM.Instance.resolutionX)
         * {
         *  if (value == Screen.currentResolution.width && PGM.Instance.resolutionY[Array.IndexOf(PGM.Instance.resolutionX, value)] == Screen.currentResolution.height)
         *  {
         *      resolutionDropdown.value = Array.IndexOf(PGM.Instance.resolutionX, value);
         *      break;
         *  }
         * }
         *
         * for (int value = 0; value < PGM.Instance.resolutions.Length; value++)
         * {
         *
         *  if (Screen.currentResolution.width == PGM.Instance.resolutions[value].x && Screen.currentResolution.height == PGM.Instance.resolutions[value].y)
         *  {
         *      resolutionDropdown.value = Array.IndexOf(PGM.Instance.resolutions, value);
         *      break;
         *  }
         * }
         */
        resolutionDropdown.value = Array.IndexOf(PGM.Instance.resolutions, PGM.Instance.currentResolution);



        // Finds the current index of the quality level and assigns that to the dropdown to accurately represent the current quality. Should work as the dropdown indexes are the same as the settings indexes.

        qualityDropdown.value = QualitySettings.GetQualityLevel(); //Array.IndexOf(QualitySettings.names, QualitySettings.GetQualityLevel());

        /*
         * PGM.Instance.screenAA = QualitySettings.antiAliasing;
         * switch (PGM.Instance.screenAA)
         * {
         *  case 1:
         *      screenAADropdown.value = 0;
         *      break;
         *  case 2:
         *      screenAADropdown.value = 1;
         *      break;
         *  case 4:
         *      screenAADropdown.value = 2;
         *      break;
         *  case 8:
         *      screenAADropdown.value = 3;
         *      break;
         * }
         */
        PGM.Instance.cameraRes  = PGM.Instance.monitorScreens[0].width;
        cameraResDropdown.value = cameraResDropdown.options.FindIndex((i) => { return(i.text.Equals(PGM.Instance.cameraRes.ToString() + 'p')); });
    }
Exemplo n.º 25
0
 void DropdownValueChanged(TMP_Dropdown dropdown)
 {
     unitCtr.setUnits(dropdown.options[dropdown.value].text);
 }
Exemplo n.º 26
0
 private void AcceptLoadedLevel(TMP_Dropdown dropdown) => SetLoadLevelPanel(dropdown.value);
Exemplo n.º 27
0
 public void SetEmployeeAction(TMP_Dropdown dropdown)
 {
     action = (EmployeeActions)dropdown.value;
     UpdateTooltipText();
 }
Exemplo n.º 28
0
 private void Awake()
 {
     _dropdown = GetComponent <TMP_Dropdown>();
 }
Exemplo n.º 29
0
 /// <summary>
 /// 设置活动Tile资源索引
 /// </summary>
 /// <param name="value"></param>
 public void SetActiveTileAssetIndex(TMP_Dropdown dropdown)
 {
     activeTileAssetName = dropdown.options[dropdown.value].text;
 }
Exemplo n.º 30
0
 public void HairColorChange(TMP_Dropdown hairColorSelection)
 {
     hair.color = hairColors[hairColorSelection.value];
 }