private UIDropDown CreateMiniDropdown(string localeId, OnDropdownSelectionChanged onValueChanged, string[] values) { UIDropDown ddObj = UIHelperExtension.CloneBasicDropDownLocalized(localeId, values, onValueChanged, 0, MainPanel, out UILabel label, out UIPanel container); container.autoFitChildrenHorizontally = false; container.autoLayoutDirection = LayoutDirection.Horizontal; container.autoLayout = true; container.autoFitChildrenHorizontally = true; container.autoFitChildrenVertically = true; ReflectionUtils.GetEventField(typeof(UIDropDown), "eventMouseWheel")?.SetValue(ddObj, null); ddObj.isLocalized = false; ddObj.autoSize = false; ddObj.horizontalAlignment = UIHorizontalAlignment.Center; ddObj.itemPadding = new RectOffset(2, 2, 6, 6); ddObj.textFieldPadding = new RectOffset(4, 40, 4, 4); ddObj.name = localeId; ddObj.size = new Vector3(240, 22); ddObj.textScale = 0.8f; ddObj.listPosition = UIDropDown.PopupListPosition.Automatic; //KlyteMonoUtils.InitButtonFull(ddObj, false, "OptionsDropboxListbox"); ddObj.horizontalAlignment = UIHorizontalAlignment.Center; KlyteMonoUtils.LimitWidthAndBox(label, 130); label.textScale = 1; label.padding.top = 4; label.position = Vector3.zero; label.verticalAlignment = UIVerticalAlignment.Middle; label.textAlignment = UIHorizontalAlignment.Left; return(ddObj); }
private void CreateGroupFileSelect(string i18n, OnDropdownSelectionChanged onChanged, Action onReload, out UIDropDown dropDown) { isLoading = true; AddDropdown(Locale.Get(i18n), out dropDown, m_uiHelperGlobal, new string[0], onChanged); AddButtonInEditorRow(dropDown, Commons.UI.SpriteNames.CommonsSpriteNames.K45_Reload, onReload, "K45_ADR_ROAD_NAME_FILES_RELOAD"); isLoading = false; onReload.Invoke(); }
private void CreateGroupFileSelect(string i18n, OnDropdownSelectionChanged onChanged, OnButtonClicked onReload, out UIDropDown dropDown) { dropDown = m_uiHelperDistrict.AddDropdownLocalized(i18n, new string[0], -1, onChanged); dropDown.width = DefaultWidth; m_uiHelperDistrict.AddSpace(1); KlyteMonoUtils.LimitWidth((UIButton)m_uiHelperDistrict.AddButton(Locale.Get(i18n + "S_RELOAD"), onReload), 380); m_uiHelperDistrict.AddSpace(20); onReload.Invoke(); }
public UIDropDown AddDropDown(string label, ICollection <string> options, int selectedIndex, OnDropdownSelectionChanged selectionChangedEvent) { label.ShouldNotBeNullOrEmpty("label"); options.ShouldNotBeNullOrEmpty("options"); selectionChangedEvent.ShouldNotBeNull("selectionChangedEvent"); return((UIDropDown)UiHelperBase.AddDropdown(label, options.ToArray(), selectedIndex, selectionChangedEvent)); }
public UIDropDown AddDropDown( string label, string[] values, int selectedIndex, OnDropdownSelectionChanged selectionChangedEvent) { label.ShouldNotBeNullOrEmpty("label"); values.ShouldNotBeNullOrEmpty("values"); selectionChangedEvent.ShouldNotBeNull("selectionChangedEvent"); return((UIDropDown)UiHelper.AddDropdown(label, values, selectedIndex, selectionChangedEvent)); }
public static UIDropDown CloneBasicDropDownNoLabel(string[] options, OnDropdownSelectionChanged eventCallback, UIComponent parent) { if (eventCallback != null) { UIDropDown uIDropDown = parent.AttachUIComponent(GameObject.Instantiate(GameObject.Find("Dropdown"))).GetComponent <UIDropDown>(); uIDropDown.items = options; uIDropDown.eventSelectedIndexChanged += delegate(UIComponent c, int sel) { eventCallback(sel); }; return(uIDropDown); } DebugOutputPanel.AddMessage(PluginManager.MessageType.Warning, "Cannot create dropdown with no name or no event"); return(null); }
public static UIDropDown CloneBasicDropDownNoLabel(string[] options, OnDropdownSelectionChanged eventCallback, UIComponent parent) { if (eventCallback != null) { UIDropDown uIDropDown = GameObject.Instantiate(UITemplateManager.GetAsGameObject(kDropdownTemplate).GetComponentInChildren <UIDropDown>().gameObject, parent.transform).GetComponent <UIDropDown>(); uIDropDown.items = options; uIDropDown.eventSelectedIndexChanged += delegate(UIComponent c, int sel) { eventCallback(sel); }; return(uIDropDown); } DebugOutputPanel.AddMessage(PluginManager.MessageType.Warning, "Cannot create dropdown with no name or no event"); return(null); }
public static UIDropDown CloneBasicDropDown(string text, string[] options, OnDropdownSelectionChanged eventCallback, UIComponent parent, out UILabel label) { if (eventCallback != null && !string.IsNullOrEmpty(text)) { UIPanel uIPanel = parent.AttachUIComponent(UITemplateManager.GetAsGameObject(kDropdownTemplate)) as UIPanel; label = uIPanel.Find <UILabel>("Label"); label.text = text; UIDropDown uIDropDown = uIPanel.Find <UIDropDown>("Dropdown"); uIDropDown.items = options; uIDropDown.eventSelectedIndexChanged += delegate(UIComponent c, int sel) { eventCallback(sel); }; return(uIDropDown); } DebugOutputPanel.AddMessage(PluginManager.MessageType.Warning, "Cannot create dropdown with no name or no event"); label = null; return(null); }
public static UIDropDown CloneBasicDropDown(string text, string[] options, OnDropdownSelectionChanged eventCallback, UIComponent parent) { bool flag = eventCallback != null && !string.IsNullOrEmpty(text); UIDropDown result; if (flag) { UIPanel uIPanel = parent.AttachUIComponent(UITemplateManager.GetAsGameObject(UIHelperExtension.kDropdownTemplate)) as UIPanel; uIPanel.Find <UILabel>("Label").text = text; UIDropDown uIDropDown = uIPanel.Find <UIDropDown>("Dropdown"); uIDropDown.items = options; uIDropDown.eventSelectedIndexChanged += delegate(UIComponent c, int sel) { eventCallback(sel); }; result = uIDropDown; } else { DebugOutputPanel.AddMessage(PluginManager.MessageType.Warning, "Cannot create dropdown with no name or no event"); result = null; } return(result); }
public static UIDropDown CloneBasicDropDown(string text, string[] options, OnDropdownSelectionChanged eventCallback, UIComponent parent, out UILabel label, bool limitLabelByPanelWidth = false) { if (eventCallback != null && !string.IsNullOrEmpty(text)) { var uIPanel = parent.AttachUIComponent(UITemplateManager.GetAsGameObject(kDropdownTemplate)) as UIPanel; uIPanel.transform.localScale = Vector3.one; label = uIPanel.Find <UILabel>("Label"); if (limitLabelByPanelWidth) { KlyteMonoUtils.LimitWidthAndBox(label, (uint)uIPanel.width); } label.text = text; UIDropDown uIDropDown = uIPanel.Find <UIDropDown>("Dropdown"); uIDropDown.items = options; uIDropDown.eventSelectedIndexChanged += delegate(UIComponent c, int sel) { eventCallback(sel); }; return(uIDropDown); } DebugOutputPanel.AddMessage(PluginManager.MessageType.Warning, "Cannot create dropdown with no name or no event"); label = null; return(null); }
public UIDropDown AddDropdown(string text, string[] options, string defaultSelection, OnDropdownSelectionChanged eventCallback, bool limitLabelByPanelWidth = false) { UIDropDown uIDropDown = AddDropdownBase(text, options, eventCallback, limitLabelByPanelWidth); if (uIDropDown != null) { bool hasIdx = options.Contains(defaultSelection); if (hasIdx) { uIDropDown.selectedIndex = options.ToList().IndexOf(defaultSelection); } return(uIDropDown); } else { return(null); } }
public UIDropDown AddDropdownLocalized(string text, string[] options, int defaultSelection, OnDropdownSelectionChanged eventCallback, bool limitLabelByPanelWidth = false) { UIDropDown uIDropDown = AddDropdownBaseLocalized(text, options, eventCallback, defaultSelection, limitLabelByPanelWidth); if (uIDropDown != null) { return(uIDropDown); } else { return(null); } }
public object AddDropdown(string text, string[] options, int defaultSelection, OnDropdownSelectionChanged eventCallback) => AddDropdown(text, options, defaultSelection, eventCallback, false);
public object AddDropdown(string text, string[] options, int defaultSelection, OnDropdownSelectionChanged eventCallback) { throw new NotImplementedException(); }
private UIDropDown AddDropdownBase(string text, string[] options, OnDropdownSelectionChanged eventCallback) { return(CloneBasicDropDown(text, options, eventCallback, this.m_Root)); }
public object AddDropdown(string text, string[] options, int defaultSelection, OnDropdownSelectionChanged eventCallback) { UIDropDown uIDropDown = AddDropdownBase(text, options, eventCallback); if (uIDropDown != null) { uIDropDown.selectedIndex = defaultSelection; return(uIDropDown); } else { return(null); } }
private UIDropDown AddDropdownBaseLocalized(string text, string[] options, OnDropdownSelectionChanged eventCallback, int defaultSelection, bool limitLabelByPanelWidth = false) => CloneBasicDropDownLocalized(text, options, eventCallback, defaultSelection, m_root, limitLabelByPanelWidth);
private UIDropDown AddDropdownBaseLocalized(string text, string[] options, OnDropdownSelectionChanged eventCallback, int defaultSelection) { return(CloneBasicDropDownLocalized(text, options, eventCallback, defaultSelection, this.m_Root)); }
public static UIDropDown CloneBasicDropDown(string text, string[] options, OnDropdownSelectionChanged eventCallback, UIComponent parent) { UILabel l; return(CloneBasicDropDown(text, options, eventCallback, parent, out l)); }
private UIDropDown AddDropdownBase(string text, string[] options, OnDropdownSelectionChanged eventCallback, bool limitLabelByPanelWidth = false) => CloneBasicDropDown(text, options, eventCallback, m_root, limitLabelByPanelWidth);
public object AddDropdown(string text, string[] options, int defaultSelection, OnDropdownSelectionChanged eventCallback) { UIDropDown uIDropDown = this.AddDropdownBase(text, options, eventCallback); bool flag = uIDropDown != null; object result; if (flag) { uIDropDown.selectedIndex = defaultSelection; result = uIDropDown; } else { result = null; } return(result); }
public UIDropDown AddDropdownLocalized(string text, string[] options, int defaultSelection, OnDropdownSelectionChanged eventCallback) { UIDropDown uIDropDown = AddDropdownBaseLocalized(text, options, eventCallback, defaultSelection); if (uIDropDown != null) { return(uIDropDown); } else { return(null); } }
public static UIDropDown CloneBasicDropDownLocalized(string text, string[] options, OnDropdownSelectionChanged eventCallback, int defaultSelection, UIComponent parent, bool limitLabelByPanelWidth = false) => CloneBasicDropDownLocalized(text, options, eventCallback, defaultSelection, parent, out _, out _, limitLabelByPanelWidth);
public static UIDropDown CloneBasicDropDown(string text, string[] options, OnDropdownSelectionChanged eventCallback, UIComponent parent, bool limitLabelByPanelWidth = false) { return(CloneBasicDropDown(text, options, eventCallback, parent, out UILabel l, limitLabelByPanelWidth)); }
private void AddFontDD(string locale, UIHelperExtension m_uiHelperHS, out UIDropDown targetDD, OnDropdownSelectionChanged callback) { AddEmptyDropdown(Locale.Get(locale), out targetDD, m_uiHelperHS, callback); AddButtonInEditorRow(targetDD, CommonsSpriteNames.K45_Reload, ReloadFonts); }
public static UIDropDown CloneBasicDropDownLocalized(string text, string[] options, OnDropdownSelectionChanged eventCallback, int defaultSelection, UIComponent parent, bool limitLabelByPanelWidth = false) { if (eventCallback != null && !string.IsNullOrEmpty(text)) { UIPanel uIPanel = parent.AttachUIComponent(UITemplateManager.GetAsGameObject(kDropdownTemplate)) as UIPanel; uIPanel.Find <UILabel>("Label").localeID = text; uIPanel.Find <UILabel>("Label").isLocalized = true; if (limitLabelByPanelWidth) { KlyteUtils.LimitWidth(uIPanel.Find <UILabel>("Label"), (uint)uIPanel.width); } UIDropDown uIDropDown = uIPanel.Find <UIDropDown>("Dropdown"); uIDropDown.items = options; uIDropDown.selectedIndex = defaultSelection; uIDropDown.eventSelectedIndexChanged += delegate(UIComponent c, int sel) { eventCallback(sel); }; return(uIDropDown); } DebugOutputPanel.AddMessage(PluginManager.MessageType.Warning, "Cannot create dropdown with no name or no event"); return(null); }
public static void AddDropdown(string title, out UIDropDown dropdown, UIHelperExtension parentHelper, string[] options, OnDropdownSelectionChanged onChange) => AddDropdown(title, out dropdown, out UILabel label, parentHelper, options, onChange);
public UIDropDown AddDropdown(string text, string[] options, string defaultSelection, OnDropdownSelectionChanged eventCallback) { UIDropDown uIDropDown = this.AddDropdownBase(text, options, eventCallback); bool flag = uIDropDown != null; UIDropDown result; if (flag) { bool flag2 = options.Contains(defaultSelection); bool flag3 = flag2; if (flag3) { uIDropDown.selectedIndex = options.ToList <string>().IndexOf(defaultSelection); } result = uIDropDown; } else { result = null; } return(result); }