Example #1
0
    // Use this for initialization
    void Start()
    {
        Res = Screen.resolutions;

        resDropDown.ClearOptions();

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


        int currentScreenRes = 0;

        for (int x = 0; x < Res.Length; x++)
        {
            string option = Res[x].width + "+" + Res[x].height;
            options.Add(option);

            if (Res[x].width == Screen.currentResolution.width && Res[x].height == Screen.currentResolution.height)
            {
                currentScreenRes = x;
            }
        }
        resDropDown.AddOptions(options);
        resDropDown.value = currentScreenRes;
        resDropDown.RefreshShownValue();
    }
Example #2
0
    public void Start()
    {
        drop.ClearOptions();
        drop.AddOptions(new List <string>(Microphone.devices));

        this.UpdateAsObservable().Subscribe(
            _ => {
            if (!nowrecord)
            {
                return;
            }
            float[] data = new float[1];
            float vol    = 0;
            source.GetOutputData(data, 0);
            for (int i = 0; i < data.Length; i++)
            {
                vol += Mathf.Abs(data[i]);
            }
            vol /= 1f;
            Debug.Log(vol);
            if (vol >= 0.001f)
            {
                Debug.Log("volume:" + vol);
            }
        }
            );
    }
Example #3
0
    public void resetGUI()
    {
        modelDropdown.ClearOptions();
        textureDropdown.ClearOptions();

        List <string> modelOptions   = new List <string>();
        List <string> textureOptions = new List <string>();

        var info = new DirectoryInfo(loadPath);

        FileInfo[] fileInfo = info.GetFiles();
        foreach (FileInfo file in fileInfo)
        {
            if (file.Name.EndsWith(".obj"))
            {
                modelOptions.Add(file.Name);
            }

            else if (file.Name.EndsWith(".png") ||
                     file.Name.EndsWith(".jpg") ||
                     file.Name.EndsWith(".jpeg") ||
                     // file.Name.EndsWith(".psd") ||
                     file.Name.EndsWith(".bmp")
                     )
            {
                textureOptions.Add(file.Name);
            }
        }

        modelDropdown.AddOptions(modelOptions);
        textureDropdown.AddOptions(textureOptions);
    }
 static int ClearOptions(IntPtr L)
 {
     L.ChkArgsCount(1);
     UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)L.ChkUnityObjectSelf(1, "UnityEngine.UI.Dropdown");
     obj.ClearOptions();
     return(0);
 }
Example #5
0
 public void UpdateStoryLevelDropdown()
 {
     // Add Levels
     PlayLevelDropDown.ClearOptions();
     PlayLevelDropDown.AddOptions(GameManager.Instance.Story.GetAvailableLevels());
     PlayLevelDropDown.RefreshShownValue();
 }
Example #6
0
    public void FindParticipants()
    {
        UnityEngine.UI.Dropdown dropdown = GetComponent <UnityEngine.UI.Dropdown>();

        dropdown.ClearOptions();
        dropdown.AddOptions(new List <string>()
        {
            "Select participant", "New Participant"
        });

        string participantDirectory = manager.fileManager.ExperimentPath();

        if (Directory.Exists(participantDirectory))
        {
            string[]      filepaths = System.IO.Directory.GetDirectories(participantDirectory);
            List <string> filenames = new List <string>();

            for (int i = 0; i < filepaths.Length; i++)
            {
                if (manager.fileManager.isValidParticipant(System.IO.Path.GetFileName(filepaths[i])))
                {
                    filenames.Add(System.IO.Path.GetFileName(filepaths[i]));
                }
            }

            dropdown.AddOptions(filenames);
        }
        dropdown.value = 0;
        dropdown.RefreshShownValue();

        nextSessionNumber = 0;
        nextListNumber    = 0;
        UpdateTexts();
    }
Example #7
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    private void SetupMapSources()
    {
        m_mapSources = (o.ui != null) ? o.ui.mapSources : null;

        if (m_mapSources != null)
        {
            m_mapSources.ClearOptions();

            int nbSources = System.Enum.GetValues(typeof(WebMap.SOURCE)).Length;

            for (int source = 0; source < nbSources; ++source)
            {
                m_mapSources.options.Add(new UnityEngine.UI.Dropdown.OptionData(((WebMap.SOURCE)source).ToString()));
            }


            m_mapSources.onValueChanged.RemoveAllListeners();

            m_mapSources.onValueChanged.AddListener(delegate { OnMapSourceSelected(); });

            m_mapSources.value = ( int )((m_map != null) ? m_map.source : WebMap.DEFAULT_SOURCE);

            m_mapSources.RefreshShownValue();
        }
    }
 private void DisplayAvailablePorts()
 {
     arduinoDropdown.ClearOptions();
     string[] ports = SerialPort.GetPortNames();
     if (ports.Length > 0)
     {
         // OSX reports ports with "tty.*" extension but we need to use "cu.*"  to access it.
         if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer)
         {
             foreach (string port in ports)
             {
                 string p = port.Replace("/dev/tty", "/dev/cu");
                 arduinoDropdown.AddOptions(new List <string> {
                     p
                 });
             }
         }
         else
         {
             arduinoDropdown.AddOptions(ports.ToList());
         }
         arduinoDropdown.AddOptions(new List <string> {
             "Custom.."
         });
         serialPortInputField.text = arduinoDropdown.options[arduinoDropdown.value].text;
         arduinoDropdown.gameObject.SetActive(true);
         serialPortInputField.gameObject.SetActive(false);
     }
     else
     {
         arduinoDropdown.gameObject.SetActive(false);
         serialPortInputField.gameObject.SetActive(true);
         shouldRefresh = false;
     }
 }
Example #9
0
 static int ClearOptions(IntPtr L)
 {
     LuaScriptMgr.CheckArgsCount(L, 1);
     UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UnityEngine.UI.Dropdown");
     obj.ClearOptions();
     return(0);
 }
Example #10
0
 static public int ClearOptions(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.UI.Dropdown self = (UnityEngine.UI.Dropdown)checkSelf(l);
         self.ClearOptions();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 public void listMaps()
 {
     if (mapsDropdown != null)
     {
         mapsDropdown.ClearOptions();
         mapsDropdown.AddOptions(getMapsPaths());
     }
 }
Example #12
0
        public override void OnShowScreen(bool first)
        {
            _started = false;

            MapSelect.ClearOptions();
            MapSelect.AddOptions(UnityDB.AllOf <MapAsset>().Select(x => x.Settings.Scene).ToList());
            MapSelect.value = 0;
        }
Example #13
0
    public void populateAnimGUI(bool listAll = false)
    {
        if (!anim)
        {
            listAll = true;
        }

        clips.Clear();
        animDropdown.ClearOptions();
 #if UNITY_EDITOR
        //populate the gui. we are in the editor, so lets make a list of the anims
        //THIS LOADS EVERY ANIMATION IN THE ENTIRE PROJECT!
        string[] guids = AssetDatabase.FindAssets("t:AnimationClip");
        foreach (string g in guids)
        {
            AssetDatabase.LoadAllAssetsAtPath(AssetDatabase.GUIDToAssetPath(g));
        }


        string assetPathOfAnimatedMesh = "";
        if (!listAll)
        {
            assetPathOfAnimatedMesh = AssetDatabase.GetAssetPath(PrefabUtility.GetPrefabParent(anim));
            if (assetPathOfAnimatedMesh.EndsWith(".prefab")) //the mesh that was dragged in is a prefab. The animationClip paths will not match, so find an asset that can be matched through the skinnedMeshRenderer.  If it is not found, it's not a problem since this code is only relevant to animation.
            {
                SkinnedMeshRenderer r = anim.gameObject.GetComponentInChildren <SkinnedMeshRenderer>();
                if (r && r.sharedMesh)
                {
                    assetPathOfAnimatedMesh = AssetDatabase.GetAssetPath(r.sharedMesh);
                }
            }
            Debug.Log(assetPathOfAnimatedMesh);
        }

        //this will list all anims currently in the scene! - not those in the assets folders.  Hence we need the step above
        Object[]      allClips = Resources.FindObjectsOfTypeAll(typeof(AnimationClip));
        List <string> names    = new List <string>();
        foreach (Object o in allClips)
        {
            if (!o.name.StartsWith("__preview__")) //ignore preview anims
            {
                string clipAssetPath = AssetDatabase.GetAssetPath(o);
                //    Debug.Log(clipAssetPath);
                if (listAll || assetPathOfAnimatedMesh == clipAssetPath)
                {
                    names.Add(o.name);
                    clips.Add(o as AnimationClip);
                }
            }
        }

        animDropdown.AddOptions(names);
#endif
    }
Example #14
0
 static public int ClearOptions(IntPtr l)
 {
     try {
         UnityEngine.UI.Dropdown self = (UnityEngine.UI.Dropdown)checkSelf(l);
         self.ClearOptions();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #15
0
    void FillOptionList()
    {
        messageDropdown.ClearOptions();
        List <string> titleList = new List <string>();

        for (int i = 0; i < optionList.Length; i++)
        {
            titleList.Add(optionList[i].title);
        }

        messageDropdown.AddOptions(titleList);
    }
Example #16
0
    void Start()
    {
        load();

        shaderDropDown.ClearOptions();
        List <string> names = new List <string>();

        foreach (Shader s in shaderOptions)
        {
            names.Add(System.IO.Path.GetFileNameWithoutExtension(s.name)); //save the base name
        }
        shaderDropDown.AddOptions(names);
    }
 static int QPYX_ClearOptions_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 1);
         UnityEngine.UI.Dropdown QPYX_obj_YXQP = (UnityEngine.UI.Dropdown)ToLua.CheckObject <UnityEngine.UI.Dropdown>(L_YXQP, 1);
         QPYX_obj_YXQP.ClearOptions();
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
Example #18
0
    private void Start()
    {
        // State Dropdown
        dropdown_state.ClearOptions();
        dropdown_state.AddOptions(states);

        // City Dropdown
        dropdown_city.ClearOptions();
        dropdown_city.AddOptions(cities_sp);

        // Garden Centers Dropdown
        dropdown_garden_center.ClearOptions();
        dropdown_garden_center.AddOptions(garden_centers);
    }
 static int ClearOptions(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)ToLua.CheckObject(L, 1, typeof(UnityEngine.UI.Dropdown));
         obj.ClearOptions();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #20
0
    public void PopulatePlaybackDataFileDropdown(UnityEngine.UI.Dropdown dropdown)
    {
        dropdown.ClearOptions();

        string[] files = Directory.GetFiles(Application.dataPath + "/StreamingAssets/Recordings/");

        foreach (string file in files)
        {
            if (!file.Contains(".meta") && !file.Contains(".DS_Store"))
            {
                dropdown.options.Add(new UnityEngine.UI.Dropdown.OptionData(file.Replace(Application.dataPath + "/StreamingAssets/Recordings/", "")));
                performanceDataFiles.Add(file);
            }
        }
    }
Example #21
0
    // Use this for initialization
    void Start()
    {
        Debug.Log(Application.dataPath);
        DirectoryInfo dir = new DirectoryInfo(Application.dataPath + "/Resources/level");

        FileInfo[]    levels   = dir.GetFiles("*.xml");
        List <string> nameList = new List <string>();

        foreach (FileInfo level in levels)
        {
            nameList.Add(Path.GetFileNameWithoutExtension(level.Name));
        }
        mapList.ClearOptions();
        mapList.AddOptions(nameList);
    }
Example #22
0
    public void UpdateCustomLevelDropdown()
    {
        customLevels = new List <string>();
        foreach (string file in System.IO.Directory.GetFiles("Levels/Custom/"))
        {
            string name = file.Replace("Levels/Custom/", "");
            name = name.Replace(".xml", "");
            customLevels.Add(name);
        }

        // Add Levels
        CustomLevelDropDown.ClearOptions();
        CustomLevelDropDown.AddOptions(customLevels);
        CustomLevelDropDown.RefreshShownValue();
    }
Example #23
0
 private void LoadBundles()
 {
     string[] bundles = System.IO.Directory.GetDirectories(WWWLoader.full_download_path);
     UnityEngine.UI.Dropdown dropdown = GameObject.Find("ActiveBundle Dropdown").GetComponent <UnityEngine.UI.Dropdown>();
     dropdown.ClearOptions();
     foreach (string bundle in bundles)
     {
         if (bundle.EndsWith(".sky"))
         {
             string bundlename = System.IO.Path.GetFileNameWithoutExtension(bundle);
             dropdown.options.Add(new UnityEngine.UI.Dropdown.OptionData(bundlename));
         }
     }
     dropdown.RefreshShownValue();
 }
Example #24
0
 private void UpdateDeckList()
 {
     //Update dropdown
     if (Database.Instance.decks.GetDeckNames().Count > 0)
     {
         deckDropdown.interactable = true;
         deckDropdown.ClearOptions();
         deckDropdown.AddOptions(Database.Instance.decks.GetDeckNames());
         loadDeckButton.interactable   = true;
         deleteDeckButton.interactable = true;
     }
     else
     {
         deckDropdown.interactable = false;
         Debug.Log(deckDropdown.interactable);
         deckDropdown.ClearOptions();
         List <string> noOption = new List <string> {
             "No Saved Decks Found"
         };
         deckDropdown.AddOptions(noOption);
         loadDeckButton.interactable   = false;
         deleteDeckButton.interactable = false;
     }
 }
    private void Awake()
    {
        drop.ClearOptions();
        DataModel model = FindObjectOfType <DataModel>();

        drop.onValueChanged.AddListener(OnDestChange);

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

        foreach (OSTData.Station s in model.Universe.GetStations())
        {
            stationNames.Add(s.Name);
        }
        drop.AddOptions(stationNames);
    }
Example #26
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    private void BuildSitesList(Localizable target)
    {
        if (m_sites == null)
        {
            return;
        }


        Site site = (target is Site) ? target as Site : null;

        Item item = (target is Item) ? target as Item : null;

        m_sites.ClearOptions();

        m_sites.value = 0;

        m_sites.interactable = (item != null) && (DBObjects.instance != null);



        if (m_sites.interactable)
        {
            m_sites.options.Add(new UnityEngine.UI.Dropdown.OptionData("NONE"));

            for (int siteIndex = 0; siteIndex < DBObjects.instance.sites.Count; ++siteIndex)
            {
                m_sites.options.Add(new UnityEngine.UI.Dropdown.OptionData(DBObjects.instance.sites[siteIndex].name));

                if (item.parentID == DBObjects.instance.sites[siteIndex].id)
                {
                    m_sites.value = siteIndex + 1;
                }
            }

            m_sites.RefreshShownValue();
        }
        else
        {
            m_sites.captionText.text = (site != null) ? site.name : string.Empty;
        }
    }
Example #27
0
    public void LoadRegionsWithCountryId(int id)
    {
        Debug.Log("country id: " + id);
        regionToSelect.Clear();
        regionListDropdown.ClearOptions();
        List <string> options = new List <string>();

        for (int i = 0; i < CeresitaWebService.Singleton.regions.Length; i++)
        {
            CeresitaWebService.Region curr = CeresitaWebService.Singleton.regions[i];

            if (curr.country.id == id)
            {
                Debug.Log("region name: " + curr.id);
                options.Add(curr.name);
                regionToSelect.Add(curr);
            }
        }

        regionListDropdown.AddOptions(options);
        regionListDropdown.gameObject.SetActive(options.Count > 1);
    }
Example #28
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public void ConfigureDropDownLists()
    {
        if (m_coordsSys != null)
        {
            m_coordsSys.ClearOptions();

            m_coordsSys.options.Add(new UnityEngine.UI.Dropdown.OptionData("WGS_84"));

            m_coordsSys.options.Add(new UnityEngine.UI.Dropdown.OptionData("LAMBERT_93"));

            m_coordsSys.value = 0;

            m_coordsSys.RefreshShownValue();
        }


        for (int row = 0; row < ( int )CSV.COL.NB; ++row)
        {
            UnityEngine.UI.Dropdown d = m_dropDowns[row];

            if (d == null)
            {
                continue;
            }

            d.ClearOptions();

            d.options.Add(new UnityEngine.UI.Dropdown.OptionData("SELECT"));

            for (int col = 0; col < m_header.Length; ++col)
            {
                d.options.Add(new UnityEngine.UI.Dropdown.OptionData(m_header[col]));
            }

            d.value = 0;

            d.RefreshShownValue();
        }
    }
Example #29
0
 // Use this for initialization
 void Start()
 {
     ddlCountries = GetComponent <UnityEngine.UI.Dropdown>();
     ddlCountries.ClearOptions();
     StartCoroutine(GetCountries());
 }