protected GUIContent m_GUIContent; //Content public ToolBarParent(string title, string tips, float space, float width, ToolBarStateEnum state = ToolBarStateEnum.Normal) { m_TitleName = title; m_ToolTips = tips; m_Space = space; m_Width = width; m_ToolBarStateEnum = state; if (string.IsNullOrEmpty(m_ToolTips)) { m_GUIContent = new GUIContent(m_TitleName); } else { m_GUIContent = new GUIContent(m_TitleName, m_ToolTips); } }
/// <summary> /// 创建一个带有纹理的工具栏 /// </summary> /// <param name="title"></param> /// <param name="tips"></param> /// <param name="space"></param> /// <param name="width"></param> /// <param name="img"></param> /// <param name="rect">相对范围</param> /// <param name="state"></param> public ToolBarWithTexture(string title, string tips, float space, float width, string img, Rect rect, ToolBarStateEnum state) : base(title, tips, space, width, state) { m_ImagePath = img; m_ImageArea = rect; m_Img = AssetDatabase.LoadAssetAtPath(m_ImagePath, typeof(Texture2D)) as Texture2D; if (m_Img == null) { Debug.LogError("ToolBarWithTexture Create Fail ,Image Not Exit " + m_ImagePath); } else { if (string.IsNullOrEmpty(m_ToolTips)) { m_GUIContent = new GUIContent(m_TitleName, m_Img); } else { m_GUIContent = new GUIContent(m_TitleName, m_Img, m_ToolTips); } } }
public ToolBarWithTexture(string title, string tips, float space, float width, ToolBarStateEnum state) : base(title, tips, space, width, state) { }