Exemple #1
0
        void DrawLevelSettings()
        {
            GUILayout.BeginArea(setUpSettings.GetRect());
            {
                setUpScrollView = EditorGUILayout.BeginScrollView(setUpScrollView, GUILayout.MaxHeight(setUpSettings.GetRect().height));
                EditorGUILayout.Space();
                EditorGUI.BeginChangeCheck();
                level = (LevelPlatformerGenerator)EditorGUILayout.ObjectField(level, typeof(LevelPlatformerGenerator), true);
                if (EditorGUI.EndChangeCheck())
                {
                    if (level == null)
                    {
                        type = GENERATOR_TO_EDIT.None;
                    }
                }
                if (level != null)
                {
                    if (levelEditor == null)
                    {
                        levelEditor = (LevelGeneratorInspector)Editor.CreateEditor(level);
                    }
                    levelEditor.OnWindowGUI();
                    if (level.setUp != null)
                    {
                        UpdateTextures();
                    }
                }

                EditorGUILayout.EndScrollView();
            }
            GUILayout.EndArea();
        }
Exemple #2
0
 void DrawMapSettings()
 {
     GUILayout.BeginArea(setUpSettings.GetRect());
     {
         setUpScrollView = EditorGUILayout.BeginScrollView(setUpScrollView, GUILayout.MaxHeight(setUpSettings.GetRect().height));
         EditorGUILayout.Space();
         EditorGUI.BeginChangeCheck();
         map = (MapGenerator)EditorGUILayout.ObjectField(map, typeof(MapGenerator), true);
         if (EditorGUI.EndChangeCheck())
         {
             if (map == null)
             {
                 type = GENERATOR_TO_EDIT.None;
             }
         }
         if (map != null)
         {
             if (mapEditor == null)
             {
                 mapEditor = (MapGeneratorInspector)Editor.CreateEditor(map);
             }
             mapEditor.OnWindowGUI();
             if (map.setUp != null)
             {
                 UpdateTextures();
             }
         }
         EditorGUILayout.EndScrollView();
     }
     GUILayout.EndArea();
 }
Exemple #3
0
 public void SetType(GENERATOR_TO_EDIT _type, object generator)
 {
     if (_type == GENERATOR_TO_EDIT.Level)
     {
         level = (LevelPlatformerGenerator)generator;
     }
     if (_type == GENERATOR_TO_EDIT.Map)
     {
         map = (MapGenerator)generator;
     }
     type = _type;
 }
Exemple #4
0
        void Draw()
        {
            DrawSections();
            DrawSettings();
            if (map == null && level == null)
            {
                type = GENERATOR_TO_EDIT.None;
            }
            if (level != null && level.setUp != null)
            {
                UpdateTextures();
            }
            if (map != null && map.setUp != null)
            {
                UpdateTextures();
            }
            switch (type)
            {
            case GENERATOR_TO_EDIT.Level:
                DrawLevelSettings();
                break;

            case GENERATOR_TO_EDIT.Map:
                DrawMapSettings();
                break;

            default:
                DrawSettingsReferenceless();
                break;
            }
            if (type == GENERATOR_TO_EDIT.Level)
            {
                if (level.setUp != null)
                {
                    if (level.setUp.editorGeneratorLevel != null)
                    {
                        DrawBody();
                    }
                }
            }
            if (type == GENERATOR_TO_EDIT.Map)
            {
                if (map.setUp != null)
                {
                    if (map.setUp.editorGeneratorLevel != null)
                    {
                        DrawBody();
                    }
                }
            }
            DrawTextureInfo();
        }
Exemple #5
0
 void DrawSettingsReferenceless()
 {
     GUILayout.BeginArea(setUpSettings.GetRect());
     {
         EditorGUILayout.Space();
         EditorGUI.indentLevel = 1;
         EditorGUI.BeginChangeCheck();
         level = (LevelPlatformerGenerator)EditorGUILayout.ObjectField(level, typeof(LevelPlatformerGenerator), true);
         if (EditorGUI.EndChangeCheck())
         {
             if (level != null)
             {
                 type = GENERATOR_TO_EDIT.Level;
                 if (level.setUp != null && level.setUp.editorGeneratorLevel != null)
                 {
                     SetTexture(level.setUp.editorGeneratorLevel);
                 }
             }
         }
         EditorGUI.BeginChangeCheck();
         map = (MapGenerator)EditorGUILayout.ObjectField(map, typeof(MapGenerator), true);
         if (EditorGUI.EndChangeCheck())
         {
             if (map != null)
             {
                 type = GENERATOR_TO_EDIT.Map;
                 if (map.setUp != null && map.setUp.editorGeneratorLevel != null)
                 {
                     SetTexture(map.setUp.editorGeneratorLevel);
                 }
             }
         }
         EditorGUI.indentLevel = 0;
     }
     GUILayout.EndArea();
 }