public override void OnInspectorGUI()
    {
        comp      = (UIStyleComponent)target;
        styleList = UIStyleConfigManager.GetUIStyleList();

        m_currentStyle = GetStyleID();
        m_currentStyle = EditorGUILayout.Popup("当前 UIStyle:", m_currentStyle, styleList);

        comp.m_styleID = styleList[m_currentStyle];

        m_StyleName = styleList[m_currentStyle];

        GUILayout.Space(15);

        if (m_StyleName != "None")
        {
            if (GUILayout.Button("套用Stlye模板"))
            {
                ApplyStyle(UIStyleConfigManager.GetData(m_StyleName));
            }

            if (GUILayout.Button("覆盖Stlye模板"))
            {
                if (EditorUtility.DisplayDialog("警告", "该模板已存在,是否覆盖?", "是", "否"))
                {
                    ReplaceStyle(UIStyleConfigManager.GetData(m_StyleName));
                }
            }
        }
        else
        {
            EditorGUILayout.BeginHorizontal();

            m_createStyleName = EditorGUILayout.TextField("创建 Style Name:", m_createStyleName);
            if (UIStyleConfigManager.GetData(m_createStyleName) != null)
            {
                if (GUILayout.Button("覆盖Stlye模板"))
                {
                    if (EditorUtility.DisplayDialog("警告", "该模板已存在,是否覆盖?", "是", "否"))
                    {
                        ReplaceStyle(UIStyleConfigManager.GetData(m_StyleName));
                    }
                }
            }
            else
            {
                if (GUILayout.Button("以此UI为模板创建UIStyle"))
                {
                    CreatStyle(m_createStyleName);
                    m_createStyleName = "";
                }
            }

            EditorGUILayout.EndHorizontal();
        }
    }
Esempio n. 2
0
    void CreateUIStyleGUI()
    {
        EditorGUI.indentLevel = 1;
        isFoldCreateUIStyle   = EditorGUILayout.Foldout(isFoldCreateUIStyle, "创建Style:");
        if (isFoldCreateUIStyle)
        {
            EditorGUI.indentLevel = 2;
            m_CreateStyleName     = EditorGUILayout.TextField("Style名称:", m_CreateStyleName);

            if (m_CreateStyleName != "")
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.Space();

                if (UIStyleConfigManager.GetData(m_CreateStyleName) == null)
                {
                    if (GUILayout.Button("创建新UIStyle", GUILayout.Width(EditorGUIStyleData.s_ButtonWidth_large)))
                    {
                        CreateUIStyle(m_CreateStyleName);

                        m_CreateStyleName = "";
                    }
                }
                else
                {
                    if (GUILayout.Button("覆盖UIStyle", GUILayout.Width(EditorGUIStyleData.s_ButtonWidth_large)))
                    {
                        if (EditorUtility.DisplayDialog("警告", "该模板已存在,是否覆盖?", "是", "否"))
                        {
                            CreateUIStyle(m_CreateStyleName);

                            m_CreateStyleName = "";
                        }
                    }
                }

                EditorGUILayout.Space();
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.Space();
        }
    }
Esempio n. 3
0
 public void OnEnable()
 {
     m_styleData = UIStyleConfigManager.GetData();
 }