public void Build(string lbl, string value, List <string> selection, Action <string> onSelected) { EditorGUILayout.LabelField($"{lbl} : {value}", EditorStyles.boldLabel); GUI.SetNextControlName(lbl); m_value = EditorGUILayout.TextField("Search", m_value); if (m_value.IsEmpty() || GUI.GetNameOfFocusedControl() != lbl) { return; } List <string> foundItems = selection.FindAll(x => x.Contains(m_value)); if (foundItems == null) { return; } GUILayout.BeginVertical("box"); m_scrollPos = EditorGUILayout.BeginScrollView(m_scrollPos, GUILayout.Width(EditorGUIUtility.currentViewWidth - 50), GUILayout.Height(300)); foundItems.ForEach(item => { EU.Btn(item, () => { m_value = item; onSelected(item); GUI.FocusControl(null); }); }); EditorGUILayout.EndScrollView(); GUILayout.EndVertical(); }
public static string TextfieldWithOk(string label, string value, Action <string> onSubmit, string submitLbl = "OK") { EU.HGroup(() => { value = EditorGUILayout.TextField(label, value); EU.Btn(submitLbl, () => onSubmit.Invoke(value)); }); return(value); }
public override void OnInspectorGUI() { DrawDefaultInspector(); AdMobHelper tgt = (AdMobHelper)target; EU.VPadding(() => EditorGUILayout.LabelField($"Cur Android Platform: {AppSettings.AndroidPlatform}", EditorStyles.boldLabel)); EU.Btn("Switch Android Platform", () => { SwitchPackageName(tgt); SwitchAppSettingsPlatform(tgt); SwitchAdmobSettings(tgt); EU.Save(); }); }
public override void OnInspectorGUI() { DrawDefaultInspector(); WowCarousel tgt = (WowCarousel)target; EU.Btn("Refresh", () => { Vector2 pivot = new Vector2(0f, .5f); Vector2 carouselSize = tgt.GetComponent <RectTransform>().Size(); tgt.ItemContainer.SetWidth(carouselSize.x); tgt.ItemContainer.pivot = pivot; RectTransform itemRt = tgt.TemplateItem.GetComponent <RectTransform>(); itemRt.pivot = pivot; itemRt.SetSize(carouselSize); EU.SetSceneDirty(); }); }