Ejemplo n.º 1
0
    private void SectionSecialProperties()
    {
        MadGUI.BeginBox("Special Properties");
        MadGUI.Indent(() => {
            MadGUI.Warning("Special properties are deprecated. Please use Children section instead.");

            if (levelIcon.generated)
            {
                int levelCount = levelIcon.configuration.LevelCount(MadLevel.Type.Level);
                if (levelCount > levelIcon.levelIndex)
                {
                    var level = levelIcon.level;
                    if (level != null)
                    {
                        MadGUI.Disabled(() => {
                            EditorGUILayout.TextField("Level TypeID", level.name);
                            EditorGUILayout.TextField("Level Arguments", level.arguments);
                        });
                    }
                    else
                    {
                        MadGUI.Warning("Level for this icon no longer exists.");
                    }
                }
                if (MadGUI.InfoFix("These values are set and managed by level configuration.",
                                   "Configuration"))
                {
                    Selection.objects = new Object[] { levelIcon.configuration };
                }
            }

            //
            // Completed property select popup
            //
            EditorGUI.BeginChangeCheck();

            MadGUI.PropertyFieldObjectsPopup <MadLevelProperty>(
                target,
                "\"Completed\" Property",
                ref levelIcon.completedProperty,
                PropertyList(),
                false
                );

            MadGUI.PropertyFieldObjectsPopup <MadLevelProperty>(
                target,
                "\"Locked\" Property",
                ref levelIcon.lockedProperty,
                PropertyList(),
                false
                );
            if (EditorGUI.EndChangeCheck())
            {
                if (levelIcon.completedProperty == null && levelIcon.lockedProperty == null)
                {
                    EditorUtility.DisplayDialog("Hiding Special Properties",
                                                "Special properties are deprecated and they will be now hidden from your inspector view. Please use the Visibility section instead.",
                                                "I understand");
                }
            }
        });
        MadGUI.EndBox();
    }
Ejemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        var levelIcon = target as MadLevelIcon;

        MadGUI.BeginBox("Properties");
        MadGUI.Indent(() => {
            var properties = PropertyList();
            foreach (MadLevelProperty property in properties)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label(property.name, GUILayout.Width(170));

                GUI.enabled = !property.propertyEnabled;
                if (GUILayout.Button("Enable"))
                {
                    property.propertyEnabled = true;
                    EditorUtility.SetDirty(property);
                }
                GUI.enabled = property.propertyEnabled;
                if (GUILayout.Button("Disable"))
                {
                    property.propertyEnabled = false;
                    EditorUtility.SetDirty(property);
                }
                GUI.enabled = true;
                GUI.color   = Color.white;

                GUILayout.EndHorizontal();
            }
        });
        MadGUI.EndBox();

        MadGUI.BeginBox("Level Icon");
        MadGUI.Indent(() => {
            if (levelIcon.hasLevelConfiguration)
            {
                int levelCount = levelIcon.configuration.LevelCount(MadLevel.Type.Level);
                if (levelCount > levelIcon.levelIndex)
                {
                    var level = levelIcon.level;
                    MadGUI.Disabled(() => {
                        EditorGUILayout.TextField("Level Name", level.name);
                        EditorGUILayout.TextField("Level Arguments", level.arguments);
                    });
                }
                if (MadGUI.InfoFix("These values are set and managed by level configuration.",
                                   "Configuration"))
                {
                    Selection.objects = new Object[] { levelIcon.configuration };
                }
            }
            else
            {
                serializedObject.Update();
                MadGUI.PropertyField(levelSceneName, "Level Scene Name");
                serializedObject.ApplyModifiedProperties();
            }

            //
            // Completed property select popup
            //
            MadGUI.PropertyFieldObjectsPopup <MadLevelProperty>(
                target,
                "\"Completed\" Property",
                ref levelIcon.completedProperty,
                PropertyList(),
                false
                );

            MadGUI.PropertyFieldObjectsPopup <MadLevelProperty>(
                target,
                "\"Locked\" Property",
                ref levelIcon.lockedProperty,
                PropertyList(),
                false
                );

            MadGUI.PropertyFieldObjectsPopup <MadText>(
                target,
                "Level Number Text",
                ref levelIcon.levelNumber,
                TextList(),
                false
                );

            serializedObject.Update();
            if (MadGUI.Foldout("Unlock On Complete", false))
            {
                var arrayList = new MadGUI.ArrayList <MadLevelIcon>(
                    unlockOnComplete, (p) => { MadGUI.PropertyField(p, ""); });
                arrayList.Draw();
            }
            serializedObject.ApplyModifiedProperties();
        });
        MadGUI.EndBox();

        MadGUI.BeginBox("Sprite");
        MadGUI.Indent(() => {
            SectionSprite();
        });
        MadGUI.EndBox();
    }