void DrawResultsList() { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUI.SetNextControlName("QuickSearch"); string s = QuickGUI.SearchTextBar(sampleSearch); UpdateShowResult(s); GUILayout.Label(string.Format("{0}/{1}", off, showResults.Count), "ProgressBarBack"); GUILayout.EndHorizontal(); GUILayout.Space(10); QuickGUI.StepVerticalScroll(ref off, ref scrollPos, 30, showResults.Count, DrawResultItem, null); GUILayout.BeginHorizontal(); pPercent = showResults.Count > 30 ? (float)off / (float)(showResults.Count - 30) : 1f; float p2 = GUILayout.HorizontalSlider(pPercent, 0f, 1f); if (p2 != pPercent && showResults.Count > 30) { off = Mathf.FloorToInt((showResults.Count - 30) * p2); } pPercent = p2; GUILayout.Label(string.Format("{0}/{1}", Mathf.Min(off + 30, showResults.Count), showResults.Count), "ProgressBarBack"); GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
void DrawComponentField() { GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Component", GUILayout.Width(100)); string[] pops = new string[mAllCmpTypes.Count + 1]; pops[0] = "All"; for (int i = 1; i < pops.Length; i++) { pops[i] = mAllCmpTypes[i - 1].Name; } cmpIndex = Mathf.Min(cmpIndex, pops.Length - 1); GUILayout.Label(pops[cmpIndex], "ShurikenModuleTitle"); GUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); showCmps = QuickGUI.SearchTextBar(showCmps); EditorGUILayout.EndHorizontal(); cmpPos = GUILayout.BeginScrollView(cmpPos, "box"); bool first = true; for (int i = 0; i < pops.Length; i++) { bool old = cmpIndex == i; if (!old && !pops[i].ToLower().Contains(showCmps.ToLower())) { continue; } if (!first) { GUILayout.Space(3); QuickGUI.HLine(Color.gray); } bool last = GUILayout.Toggle(old, pops[i], "PlayerSettingsLevel"); if (last) { cmpIndex = i; } if (last ^ old) { showCmps = ""; } first = false; } GUILayout.EndScrollView(); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); }
public override void OnGUI() { if (mStyles.Count == 0) { foreach (GUIStyle style in GUI.skin) { mStyles.Add(style); } } GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); //GUILayout.Label("单击示例将复制其名到剪贴板", "label"); //GUILayout.FlexibleSpace(); //GUILayout.Label("查找:"); search = QuickGUI.SearchTextBar(search); GUILayout.EndHorizontal(); QuickGUI.StepVerticalScroll(ref offIndex, ref offPos, 30, mStyles.Count, (id, counter) => { GUIStyle style = mStyles[id]; if (style.name.ToLower().Contains(search.ToLower())) { GUILayout.BeginHorizontal("GridList"); GUILayout.Space(7); if (GUILayout.Button(StringUtil.WrapString(style.name, 5, "."), style, GUILayout.Width(100))) { EditorGUIUtility.systemCopyBuffer = "\"" + style.name + "\""; } GUILayout.Space(10); GUILayout.Toggle(true, "t", style, GUILayout.Width(50)); GUILayout.Space(7); GUILayout.Toggle(false, "f", style, GUILayout.Width(50)); GUILayout.Space(10); GUILayout.FlexibleSpace(); EditorGUILayout.SelectableLabel("\"" + style.name + "\""); GUILayout.EndHorizontal(); GUILayout.Space(11); return(true); } return(false); }, "box"); //scrollPosition = GUILayout.BeginScrollView(scrollPosition); //foreach (GUIStyle style in GUI.skin) //{ // if (style.name.ToLower().Contains(search.ToLower())) // { // GUILayout.BeginHorizontal("GridList"); // GUILayout.Space(7); // if (GUILayout.Button(StringUtil.WrapString(style.name, 5, "."), style, GUILayout.Width(100))) // { // EditorGUIUtility.systemCopyBuffer = "\"" + style.name + "\""; // } // GUILayout.Space(10); // GUILayout.Toggle(true, "t", style, GUILayout.Width(50)); // GUILayout.Space(7); // GUILayout.Toggle(false, "f", style, GUILayout.Width(50)); // GUILayout.Space(10); // GUILayout.FlexibleSpace(); // EditorGUILayout.SelectableLabel("\"" + style.name + "\""); // GUILayout.EndHorizontal(); // GUILayout.Space(11); // } //} //GUILayout.EndScrollView(); GUILayout.EndVertical(); }