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(); }
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(); }