Beispiel #1
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());
                }
            }
        }