void OnGUI() { using (new GUILayoutBeginScrollViewScope(ref scrollPosition)) { //内置图标 int columnCount = 20; using (new GUILayoutBeginHorizontalScope()) { for (int i = 0; i < EnumUtil.GetCount <EditorIconTextureType>(); ++i) { if (i > 0 && i % columnCount == 0) { GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); } if (GUILayout.Button(EditorIconTexture.GetSystem((EditorIconTextureType)i), GUILayout.Width(50), GUILayout.Height(36))) { string displayValue = string.Format("EditorIconTextureType.{0}\n{1}", EnumUtil.GetName <EditorIconTextureType>(i), EditorIconTextureConst.IconTextureNames[i] ); this.ShowNotificationAndLog(displayValue); } } } } }
public static GUIContent Get(EditorIconTextureType editorIconTextureType) { if (iconGUIContentCacheDict.ContainsKey(editorIconTextureType.ToString())) { return(iconGUIContentCacheDict[editorIconTextureType.ToString()]); } GUIContent guiContent = new GUIContent(EditorIconTexture.GetSystem(editorIconTextureType)); iconGUIContentCacheDict.Add(editorIconTextureType.ToString(), guiContent); return(guiContent); }
public static GUIContent Get(string name) { if (iconGUIContentCacheDict.ContainsKey(name)) { return(iconGUIContentCacheDict[name]); } GUIContent guiContent = new GUIContent(EditorIconTexture.GetCustom(name)); iconGUIContentCacheDict.Add(name, guiContent); return(guiContent); }
public static GUIContent Get(string name, string text, string tips) { if (iconGUIContentCacheDict.ContainsKey(name)) { return(iconGUIContentCacheDict[name]); } GUIContent guiContent = new GUIContent(text, EditorIconTexture.GetCustom(name), tips); iconGUIContentCacheDict[name] = guiContent; return(guiContent); }