void UpdateUI()
    {
        var isManual = controlConfig.controlMode == ControlConfigMode.MANUAL;

        azimuthInputField.interactable     = isManual;
        inclinationInputField.interactable = isManual;
        azimuthSlider.interactable         = isManual;
        inclinationSlider.interactable     = isManual;

        modeDropdown.SetValueWithoutNotify((int)controlConfig.controlMode);

        solarPanelAzimuthValueText.text     = _currentState.panelOrientation.azimuth.ToString("0.000°");
        solarPanelInclinationValueText.text = _currentState.panelOrientation.inclination.ToString("0.000°");
        azimuthMotorValueText.text          = _currentState.motorsRotation.azimuth.ToString("0.000°");
        inclinationMotorValueText.text      = _currentState.motorsRotation.inclination.ToString("0.000°");

        if (isManual)
        {
            azimuthInputField.SetTextWithoutNotify(controlConfig.manualOrientation.azimuth.ToString());
            inclinationInputField.SetTextWithoutNotify(controlConfig.manualOrientation.inclination.ToString());
            azimuthSlider.SetValue(controlConfig.manualOrientation.azimuth, false);
            inclinationSlider.SetValue(controlConfig.manualOrientation.inclination, false);
        }
        else
        {
            azimuthInputField.SetTextWithoutNotify(_currentState.panelOrientation.azimuth.ToString());
            inclinationInputField.SetTextWithoutNotify(_currentState.panelOrientation.inclination.ToString());
        }

        platformIndicator.rotation = (
            SystemToWorld *
            Matrix4x4.Rotate(_currentState.platformRotation) *
            WorldToSystem
            ).rotation;
    }
        private void LoadSettingsFromPrefs()
        {
            string dataPath = Path.Combine(Application.persistentDataPath, m_Filename);

            try
            {
                MapperSettingsFile loadFile = JsonUtility.FromJson <MapperSettingsFile>(File.ReadAllText(dataPath));

                // set defaults for old file versions
                if (loadFile.version < 2)
                {
                    ResetDeveloperSettings();
                    return;
                }

                m_GpsCaptureToggle.isOn = loadFile.useGps;
                useGps = loadFile.useGps;
                m_RgbCaptureToggle.SetIsOnWithoutNotify(loadFile.captureRgb);
                captureRgb = loadFile.captureRgb;

                m_ShowPointCloudsToggle.SetIsOnWithoutNotify(loadFile.showPointClouds);
                showPointClouds = loadFile.showPointClouds;
                m_OnServerLocalizationToggle.SetIsOnWithoutNotify(loadFile.useServerLocalizer);
                useServerLocalizer = loadFile.useServerLocalizer;
                m_ListOnlyNearbyMapsToggle.SetIsOnWithoutNotify(loadFile.listOnlyNearbyMaps);
                listOnlyNearbyMaps = loadFile.listOnlyNearbyMaps;

                m_DownsampleWhenLocalizingToggle.SetIsOnWithoutNotify(loadFile.downsampleWhenLocalizing);
                downsampleWhenLocalizing = loadFile.downsampleWhenLocalizing;
                localizer = loadFile.localizer;
                m_LocalizerDropdown.value = localizer;

                //m_ResolutionDropdown.value = loadFile.resolution;
                //resolution = loadFile.resolution;

                m_MapDetailLevelInput.SetTextWithoutNotify(loadFile.mapDetailLevel.ToString());
                mapDetailLevel = loadFile.mapDetailLevel;
                m_ServerLocalizationWithIdsToggle.SetIsOnWithoutNotify(loadFile.serverLocalizationWithIds);
                serverLocalizationWithIds = loadFile.serverLocalizationWithIds;
                m_PreservePosesToggle.SetIsOnWithoutNotify(loadFile.preservePoses);
                preservePoses = loadFile.preservePoses;
                m_WindowSizeInput.SetTextWithoutNotify(loadFile.windowSize.ToString());
                windowSize = loadFile.windowSize;

                m_Param1Input.SetTextWithoutNotify(loadFile.param1.ToString());
                param1 = loadFile.param1;
                m_Param2Input.SetTextWithoutNotify(loadFile.param2.ToString());
                param2 = loadFile.param2;
                m_Param3Input.SetTextWithoutNotify(loadFile.param3.ToString());
                param3 = loadFile.param3;
                m_Param4Input.SetTextWithoutNotify(loadFile.param4.ToString());
                param4 = loadFile.param4;
            }
            catch (FileNotFoundException e)
            {
                Debug.Log(e.Message + "\nsettings.json file not found");
            }

            SaveSettingsToPrefs();
        }
 public void RestrictNegative(string text)
 {
     if (text.Length > 0 && text[0] == '-')
     {
         Bind.SetTextWithoutNotify("0");
     }
 }
Beispiel #4
0
        protected override void OnAwake()
        {
            this.LogIfStripped();

            xField.onSelect.AddListener(x => BeginEdit());
            yField.onSelect.AddListener(x => BeginEdit());

            xField.onValueChanged.AddListener(x => SetPropValue(false));
            yField.onValueChanged.AddListener(x => SetPropValue(false));

            xField.onEndEdit.AddListener(x =>
            {
                if (string.IsNullOrWhiteSpace(x))
                {
                    xField.SetTextWithoutNotify("0");
                }

                SetPropValue(true);
            });

            yField.onEndEdit.AddListener(x =>
            {
                if (string.IsNullOrWhiteSpace(x))
                {
                    yField.SetTextWithoutNotify("0");
                }

                SetPropValue(true);
            });
        }
Beispiel #5
0
 private void OnEnable()
 {
     field  = GetComponent <TMP_InputField>();
     toggle = GetComponent <Toggle>();
     if (field)
     {
         if (myFloat)
         {
             //field.text = myFloat.ToString();
             field.SetTextWithoutNotify(myFloat.value.ToString());
             Debug.Log(1);
         }
         else if (myInt)
         {
             //field.text = myInt.ToString();
             field.SetTextWithoutNotify(myInt.value.ToString());
         }
     }
     else if (toggle)
     {
         if (myBool)
         {
             toggle.isOn = myBool;
         }
     }
 }
Beispiel #6
0
    public void OnClickedNumPad()
    {
        switch (text.text)
        {
        case "0":
        case "1":
        case "2":
        case "3":
        case "4":
        case "5":
        case "6":
        case "7":
        case "8":
        case "9":
            if (input.characterLimit > input.text.Length)
            {
                input.SetTextWithoutNotify(input.text + text.text);
            }
            break;

        case "CC":
            input.SetTextWithoutNotify("");
            break;

        case "<<":
            input.SetTextWithoutNotify(input.text.Remove(input.text.Length - 1, 1));
            break;
        }
    }
Beispiel #7
0
 private void Start()
 {
     ID.onEndEdit.AddListener(s =>
     {
         byte b;
         if (!string.IsNullOrWhiteSpace(s) && byte.TryParse(s, out b))
         {
             oldVal = s;
             numberDropDown.SetValueWithoutNotify(b % 16);
             letterDropDown.SetValueWithoutNotify(b / 16);
         }
         else
         {
             ID.SetTextWithoutNotify(oldVal);
         }
     });
     numberDropDown.onValueChanged.AddListener(v =>
     {
         ID.SetTextWithoutNotify("" + (numberDropDown.value + letterDropDown.value * 16));
     });
     letterDropDown.onValueChanged.AddListener(v =>
     {
         ID.SetTextWithoutNotify("" + (numberDropDown.value + letterDropDown.value * 16));
     });
 }
 /// <summary>
 ///     Reset search state
 /// </summary>
 public void Reset()
 {
     _foundObjects.Clear();
     userInput.SetTextWithoutNotify(Placeholder);
     textAmountResults.gameObject.SetActive(false);
     _allowInputReset = false;
 }
        private void OnInputChangedEvent(string input)
        {
            // Don't allow tags to be manually added by the user.
            input = input.Trim('<', '>');
            inputField.SetTextWithoutNotify(input);

            requiresTranslationUpdate = true;
            SaveInputText();
        }
Beispiel #10
0
 protected override void SetFieldValue(object value)
 {
     if (isChar)
     {
         textField.SetTextWithoutNotify(((char)value).ToString());
     }
     else
     {
         textField.SetTextWithoutNotify((string)value);
     }
 }
 public void SetValue(string hex, bool notify = true)
 {
     hex = hex ?? "000000";
     TryParseHex(hex, out var red, out var green, out var blue);
     currentColor = new Color(red / 255f, green / 255f, blue / 255f);
     ToHex        = hex;
     image.color  = currentColor;
     input.SetTextWithoutNotify(ToHex);
     if (notify)
     {
         OnColorChange?.Invoke();
     }
 }
        private void ReInsertCommand(bool reverse)
        {
            if (GameConsoleController.invokedCommands.Count == 0)
            {
                return;
            }
            _commandIndex += reverse ? -1 : 1;

            _commandIndex = Mathf.Clamp(_commandIndex, 0, GameConsoleController.invokedCommands.Count - 1);
            if (inputField != null)
            {
                inputField.SetTextWithoutNotify(GameConsoleController.invokedCommands[GameConsoleController.invokedCommands.Count - _commandIndex - 1]);
            }
        }
Beispiel #13
0
    void ResetToInitial()
    {
        Debug.Log("ResetToInitial()");
        currentLogin = string.Empty;
        currentPass  = string.Empty;

        HideLoginMessage();

        loginInputField.SetTextWithoutNotify(string.Empty);
        passInputField.SetTextWithoutNotify(string.Empty);
        loginButton_tmp.SetText("Войти");
        loginButton_img.color = new Color(47f / 255f, 128f / 255f, 54f / 255f);
        proceedButton_obj.SetActive(false);
        makeStandardsButton_obj.SetActive(false);
    }
Beispiel #14
0
        private void Start()
        {
            inputField.SetTextWithoutNotify(gameConfig.Config.mouseSensitivity.ToString(CultureInfo.InvariantCulture));
            inputField.onValueChanged.AddListener(UpdateSensitivity);

            languageDropdown.ClearOptions();
            languageDropdown.AddOptions(gameConfig.Translations.Languages.Select(item => item.NativeLanguageName)
                                        .ToList());
            languageDropdown.SetValueWithoutNotify((int)gameConfig.Config.currentLanguage);
            languageDropdown.onValueChanged.AddListener(UpdateLanguage);

            qualityDropdown.ClearOptions();
            qualityDropdown.AddOptions(QualitySettings.names.ToList());
            // Debug.Log(QualitySettings.names[QualitySettings.GetQualityLevel()]);

            qualityDropdown.SetValueWithoutNotify(QualitySettings.GetQualityLevel());
            qualityDropdown.onValueChanged.AddListener(UpdateQuality);

            resolutionDropdown.ClearOptions();
            resolutionDropdown.AddOptions(Screen.resolutions.Select(it => $"{it.width} x {it.height}").ToList());
            _resolutions = Screen.resolutions.ToList();
            var resolutionIndex = _resolutions.IndexOf(Screen.currentResolution);

            resolutionDropdown.SetValueWithoutNotify(resolutionIndex);
            resolutionDropdown.onValueChanged.AddListener(UpdateResolution);

            fullScreenSelect.SetSelectedSegmentWithoutNotify(Screen.fullScreen == false ? 0 : 1);
            fullScreenSelect.onValueChanged.AddListener(UpdateFullScreen);
        }
Beispiel #15
0
 private void UpdateChat()
 {
     if (Input.GetKeyDown(KeyCode.Return))
     {
         if (Writing)
         {
             Debug.Log("Works2");
             ChatInput.DeactivateInputField();
             var text = ChatInput.text;
             if (!string.IsNullOrWhiteSpace(text))
             {
                 GameController.NetworkController.SendPacketAsync(new ClientSendChatMessage
                 {
                     Message = text,
                 });
                 AddChatMessage($"<{GameController.EntitiesController.OwnPlayerController.OwnPlayer.Nickname}> " + text);
             }
             ChatInput.SetTextWithoutNotify("");
             Writing = false;
         }
         else
         {
             Debug.Log("Works");
             ChatInput.ActivateInputField();
             Writing = true;
         }
     }
 }
Beispiel #16
0
    public void RefreshMetadataTab()
    {
        TrackMetadata metadata = EditorContext.track.trackMetadata;

        RefreshFilenameCachesIfNull();

        trackTitle.SetTextWithoutNotify(metadata.title);
        artist.SetTextWithoutNotify(metadata.artist);
        genre.SetTextWithoutNotify(metadata.genre);
        additionalCredits.SetTextWithoutNotify(
            metadata.additionalCredits);

        UIUtils.MemoryToDropdown(eyecatchImage,
                                 metadata.eyecatchImage, imageFilesCache);
        UIUtils.MemoryToDropdown(previewTrack,
                                 metadata.previewTrack, audioFilesCache);
        startTime.SetTextWithoutNotify(metadata.previewStartTime.ToString());
        endTime.SetTextWithoutNotify(metadata.previewEndTime.ToString());

        foreach (TMP_InputField field in new List <TMP_InputField>()
        {
            trackTitle,
            artist,
            genre,
            additionalCredits,
            startTime,
            endTime
        })
        {
            field.GetComponent <MaterialTextField>().RefreshMiniLabel();
        }

        RefreshEyecatchPreview();
    }
Beispiel #17
0
    void UpdateFoodInputField()
    {
        string s            = "\n";
        int    pre          = runeManager.currentRuneId;
        int    currentValue = runeSize;

        for (int i = 0; i < food.Count; ++i)
        {
            if (ans[i])
            {
                if (food[i].setId != pre)
                {
                    s  += "----------------\n";
                    pre = food[i].setId;
                }
                currentValue += food[i].value;
                s            += runeManager.GetRuneList(food[i].setId)[food[i].id].ToString("0.000");
                s            += " ---> ";
                s            += (currentValue / 1000f).ToString("0.000") + "\n";
            }
        }
        resultSize.text  = (ans_max / 1000f).ToString("0.000");
        resultSize.color = (ans_max == targetSize) ? Color.white : Color.red;
        resultInputField.SetTextWithoutNotify(s);
        resultInputField.ActivateInputField();
    }
Beispiel #18
0
    public void OnUserInput(string input)
    {
        input = input.Replace('"'.ToString(), string.Empty);
        field.SetTextWithoutNotify(input);
        this.input = input;

        var lastIndex = input.LastIndexOf('.');

        if (lastIndex == -1)
        {
            SetState(State.HasNone);
            return;
        }

        lastIndex++;
        var extension = input.Substring(lastIndex, input.Length - lastIndex);

        if (extension != "cbk")
        {
            SetState(State.HasNone);
            return;
        }

        if (File.Exists(input))
        {
            Data = new PlayerData(input, File.ReadAllLines(input));
            SetState(State.HasFile);
        }
        else
        {
            SetState(State.HasPath);
        }
    }
 /// <summary>
 /// Implement the config to this UI
 /// </summary>
 /// <param name="mca">reference to the config.</param>
 void SetMatchmakingConfigAsset(MatchmakingConfigAsset mca)
 {
     MmClient.SetFleetId(mca.MultiplayFleetID);
     fleetIDField.SetTextWithoutNotify(mca.MultiplayFleetID);
     MmClient.SetMatchmakingUrl(mca.URLAndUPID());
     mmServiceField.SetTextWithoutNotify(mca.URLAndUPID());
 }
Beispiel #20
0
 // Start is called before the first frame update
 void Start()
 {
     _graph = new Graph <Transform, float>();
     x      = new List <int>();
     y      = new List <int>();
     _NodeNumber.SetTextWithoutNotify("0");
 }
Beispiel #21
0
        protected override void SetInputField(string value)
        {
            bool hasMixedValues = HasMixedValues();

            m_input.placeholder.gameObject.SetActive(hasMixedValues);
            m_input.SetTextWithoutNotify(hasMixedValues ? null : value);
        }
 private void RefreshInputFields()
 {
     if (calibratingTouchscreen)
     {
         offsetInputField.SetTextWithoutNotify(
             options.touchOffsetMs.ToString());
         latencyInputField.SetTextWithoutNotify(
             options.touchLatencyMs.ToString());
     }
     else
     {
         offsetInputField.SetTextWithoutNotify(
             options.keyboardMouseOffsetMs.ToString());
         latencyInputField.SetTextWithoutNotify(
             options.keyboardMouseLatencyMs.ToString());
     }
 }
 public override void Enable()
 {
     base.Enable();
     errorMessage.SetText(string.Empty);
     userName.SetText(ContextControler.UserName);
     password.SetTextWithoutNotify("");
     ContextControler.PropertyChanged += OnPropertyChanged;
 }
Beispiel #24
0
 public void OnClearTextClicked()
 {
     print("Clear text");
     searchBarInputField.SetTextWithoutNotify("");
     clearSearchBarTextButton.SetActive(false);
     searchBarInputField.Select();
     UnfilterAllCards();
 }
        public override void OnDeserialize(Serializer serializer)
        {
            var value = serializer.Get("floatValue");

            valueField.SetTextWithoutNotify(value);

            HandleInputValue(value);
        }
 private void SetChannelInputsFromColor(Color color)
 {
     if (_rgbMode)
     {
         input1.SetTextWithoutNotify(Mathf.RoundToInt(255 * color.r).ToString());
         input2.SetTextWithoutNotify(Mathf.RoundToInt(255 * color.g).ToString());
         input3.SetTextWithoutNotify(Mathf.RoundToInt(255 * color.b).ToString());
     }
     else
     {
         float h, s, v;
         Color.RGBToHSV(color, out h, out s, out v);
         input1.SetTextWithoutNotify(Mathf.RoundToInt(360 * h).ToString());
         input2.SetTextWithoutNotify(Mathf.RoundToInt(100 * s).ToString());
         input3.SetTextWithoutNotify(Mathf.RoundToInt(100 * v).ToString());
     }
 }
    public void ChangeValue()
    {
        var rgbColour = new Color(KWData.colorR, KWData.colorG, KWData.colorB);

        KWData.hexColor = "#" + ColorUtility.ToHtmlStringRGB(rgbColour);

        tmpi.SetTextWithoutNotify(KWData.hexColor);
    }
 private void UpdateInfo()
 {
     mutationRate.SetTextWithoutNotify(gene.mutationRate.ToString(CultureInfo.InvariantCulture));
     insertion.SetTextWithoutNotify(gene.insertionRate.ToString(CultureInfo.InvariantCulture));
     elitsm.SetTextWithoutNotify(gene.elitismRate.ToString(CultureInfo.InvariantCulture));
     mutationRange.SetTextWithoutNotify(gene.mutationRange.ToString(CultureInfo.InvariantCulture));
     lerpTime.SetTextWithoutNotify(gene.lerpTime.ToString(CultureInfo.InvariantCulture));
 }