Exemple #1
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        //Cleaners

        EditorGUILayout.BeginHorizontal();

        if (GUILayout.Button("Clear Item Data"))
        {
            comp.ClearItemData();
            AssetDatabase.DeleteAsset("Assets/Data/ScriptableObjects/Items");
        }
        if (GUILayout.Button("Clear Type Data"))
        {
            comp.ClearTypeData();
            AssetDatabase.DeleteAsset("Assets/Data/ScriptableObjects/Types");
        }
        if (GUILayout.Button("Clear Ability Data"))
        {
            comp.ClearAbilityData();
            AssetDatabase.DeleteAsset("Assets/Data/ScriptableObjects/Abilites");
        }
        if (GUILayout.Button("Clear Move Data"))
        {
            comp.ClearMoveData();
            AssetDatabase.DeleteAsset("Assets/Data/ScriptableObjects/Moves");
        }
        if (GUILayout.Button("Clear Pokemon Data"))
        {
            comp.ClearPokemonData();
            AssetDatabase.DeleteAsset("Assets/Data/ScriptableObjects/Pokemon");
        }

        EditorGUILayout.EndHorizontal();

        if (GUILayout.Button("Clear ALL Data"))
        {
            comp.ClearPokemonData();
            comp.ClearMoveData();
            comp.ClearAbilityData();
            comp.ClearTypeData();
            comp.ClearItemData();
            AssetDatabase.DeleteAsset("Assets/Data/ScriptableObjects/Pokemon");
            AssetDatabase.DeleteAsset("Assets/Data/ScriptableObjects/Moves");
            AssetDatabase.DeleteAsset("Assets/Data/ScriptableObjects/Abilites");
            AssetDatabase.DeleteAsset("Assets/Data/ScriptableObjects/Types");
            AssetDatabase.DeleteAsset("Assets/Data/ScriptableObjects/Items");
        }

        //Item, Move and Ability Generation

        EditorGUILayout.BeginHorizontal();


        if (GUILayout.Button("Generate Type Data"))
        {
            GenerateTypeData();
        }
        if (GUILayout.Button("Generate Ability Data"))
        {
            GenerateAbilityData();
        }
        if (GUILayout.Button("Generate Move Data"))
        {
            GenerateMoveData();
        }
        if (GUILayout.Button("Generate Item Data"))
        {
            GenerateItemData();
        }
        if (GUILayout.Button("Generate Pokemon Data"))
        {
            GeneratePokemonData();
        }

        EditorGUILayout.EndHorizontal();

        if (GUILayout.Button("Generate All Data"))
        {
            EditorGUI.BeginChangeCheck();
            EditorUtility.SetDirty(this);
            EditorSceneManager.MarkAllScenesDirty();

            GenerateTypeData();
            GenerateAbilityData();
            GenerateMoveData();
            GenerateItemData();
            GeneratePokemonData();

            AssetDatabase.SaveAssets();
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(comp, "arrays");
            }
        }

        EditorGUILayout.LabelField(
            "Generate in this order: Type, Ability, Move, Item, Pokemon. Clear beforehand.",
            EditorStyles.helpBox);
    }