void Start()
 {
     dropdown   = GameObject.Find("Alignment_Dropdown").GetComponent <TMPro.TMP_Dropdown>();
     controller = GameObject.Find("UI_Controller").GetComponent <WUI_Component>();
     dropdown.AddOptions(alignment);
     Debug.Log(dropdown == null);
 }
    public void Start()
    {
        // Get the control buttons references
        initialize_btn = GameObject.Find("InitButton").GetComponent <UnityEngine.UI.Button>();
        step_btn       = GameObject.Find("Step1Button").GetComponent <UnityEngine.UI.Button>();
        finish_btn     = GameObject.Find("FinishGenButton").GetComponent <UnityEngine.UI.Button>();
        plates_btn     = GameObject.Find("PlatesModeButton").GetComponent <UnityEngine.UI.Button>();
        geography_btn  = GameObject.Find("GeographyModeButton").GetComponent <UnityEngine.UI.Button>();
        height_btn     = GameObject.Find("HeightModeButton").GetComponent <UnityEngine.UI.Button>();

        // Get the option fields references
        seed_option         = GameObject.Find("SeedField").GetComponent <TMPro.TMP_InputField>();
        map_size_option     = GameObject.Find("MapSize").GetComponent <TMPro.TMP_Dropdown>();
        water_level_option  = GameObject.Find("WaterLevel").GetComponent <TMPro.TMP_Dropdown>();
        climate_option      = GameObject.Find("Climate").GetComponent <TMPro.TMP_Dropdown>();
        resources_option    = GameObject.Find("ResourcesLevel").GetComponent <TMPro.TMP_Dropdown>();
        distribution_option = GameObject.Find("Distribution").GetComponent <TMPro.TMP_Dropdown>();

        // Get the info labels references
        steps_info = GameObject.Find("StepsLabel").GetComponent <TMPro.TextMeshProUGUI>();

        // Set the options on the gui
        seed_option.text          = seed_value.ToString();
        map_size_option.value     = map_size_value;
        water_level_option.value  = water_level_value;
        climate_option.value      = climate_value;
        resources_option.value    = resources_value;
        distribution_option.value = distribution_value;
    }
Exemple #3
0
    private void Awake()
    {
        //BarChart = transform.Find("barChartBtn").GetComponent<Button_UI>();
        //LineChart = transform.Find("lineGraphBtn").GetComponent<Button_UI>();

        graphContainer = transform.Find("graphContainer").GetComponent <RectTransform>();
        labelTemplateX = graphContainer.Find("labelTemplateX").GetComponent <RectTransform>();
        labelTemplateY = graphContainer.Find("labelTemplateY").GetComponent <RectTransform>();
        //dashTemplateX = graphContainer.Find("dashTemplateX").GetComponent<RectTransform>();
        //dashTemplateY = graphContainer.Find("dashTemplateY").GetComponent<RectTransform>();

        gameObjectList = new List <GameObject>();

        List <int> valueList = new List <int>(15);

        System.Random randNum = new System.Random();
        yAxis = GameObject.Find("yAxis").GetComponent <TMPro.TMP_Dropdown>();
        string yAxisValue = yAxis.captionText.text;
        //print(yAxisValue);

        // yAxis_1 = GameObject.Find("yAxis_1").GetComponent<TMPro.TMP_Dropdown>();
        // string yAxisValue_1 = yAxis.captionText.text;
        // print(yAxisValue_1);
        //GraphFlag = true;
    }
Exemple #4
0
    void Start()
    {
        Drop = GetComponent <TMP_Dropdown>();

        selecionado = PlayerPrefs.GetInt("Skin");

        Drop.value = selecionado;
    }
    public static void SetValue(this TMPro.TMP_Dropdown instance, int value)
    {
        var originalEvent = instance.onValueChanged;

        instance.onValueChanged = emptyTMDropdownFieldEvent;
        instance.value          = value;
        instance.onValueChanged = originalEvent;
    }
Exemple #6
0
    private void OnEnable()
    {
        dropdown = GetComponent <TMPro.TMP_Dropdown>();
        dropdown.ClearOptions();
        var names = new List <string>();

        PlayerContainer.contents.ForEach(item => names.Add(item.name));
        dropdown.AddOptions(names);
    }
Exemple #7
0
 void Start()
 {
     //Fetch the Dropdown GameObject
     myDropdown = GetComponent <TMPro.TMP_Dropdown>();
     //Add listener for when the dropdown is changed
     myDropdown.onValueChanged.AddListener(delegate {
         DropdownValueChanged(myDropdown);
     });
 }
Exemple #8
0
    public void updateText()
    {
        string alertmessage  = "";
        string value1        = "";
        string value         = "";
        double thresholdval  = 2.0F;
        int    experimentVal = 0;

        InputAlgorithm = GameObject.Find("Algorithm").GetComponent <TMPro.TMP_Dropdown>();
        string InputAlgorithmValue = InputAlgorithm.captionText.text;

        MazeSize = GameObject.Find("MazeSize").GetComponent <TMPro.TMP_Dropdown>();
        string    MazeSizeValue = MazeSize.captionText.text;
        TestSuite ts            = new TestSuite();

        try
        {
            value1        = NumberOfExperiments.text;
            experimentVal = int.Parse(value1);
        }
        catch (FormatException fe)
        {
            alertmessage += "Kindly enter the value of Number of Experiments or Enter values in range 1 to 100";
            Result.text   = alertmessage;
        }

        try
        {
            value        = Thresholdvalue.text;
            thresholdval = float.Parse(value);
        }
        catch (FormatException fe)
        {
            alertmessage += "Kindly enter the value of Placement Threshold or Enter values in range 0 to 1";
            Result.text   = alertmessage;
        }
        SensorType = GameObject.Find("SensorType").GetComponent <TMPro.TMP_Dropdown>();
        string SensorTypeValue = SensorType.captionText.text;


        if ((!string.IsNullOrEmpty(value) && (thresholdval >= 0 && thresholdval <= 1)) && !string.IsNullOrEmpty(value1) && (experimentVal >= 1 && experimentVal <= 100))
        {
            string updatedmessage = "Simulation is running with " + InputAlgorithmValue + " as Algorithm Type, " + value + " as Threshold Value, " + MazeSizeValue + " as Maze Size, " + SensorTypeValue + " as sensors on" + ExperimentType.captionText.text + " with " + experimentVal + " Experiments";
            Result.text = updatedmessage;
            database db = new database();
            thresholdval = Math.Round(thresholdval, 2);
            inputs       = new string[] { InputAlgorithmValue, MazeSizeValue, SensorTypeValue, ExperimentType.captionText.text };
            ts.testUpdateText(inputs);
            db.Insert(InputAlgorithmValue, MazeSizeValue, thresholdval, SensorTypeValue, ExperimentType.captionText.text);
        }
        else
        {
            alertmessage = "Kindly enter the valid Values";
            Result.text  = alertmessage;
        }
    }
    public void Awake()
    {
        //referencing UI_Controller_Script
        Game_Manager  = GameObject.Find("Game_Manager");
        ui_controller = Game_Manager.GetComponent <UI_Controller_Script>();

        back_button = GameObject.Find("back_button").GetComponent <Button>();
        back_button.onClick.AddListener(ui_controller.back_button);

        //reading name and alignment from the inputfield
        input_alignment = GameObject.Find("input_alignment").GetComponent <InputField>();
        input_alignment.onEndEdit.AddListener(delegate { ui_controller.read_alignment(input_alignment); });
        inputfield_name = GameObject.Find("inputfield_name").GetComponent <InputField>();
        inputfield_name.onEndEdit.AddListener(delegate { ui_controller.read_char_name(inputfield_name); });

        //reading race and class from dropdowns
        Dropdown_Race = GameObject.Find("Dropdown_Race").GetComponent <TMPro.TMP_Dropdown>();
        Dropdown_Race.onValueChanged.AddListener(delegate { ui_controller.race_selected(Dropdown_Race); });
        Dropdown_Class = GameObject.Find("Dropdown_Class").GetComponent <TMPro.TMP_Dropdown>();
        Dropdown_Class.onValueChanged.AddListener(delegate { ui_controller.class_selected(Dropdown_Class); });

        //referencing ability buttons
        strength_button     = GameObject.Find("strength_button").GetComponent <Button>();
        dexterity_button    = GameObject.Find("dexterity_button").GetComponent <Button>();
        constitution_button = GameObject.Find("constitution_button").GetComponent <Button>();
        intelligence_button = GameObject.Find("intelligence_button").GetComponent <Button>();
        wisdom_button       = GameObject.Find("wisdom_button").GetComponent <Button>();
        charisma_button     = GameObject.Find("charisma_button").GetComponent <Button>();

        //referencing output Gameobjects
        score_strength     = GameObject.Find("score_strength").GetComponent <TMPro.TMP_Text>();
        score_dexterity    = GameObject.Find("score_dexterity").GetComponent <TMPro.TMP_Text>();
        score_constitution = GameObject.Find("score_constitution").GetComponent <TMPro.TMP_Text>();
        score_intelligence = GameObject.Find("score_intelligence").GetComponent <TMPro.TMP_Text>();
        score_wisdom       = GameObject.Find("score_wisdom").GetComponent <TMPro.TMP_Text>();
        score_charisma     = GameObject.Find("score_charisma").GetComponent <TMPro.TMP_Text>();

        //adding listener functions to roll buttons
        strength_button.onClick.AddListener(delegate { ui_controller.ability_button_clicked(strength_button, score_strength, 's'); });
        dexterity_button.onClick.AddListener(delegate { ui_controller.ability_button_clicked(dexterity_button, score_dexterity, 'd'); });
        constitution_button.onClick.AddListener(delegate { ui_controller.ability_button_clicked(constitution_button, score_constitution, 'c'); });
        intelligence_button.onClick.AddListener(delegate { ui_controller.ability_button_clicked(intelligence_button, score_intelligence, 'i'); });
        wisdom_button.onClick.AddListener(delegate { ui_controller.ability_button_clicked(wisdom_button, score_wisdom, 'w'); });
        charisma_button.onClick.AddListener(delegate { ui_controller.ability_button_clicked(charisma_button, score_charisma, 'm'); }); //I use m to flag "charisma"

        //referencing output button and text area
        json_button = GameObject.Find("json_button").GetComponent <Button>();
        json_text   = GameObject.Find("json_text").GetComponent <TMPro.TMP_Text>(); //inputfield was used so grader would be able to copy/paste JSON output

        //adding listener function to the output button
        json_button.onClick.AddListener(delegate { ui_controller.json_button_clicked(json_text); });


        json_copy = GameObject.Find("json_copy").GetComponent <Button>();
        json_copy.onClick.AddListener(delegate { ui_controller.copy_json(json_text); });
    }
Exemple #10
0
    private void Awake()
    {
        if (DropDown == null)
        {
            DropDown = this.GetComponent <TMPro.TMP_Dropdown>();
        }



        DropDown.AddOptions(GetOptions());
    }
    // Start is called before the first frame update
    void Start()
    {
        //find and set the toolprompt object
        toolPromptObject = GameObject.Find("ToolText");

        //find and set the toolprompt component
        toolPromptText = toolPromptObject.GetComponent <Text>();

        //find and set the drop down object
        dropDown = GameObject.Find("ToolMenu").GetComponent <TMPro.TMP_Dropdown>();
    }
 /// <summary>
 /// Set the anti aliasing level
 /// </summary>
 public void SetAntiAliasingLevel()
 {
     TMPro.TMP_Dropdown dropdown = antiAliasingDropdown.GetComponent <TMPro.TMP_Dropdown>();
     for (int i = 0; i < qualitySettings.Length; i++)
     {
         if (qualitySettings[i] == dropdown.itemText.text)
         {
             VideoHelper.SetQualityLevel(i);
         }
     }
 }
Exemple #13
0
 void Awake()
 {
     this._routes = new Dictionary <string, string>();
     this._routes.Add("server", "http://149.202.41.22:8080");
     this._routes.Add("user", "/api/user/");
     this._routes.Add("trainingId", "/api/training/");
     this._optionsDataList = new List <TMPro.TMP_Dropdown.OptionData>();
     this._optionsDatas    = this.gameObject.GetComponentInChildren <TMPro.TMP_Dropdown>();
     this._optionsDatas.ClearOptions();
     this._optionsDatas.AddOptions(this._optionsDataList);
 }
 public void SetGraphicsLevel(TMPro.TMP_Dropdown quality)
 {
     settings.GraphicsLevel = quality.value;
     if (MenuManager.Instance.GetCurrentMenu() == MenuType.settings)
     {
         QualitySettings.SetQualityLevel(quality.value);
     }
     else
     {
         QualitySettings.SetQualityLevel(quality.value, false);
     }
 }
 /// <summary>
 /// Set the speaker mode
 /// </summary>
 public void SetAudioSpeakerMode()
 {
     TMPro.TMP_Dropdown dropdown = speakerModesDropdown.GetComponent <TMPro.TMP_Dropdown>();
     foreach (KeyValuePair <string, AudioSpeakerMode> speakerMode in speakerModes)
     {
         if (speakerMode.Key == dropdown.itemText.text)
         {
             AudioHelper.SetAudioSpeakerMode(speakerMode.Value);
             return;
         }
     }
 }
Exemple #16
0
    private void changeControls(TMPro.TMP_Dropdown d)
    {
        print("sto cambiando i controlli");
        string controls = d.captionText.text;

        if (controls == "AD")
        {
            PlayerPrefs.SetString("controls", "AD");
        }
        else
        {
            PlayerPrefs.SetString("controls", "LR");
        }
    }
 /// <summary>
 /// Add items to the speaker mode settings dropdown and set the default
 /// </summary>
 protected void SetUpDisplayModeDropdown()
 {
     if (displayModeDropdown)
     {
         bool isFullScreen = VideoHelper.isFullscreen();
         int  selected     = isFullScreen ? 1 : 0;
         List <TMPro.TMP_Dropdown.OptionData> displayDropdownOptions = new List <TMPro.TMP_Dropdown.OptionData>();
         displayDropdownOptions.Add(new TMPro.TMP_Dropdown.OptionData("Windowed"));
         displayDropdownOptions.Add(new TMPro.TMP_Dropdown.OptionData("Fullscreen"));
         TMPro.TMP_Dropdown dropdown = displayModeDropdown.GetComponent <TMPro.TMP_Dropdown>();
         dropdown.options = displayDropdownOptions;
         dropdown.SetValueWithoutNotify(selected);
     }
 }
Exemple #18
0
 static int RefreshShownValue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         TMPro.TMP_Dropdown obj = (TMPro.TMP_Dropdown)ToLua.CheckObject <TMPro.TMP_Dropdown>(L, 1);
         obj.RefreshShownValue();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #19
0
 static int OnCancel(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         TMPro.TMP_Dropdown obj = (TMPro.TMP_Dropdown)ToLua.CheckObject <TMPro.TMP_Dropdown>(L, 1);
         UnityEngine.EventSystems.BaseEventData arg0 = (UnityEngine.EventSystems.BaseEventData)ToLua.CheckObject <UnityEngine.EventSystems.BaseEventData>(L, 2);
         obj.OnCancel(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #20
0
 static int SetValueWithoutNotify(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         TMPro.TMP_Dropdown obj = (TMPro.TMP_Dropdown)ToLua.CheckObject <TMPro.TMP_Dropdown>(L, 1);
         int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         obj.SetValueWithoutNotify(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    void Awake()
    {
        midiStreamSynthesizer = new StreamSynthesizer(44100, 2, bufferSize, 40);
        sampleBuffer          = new float[midiStreamSynthesizer.BufferSize];

        midiStreamSynthesizer.LoadBank(bankFilePath);

        midiSequencer = new MidiSequencer(midiStreamSynthesizer);

        instrumentSelect = GameObject.Find("Instrument Select").GetComponent <TMPro.TMP_Dropdown>();

        //These will be fired by the midiSequencer when a song plays. Check the console for messages if you uncomment these
        //midiSequencer.NoteOnEvent += new MidiSequencer.NoteOnEventHandler (MidiNoteOnHandler);
        //midiSequencer.NoteOffEvent += new MidiSequencer.NoteOffEventHandler (MidiNoteOffHandler);
    }
    void Start()
    {
        //Asigna el desplegable de resoluciones.
        TMPro.TMP_Dropdown dropdown = GetComponent <TMPro.TMP_Dropdown>();

        dropdown.options.RemoveAt(0);

        list = new List <Resolution>();

        //Mira si en el sistema ya hay una configuración de resolución guardada.
        if (PlayerPrefs.HasKey("Width") == false)
        {
            PlayerPrefs.SetInt("Width", Screen.currentResolution.width);
            PlayerPrefs.SetInt("Height", Screen.currentResolution.height);
            PlayerPrefs.SetInt("Hz", Screen.currentResolution.refreshRate);
            PlayerPrefs.Save();
        }

        //Comprueba el ratio de la pantalla.
        float aspect = (float)Display.main.systemWidth / (float)Display.main.systemHeight;

        //rellena el desplegable con resoluciones compatibles.
        for (int i = Screen.resolutions.Length - 1; i > 0; i--)
        {
            string resText = Screen.resolutions[i].width + " x " + Screen.resolutions[i].height + ", " + Screen.resolutions[i].refreshRate + "Hz";
            TMPro.TMP_Dropdown.OptionData data = new TMPro.TMP_Dropdown.OptionData(resText);

            if (Mathf.Approximately((float)Screen.resolutions[i].width / (float)Screen.resolutions[i].height, aspect))
            {
                dropdown.options.Add(data);
                list.Add(Screen.resolutions[i]);
            }
        }

        //Muestra la resolución actual como la seleccionada en el desplegable.
        bool found = false;

        for (int i = 0; i < list.Count && found == false; i++)
        {
            if (list[i].width == Screen.currentResolution.width && list[i].height == Screen.currentResolution.height)
            {
                found = true;
                Mute(dropdown.onValueChanged);
                dropdown.value = i;
                Unmute(dropdown.onValueChanged);
            }
        }
    }
Exemple #23
0
    public void Start()
    {
        //find and set the toolprompt object
        toolPromptObject = GameObject.Find("ToolPrompt");

        //find and set the toolprompt component
        toolPromptText = toolPromptObject.GetComponent <Text>();

        //find and set the drop down object
        dropDown = GameObject.Find("Dropdown").GetComponent <TMPro.TMP_Dropdown>();

        //set selected game object to the selected game object
        selectedGameObject = selection1;
        dropDown           = GameObject.Find("Dropdown").GetComponent <TMPro.TMP_Dropdown>();
        dropDown           = GameObject.Find("Dropdown").GetComponent <TMPro.TMP_Dropdown>();
    }
 /// <summary>
 /// Add items to the quality settings dropdown and set the default
 /// </summary>
 protected void SetUpQualitySettingsDropdown()
 {
     if (qualitySettingsDropdown)
     {
         qualitySettings = VideoHelper.GetQualityLevels();
         int current = VideoHelper.GetCurrentQualityLevel();
         List <TMPro.TMP_Dropdown.OptionData> qualityDropdownOptions = new List <TMPro.TMP_Dropdown.OptionData>();
         for (int i = 0; i < qualitySettings.Length; i++)
         {
             qualityDropdownOptions.Add(new TMPro.TMP_Dropdown.OptionData(qualitySettings[i]));
         }
         TMPro.TMP_Dropdown dropdown = qualitySettingsDropdown.GetComponent <TMPro.TMP_Dropdown>();
         dropdown.options = qualityDropdownOptions;
         dropdown.SetValueWithoutNotify(current);
     }
 }
    public void ChangeResolution()
    {
        TMPro.TMP_Dropdown dropdown = GameObject.Find("ResolutionDropdown").GetComponent <TMPro.TMP_Dropdown>();
        List <Resolution>  list     = dropdown.GetComponent <GetResolutions>().list;

        Resolution res = list[dropdown.value];

        bool fullscreen = Screen.fullScreen;

        Screen.SetResolution(res.width, res.height, fullscreen);

        PlayerPrefs.SetInt("Width", res.width);
        PlayerPrefs.SetInt("Height", res.height);
        PlayerPrefs.SetInt("Hz", res.refreshRate);
        PlayerPrefs.Save();
    }
Exemple #26
0
    static int set_value(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            TMPro.TMP_Dropdown obj = (TMPro.TMP_Dropdown)o;
            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
            obj.value = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index value on a nil value"));
        }
    }
Exemple #27
0
    static int set_onValueChanged(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            TMPro.TMP_Dropdown obj = (TMPro.TMP_Dropdown)o;
            TMPro.TMP_Dropdown.DropdownEvent arg0 = (TMPro.TMP_Dropdown.DropdownEvent)ToLua.CheckObject <TMPro.TMP_Dropdown.DropdownEvent>(L, 2);
            obj.onValueChanged = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onValueChanged on a nil value"));
        }
    }
Exemple #28
0
    static int set_options(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            TMPro.TMP_Dropdown obj = (TMPro.TMP_Dropdown)o;
            System.Collections.Generic.List <TMPro.TMP_Dropdown.OptionData> arg0 = (System.Collections.Generic.List <TMPro.TMP_Dropdown.OptionData>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List <TMPro.TMP_Dropdown.OptionData>));
            obj.options = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index options on a nil value"));
        }
    }
Exemple #29
0
    static int set_itemImage(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            TMPro.TMP_Dropdown   obj  = (TMPro.TMP_Dropdown)o;
            UnityEngine.UI.Image arg0 = (UnityEngine.UI.Image)ToLua.CheckObject <UnityEngine.UI.Image>(L, 2);
            obj.itemImage = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index itemImage on a nil value"));
        }
    }
Exemple #30
0
    static int set_itemText(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            TMPro.TMP_Dropdown obj  = (TMPro.TMP_Dropdown)o;
            TMPro.TMP_Text     arg0 = (TMPro.TMP_Text)ToLua.CheckObject <TMPro.TMP_Text>(L, 2);
            obj.itemText = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index itemText on a nil value"));
        }
    }