Exemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        if (myModel.StateStyle)
        {
            UpdateTag();
            myModel.DemoTag.localnub = AllName.IndexOf(myModel.NowName);
            myModel.StateStyle       = false;
            Debug.Log(myModel.NowName);
        }
        serializedObject.Update();
        GUILayout.Space(10);

        if (myModel != null)
        {
            myModel.DemoTag.localnub = EditorGUILayout.Popup(myModel.DemoTag.localnub, AllName.ToArray());
            myModel.DemoTag.TextType = AllName[myModel.DemoTag.localnub];
        }
        if (Lastnub != myModel.DemoTag.localnub)
        {
            UpdateState();
            Lastnub = myModel.DemoTag.localnub;
        }

        if (myModel.DemoTag.TextType != "自定义风格")
        {
            myModel.UseBasicStyle = true;
        }
        else
        {
            myModel.UseBasicStyle = false;

            EditorGUILayout.BeginVertical();
            {
                EditorGUILayout.BeginHorizontal();
                {
                    DrawOutline = EditorGUILayout.Foldout(DrawOutline, "DrawOutline");
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("IsDrawOutline"));
                }
                EditorGUILayout.EndHorizontal();
                if (DrawOutline)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Outline_effectColor"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Outline_effectDistance"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("ShadowType"));
                }
                EditorGUILayout.BeginHorizontal();
                {
                    DrawGradent = EditorGUILayout.Foldout(DrawGradent, "DrawGradent");
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("IsDrawGradent"));
                }
                EditorGUILayout.EndHorizontal();
                if (DrawGradent)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("GradientType"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("colorTop"));
                    if (serializedObject.FindProperty("GradientType").intValue == 2)
                    {
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("colorCenter"));
                    }
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("colorBottom"));
                    //EditorGUILayout.PropertyField(serializedObject.FindProperty("MultiplyTextColor"));
                }
                EditorGUILayout.BeginHorizontal();
                {
                    DrawShadow = EditorGUILayout.Foldout(DrawShadow, "DrawShadow");
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("IsDrawShadow"));
                }
                EditorGUILayout.EndHorizontal();
                if (DrawShadow)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Shadow_effectColor"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Shadow_effectDistance"));
                }
            }
            EditorGUILayout.EndVertical();
        }

        GUILayout.Space(20);

        EditorGUILayout.BeginHorizontal();
        {
            if (GUILayout.Button("Open Editor Window"))
            {
                EditorStyle.CreateWizard(Lastnub);
            }
            EditorGUI.BeginDisabledGroup(myModel.UseBasicStyle);
            if (GUILayout.Button("Create a new style based on this"))
            {
                EditorStyle.EditorGUILayoutTextNow.ShowCreatWindow(myModel, myModel.GetComponent <Text>());
            }
            EditorGUI.EndDisabledGroup();
        }
        EditorGUILayout.EndHorizontal();
        serializedObject.ApplyModifiedProperties();
    }