public void SubirRespuestaCorrecta(UnityEngine.UI.Dropdown o) { double[] salidasDeseadas = new double[14]; for (int i = 0; i < salidasDeseadas.Length; i++) { salidasDeseadas[i] = 0.0; } salidasDeseadas[o.value - 1] = 1.0; dataSets.Add(new NeuralNetwork.DataSet(respuesta, salidasDeseadas)); net.Train(dataSets, 0.1); StreamWriter writter = new StreamWriter(path, true); foreach (double item in respuesta) { writter.Write(writter.NewLine); writter.Write(item); } foreach (double item in salidasDeseadas) { writter.Write(writter.NewLine); writter.Write(item); } //writter. writter.Close(); ReiniciarDatos(ref o); }
//UI Elements cannot access the Managers Object when we re-enter the Main Menu scene from the Game Scene. //This function is a way to still access what we need, and this means all UI functionality can be using the MenuManager instead. public void SetCharacter(UnityEngine.UI.Dropdown character) { //gets the value from the dropdown string gameCharacter = character.options[character.value].text; //check to see the value inside of the string is equal to samurai or cowboy and set the local player equal to the right one GameManager.Instance.SetCharacter(gameCharacter); }
protected override void ClearUIComponents() { ImagePanel = null; ActivityOptions = null; Update = null; Guide = null; Start = null; mData = null; }
protected override void GameSetup() { DialogInstance = GetComponent <DialogInstance>(); Assert.IsNotNull(DialogInstance.DialogGameObject, "Ensure that you have set the script execution order of dialog instance in settings (see help for details."); _musicVolume = GameObjectHelper.GetChildComponentOnNamedGameObject <UnityEngine.UI.Slider>(DialogInstance.DialogGameObject, "MusicSlider", true); _sfxVolume = GameObjectHelper.GetChildComponentOnNamedGameObject <UnityEngine.UI.Slider>(DialogInstance.DialogGameObject, "SfxSlider", true); _language = GameObjectHelper.GetChildComponentOnNamedGameObject <UnityEngine.UI.Dropdown>(DialogInstance.DialogGameObject, "LanguageDropdown", true); }
private void ReiniciarDatos(ref UnityEngine.UI.Dropdown o) { i = 0; o.value = 0; preguntaPanel.SetActive(true); respuestaPanel.SetActive(false); pregunta.text = preguntas[i]; for (int i = 0; i < respuestas.Length; i++) { respuestas[i] = ""; } }
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() { dropdown = gameObject.GetComponent <UnityEngine.UI.Dropdown>(); foreach (string s in System.IO.Directory.GetFiles(System.IO.Path.Combine(Application.streamingAssetsPath, "UserMusic/"))) { if (s.Contains(".meta")) { continue; } string lmoa = s.Replace(System.IO.Path.Combine(Application.streamingAssetsPath, "UserMusic/"), ""); listOfStuff.Add(lmoa); dict.Add(lmoa, s); } AddStuff(); }
static int set_template(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)o; UnityEngine.RectTransform arg0 = (UnityEngine.RectTransform)ToLua.CheckObject(L, 2, typeof(UnityEngine.RectTransform)); obj.template = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index template on a nil value")); } }
static int get_onValueChanged(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)o; UnityEngine.UI.Dropdown.DropdownEvent ret = obj.onValueChanged; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onValueChanged on a nil value")); } }
static int get_alphaFadeSpeed(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)o; float ret = obj.alphaFadeSpeed; LuaDLL.lua_pushnumber(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index alphaFadeSpeed on a nil value")); } }
static int get_itemImage(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)o; UnityEngine.UI.Image ret = obj.itemImage; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index itemImage on a nil value")); } }
static int get_options(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)o; System.Collections.Generic.List <UnityEngine.UI.Dropdown.OptionData> ret = obj.options; ToLua.PushSealed(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index options on a nil value")); } }
static int get_template(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)o; UnityEngine.RectTransform ret = obj.template; ToLua.PushSealed(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index template on a nil value")); } }
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.LogWarning("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); } ); }
public void LoadParticipant() { UnityEngine.UI.Dropdown dropdown = GetComponent <UnityEngine.UI.Dropdown>(); string selectedParticipant = dropdown.captionText.text; if (!System.IO.Directory.Exists(manager.fileManager.ParticipantPath(selectedParticipant))) { throw new UnityException("You tried to load a participant that doesn't exist."); } participantNameInput.text = selectedParticipant; nextSessionNumber = manager.fileManager.CurrentSession(selectedParticipant); UpdateTexts(); //LoadSession(); }
static int set_captionText(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)o; UnityEngine.UI.Text arg0 = (UnityEngine.UI.Text)ToLua.CheckObject <UnityEngine.UI.Text>(L, 2); obj.captionText = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index captionText on a nil value")); } }
static int set_itemImage(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.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")); } }
static int get_value(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)o; int ret = obj.value; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index value on a nil value")); } }
void Start() { this.modes = this.gameObject.GetComponentInChildren <UiDropdown>(); this.fullscreen = this.gameObject.GetComponentInChildren <UiToggle>(); this.resolutions = UnityEngine.Screen.resolutions; StrList options = new StrList(); foreach (ResMode res in resolutions) { options.Add($"{res.width}x{res.height}@{res.refreshRate}"); } this.modes.AddOptions(options); this.fullscreen.isOn = Screen.fullScreen; }
static int set_itemText(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)o; UnityEngine.UI.Text arg0 = (UnityEngine.UI.Text)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.UI.Text)); obj.itemText = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index itemText on a nil value" : e.Message)); } }
static int get_itemText(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)o; UnityEngine.UI.Text ret = obj.itemText; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index itemText on a nil value" : e.Message)); } }
static int set_value(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ComponentCache.Injection <UnityEngine.UI.Dropdown> obj = (ComponentCache.Injection <UnityEngine.UI.Dropdown>)o; UnityEngine.UI.Dropdown arg0 = (UnityEngine.UI.Dropdown)ToLua.CheckObject <UnityEngine.UI.Dropdown>(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")); } }
static int get_value(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ComponentCache.Injection <UnityEngine.UI.Dropdown> obj = (ComponentCache.Injection <UnityEngine.UI.Dropdown>)o; UnityEngine.UI.Dropdown ret = obj.value; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index value on a nil value")); } }
static int set_value(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.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")); } }
static int set_alphaFadeSpeed(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)o; float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.alphaFadeSpeed = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index alphaFadeSpeed on a nil value")); } }
static int set_onValueChanged(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)o; UnityEngine.UI.Dropdown.DropdownEvent arg0 = (UnityEngine.UI.Dropdown.DropdownEvent)ToLua.CheckObject <UnityEngine.UI.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")); } }
static int set_options(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown obj = (UnityEngine.UI.Dropdown)o; System.Collections.Generic.List <UnityEngine.UI.Dropdown.OptionData> arg0 = (System.Collections.Generic.List <UnityEngine.UI.Dropdown.OptionData>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List <UnityEngine.UI.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")); } }
//**************************************************************************************************** // //**************************************************************************************************** public void ResolveDependencies() { m_UI = GameObject.Find("UI"); GameObject dockT = CORE.HIERARCHY.Resolve(m_UI, "CANVAS.HUDS.DOCK_T"); GameObject dockB = CORE.HIERARCHY.Resolve(m_UI, "CANVAS.HUDS.DOCK_B"); GameObject dockR = CORE.HIERARCHY.Resolve(m_UI, "CANVAS.HUDS.DOCK_R"); m_coords = CORE.HIERARCHY.Find(dockT, "HUDCoords"); m_mapSourceIcon = CORE.HIERARCHY.Find(dockT, "ICON_SOURCE"); m_mapSource = CORE.HIERARCHY.Find(dockT, "SOURCE"); m_mapDisplatMode = CORE.HIERARCHY.Find(dockR, "HUDMapDisplayMode"); m_mapZoom = CORE.HIERARCHY.Find(dockR, "HUDZoom"); m_mapButtons = CORE.HIERARCHY.Find(dockR, "HUDMapButtons"); m_latitude = CORE.HIERARCHY.FindComp <UnityEngine.UI.Text>(m_coords, "HUDLatitude"); m_longitude = CORE.HIERARCHY.FindComp <UnityEngine.UI.Text>(m_coords, "HUDLongitude"); m_mapZoomValue = CORE.HIERARCHY.FindComp <UnityEngine.UI.InputField>(m_mapZoom, "HUDZoomValue"); m_mapSources = (m_mapSource != null) ? m_mapSource.GetComponent <UnityEngine.UI.Dropdown>() : null; m_mapNotice = (dockB != null) ? dockB.GetComponent <MapNotice>() : null; if (m_mapNotice != null) { m_mapNotice.text = string.Empty; } GameObject o = CORE.HIERARCHY.Resolve(m_UI, "CANVAS.NAMEPLATES"); m_nameplates = (o != null) ? o.GetComponent <Nameplates>() : null; }
public void OnValueChanged(UnityEngine.UI.Dropdown dropdown) { switch (dropdown.value) { case 0: SceneManager.LoadScene("HomeScene"); break; case 1: SceneManager.LoadScene("EvaluateScene"); break; case 2: SceneManager.LoadScene("DataScene"); break; default: break; } }
private void CreateGUI() { 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 Selected:"; textView.GetComponent <UnityEngine.UI.Text>().resizeTextForBestFit = true; textView.GetComponent <UnityEngine.UI.Text>().font = Resources.GetBuiltinResource <Font>("Arial.ttf"); 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; Material overlayMaterial = Resources.Load <Material>("Shaders/UI-Unlit-Transparent"); colorMapView.GetComponent <UnityEngine.UI.Image>().material = overlayMaterial; List <string> options = new List <string> { "None" }; options.AddRange(overlays.Keys); dropdown.AddOptions(options); dropdown.onValueChanged.AddListener( (int idx) => { SetOverlay(dropdown.captionText.text); }); }