Exemple #1
0
 public static void DrawBeautyArrayofClasses(this SerializedProperty property, string[] themeList, float height = 32f, float Spacement = 5f, string IconFileName = "", int depth = 0, string OverrideName = "")
 {
     try
     {
         if (property.BeginWrapperWindow(height, themeList[0], IconFileName, 0f, OverrideName))
         {
             if (!property.isArray)
             {
                 Debug.LogError("Error: " + property.displayName);
             }
             for (int i = 0; i < property.arraySize; i++)
             {
                 if (property.GetArrayElementAtIndex(i).hasVisibleChildren&& depth > 0)
                 {
                     string[] newThemeList = LeoLuz.Utilities.ArrayUtility.Remove(themeList, themeList[0]);
                     property.GetArrayElementAtIndex(i).DrawBeautyClass(newThemeList, Mathf.Clamp(height * 0.75f, 16f, 999f), 5f, IconFileName, depth - 1);
                     if (i < property.arraySize - 1)
                     {
                         GUILayout.Space(Spacement);
                     }
                 }
                 else
                 {
                     property.GetArrayElementAtIndex(i).Draw();
                 }
             }
             DGUI.ArrayIncreaseButton(property);
         }
         property.EndWrapperWindow();
     }
     catch
     {
         Debug.LogError("Error: " + property.displayName);
     }
 }
Exemple #2
0
        //	public static void DrawBeautyArrayofClasses(this SerializedProperty property, string[] themeList, float[] heightList, float[] SpacementList, string[] IconFileNameList,int depth)
        //    {
        //        try
        //        {
        //			if (property.BeginWrapperWindow(heightList[0], themeList[0], IconFileNameList[0]))
        //            {
        //                ComboMasterInterfaceConfig.DepthTheme theme = InterfaceThemeConfig.GetCustomStyle(themeList[0]);
        //                if (!property.isArray)
        //                {
        //                    Debug.LogError("Error: " + property.displayName);
        //                }
        //                for (int i = 0; i < property.arraySize; i++)
        //                {
        //
        //                    if (property.GetArrayElementAtIndex(i).hasVisibleChildren && depth > 0)
        //                    {
        //
        //                        string[] newThemeList = ArrayUtility.Remove(themeList, themeList[0]);
        //						float[] newHeightList = ArrayUtility.Remove(heightList, heightList[0]);
        //						string[] newSpacementList= ArrayUtility.Remove(SpacementList, SpacementList[0]);
        //						string[] newIconFileName = ArrayUtility.Remove(IconFileNameList, IconFileNameList[0]);
        //						property.GetArrayElementAtIndex(i).DrawBeautyClass(themeList, heightList,SpacementList,IconFileNameList, depth - 1);
        //                        if (i < property.arraySize - 1)
        //							GUILayout.Space(SpacementList[0]);
        //                    }
        //                    else
        //                    {
        //                        property.GetArrayElementAtIndex(i).Draw();
        //                    }
        //
        //                }
        //                DGUI.ArrayIncreaseButton(property);
        //            }
        //            property.EndWrapperWindow();
        //        } catch
        //        {
        //            Debug.LogError("Error: " + property.displayName);
        //        }
        //    }
        public static void DrawBeautyClass(this SerializedProperty property, string[] themeList, float height, float Spacement, string IconFileName, int depth)
        {
            if (property.BeginWrapperWindow(height, themeList[0], IconFileName))
            {
                GUILayout.Space(5f);
                List <SerializedProperty> children = property.GetChildren();

                for (int i = 0; i < children.Count; i++)
                {
                    if (children[i].hasVisibleChildren && depth > 0)
                    {
                        string[] newThemeList = LeoLuz.Utilities.ArrayUtility.Remove(themeList, themeList[0]);

                        if (children[i].isArray)
                        {
                            children[i].DrawBeautyArrayofClasses(newThemeList, Mathf.Clamp(height * 0.75f, 16f, 999f), 5f, IconFileName, depth - 1);
                        }
                        else
                        {
                            children[i].DrawBeautyClass(newThemeList, Mathf.Clamp(height * 0.75f, 16f, 999f), 5f, IconFileName, depth - 1);
                        }
                    }
                    else
                    {
                        children[i].Draw();
                    }
                    if (i < children.Count - 1)
                    {
                        GUILayout.Space(Spacement);
                    }
                }
            }
            property.EndWrapperWindow();
        }
Exemple #3
0
 public static void DrawWindowed(this SerializedProperty serializedProperty, float height, string themeName = "", string IconName = "", float minLabelWidth = 150f, float minValueWidth = 22f)
 {
     if (serializedProperty.BeginWrapperWindow(height, themeName, IconName))
     {
         serializedProperty.DrawChildren(0, 999, minLabelWidth, minValueWidth);
     }
     serializedProperty.EndWrapperWindow();
 }
Exemple #4
0
 public static void DrawWindowed(this SerializedProperty serializedProperty, float height, string themeName, string IconName, string overrideName)
 {
     if (serializedProperty.BeginWrapperWindow(height, themeName, IconName, 0f, overrideName))
     {
         serializedProperty.DrawChildren();
     }
     serializedProperty.EndWrapperWindow(true);
 }
Exemple #5
0
 public static void DrawWindowed(this SerializedProperty serializedProperty, float height, string themeName, string IconName, int startOn, int endOn, float labelwidth, float minValueWidth)
 {
     if (serializedProperty.BeginWrapperWindow(height, themeName, IconName))
     {
         serializedProperty.DrawChildren(startOn, endOn, labelwidth, minValueWidth);
     }
     serializedProperty.EndWrapperWindow();
 }
Exemple #6
0
 public static void DrawBeautyArray(this SerializedProperty property, float height, string themeName, string IconFileName = "")
 {
     if (property.BeginWrapperWindow(height, themeName, IconFileName))
     {
         property.DrawChildren(1, 99999);
         DGUI.ArrayIncreaseButton(property);
     }
     property.EndWrapperWindow();
 }
Exemple #7
0
        public static void DrawWindowedChild(this SerializedProperty serializedProperty, string childName, float height, string themeName = "", string IconName = "")
        {
            SerializedProperty child = serializedProperty.FindPropertyRelative(childName);

            if (child.BeginWrapperWindow(height, themeName, IconName))
            {
                child.DrawChildren();
            }
            child.EndWrapperWindow();
        }
Exemple #8
0
        public void Draw()
        {
            serializedObj.Update();

            if (InterfaceThemeConfig == null)
            {
                InterfaceThemeConfig = FileUtility.LoadFile("ComboMasterTheme") as ComboMasterInterfaceConfig;
            }

            if (serializedObj == null)
            {
                ReloadSerializedProperties();
            }

            InspectorBeautifierExtensions.ThemeFileName = "ComboMasterTheme";

            if (comboMaster.InputSequences == null || comboMaster.InputSequences.Length != InputSequenceElements.Length || comboMaster.InputSequences.Length != InputSequencesProp.arraySize)
            {
                ReloadSerializedProperties();
            }
            if (Math.Round(EditorStyles.label.normal.textColor.r, 2) == 0.7)
            {
                useDarkTheme = true;
            }
            else
            {
                useDarkTheme = false;
            }


            DGUI.Space(0f);
            if (configProp.BeginWrapperWindow(32f, useDarkTheme ? "Dark" : "Grey", "GearIcon"))
            {
                configProp.FindPropertyRelative("DigitalHorizontal").Draw();
                configProp.FindPropertyRelative("DigitalVertical").Draw();
                configProp.FindPropertyRelative("inversionDetection").Draw();
                if (comboMaster.config.inversionDetection == CommandSequences.Config.InversionDetection.Manual)
                {
                    serializedObj.FindProperty("FacingRight").Draw();
                    serializedObj.FindProperty("FacingUp").Draw();
                }
                configProp.FindPropertyRelative("Player").Draw();
                configProp.FindPropertyRelative("Debug").Draw();
            }
            configProp.EndWrapperWindow();
            //Economic interface mode
            ComboMasterInterfaceConfig.DepthTheme theme = InterfaceThemeConfig.GetCustomStyle(useDarkTheme ? "Dark" : "Grey");
            Texture2D SequenceIcon = (Texture2D)FileUtility.LoadTexture("SequenceIcon");
            GUIStyle  BoldLabel    = GUIStyle.none;

            BoldLabel.fontStyle = FontStyle.Bold;
            BoldLabel.fontSize  = 12;
            DGUI.Space(0f);
            for (int i = 0; comboMaster.InputSequences != null && i < comboMaster.InputSequences.Length; i++)
            {
                GUILayout.BeginVertical(InputSequenceElements[i].isExpanded ? theme.WindowOpennedHeaderStyle : theme.WindowClosedHeaderStyle);

                Rect  BlockRect = EditorGUILayout.GetControlRect(false, 32f);
                float fullwidth = BlockRect.width;
                BlockRect.x     -= 12f;
                BlockRect.width += 12f;
                //Header block style:
                #region Header visible block
                GUI.Box(BlockRect, SequenceIcon, theme.HeaderLabelStyle);
                //label.x -= LabelXOffset;
                #endregion

                #region clicable button
                BlockRect.width = 32f;
                if (GUI.Button(BlockRect, "", GUIStyle.none))
                {
                    InputSequenceElements[i].isExpanded = !InputSequenceElements[i].isExpanded;
                }
                #endregion

                #region Sandwich
                if (InputSequenceElements[i].isExpanded)
                {
                    //BlockRect.width = fullwidth;

                    //GUIStyle sandwichStyle = new GUIStyle();
                    //sandwichStyle.alignment = TextAnchor.MiddleRight;
                    //GUI.Box(BlockRect, new GUIContent(theme.MinimizeIcon), sandwichStyle);
                    DrawMoveOrderingOptions(i, comboMaster, comboMaster.InputSequences[i], -13f, 13f);
                }
                else
                {
                    DrawMoveOrderingOptions(i, comboMaster, comboMaster.InputSequences[i], -13f, 13f);
                }
                #endregion

                #region Editable Label
                BlockRect.width = fullwidth - 36f;
                BlockRect.xMin += 34f;
                //  BlockRect.yMin += 10f;
                if (i >= comboMaster.InputSequences.Length)
                {
                    return;
                }
                if (comboMaster.InputSequences[i].Name == "")
                {
                    comboMaster.InputSequences[i].Name = "New Sequence";
                }
                comboMaster.InputSequences[i].Name = EditorGUI.TextField(BlockRect, comboMaster.InputSequences[i].Name, theme.HeaderLabelStyle);
                #endregion

                #region Sequence Body
                if (InputSequenceElements[i].isExpanded)
                {
                    EditorGUILayout.BeginVertical(theme.WindowInnerStyle);
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Space(10f);
                    EditorGUILayout.BeginVertical();
                    GUILayout.Space(10f);
                    comboMaster.InputSequences[i].AutofitConnections();
                    DrawCommandSteps(InputSequenceElements[i].FindPropertyRelative("commandList"), ref comboMaster.InputSequences[i].commandList);
                }

                if (InputSequenceElements[i].isExpanded)
                {
                    GUILayout.Space(10f);
                    EditorGUILayout.EndVertical();
                    GUILayout.Space(10f);
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndVertical();
                DGUI.Space(0f);
                #endregion
            }
            InputSequencesProp.ArrayIncreaseButton();
            DGUI.Space(0f);
            if (GUI.changed)
            {
                serializedObj.ApplyModifiedProperties();
                if (!Application.isPlaying)
                {
                    UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene());
                }
            }
        }