public void Call(UnityEngine.UI.Dropdown.OptionData param0) { func.BeginPCall(); func.PushObject(param0); func.PCall(); func.EndPCall(); }
static public int get_text(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.OptionData self = (UnityEngine.UI.Dropdown.OptionData)checkSelf(l); pushValue(l, true); pushValue(l, self.text); 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 }
protected override void _initialize() { for (int i = 0; i < (resolutions.Length / 2); i++) // add all of the resolutions as options to the reolution dropdown { string text = string.Format("{0} x {1}", resolutions[i, 0], resolutions[i, 1]); UnityEngine.UI.Dropdown.OptionData data = new UnityEngine.UI.Dropdown.OptionData(text); resolutionDropdown.options.Add(data); } }
public bool Call(UnityEngine.UI.Dropdown.OptionData param0) { func.BeginPCall(); func.PushObject(param0); func.PCall(); bool ret = func.CheckBoolean(); func.EndPCall(); return(ret); }
public int Call(UnityEngine.UI.Dropdown.OptionData param0, UnityEngine.UI.Dropdown.OptionData param1) { func.BeginPCall(); func.PushObject(param0); func.PushObject(param1); func.PCall(); int ret = (int)func.CheckNumber(); func.EndPCall(); return(ret); }
static public int get_image(IntPtr l) { try { UnityEngine.UI.Dropdown.OptionData self = (UnityEngine.UI.Dropdown.OptionData)checkSelf(l); pushValue(l, self.image); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int ctor_s(IntPtr l) { try { UnityEngine.UI.Dropdown.OptionData o; o = new UnityEngine.UI.Dropdown.OptionData(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
public void AddMachineSelectable(GameObject selectable) { SelectableMachines.Add(selectable); UnityEngine.UI.Dropdown.OptionData optionData = new UnityEngine.UI.Dropdown.OptionData { text = selectable.name }; SelectedMachineDropdown.options.Add(optionData); SelectedMachineDropdown.RefreshShownValue(); GUI_Debug("Adds: " + selectable.name); }
static public int set_image(IntPtr l) { try { UnityEngine.UI.Dropdown.OptionData self = (UnityEngine.UI.Dropdown.OptionData)checkSelf(l); UnityEngine.Sprite v; checkType(l, 2, out v); self.image = v; return(0); } catch (Exception e) { return(error(l, e)); } }
static public int set_text(IntPtr l) { try { UnityEngine.UI.Dropdown.OptionData self = (UnityEngine.UI.Dropdown.OptionData)checkSelf(l); string v; checkType(l, 2, out v); self.text = v; return(0); } catch (Exception e) { return(error(l, e)); } }
static public int ctor__Sprite_s(IntPtr l) { try { UnityEngine.UI.Dropdown.OptionData o; UnityEngine.Sprite a1; checkType(l, 1, out a1); o = new UnityEngine.UI.Dropdown.OptionData(a1); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
public void updateStates() { if (Application.systemLanguage == SystemLanguage.German) { m_Button.GetComponentInChildren <UnityEngine.UI.Text>().text = LocalizationSupport.GetString("BtnBack"); //"ZURÜCK"; m_Rank.GetComponentInChildren <UnityEngine.UI.Text>().text = LocalizationSupport.GetString("LeaderboardRank"); //"Rang"; m_LName.GetComponentInChildren <UnityEngine.UI.Text>().text = LocalizationSupport.GetString("LeaderboardName"); //"Name"; m_Score.GetComponentInChildren <UnityEngine.UI.Text>().text = LocalizationSupport.GetString("LeaderboardNrQuests"); //"Quests gemacht"; m_Dropdown.GetComponentInChildren <UnityEngine.UI.Text>().text = "Insgesamt"; UnityEngine.UI.Dropdown.OptionData list = new UnityEngine.UI.Dropdown.OptionData("Insgesamt"); UnityEngine.UI.Dropdown.OptionData list2 = new UnityEngine.UI.Dropdown.OptionData("Diese Woche"); UnityEngine.UI.Dropdown.OptionData list3 = new UnityEngine.UI.Dropdown.OptionData("Letzte Woche"); UnityEngine.UI.Dropdown dropdown; dropdown = m_Dropdown.GetComponent <UnityEngine.UI.Dropdown>(); dropdown.options.Clear(); dropdown.options.Add(list); dropdown.options.Add(list2); dropdown.options.Add(list3); } else { //m_Score.GetComponentInChildren<UnityEngine.UI.Text>().text = "Quests done"; m_Rank.GetComponentInChildren <UnityEngine.UI.Text>().text = LocalizationSupport.GetString("LeaderboardRank"); //"Rang"; m_LName.GetComponentInChildren <UnityEngine.UI.Text>().text = LocalizationSupport.GetString("LeaderboardName"); //"Name"; m_Score.GetComponentInChildren <UnityEngine.UI.Text>().text = LocalizationSupport.GetString("LeaderboardNrQuests"); //"Quests gemacht"; m_Button.GetComponentInChildren <UnityEngine.UI.Text>().text = LocalizationSupport.GetString("BtnBack"); //"CLOSE"; m_Dropdown.GetComponentInChildren <UnityEngine.UI.Text>().text = "Total"; UnityEngine.UI.Dropdown.OptionData list = new UnityEngine.UI.Dropdown.OptionData("Total"); UnityEngine.UI.Dropdown.OptionData list2 = new UnityEngine.UI.Dropdown.OptionData("This week"); UnityEngine.UI.Dropdown.OptionData list3 = new UnityEngine.UI.Dropdown.OptionData("Last week"); UnityEngine.UI.Dropdown dropdown; dropdown = m_Dropdown.GetComponent <UnityEngine.UI.Dropdown>(); dropdown.options.Clear(); dropdown.options.Add(list); dropdown.options.Add(list2); dropdown.options.Add(list3); } }
static public int constructor(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); UnityEngine.UI.Dropdown.OptionData o; if (argc == 1) { o = new UnityEngine.UI.Dropdown.OptionData(); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(string))) { System.String a1; checkType(l, 2, out a1); o = new UnityEngine.UI.Dropdown.OptionData(a1); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(UnityEngine.Sprite))) { UnityEngine.Sprite a1; checkType(l, 2, out a1); o = new UnityEngine.UI.Dropdown.OptionData(a1); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 3) { System.String a1; checkType(l, 2, out a1); UnityEngine.Sprite a2; checkType(l, 3, out a2); o = new UnityEngine.UI.Dropdown.OptionData(a1, a2); pushValue(l, true); pushValue(l, o); return(2); } return(error(l, "New object failed.")); } catch (Exception e) { return(error(l, e)); } }
private void AddOptions() { List <UnityEngine.UI.Dropdown.OptionData> options = new List <UnityEngine.UI.Dropdown.OptionData>(); if (type == DropdownType.LOCATION) { foreach (string file in System.IO.Directory.GetFiles(Application.streamingAssetsPath + "/Location")) { if (file.Contains(".meta")) { continue; } UnityEngine.UI.Dropdown.OptionData data = new UnityEngine.UI.Dropdown.OptionData(); data.text = ExtractName(file); options.Add(data); } dropdown.AddOptions(options); DataParser.Instance.SetLocationPath(dropdown.options[0].text); } if (type == DropdownType.DATA) { foreach (string file in System.IO.Directory.GetFiles(Application.streamingAssetsPath + "/Data")) { if (file.Contains(".meta")) { continue; } UnityEngine.UI.Dropdown.OptionData data = new UnityEngine.UI.Dropdown.OptionData(); data.text = ExtractName(file); options.Add(data); } dropdown.AddOptions(options); dropdown.value = 3; DataParser.Instance.SetDataPath(dropdown.options[dropdown.value].text); } dropdown.onValueChanged.AddListener(delegate { DropdownValueChanged(dropdown); }); }
static int get_image(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown.OptionData obj = (UnityEngine.UI.Dropdown.OptionData)o; UnityEngine.Sprite ret = obj.image; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index image on a nil value" : e.Message)); } }
static int get_text(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown.OptionData obj = (UnityEngine.UI.Dropdown.OptionData)o; string ret = obj.text; LuaDLL.lua_pushstring(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index text on a nil value" : e.Message)); } }
static int set_image(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown.OptionData obj = (UnityEngine.UI.Dropdown.OptionData)o; UnityEngine.Sprite arg0 = (UnityEngine.Sprite)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.Sprite)); obj.image = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index image on a nil value" : e.Message)); } }
static int set_text(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.Dropdown.OptionData obj = (UnityEngine.UI.Dropdown.OptionData)o; string arg0 = ToLua.CheckString(L, 2); obj.text = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index text on a nil value" : e.Message)); } }
/// <summary> /// /// <para> /// Refreshes the text and image (if available) of the currently selected option. /// /// If you have modified the list of options, you should call this method afterwards to ensure that the visual state of the dropdown corresponds to the updated options. /// </para> /// /// </summary> public void RefreshShownValue() { Dropdown.OptionData optionData = Dropdown.s_NoOptionData; if (this.options.Count > 0) { optionData = this.options[Mathf.Clamp(this.m_Value, 0, this.options.Count - 1)]; } if ((bool)((UnityEngine.Object) this.m_CaptionText)) { this.m_CaptionText.text = optionData == null || optionData.text == null ? string.Empty : optionData.text; } if (!(bool)((UnityEngine.Object) this.m_CaptionImage)) { return; } this.m_CaptionImage.sprite = optionData == null ? (Sprite)null : optionData.image; this.m_CaptionImage.enabled = (UnityEngine.Object) this.m_CaptionImage.sprite != (UnityEngine.Object)null; }
static int _CreateUnityEngine_UI_Dropdown_OptionData(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { UnityEngine.UI.Dropdown.OptionData obj = new UnityEngine.UI.Dropdown.OptionData(); ToLua.PushObject(L, obj); return(1); } else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Sprite))) { UnityEngine.Sprite arg0 = (UnityEngine.Sprite)ToLua.CheckUnityObject(L, 1, typeof(UnityEngine.Sprite)); UnityEngine.UI.Dropdown.OptionData obj = new UnityEngine.UI.Dropdown.OptionData(arg0); ToLua.PushObject(L, obj); return(1); } else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(string))) { string arg0 = ToLua.CheckString(L, 1); UnityEngine.UI.Dropdown.OptionData obj = new UnityEngine.UI.Dropdown.OptionData(arg0); ToLua.PushObject(L, obj); return(1); } else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(UnityEngine.Sprite))) { string arg0 = ToLua.CheckString(L, 1); UnityEngine.Sprite arg1 = (UnityEngine.Sprite)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.Sprite)); UnityEngine.UI.Dropdown.OptionData obj = new UnityEngine.UI.Dropdown.OptionData(arg0, arg1); ToLua.PushObject(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.UI.Dropdown.OptionData.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int QPYX__CreateUnityEngine_UI_Dropdown_OptionData_YXQP(IntPtr L_YXQP) { try { int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP); if (QPYX_count_YXQP == 0) { UnityEngine.UI.Dropdown.OptionData QPYX_obj_YXQP = new UnityEngine.UI.Dropdown.OptionData(); ToLua.PushObject(L_YXQP, QPYX_obj_YXQP); return(1); } else if (QPYX_count_YXQP == 1 && TypeChecker.CheckTypes <UnityEngine.Sprite>(L_YXQP, 1)) { UnityEngine.Sprite QPYX_arg0_YXQP = (UnityEngine.Sprite)ToLua.ToObject(L_YXQP, 1); UnityEngine.UI.Dropdown.OptionData QPYX_obj_YXQP = new UnityEngine.UI.Dropdown.OptionData(QPYX_arg0_YXQP); ToLua.PushObject(L_YXQP, QPYX_obj_YXQP); return(1); } else if (QPYX_count_YXQP == 1 && TypeChecker.CheckTypes <string>(L_YXQP, 1)) { string QPYX_arg0_YXQP = ToLua.ToString(L_YXQP, 1); UnityEngine.UI.Dropdown.OptionData QPYX_obj_YXQP = new UnityEngine.UI.Dropdown.OptionData(QPYX_arg0_YXQP); ToLua.PushObject(L_YXQP, QPYX_obj_YXQP); return(1); } else if (QPYX_count_YXQP == 2) { string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 1); UnityEngine.Sprite QPYX_arg1_YXQP = (UnityEngine.Sprite)ToLua.CheckObject(L_YXQP, 2, typeof(UnityEngine.Sprite)); UnityEngine.UI.Dropdown.OptionData QPYX_obj_YXQP = new UnityEngine.UI.Dropdown.OptionData(QPYX_arg0_YXQP, QPYX_arg1_YXQP); ToLua.PushObject(L_YXQP, QPYX_obj_YXQP); return(1); } else { return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to ctor method: UnityEngine.UI.Dropdown.OptionData.New")); } } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
private Dropdown.DropdownItem AddItem(Dropdown.OptionData data, bool selected, Dropdown.DropdownItem itemTemplate, List <Dropdown.DropdownItem> items) { Dropdown.DropdownItem dropdownItem = this.CreateItem(itemTemplate); dropdownItem.rectTransform.SetParent(itemTemplate.rectTransform.parent, false); dropdownItem.gameObject.SetActive(true); dropdownItem.gameObject.name = "Item " + items.Count + ((data.text == null) ? "" : (": " + data.text)); if (dropdownItem.toggle != null) { dropdownItem.toggle.isOn = false; } if (dropdownItem.text) { dropdownItem.text.text = data.text; } if (dropdownItem.image) { dropdownItem.image.sprite = data.image; dropdownItem.image.enabled = (dropdownItem.image.sprite != null); } items.Add(dropdownItem); return(dropdownItem); }
private Dropdown.DropdownItem AddItem(Dropdown.OptionData data, bool selected, Dropdown.DropdownItem itemTemplate, List <Dropdown.DropdownItem> items) { Dropdown.DropdownItem dropdownItem = this.CreateItem(itemTemplate); dropdownItem.rectTransform.SetParent(itemTemplate.rectTransform.parent, false); dropdownItem.gameObject.SetActive(true); dropdownItem.gameObject.name = "Item " + (object)items.Count + (string)(data.text == null ? (object)string.Empty : (object)(": " + data.text)); if ((UnityEngine.Object)dropdownItem.toggle != (UnityEngine.Object)null) { dropdownItem.toggle.isOn = false; } if ((bool)((UnityEngine.Object)dropdownItem.text)) { dropdownItem.text.text = data.text; } if ((bool)((UnityEngine.Object)dropdownItem.image)) { dropdownItem.image.sprite = data.image; dropdownItem.image.enabled = (UnityEngine.Object)dropdownItem.image.sprite != (UnityEngine.Object)null; } items.Add(dropdownItem); return(dropdownItem); }
public void savePreset() { string name = GameObject.FindGameObjectWithTag("presetname").GetComponent <UnityEngine.UI.InputField>().text; float scale = float.Parse(GameObject.FindGameObjectWithTag("scale").GetComponent <UnityEngine.UI.InputField>().text); float coarse = float.Parse(GameObject.FindGameObjectWithTag("coarse").GetComponent <UnityEngine.UI.InputField>().text); float contrib = float.Parse(GameObject.FindGameObjectWithTag("contrib").GetComponent <UnityEngine.UI.InputField>().text); float output = float.Parse(GameObject.FindGameObjectWithTag("output").GetComponent <UnityEngine.UI.InputField>().text); bool shader = GameObject.FindGameObjectWithTag("shadertoggle").GetComponent <UnityEngine.UI.Toggle>().isOn; bool threading = GameObject.FindGameObjectWithTag("threadingtoggle").GetComponent <UnityEngine.UI.Toggle>().isOn; bool plants = GameObject.FindGameObjectWithTag("plantstoggle").GetComponent <UnityEngine.UI.Toggle>().isOn; Preset p = new Preset(name, scale, coarse, contrib, output, shader, threading, plants); print("save p# = " + p); presets.Add(p); UnityEngine.UI.Dropdown.OptionData newoption = new UnityEngine.UI.Dropdown.OptionData(name); GameObject.FindGameObjectWithTag("presets").GetComponent <UnityEngine.UI.Dropdown>().options.Add(newoption); }
static int _CreateUnityEngine_UI_Dropdown_OptionData(IntPtr L) { int count = L.GetTop(); if (count == 0) { UnityEngine.UI.Dropdown.OptionData obj = new UnityEngine.UI.Dropdown.OptionData(); L.PushLightUserData(obj); return(1); } else if (count == 1 && L.CheckTypes(1, typeof(Sprite))) { Sprite arg0 = (Sprite)L.ChkUnityObject(1, typeof(Sprite)); UnityEngine.UI.Dropdown.OptionData obj = new UnityEngine.UI.Dropdown.OptionData(arg0); L.PushLightUserData(obj); return(1); } else if (count == 1 && L.CheckTypes(1, typeof(string))) { var arg0 = L.ChkLuaString(1); UnityEngine.UI.Dropdown.OptionData obj = new UnityEngine.UI.Dropdown.OptionData(arg0); L.PushLightUserData(obj); return(1); } else if (count == 2) { var arg0 = L.ChkLuaString(1); Sprite arg1 = (Sprite)L.ChkUnityObject(2, typeof(Sprite)); UnityEngine.UI.Dropdown.OptionData obj = new UnityEngine.UI.Dropdown.OptionData(arg0, arg1); L.PushLightUserData(obj); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: UnityEngine.UI.Dropdown.OptionData.New"); } return(0); }
static int set_image(IntPtr L) { object o = L.ToUserData(1); UnityEngine.UI.Dropdown.OptionData obj = (UnityEngine.UI.Dropdown.OptionData)o; if (obj == null) { LuaTypes types = L.Type(1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name image"); } else { LuaDLL.luaL_error(L, "attempt to index image on a nil value"); } } obj.image = (Sprite)L.ChkUnityObject(3, typeof(Sprite)); return(0); }
static int get_text(IntPtr L) { object o = L.ToUserData(1); UnityEngine.UI.Dropdown.OptionData obj = (UnityEngine.UI.Dropdown.OptionData)o; if (obj == null) { LuaTypes types = L.Type(1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name text"); } else { LuaDLL.luaL_error(L, "attempt to index text on a nil value"); } } L.PushString(obj.text); return(1); }
public void Show() { if (this.IsActive() && this.IsInteractable() && !(this.m_Dropdown != null)) { if (!this.validTemplate) { this.SetupTemplate(); if (!this.validTemplate) { return; } } List <Canvas> list = ListPool <Canvas> .Get(); base.gameObject.GetComponentsInParent <Canvas>(false, list); if (list.Count != 0) { Canvas canvas = list[0]; ListPool <Canvas> .Release(list); this.m_Template.gameObject.SetActive(true); this.m_Dropdown = this.CreateDropdownList(this.m_Template.gameObject); this.m_Dropdown.name = "Dropdown List"; this.m_Dropdown.SetActive(true); RectTransform rectTransform = this.m_Dropdown.transform as RectTransform; rectTransform.SetParent(this.m_Template.transform.parent, false); Dropdown.DropdownItem componentInChildren = this.m_Dropdown.GetComponentInChildren <Dropdown.DropdownItem>(); GameObject gameObject = componentInChildren.rectTransform.parent.gameObject; RectTransform rectTransform2 = gameObject.transform as RectTransform; componentInChildren.rectTransform.gameObject.SetActive(true); Rect rect = rectTransform2.rect; Rect rect2 = componentInChildren.rectTransform.rect; Vector2 vector = rect2.min - rect.min + componentInChildren.rectTransform.localPosition; Vector2 vector2 = rect2.max - rect.max + componentInChildren.rectTransform.localPosition; Vector2 size = rect2.size; this.m_Items.Clear(); Toggle toggle = null; for (int i = 0; i < this.options.Count; i++) { Dropdown.OptionData data = this.options[i]; Dropdown.DropdownItem item = this.AddItem(data, this.value == i, componentInChildren, this.m_Items); if (!(item == null)) { item.toggle.isOn = (this.value == i); item.toggle.onValueChanged.AddListener(delegate(bool x) { this.OnSelectItem(item.toggle); }); if (item.toggle.isOn) { item.toggle.Select(); } if (toggle != null) { Navigation navigation = toggle.navigation; Navigation navigation2 = item.toggle.navigation; navigation.mode = Navigation.Mode.Explicit; navigation2.mode = Navigation.Mode.Explicit; navigation.selectOnDown = item.toggle; navigation.selectOnRight = item.toggle; navigation2.selectOnLeft = toggle; navigation2.selectOnUp = toggle; toggle.navigation = navigation; item.toggle.navigation = navigation2; } toggle = item.toggle; } } Vector2 sizeDelta = rectTransform2.sizeDelta; sizeDelta.y = size.y * (float)this.m_Items.Count + vector.y - vector2.y; rectTransform2.sizeDelta = sizeDelta; float num = rectTransform.rect.height - rectTransform2.rect.height; if (num > 0f) { rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, rectTransform.sizeDelta.y - num); } Vector3[] array = new Vector3[4]; rectTransform.GetWorldCorners(array); RectTransform rectTransform3 = canvas.transform as RectTransform; Rect rect3 = rectTransform3.rect; for (int j = 0; j < 2; j++) { bool flag = false; for (int k = 0; k < 4; k++) { Vector3 vector3 = rectTransform3.InverseTransformPoint(array[k]); if (vector3[j] < rect3.min[j] || vector3[j] > rect3.max[j]) { flag = true; break; } } if (flag) { RectTransformUtility.FlipLayoutOnAxis(rectTransform, j, false, false); } } for (int l = 0; l < this.m_Items.Count; l++) { RectTransform rectTransform4 = this.m_Items[l].rectTransform; rectTransform4.anchorMin = new Vector2(rectTransform4.anchorMin.x, 0f); rectTransform4.anchorMax = new Vector2(rectTransform4.anchorMax.x, 0f); rectTransform4.anchoredPosition = new Vector2(rectTransform4.anchoredPosition.x, vector.y + size.y * (float)(this.m_Items.Count - 1 - l) + size.y * rectTransform4.pivot.y); rectTransform4.sizeDelta = new Vector2(rectTransform4.sizeDelta.x, size.y); } this.AlphaFadeList(0.15f, 0f, 1f); this.m_Template.gameObject.SetActive(false); componentInChildren.gameObject.SetActive(false); this.m_Blocker = this.CreateBlocker(canvas); } } }
/// <summary> /// /// <para> /// Show the dropdown list. /// </para> /// /// </summary> public void Show() { if (!this.IsActive() || !this.IsInteractable() || (UnityEngine.Object) this.m_Dropdown != (UnityEngine.Object)null) { return; } if (!this.validTemplate) { this.SetupTemplate(); if (!this.validTemplate) { return; } } List <Canvas> list = ListPool <Canvas> .Get(); this.gameObject.GetComponentsInParent <Canvas>(false, list); if (list.Count == 0) { return; } Canvas rootCanvas = list[0]; ListPool <Canvas> .Release(list); this.m_Template.gameObject.SetActive(true); this.m_Dropdown = this.CreateDropdownList(this.m_Template.gameObject); this.m_Dropdown.name = "Dropdown List"; this.m_Dropdown.SetActive(true); RectTransform rect1 = this.m_Dropdown.transform as RectTransform; rect1.SetParent(this.m_Template.transform.parent, false); Dropdown.DropdownItem componentInChildren = this.m_Dropdown.GetComponentInChildren <Dropdown.DropdownItem>(); RectTransform rectTransform1 = componentInChildren.rectTransform.parent.gameObject.transform as RectTransform; componentInChildren.rectTransform.gameObject.SetActive(true); Rect rect2 = rectTransform1.rect; Rect rect3 = componentInChildren.rectTransform.rect; Vector2 vector2_1 = rect3.min - rect2.min + (Vector2)componentInChildren.rectTransform.localPosition; Vector2 vector2_2 = rect3.max - rect2.max + (Vector2)componentInChildren.rectTransform.localPosition; Vector2 size = rect3.size; this.m_Items.Clear(); Toggle toggle = (Toggle)null; for (int index = 0; index < this.options.Count; ++index) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type Dropdown.\u003CShow\u003Ec__AnonStorey6 showCAnonStorey6 = new Dropdown.\u003CShow\u003Ec__AnonStorey6(); // ISSUE: reference to a compiler-generated field showCAnonStorey6.\u003C\u003Ef__this = this; Dropdown.OptionData data = this.options[index]; // ISSUE: reference to a compiler-generated field showCAnonStorey6.item = this.AddItem(data, this.value == index, componentInChildren, this.m_Items); // ISSUE: reference to a compiler-generated field if (!((UnityEngine.Object)showCAnonStorey6.item == (UnityEngine.Object)null)) { // ISSUE: reference to a compiler-generated field showCAnonStorey6.item.toggle.isOn = this.value == index; // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated method showCAnonStorey6.item.toggle.onValueChanged.AddListener(new UnityAction <bool>(showCAnonStorey6.\u003C\u003Em__2)); // ISSUE: reference to a compiler-generated field if (showCAnonStorey6.item.toggle.isOn) { // ISSUE: reference to a compiler-generated field showCAnonStorey6.item.toggle.Select(); } if ((UnityEngine.Object)toggle != (UnityEngine.Object)null) { Navigation navigation1 = toggle.navigation; // ISSUE: reference to a compiler-generated field Navigation navigation2 = showCAnonStorey6.item.toggle.navigation; navigation1.mode = Navigation.Mode.Explicit; navigation2.mode = Navigation.Mode.Explicit; // ISSUE: reference to a compiler-generated field navigation1.selectOnDown = (Selectable)showCAnonStorey6.item.toggle; // ISSUE: reference to a compiler-generated field navigation1.selectOnRight = (Selectable)showCAnonStorey6.item.toggle; navigation2.selectOnLeft = (Selectable)toggle; navigation2.selectOnUp = (Selectable)toggle; toggle.navigation = navigation1; // ISSUE: reference to a compiler-generated field showCAnonStorey6.item.toggle.navigation = navigation2; } // ISSUE: reference to a compiler-generated field toggle = showCAnonStorey6.item.toggle; } } Vector2 sizeDelta = rectTransform1.sizeDelta; sizeDelta.y = size.y * (float)this.m_Items.Count + vector2_1.y - vector2_2.y; rectTransform1.sizeDelta = sizeDelta; float num = rect1.rect.height - rectTransform1.rect.height; if ((double)num > 0.0) { rect1.sizeDelta = new Vector2(rect1.sizeDelta.x, rect1.sizeDelta.y - num); } Vector3[] fourCornersArray = new Vector3[4]; rect1.GetWorldCorners(fourCornersArray); RectTransform rectTransform2 = rootCanvas.transform as RectTransform; Rect rect4 = rectTransform2.rect; for (int axis = 0; axis < 2; ++axis) { bool flag = false; for (int index = 0; index < 4; ++index) { Vector3 vector3 = rectTransform2.InverseTransformPoint(fourCornersArray[index]); if ((double)vector3[axis] < (double)rect4.min[axis] || (double)vector3[axis] > (double)rect4.max[axis]) { flag = true; break; } } if (flag) { RectTransformUtility.FlipLayoutOnAxis(rect1, axis, false, false); } } for (int index = 0; index < this.m_Items.Count; ++index) { RectTransform rectTransform3 = this.m_Items[index].rectTransform; rectTransform3.anchorMin = new Vector2(rectTransform3.anchorMin.x, 0.0f); rectTransform3.anchorMax = new Vector2(rectTransform3.anchorMax.x, 0.0f); rectTransform3.anchoredPosition = new Vector2(rectTransform3.anchoredPosition.x, (float)((double)vector2_1.y + (double)size.y * (double)(this.m_Items.Count - 1 - index) + (double)size.y * (double)rectTransform3.pivot.y)); rectTransform3.sizeDelta = new Vector2(rectTransform3.sizeDelta.x, size.y); } this.AlphaFadeList(0.15f, 0.0f, 1f); this.m_Template.gameObject.SetActive(false); componentInChildren.gameObject.SetActive(false); this.m_Blocker = this.CreateBlocker(rootCanvas); }
public static GameObject CreateDropdown(Resources resources) { GameObject parent = CreateUIElementRoot("Dropdown", s_ThickElementSize); GameObject obj3 = CreateUIObject("Label", parent); GameObject obj4 = CreateUIObject("Arrow", parent); GameObject obj5 = CreateUIObject("Template", parent); GameObject obj6 = CreateUIObject("Viewport", obj5); GameObject obj7 = CreateUIObject("Content", obj6); GameObject obj8 = CreateUIObject("Item", obj7); GameObject obj9 = CreateUIObject("Item Background", obj8); GameObject obj10 = CreateUIObject("Item Checkmark", obj8); GameObject obj11 = CreateUIObject("Item Label", obj8); GameObject child = CreateScrollbar(resources); child.name = "Scrollbar"; SetParentAndAlign(child, obj5); Scrollbar component = child.GetComponent <Scrollbar>(); component.SetDirection(Scrollbar.Direction.BottomToTop, true); RectTransform transform = child.GetComponent <RectTransform>(); transform.anchorMin = Vector2.right; transform.anchorMax = Vector2.one; transform.pivot = Vector2.one; transform.sizeDelta = new Vector2(transform.sizeDelta.x, 0f); Text lbl = obj11.AddComponent <Text>(); SetDefaultTextValues(lbl); lbl.alignment = TextAnchor.MiddleLeft; Image image = obj9.AddComponent <Image>(); image.color = (Color) new Color32(0xf5, 0xf5, 0xf5, 0xff); Image image2 = obj10.AddComponent <Image>(); image2.sprite = resources.checkmark; Toggle toggle = obj8.AddComponent <Toggle>(); toggle.targetGraphic = image; toggle.graphic = image2; toggle.isOn = true; Image image3 = obj5.AddComponent <Image>(); image3.sprite = resources.standard; image3.type = Image.Type.Sliced; ScrollRect rect = obj5.AddComponent <ScrollRect>(); rect.content = (RectTransform)obj7.transform; rect.viewport = (RectTransform)obj6.transform; rect.horizontal = false; rect.movementType = ScrollRect.MovementType.Clamped; rect.verticalScrollbar = component; rect.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport; rect.verticalScrollbarSpacing = -3f; obj6.AddComponent <Mask>().showMaskGraphic = false; Image image4 = obj6.AddComponent <Image>(); image4.sprite = resources.mask; image4.type = Image.Type.Sliced; Text text2 = obj3.AddComponent <Text>(); SetDefaultTextValues(text2); text2.alignment = TextAnchor.MiddleLeft; obj4.AddComponent <Image>().sprite = resources.dropdown; Image image6 = parent.AddComponent <Image>(); image6.sprite = resources.standard; image6.color = s_DefaultSelectableColor; image6.type = Image.Type.Sliced; Dropdown slider = parent.AddComponent <Dropdown>(); slider.targetGraphic = image6; SetDefaultColorTransitionValues(slider); slider.template = obj5.GetComponent <RectTransform>(); slider.captionText = text2; slider.itemText = lbl; lbl.text = "Option A"; Dropdown.OptionData item = new Dropdown.OptionData { text = "Option A" }; slider.options.Add(item); item = new Dropdown.OptionData { text = "Option B" }; slider.options.Add(item); item = new Dropdown.OptionData { text = "Option C" }; slider.options.Add(item); slider.RefreshShownValue(); RectTransform transform2 = obj3.GetComponent <RectTransform>(); transform2.anchorMin = Vector2.zero; transform2.anchorMax = Vector2.one; transform2.offsetMin = new Vector2(10f, 6f); transform2.offsetMax = new Vector2(-25f, -7f); RectTransform transform3 = obj4.GetComponent <RectTransform>(); transform3.anchorMin = new Vector2(1f, 0.5f); transform3.anchorMax = new Vector2(1f, 0.5f); transform3.sizeDelta = new Vector2(20f, 20f); transform3.anchoredPosition = new Vector2(-15f, 0f); RectTransform transform4 = obj5.GetComponent <RectTransform>(); transform4.anchorMin = new Vector2(0f, 0f); transform4.anchorMax = new Vector2(1f, 0f); transform4.pivot = new Vector2(0.5f, 1f); transform4.anchoredPosition = new Vector2(0f, 2f); transform4.sizeDelta = new Vector2(0f, 150f); RectTransform transform5 = obj6.GetComponent <RectTransform>(); transform5.anchorMin = new Vector2(0f, 0f); transform5.anchorMax = new Vector2(1f, 1f); transform5.sizeDelta = new Vector2(-18f, 0f); transform5.pivot = new Vector2(0f, 1f); RectTransform transform6 = obj7.GetComponent <RectTransform>(); transform6.anchorMin = new Vector2(0f, 1f); transform6.anchorMax = new Vector2(1f, 1f); transform6.pivot = new Vector2(0.5f, 1f); transform6.anchoredPosition = new Vector2(0f, 0f); transform6.sizeDelta = new Vector2(0f, 28f); RectTransform transform7 = obj8.GetComponent <RectTransform>(); transform7.anchorMin = new Vector2(0f, 0.5f); transform7.anchorMax = new Vector2(1f, 0.5f); transform7.sizeDelta = new Vector2(0f, 20f); RectTransform transform8 = obj9.GetComponent <RectTransform>(); transform8.anchorMin = Vector2.zero; transform8.anchorMax = Vector2.one; transform8.sizeDelta = Vector2.zero; RectTransform transform9 = obj10.GetComponent <RectTransform>(); transform9.anchorMin = new Vector2(0f, 0.5f); transform9.anchorMax = new Vector2(0f, 0.5f); transform9.sizeDelta = new Vector2(20f, 20f); transform9.anchoredPosition = new Vector2(10f, 0f); RectTransform transform10 = obj11.GetComponent <RectTransform>(); transform10.anchorMin = Vector2.zero; transform10.anchorMax = Vector2.one; transform10.offsetMin = new Vector2(20f, 1f); transform10.offsetMax = new Vector2(-10f, -2f); obj5.SetActive(false); return(parent); }