Пример #1
0
    void CreateUIStyle(string l_uiStyleName)
    {
        UIStyleInfo l_tmp = new UIStyleInfo();

        l_tmp.m_StyleInfoName = l_uiStyleName;

        UIStyleConfigManager.AddData(l_uiStyleName, l_tmp);
    }
Пример #2
0
 void DeleteLogic()
 {
     if (m_deleteKey != "")
     {
         UIStyleConfigManager.DeleteData(m_deleteKey);
         m_deleteKey = "";
     }
 }
    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();
        }
    }
Пример #4
0
    public void CreatStyleTmp()
    {
        UIStyleInfo styleTmp = new UIStyleInfo();

        styleTmp.GetStyle(((UIWindowBase)target).gameObject);

        UIStyleConfigManager.AddData(styleTmp.m_StyleInfoName, styleTmp);

        m_StyleName = styleTmp.m_StyleInfoName;
    }
Пример #5
0
    void ButtonsGUI()
    {
        if (GUILayout.Button("保存"))
        {
            UIStyleConfigManager.SaveData();
        }

        if (GUILayout.Button("应用全部Style"))
        {
            ApplyAllStyle();
        }
    }
    public void CreatStyle(string UIstyleName)
    {
        UIStyleInfo styleTmp = new UIStyleInfo();

        styleTmp.GetStyle(comp.gameObject);

        styleTmp.m_StyleInfoName = UIstyleName;

        UIStyleConfigManager.AddData(styleTmp.m_StyleInfoName, styleTmp);

        m_StyleName = styleTmp.m_StyleInfoName;

        m_currentStyle = UIStyleConfigManager.GetUIStyleList().Length - 1;
    }
Пример #7
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();
        }
    }
Пример #8
0
 public void OnEnable()
 {
     m_styleData = UIStyleConfigManager.GetData();
 }