Exemple #1
0
    private void Start()
    {
        deleteButton.onClick.AddListener(DeleteInteraction);
        saveVRTarget = data.vrIndex;

        // load or create data
        if (data.init == false) // if new interaction
        {
            data.vrIndex          = 0;
            data.flockTargetIndex = 0;
            data.min = 0f;
            data.max = 1f;
            addInteractionParentUI.parent.saveSystem.CurrentData.AddBehaviorDataInteraction(data);
            data.init = true;
        }

        // Possible VR Input
        OnVRInputChanged(addInteractionParentUI.parent.saveSystem.CurrentData.VRInteractions);
        vrInputDropdown.onValueChanged.AddListener(delegate { OnVRInteractionChanged(vrInputDropdown); });
        addInteractionParentUI.parent.saveSystem.CurrentData.OnVRInteractionsChange += OnVRInputChanged;
        vrInputDropdown.SetValueWithoutNotify(data.vrIndex);
        OnVRInteractionChanged(vrInputDropdown);

        // Possible flockTarget
        OnBehaviorChange(addInteractionParentUI.parent.saveSystem.CurrentData.CompositeBehavior.behaviors);
        flockTargetDropdown.onValueChanged.AddListener(delegate { OnFlockTargetChanged(flockTargetDropdown); });
        addInteractionParentUI.parent.saveSystem.CurrentData.OnCompositeBehaviorsChange += OnBehaviorsChanged;
        flockTargetDropdown.SetValueWithoutNotify(data.flockTargetIndex);


        min.text = (data.min).ToString();
        max.text = (data.max).ToString();
        min.onValueChanged.AddListener(delegate { OnMinMaxChanged(min, max); });
        max.onValueChanged.AddListener(delegate { OnMinMaxChanged(min, max); });
    }
 private void Start()
 {
     entityDropDown.onValueChanged.AddListener(SelectedEntity);
     actionDropDown.onValueChanged.AddListener(GenerateParametersFromIndex);
     optionsDropDown.onValueChanged.AddListener(OptionSelected);
     optionsDropDown.SetValueWithoutNotify(-1);
 }
Exemple #3
0
        public void Start()
        {
            ConfigField = configField as ArtifactBlacklistField;
            if (ConfigField == null)
            {
                return;
            }

            dropdown.options = ArtifactCatalog.artifactDefs.Select(def => new TMP_Dropdown.OptionData(Language.GetString(def.nameToken))).ToList();
            dropdown.options.Add(new TMP_Dropdown.OptionData());

            if (tooltipProvider)
            {
                tooltipProvider.SetContent(ConfigField.Tooltip);
            }

            if (fieldText)
            {
                fieldText.text = ConfigField.DisplayName;
            }

            var value = ConfigField.GetValue();

            foreach (var item in value)
            {
                AddNewItem(item, true);
            }
            dropdown.SetValueWithoutNotify(dropdown.options.Count - 1);
        }
Exemple #4
0
    private void MemoryToUI()
    {
        resolutionDropdown.ClearOptions();
        foreach (Resolution r in resolutions)
        {
            resolutionDropdown.options.Add(new TMP_Dropdown.OptionData(r.ToString()));
        }
        if (resolutions.Count > 1)
        {
            // I believe there's a bug in TMP_Dropdown 2.1.1:
            // SetValueWithoutNotify(0) clears the label, even if the
            // 0-st option is not empty.
            //
            // Setting a non-0 value works around it.
            resolutionDropdown.SetValueWithoutNotify(1);
        }
        resolutionDropdown.SetValueWithoutNotify(resolutionIndex);

        fullscreenDropdown.ClearOptions();
        foreach (FullScreenMode m in System.Enum.GetValues(typeof(FullScreenMode)))
        {
            fullscreenDropdown.options.Add(new TMP_Dropdown.OptionData(m.ToString()));
        }
        fullscreenDropdown.SetValueWithoutNotify(1);
        fullscreenDropdown.SetValueWithoutNotify((int)options.fullScreenMode);

        vSyncToggle.SetIsOnWithoutNotify(options.vSync);

        masterVolumeSlider.SetValueWithoutNotify(options.masterVolume);
        musicVolumeSlider.SetValueWithoutNotify(options.musicVolume);
        keysoundVolumeSlider.SetValueWithoutNotify(options.keysoundVolume);
        sfxVolumeSlider.SetValueWithoutNotify(options.sfxVolume);
    }
Exemple #5
0
    public void LevelTypeChanged(TMP_Dropdown change)
    {
        switch (change.value)
        {
        case 0:
            controlTypeDropdown.enabled = true;
            normalLevels.SetActive(true);
            challengeLevels.SetActive(false);
            metroidLevels.SetActive(false);

            break;

        case 1:
            controlTypeDropdown.SetValueWithoutNotify(0);
            controlTypeDropdown.enabled = false;
            normalLevels.SetActive(false);
            challengeLevels.SetActive(true);
            metroidLevels.SetActive(false);
            break;

        case 2:
            controlTypeDropdown.SetValueWithoutNotify(1);
            controlTypeDropdown.enabled = false;
            normalLevels.SetActive(false);
            challengeLevels.SetActive(false);
            metroidLevels.SetActive(true);
            break;
        }
    }
        void OnStateDataChanged(UIStateData data)
        {
            m_DialogButtonImage.enabled = data.activeDialog == DialogType.SceneOptions;

            if (m_CurrentsSceneOptionData == data.sceneOptionData)
            {
                return;
            }

            if (m_CurrentsSceneOptionData.enableTexture != data.sceneOptionData.enableTexture)
            {
                m_TextureToggle.on = data.sceneOptionData.enableTexture;
            }

            if (m_CurrentsSceneOptionData.enableLightData != data.sceneOptionData.enableLightData)
            {
                m_LightDataToggle.on = data.sceneOptionData.enableLightData;
            }

            if (m_CurrentsSceneOptionData.skyboxData != data.sceneOptionData.skyboxData)
            {
                if (data.sceneOptionData.skyboxData.skyboxType == SkyboxType.Light)
                {
                    m_SkyboxDropdown.SetValueWithoutNotify(0);
                }
                else if (data.sceneOptionData.skyboxData.skyboxType == SkyboxType.Dark)
                {
                    m_SkyboxDropdown.SetValueWithoutNotify(1);
                }
                else
                {
                    m_SkyboxDropdown.SetValueWithoutNotify(2);
                }
            }


            if (m_CurrentsSceneOptionData.enableClimateSimulation != data.sceneOptionData.enableClimateSimulation)
            {
                m_SimulationToggle.on = data.sceneOptionData.enableClimateSimulation;
            }

            if (m_CurrentsSceneOptionData.weatherType != data.sceneOptionData.weatherType)
            {
                if (data.sceneOptionData.weatherType == WeatherType.HeavyRain)
                {
                    m_WeatherDropdown.SetValueWithoutNotify(0);
                }
                else if (data.sceneOptionData.weatherType == WeatherType.Sunny)
                {
                    m_WeatherDropdown.SetValueWithoutNotify(1);
                }
            }

            m_TemperatureControl.SetValue(data.sceneOptionData.temperature);

            m_CurrentsSceneOptionData = data.sceneOptionData;
        }
 void Awake()
 {
     m_LocalizerDropdown.ClearOptions();
     m_LocalizerDropdown.AddOptions(new List <string>()
     {
         "v1.10", "v1.11"
     });
     m_LocalizerDropdown.SetValueWithoutNotify(localizer);
 }
 void OnWeatherTypeChanged(WeatherType newData)
 {
     if (newData == WeatherType.HeavyRain)
     {
         m_WeatherDropdown.SetValueWithoutNotify(0);
     }
     else if (newData == WeatherType.Sunny)
     {
         m_WeatherDropdown.SetValueWithoutNotify(1);
     }
 }
Exemple #9
0
    private void MemoryToUI()
    {
        // Graphics

        resolutionDropdown.ClearOptions();
        foreach (Resolution r in resolutions)
        {
            resolutionDropdown.options.Add(
                new TMP_Dropdown.OptionData(r.ToString()));
        }
        if (resolutions.Count > 1)
        {
            // I believe there's a bug in TMP_Dropdown 2.1.1:
            // SetValueWithoutNotify(0) clears the label, even if the
            // 0-st option is not empty.
            //
            // Setting a non-0 value works around it.
            resolutionDropdown.SetValueWithoutNotify(1);
        }
        resolutionDropdown.SetValueWithoutNotify(resolutionIndex);

        fullscreenDropdown.ClearOptions();
        foreach (FullScreenMode m in
                 System.Enum.GetValues(typeof(FullScreenMode)))
        {
            fullscreenDropdown.options.Add(
                new TMP_Dropdown.OptionData(m.ToString()));
        }
        fullscreenDropdown.SetValueWithoutNotify(1);
        fullscreenDropdown.SetValueWithoutNotify(
            (int)Options.instance.fullScreenMode);

        vSyncToggle.SetIsOnWithoutNotify(Options.instance.vSync);

        // Audio

        masterVolumeSlider.SetValueWithoutNotify(
            Options.instance.masterVolume);
        musicVolumeSlider.SetValueWithoutNotify(
            Options.instance.musicVolume);
        keysoundVolumeSlider.SetValueWithoutNotify(
            Options.instance.keysoundVolume);
        sfxVolumeSlider.SetValueWithoutNotify(
            Options.instance.sfxVolume);
        UpdateVolumeDisplay();

        UIUtils.MemoryToDropdown(audioBufferDropdown,
                                 Options.instance.audioBufferSize.ToString(),
                                 defaultValue: 0);

        // Miscellaneous

        latencyDisplay.text = $"{Options.instance.touchOffsetMs}/{Options.instance.touchLatencyMs}/{Options.instance.keyboardMouseOffsetMs}/{Options.instance.keyboardMouseLatencyMs} ms";
    }
Exemple #10
0
    // Start is called before the first frame update
    void Start()
    {
        deleteButton.onClick.AddListener(DeleteInteraction);
        saveVRTarget = data.vrIndex;
        // Possible VR Input
        OnVRInputChanged(addInteractionParentUI.parent.saveSystem.CurrentData.VRInteractions);
        vrInputDropdown.onValueChanged.AddListener(delegate { OnVRInteractionChanged(vrInputDropdown); });
        addInteractionParentUI.parent.saveSystem.CurrentData.OnVRInteractionsChange += OnVRInputChanged;

        // Possible Gene
        OnGenesChanged(addInteractionParentUI.parent.saveSystem.CurrentData.Genes);
        geneDropdown.onValueChanged.AddListener(delegate { OnGeneInputChange(geneDropdown); });
        addInteractionParentUI.parent.saveSystem.CurrentData.OnGenesChange += OnGenesChanged;

        // Possible Variable
        names = new string[typeof(GeneticBehavior).GetFields().Length];
        variableDropdown.options.Clear();
        for (int i = 0; i < typeof(GeneticBehavior).GetFields().Length; i++)
        {
            variableDropdown.options.Add(new TMP_Dropdown.OptionData()
            {
                text = typeof(GeneticBehavior).GetFields()[i].Name
            });
            names[i] = typeof(GeneticBehavior).GetFields()[i].Name;
        }
        variableDropdown.onValueChanged.AddListener(delegate { OnVariableChanged(variableDropdown); });

        // load or create data
        if (data.init == false) // if new interaction
        {
            data.vrIndex       = 0;
            data.geneIndex     = 0;
            data.variableIndex = 0;
            data.min           = 0f;
            data.max           = 1f;
            addInteractionParentUI.parent.saveSystem.CurrentData.AddGeneInteraction(data);
            data.init = true;
        }
        vrInputDropdown.SetValueWithoutNotify(data.vrIndex);
        OnVRInteractionChanged(vrInputDropdown);

        propInfo = typeof(GeneticBehavior).GetField(names[data.variableIndex]);
        variableDropdown.SetValueWithoutNotify(data.variableIndex);
        geneDropdown.SetValueWithoutNotify(data.geneIndex);

        min.text = (data.min).ToString();
        max.text = (data.max).ToString();
        min.onValueChanged.AddListener(delegate { OnMinMaxChange(min); });
        max.onValueChanged.AddListener(delegate { OnMinMaxChange(max); });
    }
 void OnSkyboxDataChanged(SkyboxData newData)
 {
     if (newData.skyboxType == SkyboxType.Light)
     {
         m_SkyboxDropdown.SetValueWithoutNotify(0);
     }
     else if (newData.skyboxType == SkyboxType.Dark)
     {
         m_SkyboxDropdown.SetValueWithoutNotify(1);
     }
     else
     {
         m_SkyboxDropdown.SetValueWithoutNotify(2);
     }
 }
Exemple #12
0
 // Updates the value of dropdown so the new value points to
 // currentOptions if it is among the dropdown's options.
 public static void MemoryToDropdown(TMP_Dropdown dropdown,
                                     string currentOption, int defaultValue = 0)
 {
     for (int i = 0; i < dropdown.options.Count; i++)
     {
         if (dropdown.options[i].text == currentOption)
         {
             dropdown.SetValueWithoutNotify(i);
             dropdown.RefreshShownValue();
             return;
         }
     }
     dropdown.SetValueWithoutNotify(defaultValue);
     dropdown.RefreshShownValue();
 }
Exemple #13
0
    private void AddResolutionAsOptions()
    {
        Resolution[] resolutions = (Resolution[])Screen.resolutions.Select(resolution => new Resolution {
            width = resolution.width, height = resolution.height
        }).Distinct().ToArray();
        List <string> options = new List <string>();

        for (int i = 0; i < resolutions.Length; i++)
        {
            options.Add(resolutions[i].width + " x " + resolutions[i].height + " " + GetAspectRatio(resolutions[i]));
        }

        _dropdown.AddOptions(options);
        _dropdown.SetValueWithoutNotify(GetResolutionIndex(Screen.width, Screen.height));
    }
Exemple #14
0
    // Start is called before the first frame update
    void Start()
    {
        _dropdown = GetComponentInChildren <TMP_Dropdown>();
        if (_dropdown == null)
        {
            Debug.Log("Could not find dropdown child!");
            return;
        }

        String[] qualities        = QualitySettings.names;
        int      activeQuality    = QualitySettings.GetQualityLevel();
        int      preferredQuality = PlayerPrefs.GetInt("Quality", activeQuality);

        QualitySettings.SetQualityLevel(preferredQuality, true);
        List <string> qualityOptions = new List <string>();

        foreach (var quality in qualities)
        {
            qualityOptions.Add(quality);
        }

        _dropdown.ClearOptions();
        _dropdown.AddOptions(qualityOptions);
        _dropdown.SetValueWithoutNotify(preferredQuality);

        _dropdown.onValueChanged.AddListener(delegate(int choice) { SetQuality(choice); });
    }
Exemple #15
0
    void GenerateDropdownContent()
    {
        dropDown.ClearOptions();

        dropDown.options = new List <TMP_Dropdown.OptionData>();

        List <TMP_Dropdown.OptionData> optionsList = new List <TMP_Dropdown.OptionData>();

        foreach (DCLBuilderInWorldEntity entity in entitiesList)
        {
            var item = new TMP_Dropdown.OptionData();
            item.text = entity.GetDescriptiveName();
            if (entitySpriteDict.ContainsKey(entity))
            {
                item.image = entitySpriteDict[entity];
            }
            optionsList.Add(item);
        }

        dropDown.AddOptions(optionsList);


        string value = (string)GetParameterValue();

        for (int i = 0; i < entitiesList.Count; i++)
        {
            if (entitiesList[i].rootEntity.entityId == value)
            {
                dropDown.SetValueWithoutNotify(i);
            }
        }
    }
    private void Awake()
    {
        playerScript = playerObject.GetComponent <PlayerMovement>();
        playerCombat = playerObject.GetComponent <PlayerCombat>();
        playerBow    = playerObject.GetComponent <Bow>();

        if (PlayerPrefs.HasKey("Volume"))
        {
            SetVolume(PlayerPrefs.GetFloat("Volume"));
            volumeSlider.value = PlayerPrefs.GetFloat("Volume");
        }
        if (PlayerPrefs.HasKey("isFullscreen"))
        {
            if (PlayerPrefs.GetString("isFullscreen") == "False")
            {
                fullscreenToggle.isOn = false;
            }
            else
            {
                fullscreenToggle.isOn = true;
            }
        }
        if (PlayerPrefs.HasKey("ResolutionIndex"))
        {
            resolutionDropdown.SetValueWithoutNotify(PlayerPrefs.GetInt("ResolutionIndex"));
        }
    }
    private void GenerateEntityDropdownContent()
    {
        entityDropDown.ClearOptions();

        entityDropDown.options = new List <TMP_Dropdown.OptionData>();

        List <TMP_Dropdown.OptionData> optionsList = new List <TMP_Dropdown.OptionData>();

        int index      = 0;
        int indexToUse = 0;

        foreach (DCLBuilderInWorldEntity entity in filteredList)
        {
            var item = new TMP_Dropdown.OptionData();
            item.text = entity.GetDescriptiveName();
            if (entitySpriteDict.ContainsKey(entity))
            {
                item.image = entitySpriteDict[entity];
            }
            optionsList.Add(item);

            if (!string.IsNullOrEmpty(actionEvent.smartItemActionable.entityId) &&
                entity.rootEntity.entityId == actionEvent.smartItemActionable.entityId)
            {
                indexToUse = index;
            }

            index++;
        }

        entityDropDown.AddOptions(optionsList);
        entityDropDown.SetValueWithoutNotify(indexToUse);
    }
    private void GenerateActionDropdownContent(SmartItemAction[] actions)
    {
        actionDropDown.ClearOptions();

        actionDropDown.options = new List <TMP_Dropdown.OptionData>();

        List <string> optionsLabelList = new List <string>();
        int           index            = 0;
        int           indexToUse       = 0;

        foreach (SmartItemAction action in actions)
        {
            optionsLabelList.Add(action.label);
            if (!string.IsNullOrEmpty(actionEvent.smartItemActionable.actionId) &&
                action.id == actionEvent.smartItemActionable.actionId)
            {
                indexToUse = index;
            }

            index++;
        }

        actionDropDown.AddOptions(optionsLabelList);
        actionDropDown.SetValueWithoutNotify(indexToUse);
    }
    void GiveResos()
    {
        resolutions = Screen.resolutions;

        delReso = new List <Resolution>();

        foreach (Resolution reso in resolutions)
        {
            delReso.Add(reso);
        }

        for (int i = 0; i < delReso.Capacity; i++)
        {
            if (resolutions[i].width != Mathf.Ceil((float)resolutions[i].height * aspectRatioA / aspectRatioB))
            {
                delReso.RemoveAt(i);
            }
        }

        resolutions = delReso.ToArray();

        foreach (Resolution reso in resolutions)
        {
            resoDropdown.options.Add(new TMP_Dropdown.OptionData()
            {
                text = reso.width + "x" + reso.height
            });
        }

        resoDropdown.SetValueWithoutNotify(resoDropdown.options.Capacity);
    }
Exemple #20
0
    void Start()
    {
        dropdown = GetComponent <TMP_Dropdown>();

        for (int i = 0; i < ManyMouseWrapper.MouseCount; i++)
        {
            mouseDevices.Add(ManyMouseWrapper.MouseDeviceName(i));
        }
        dropdown.AddOptions(mouseDevices);

        int selection;

        if (player == Player.PlayerA)
        {
            selection = PlayerPrefs.GetInt("MouseIdA", defaultSelection);
        }
        else
        {
            selection = PlayerPrefs.GetInt("MouseIdB", defaultSelection);
        }

        if (selection > ManyMouseWrapper.MouseCount)
        {
            selection = defaultSelection;
        }

        dropdown.SetValueWithoutNotify(selection);
    }
Exemple #21
0
        public void ResetDeveloperSettings()
        {
            m_ResolutionDropdown.SetValueWithoutNotify(0);
            resolution = 0;
            //m_LocalizerDropdown.SetValueWithoutNotify(1);
            //localizer = 1;
            m_MapDetailLevelInput.SetTextWithoutNotify(1024.ToString());
            mapDetailLevel = 1024;
            m_ServerLocalizationWithIdsToggle.SetIsOnWithoutNotify(true);
            serverLocalizationWithIds = true;
            m_ListOnlyNearbyMapsToggle.SetIsOnWithoutNotify(false);
            listOnlyNearbyMaps = false;
            m_DownsampleWhenLocalizingToggle.SetIsOnWithoutNotify(false);
            downsampleWhenLocalizing = false;
            m_UseDifferentARSpacesToggle.SetIsOnWithoutNotify(true);
            useDifferentARSpaces = true;
            m_PreservePosesToggle.SetIsOnWithoutNotify(false);
            preservePoses = false;

            /*m_Param1Input.SetTextWithoutNotify(0.ToString());
             * param1 = 0;
             * m_Param2Input.SetTextWithoutNotify(12.ToString());
             * param2 = 12;
             * m_Param3Input.SetTextWithoutNotify(0f.ToString());
             * param3 = 0f;
             * m_Param4Input.SetTextWithoutNotify(2f.ToString());
             * param4 = 2f;*/

            SaveSettingsToPrefs();
        }
        private void ApplySettingsVisual(SettingsModel settingsModel)
        {
            int GetPotBase(int value)
            {
                var counter = 0;

                while (value > 1)
                {
                    value >>= 1;
                    counter++;
                }
                return(counter);
            }

            _msaaDropdown.SetValueWithoutNotify(GetPotBase(settingsModel.MSAA));
            _framerateDropdown.SetValueWithoutNotify(GetPotBase(settingsModel.TargetFramerate / 15));
            _particleTypeDropdown.SetValueWithoutNotify((int)settingsModel.ParticleType);
            _attractionSlider.SetValueWithoutNotify(settingsModel.Attraction);
            _attractionValueLabel.text = settingsModel.Attraction.ToString("N1");
            _repulsionSlider.SetValueWithoutNotify(settingsModel.Repulsion);
            _repulsionValueLabel.text = settingsModel.Repulsion.ToString("N2");
            _dampingSlider.SetValueWithoutNotify(settingsModel.Damping);
            _dampingValueLabel.text = settingsModel.Damping.ToString("N1");
            _particlesCountSlider.SetValueWithoutNotify(1 / settingsModel.ParticlesScale);
            _backgroundColor.color = settingsModel.BackgroundColor;
            _repulsionDropdown.SetValueWithoutNotify((int)settingsModel.RepulsionMode);
            _brightnessSlider.SetValueWithoutNotify(settingsModel.Brightness);
            _brightnessValueLabel.text = settingsModel.Brightness.ToString("N0");
            _saturationSlider.SetValueWithoutNotify(settingsModel.Saturation);
            _saturationValueLabel.text = settingsModel.Saturation.ToString("N0");
            _contrastSlider.SetValueWithoutNotify(settingsModel.Contrast);
            _contrastValueLabel.text = settingsModel.Contrast.ToString("N0");
        }
        public void Start()
        {
            ConfigField = configField as EnumConfigField;
            if (ConfigField == null)
            {
                return;
            }

            if (fieldText)
            {
                fieldText.text = ConfigField.DisplayName;
            }

            if (tooltipProvider)
            {
                tooltipProvider.SetContent(ConfigField.Tooltip);
            }

            foreach (var option in ConfigField.Options)
            {
                dropdown.options.Add(new TMP_Dropdown.OptionData(option));
            }

            var value = ConfigField.Values.IndexOf(ConfigField.GetValue());

            if (value == dropdown.value)
            {
                return;
            }
            dropdown.SetValueWithoutNotify(value);
        }
Exemple #24
0
    internal override void Show(bool isForce)
    {
        Show(isForce);

        if (!isInit)
        {
            isInit = true;
            Init();
        }

        enableAudioOnToggle.SetIsOnWithoutNotify(AudioManager.Instance.IsEnabled);
        mainVolumeSlider.SetValueWithoutNotify(AudioManager.Instance.GetVolume(AudioManager.AudioChannel.Master));
        musicVolumeSlider.SetValueWithoutNotify(AudioManager.Instance.GetVolume(AudioManager.AudioChannel.Music));
        soundVolumeSlider.SetValueWithoutNotify(AudioManager.Instance.GetVolume(AudioManager.AudioChannel.Sound));

        videoOptionsData.Load();

        fullscreenOnToggle.SetIsOnWithoutNotify(videoOptionsData.isFullscreen);
        for (ushort i = 0; i < videoOptionsData.avaliableResolutions.Length; ++i)
        {
            if (Screen.currentResolution.height == videoOptionsData.avaliableResolutions[i].height &&
                Screen.currentResolution.width == videoOptionsData.avaliableResolutions[i].width)
            {
                resolutionDropdown.SetValueWithoutNotify(i);
                videoOptionsData.resolution = videoOptionsData.avaliableResolutions[i];
                break;
            }
        }
    }
    private void Awake()
    {
        MasterVolumeSlider.value = masterVolume;
        MusicVolumeSlider.value  = musicVolume;
        SFXVolumeSlider.value    = sfxVolume;
        FullScreenToggle.SetIsOnWithoutNotify(Screen.fullScreen);
        FullScreenToggle.onValueChanged.AddListener(SetFullScreen);

        resolutions = Screen.resolutions;

        List <string> ops          = new List <string>(resolutions.Length);
        int           currentIndex = 0;

        for (int i = 0; i < resolutions.Length; i++)
        {
            Resolution r = resolutions[i];
            ops.Add($"{r.width}x{r.height}");
            if (r.width == Screen.width && r.height == Screen.height)
            {
                currentIndex = i;
            }
        }
        ResolutionDropdown.AddOptions(ops);
        ResolutionDropdown.RefreshShownValue();
        ResolutionDropdown.SetValueWithoutNotify(currentIndex);

        ResolutionDropdown.onValueChanged.AddListener(SetResolution);
    }
Exemple #26
0
    private void Start()
    {
        dropdown.gameObject.SetActive(false);
        if (block.GetType() == typeof(BlockDetectCollider))
        {
            textBlock.text = "Detection de la Collision";
        }
        else if (block.GetType() == typeof(BlockDetectColor))
        {
            textBlock.text = "Detection de la Couleur";
        }
        else
        {
            switch (block.type)
            {
            case BlockType.Bool:
                textBlock.text = block.GetBool() ? "True" : "False";
                break;

            case BlockType.Color:
                textBlock.text = "Couleur";
                dropdown.gameObject.SetActive(true);
                dropdown.ClearOptions();
                List <string> colors = StatesColorExtends.ToList();
                dropdown.AddOptions(colors);
                StatesColor.StatesColorType color = block.GetColor();
                dropdown.SetValueWithoutNotify((int)color);
                break;
            }
        }
    }
    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;
    }
        void OnCameraViewTypeChanged(ICameraViewOption type)
        {
            if (type == null)
            {
                return;
            }

            int cameraViewTypeIndex = 0;

            switch (type.cameraViewType)
            {
            case SetCameraViewTypeAction.CameraViewType.Default:
                cameraViewTypeIndex = -1;
                break;

            case SetCameraViewTypeAction.CameraViewType.Top:
                cameraViewTypeIndex = 0;
                break;

            case SetCameraViewTypeAction.CameraViewType.Left:
                cameraViewTypeIndex = 1;
                break;

            case SetCameraViewTypeAction.CameraViewType.Right:
                cameraViewTypeIndex = 2;
                break;
            }
            if (cameraViewTypeIndex != -1)
            {
                m_CameraViewDropdown.SetValueWithoutNotify(cameraViewTypeIndex);
            }
        }
Exemple #29
0
        private void NewSelection(DialogEventListItem selection)
        {
            if (lastSelected && selection.transform != lastSelected)
            {
                lastSelected.Select(false);
            }
            lastSelected = selection;

            selection.Select(true);

            durationInput.text = selection.dialogEvent.duration.ToString();

            toggleL.SetIsOnWithoutNotify(selection.dialogEvent.leftCharacter);

            eventTypeDropdown.SetValueWithoutNotify((int)selection.dialogEvent.type);
            eventTypeDropdown.RefreshShownValue();

            if (selection.dialogEvent.CharacterData)
            {
                int index = characterDropdown.options.FindIndex(
                    x => x.text.Equals(selection.dialogEvent.CharacterData.name));
                characterDropdown.SetValueWithoutNotify(index);
                characterDropdown.RefreshShownValue();
            }

            textInput.text          = selection.dialogEvent.text;
            animTriggerInput.text   = selection.dialogEvent.animationTrigger;
            spriteTriggerInput.text = selection.dialogEvent.spriteTrigger;

            targetXInput.text = selection.dialogEvent.target.x.ToString();
            targetYInput.text = selection.dialogEvent.target.y.ToString();

            ToggleInputs(selection.dialogEvent.type);
        }
    public override void SetInfo()
    {
        base.SetInfo();

        dropDown.options = new List <TMP_Dropdown.OptionData>();

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

        foreach (SmartItemParameter.OptionsParameter options in currentParameter.options)
        {
            optionsLabelList.Add(options.label);
        }

        dropDown.AddOptions(optionsLabelList);

        string value = (string)GetParameterValue();

        for (int i = 0; i < currentParameter.options.Length; i++)
        {
            if (currentParameter.options[i].value == value)
            {
                dropDown.SetValueWithoutNotify(i);
            }
        }
    }