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; } }
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(); }
void Awake() { GameObject mgr = GameObject.Find("InterfaceManager"); manager = (InterfaceManager)mgr.GetComponent("InterfaceManager"); UnityEngine.UI.Dropdown dropdown = GetComponent <UnityEngine.UI.Dropdown>(); string[] experiments = manager.GetSetting("availableExperiments").ToObject <string[]>(); dropdown.AddOptions(new List <string>(new string[] { "Select Task..." })); dropdown.AddOptions(new List <string>(experiments)); SetExperiment(); }
// 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(); }
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); } } ); }
public void UpdateStoryLevelDropdown() { // Add Levels PlayLevelDropDown.ClearOptions(); PlayLevelDropDown.AddOptions(GameManager.Instance.Story.GetAvailableLevels()); PlayLevelDropDown.RefreshShownValue(); }
static int AddOptions(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2 && L.CheckTypes(1, typeof(UnityEngine.UI.Dropdown), typeof(List <Sprite>))) { UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)L.ChkUnityObjectSelf(1, "UnityEngine.UI.Dropdown"); List <Sprite> arg0 = (List <Sprite>)L.ToUserData(2); obj.AddOptions(arg0); return(0); } else if (count == 2 && L.CheckTypes(1, typeof(UnityEngine.UI.Dropdown), typeof(List <string>))) { UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)L.ChkUnityObjectSelf(1, "UnityEngine.UI.Dropdown"); List <string> arg0 = (List <string>)L.ToUserData(2); obj.AddOptions(arg0); return(0); } else if (count == 2 && L.CheckTypes(1, typeof(UnityEngine.UI.Dropdown), typeof(List <UnityEngine.UI.Dropdown.OptionData>))) { UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)L.ChkUnityObjectSelf(1, "UnityEngine.UI.Dropdown"); List <UnityEngine.UI.Dropdown.OptionData> arg0 = (List <UnityEngine.UI.Dropdown.OptionData>)L.ToUserData(2); obj.AddOptions(arg0); return(0); } else { LuaDLL.luaL_error(L, "invalid arguments to method: UnityEngine.UI.Dropdown.AddOptions"); } return(0); }
void Update() { if (loadRegionList) { if (CeresitaWebService.Singleton.isWebServiceReady) { loadRegionList = false; countryListDropdown.options.Clear(); List <string> countryOptions = new List <string>(); for (int i = 0; i < CeresitaWebService.Singleton.countries.Length; i++) { countryOptions.Add(CeresitaWebService.Singleton.countries[i].name); } countryListDropdown.AddOptions(countryOptions); LoadRegionsWithCountryId(CeresitaWebService.Singleton.countries[0].id); } } }
static public int AddOptions(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (matchType(l, argc, 2, typeof(List <UnityEngine.Sprite>))) { UnityEngine.UI.Dropdown self = (UnityEngine.UI.Dropdown)checkSelf(l); System.Collections.Generic.List <UnityEngine.Sprite> a1; checkType(l, 2, out a1); self.AddOptions(a1); return(0); } else if (matchType(l, argc, 2, typeof(List <System.String>))) { UnityEngine.UI.Dropdown self = (UnityEngine.UI.Dropdown)checkSelf(l); System.Collections.Generic.List <System.String> a1; checkType(l, 2, out a1); self.AddOptions(a1); return(0); } else if (matchType(l, argc, 2, typeof(List <UnityEngine.UI.Dropdown.OptionData>))) { UnityEngine.UI.Dropdown self = (UnityEngine.UI.Dropdown)checkSelf(l); System.Collections.Generic.List <UnityEngine.UI.Dropdown.OptionData> a1; checkType(l, 2, out a1); self.AddOptions(a1); return(0); } return(error(l, "No matched override function to call")); } catch (Exception e) { return(error(l, e)); } }
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 QPYX_AddOptions_YXQP(IntPtr L_YXQP) { try { int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP); if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <System.Collections.Generic.List <UnityEngine.Sprite> >(L_YXQP, 2)) { UnityEngine.UI.Dropdown QPYX_obj_YXQP = (UnityEngine.UI.Dropdown)ToLua.CheckObject <UnityEngine.UI.Dropdown>(L_YXQP, 1); System.Collections.Generic.List <UnityEngine.Sprite> QPYX_arg0_YXQP = (System.Collections.Generic.List <UnityEngine.Sprite>)ToLua.ToObject(L_YXQP, 2); QPYX_obj_YXQP.AddOptions(QPYX_arg0_YXQP); return(0); } else if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <System.Collections.Generic.List <string> >(L_YXQP, 2)) { UnityEngine.UI.Dropdown QPYX_obj_YXQP = (UnityEngine.UI.Dropdown)ToLua.CheckObject <UnityEngine.UI.Dropdown>(L_YXQP, 1); System.Collections.Generic.List <string> QPYX_arg0_YXQP = (System.Collections.Generic.List <string>)ToLua.ToObject(L_YXQP, 2); QPYX_obj_YXQP.AddOptions(QPYX_arg0_YXQP); return(0); } else if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <System.Collections.Generic.List <UnityEngine.UI.Dropdown.OptionData> >(L_YXQP, 2)) { UnityEngine.UI.Dropdown QPYX_obj_YXQP = (UnityEngine.UI.Dropdown)ToLua.CheckObject <UnityEngine.UI.Dropdown>(L_YXQP, 1); System.Collections.Generic.List <UnityEngine.UI.Dropdown.OptionData> QPYX_arg0_YXQP = (System.Collections.Generic.List <UnityEngine.UI.Dropdown.OptionData>)ToLua.ToObject(L_YXQP, 2); QPYX_obj_YXQP.AddOptions(QPYX_arg0_YXQP); return(0); } else { return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: UnityEngine.UI.Dropdown.AddOptions")); } } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
public void listMaps() { if (mapsDropdown != null) { mapsDropdown.ClearOptions(); mapsDropdown.AddOptions(getMapsPaths()); } }
public override void OnShowScreen(bool first) { _started = false; MapSelect.ClearOptions(); MapSelect.AddOptions(UnityDB.AllOf <MapAsset>().Select(x => x.Settings.Scene).ToList()); MapSelect.value = 0; }
static public int AddOptions(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 int argc = LuaDLL.lua_gettop(l); if (matchType(l, argc, 2, typeof(List <UnityEngine.UI.Dropdown.OptionData>))) { UnityEngine.UI.Dropdown self = (UnityEngine.UI.Dropdown)checkSelf(l); System.Collections.Generic.List <UnityEngine.UI.Dropdown.OptionData> a1; checkType(l, 2, out a1); self.AddOptions(a1); pushValue(l, true); return(1); } else if (matchType(l, argc, 2, typeof(List <System.String>))) { UnityEngine.UI.Dropdown self = (UnityEngine.UI.Dropdown)checkSelf(l); System.Collections.Generic.List <System.String> a1; checkType(l, 2, out a1); self.AddOptions(a1); pushValue(l, true); return(1); } else if (matchType(l, argc, 2, typeof(List <UnityEngine.Sprite>))) { UnityEngine.UI.Dropdown self = (UnityEngine.UI.Dropdown)checkSelf(l); System.Collections.Generic.List <UnityEngine.Sprite> a1; checkType(l, 2, out a1); self.AddOptions(a1); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function AddOptions to call"); return(2); } 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 }
void Awake() { eventSystem = EventSystem.current; string[] ports = SerialPort.GetPortNames(); if (ports.Length > 0) { arduinoDropdown.AddOptions(ports.ToList()); arduinoDropdown.AddOptions(new List <string> { "Custom.." }); serialPortInputField.text = arduinoDropdown.options[arduinoDropdown.value].text; } else { arduinoDropdown.gameObject.SetActive(false); serialPortInputField.gameObject.SetActive(true); } DontDestroyOnLoad(transform.gameObject); }
private void Start() { dropdownComp = GetComponent <UnityEngine.UI.Dropdown>(); List <string> dropdownOptions = new List <string>(); foreach (var lang in SimpleLocalization.LocalizationSystem.Instance.LocAsset.availableLangs) { dropdownOptions.Add(lang.ToString()); } dropdownComp.AddOptions(dropdownOptions); }
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 }
void Start() { //fill the dropdown List <string> mapNames = new List <string>(); for (int i = 0; i < mapValues.GetLength(0); i++) { mapNames.Add(mapValues [i, 0]); } dropDown.AddOptions(mapNames); }
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); }
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); }
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 public int AddOptions__List_1_Sprite(IntPtr l) { try { UnityEngine.UI.Dropdown self = (UnityEngine.UI.Dropdown)checkSelf(l); System.Collections.Generic.List <UnityEngine.Sprite> a1; checkType(l, 2, out a1); self.AddOptions(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
private void CreateGUI() { UnityEngine.UI.Dropdown dropdown = parentPanel.GetComponentInChildren <UnityEngine.UI.Dropdown>(); if (dropdown == null) { UnityDebugger.Debugger.LogWarning("OverlayMap", "No parent panel was selected!"); return; } LayoutElement layout; colorMapView = new GameObject(); Image image = colorMapView.AddComponent <UnityEngine.UI.Image>(); colorMapView.transform.SetParent(parentPanel.transform); layout = colorMapView.AddComponent <LayoutElement>(); layout.minHeight = 30; layout.minWidth = 150; Material overlayMaterial = new Material(Resources.Load <Material>("Shaders/UI-Unlit-Transparent")); image.material = overlayMaterial; textView = new GameObject(); Text text = textView.AddComponent <Text>(); layout = textView.AddComponent <LayoutElement>(); layout.minHeight = 30; layout.minWidth = 150; textView.transform.SetParent(parentPanel.transform); text.text = "Currently Selected:"; text.fontSize = 14; text.font = Resources.GetBuiltinResource <Font>("Arial.ttf"); List <string> options = new List <string> { LocalizationTable.GetLocalization("overlay_none") }; List <string> types = new List <string> { "None" }; foreach (OverlayDescriptor descr in PrototypeManager.Overlay.Values) { options.Add(descr.Name); types.Add(descr.Type); } dropdown.AddOptions(options); dropdown.onValueChanged.AddListener((index) => { SetOverlay(types[index]); }); }
// 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); }
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(); }
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); }
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; } }
void CreateGUI() { //dropdownObject = new GameObject(); //dropdownObject.transform.SetParent(parentPanel.transform); //UnityEngine.UI.Dropdown dropdown = dropdownObject.AddComponent<UnityEngine.UI.Dropdown>(); UnityEngine.UI.Dropdown dropdown = parentPanel.GetComponentInChildren <UnityEngine.UI.Dropdown>(); if (dropdown == null) { Debug.ULogWarningChannel("OverlayMap", "No parent panel was selected!"); return; } textView = new GameObject(); textView.AddComponent <UnityEngine.UI.Text>(); textView.AddComponent <UnityEngine.UI.LayoutElement>(); textView.GetComponent <UnityEngine.UI.LayoutElement>().minHeight = 30; textView.GetComponent <UnityEngine.UI.LayoutElement>().minWidth = 150; textView.transform.SetParent(parentPanel.transform); textView.GetComponent <UnityEngine.UI.Text>().text = "Currently slected:"; textView.GetComponent <UnityEngine.UI.Text>().resizeTextForBestFit = true; textView.GetComponent <UnityEngine.UI.Text>().font = Resources.GetBuiltinResource <Font>("Arial.ttf"); //colorMapView = GameObject.CreatePrimitive(PrimitiveType.Quad); colorMapView = new GameObject(); colorMapView.AddComponent <UnityEngine.UI.Image>(); colorMapView.transform.SetParent(parentPanel.transform); colorMapView.AddComponent <UnityEngine.UI.Text>(); colorMapView.AddComponent <UnityEngine.UI.LayoutElement>(); colorMapView.GetComponent <UnityEngine.UI.LayoutElement>().minHeight = 30; colorMapView.GetComponent <UnityEngine.UI.LayoutElement>().minWidth = 150; Shader shader = Shader.Find("UI/Unlit/Transparent"); colorMapView.GetComponent <UnityEngine.UI.Image>().material = new Material(shader); List <string> options = new List <string> { "None" }; options.AddRange(overlays.Keys); dropdown.AddOptions(options); dropdown.onValueChanged.AddListener( (int idx) => { SetOverlay(dropdown.captionText.text); } ); }
void Awake() { User[] children = DBWorker.loadChildren(); for (int i = 0; i < children.Length; i++) { ChildNote childNote = (ChildNote)Instantiate(childNotePrefab, childrenLayout); childNote.transform.localScale = new Vector3(1, 1, 1); childNote.setChild(children [i]); } taskList = DBWorker.loadAllTasks(); for (int i = 0; i < taskList.Length; i++) { TaskNote taskNote = (TaskNote)Instantiate(fullTaskNotePrefab, allTasksLayout); taskNote.transform.localScale = new Vector3(1, 1, 1); taskNote.setTask(taskList [i]); } List <string> monthes = new List <string> (); for (int i = 0; i < MONTH_COUNT; i++) { monthes.Add((i + 1).ToString()); } month.AddOptions(monthes); List <string> years = new List <string> (); //System.DateTime curDateTime = System.DateTime.Now; //for (int i = curDateTime.Year - YEAR_PERIOD + 1; i <= curDateTime.Year; i++) { for (int i = 2017 - YEAR_PERIOD + 1; i <= 2017; i++) { years.Add(i.ToString()); } year.AddOptions(years); List <string> days = new List <string> (); for (int i = 1; i <= DAYS_IN_MONTH; i++) { days.Add(i.ToString()); } day.AddOptions(days); }
// Use this for initialization void Start() { int sceneCount = UnityEngine.SceneManagement.SceneManager.sceneCountInBuildSettings; List <string> scenes = new List <string>(); for (int i = 0; i < sceneCount; i++) { string sceneName = System.IO.Path.GetFileNameWithoutExtension(UnityEngine.SceneManagement.SceneUtility.GetScenePathByBuildIndex(i)); if (sceneName != "Launcher") { scenes.Add(sceneName); } } dropdownList.AddOptions(scenes); //Debug.LogError("Scnee: " + sceneCount); }