Beispiel #1
0
        public static void AutoSave()
        {
            if (Rm_RPGHandler.Instance == null)
            {
                return;
            }

            if (!Rm_RPGHandler.Instance.Preferences.EnableAutoSave)
            {
                return;
            }
            if (Application.isPlaying)
            {
                return;
            }

            if (AutoSaveTime == 0)
            {
                if (Rm_RPGHandler.Instance != null)
                {
                    InitAutoSave();
                }
                else
                {
                    return;
                }
            }

            if (Time.realtimeSinceStartup >= AutoSaveTime)
            {
                EditorGameDataSaveLoad.SaveGameData(true);
                Notify.Save("Autosaved Game Data");
                InitAutoSave();
            }
        }
Beispiel #2
0
 private static void RunOnce()
 {
     EditorApplication.update -= RunOnce;
     if (EditorGameDataSaveLoad.LoadIfNotLoadedFromEditor())
     {
         Debug.Log("[RPGAIO] Loading Game Data");
     }
 }
Beispiel #3
0
 public static void DidReloadScripts()
 {
     if (!EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
     {
         Debug.Log("[RPGAIO] Compiled scripts, reloading game data");
         EditorGameDataSaveLoad.LoadGameDataFromEditor();
         loadedData = true;
     }
 }
Beispiel #4
0
    public static void Init()
    {
        // Get existing open window or if none, make a new one:
        var window = (Rme_Main)GetWindow(typeof(Rme_Main));

        //window.maxSize = new Vector2(1050, 500);
        window.titleContent = new GUIContent("RPG AIO");
        window.minSize      = new Vector2(950.1F, 530.1F);
        window.position     = new Rect(200, 200, 950.1F, 530.1F);
        Window = window;
        Pages  = Enum.GetValues(typeof(CurrentPage)) as CurrentPage[];
        EditorGameDataSaveLoad.LoadIfNotLoadedFromEditor();
    }
Beispiel #5
0
    void OnDisable()
    {
        var option = EditorUtility.DisplayDialogComplex("Save Changes?", "Would you like to save changes to the Game Data? \n\n Note: Discarding will reload the previous Game Data",
                                                        "Save", "Close without Saving", "Discard");

        if (option == 0)
        {
            EditorGameDataSaveLoad.SaveGameData();
        }
        else if (option == 2)
        {
            EditorGameDataSaveLoad.LoadGameDataFromEditor();
        }
    }
Beispiel #6
0
        private static void UpdateData()
        {
            //Perform any updates here
            Rme_Tools_Toolbar.UpdatePrefabs();

            //Update Specific: If we're upgrading to version 1.3.0 add the minimap icon
            if (Rme_Main.RpgVersion == "RPG All-In-One v1.3.0")
            {
                Rm_RPGHandler.Instance.GameInfo.MinimapOptions.PlayerIconPath = "RPGMakerAssets/minimapIcon";
            }

            //Update the version number and save
            Rm_RPGHandler.Instance.Version = Rme_Main.RpgVersion;
            EditorGameDataSaveLoad.SaveGameData();
        }
Beispiel #7
0
 public static void NewGameData()
 {
     EditorGameDataSaveLoad.NewData();
     GameSettingsSaveLoadManager.Instance.NewData();
     if (CombatNodeWindow.Window != null)
     {
         CombatNodeWindow.Window.Close();
     }
     if (DialogNodeWindow.Window != null)
     {
         DialogNodeWindow.Window.Close();
     }
     if (EventNodeWindow.Window != null)
     {
         EventNodeWindow.Window.Close();
     }
 }
Beispiel #8
0
        private void OnGUIx()
        {
            GUI.skin = Resources.Load("RPGMakerAssets/EditorSkinRPGMaker") as GUISkin;
            if (Window.position.width > 600)
            {
                GUILayout.BeginHorizontal();
            }
            else
            {
                GUILayout.BeginVertical();
            }

            if (GUILayout.Button(new GUIContent("RPGAIO", RPGMakerGUI.RPGMakerIcon), "rpgToolBarButton"))
            {
                Rme_Main.Init();
            }
            if (GUILayout.Button(new GUIContent("Prefab Window", PrefabBrowserIcon), "rpgToolBarButton"))
            {
                Rme_Tools_PrefabRepository.Init();
            }
            if (GUILayout.Button(new GUIContent("Save Data", SaveIcon), "rpgToolBarButton"))
            {
                EditorGameDataSaveLoad.SaveGameData();
            }
            if (GUILayout.Button(new GUIContent("Reload Data", LoadIcon), "rpgToolBarButton"))
            {
                EditorGameDataSaveLoad.LoadGameDataFromEditor();
            }
            if (GUILayout.Button(new GUIContent("Combat", CombatIcon), "rpgToolBarButton"))
            {
                CombatNodeWindow.Init();
            }
            if (GUILayout.Button(new GUIContent("Dialog", DialogIcon), "rpgToolBarButton"))
            {
                DialogNodeWindow.Init();
            }
            if (GUILayout.Button(new GUIContent("Events", EventIcon), "rpgToolBarButton"))
            {
                EventNodeWindow.Init();
            }
            if (GUILayout.Button(new GUIContent("Achievements", AchievementIcon), "rpgToolBarButton"))
            {
                AchievementNodeWindow.Init();
            }
            if (GUILayout.Button(new GUIContent("Map", MapIcon), "rpgToolBarButton"))
            {
                WorldMapNodeWindow.Init();
            }

            if (GUILayout.Button(new GUIContent("New Scene", NewSceneIcon), "rpgToolBarButton"))
            {
                AddScene();
            }
            if (GUILayout.Button(new GUIContent("Event Trigger", EventTriggerIcon), "rpgToolBarButton"))
            {
                EventTrigger();
            }
            if (GUILayout.Button(new GUIContent("Level Switch", LevelSwitchIcon), "rpgToolBarButton"))
            {
                LevelSwitch();
            }
            if (GUILayout.Button(new GUIContent("Popup Text", PopupTextIcon), "rpgToolBarButton"))
            {
                PopupText();
            }


            GUILayout.EndHorizontal();
        }
Beispiel #9
0
 public void OnEnable()
 {
     Window = this;
     EditorGameDataSaveLoad.LoadIfNotLoadedFromEditor();
 }
Beispiel #10
0
    private void OnGUIx()
    {
        GUI.skin = null;
        GUI.skin = Resources.Load("RPGMakerAssets/EditorSkinRPGMaker") as GUISkin;

        if (PlayerSettings.colorSpace == ColorSpace.Linear)
        {
            GUI.backgroundColor = new Color(1, 1, 1, 0.3f);
        }
        else
        {
            GUI.backgroundColor = new Color(1, 1, 1, 1);
        }

        var subMenuHeight = 30;
        var workingArea   = new Rect(5, 5, Window.position.width - 10, Window.position.height - 10);
        var topbarArea    = new Rect(10, 10, workingArea.width - 10, 30);
        var topbarAreaTwo = new Rect(10, topbarArea.yMax + 5, topbarArea.width, 25);

        if (ShowSubMenu)
        {
            topbarAreaTwo = new Rect(10, topbarArea.yMax + 5, topbarArea.width, 25 + subMenuHeight);
        }
        var subMenu = new Rect(10, topbarAreaTwo.yMax - subMenuHeight, topbarArea.width, subMenuHeight);

        var bottomAreaHeight = 35;
        var leftBar          = new Rect(10, topbarAreaTwo.yMax + 5,
                                        180, Window.position.height - 10 - (topbarAreaTwo.yMax + bottomAreaHeight + 5 + 5));
        var bottomArea = new Rect(10, leftBar.yMax + 5, topbarArea.width, bottomAreaHeight);
        var mainArea   = new Rect(leftBar.xMax + 5, leftBar.y, topbarArea.width - (leftBar.width + 5), leftBar.height);
        var fullArea   = new Rect(leftBar.x, leftBar.y, topbarArea.width, leftBar.height);

        GUI.Box(workingArea, "", "workingAreaBox");
        GUI.Box(bottomArea, "", "backgroundBox");

        GUILayout.BeginArea(PadRect(topbarArea, 0, 0), "", "topAreaBackground");
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("", "LogicSpawnIcon"))
        {
            Application.OpenURL("http://rpgaio.logicspawn.co.uk/");
        }
        //GUILayout.Label(RpgVersion);
        var isMobile = "";

#if (UNITY_IOS || UNITY_ANDROID)
        isMobile = " - Mobile Mode";
#endif
        if (GUILayout.Button(RpgVersion + isMobile, "Label"))
        {
            Application.OpenURL("http://rpgaio.logicspawn.co.uk/");
        }
        GUILayout.FlexibleSpace();
        GUILayout.Label(Rm_RPGHandler.Instance.GameInfo.GameTitle + " by " + Rm_RPGHandler.Instance.GameInfo.GameCompany);
        GUILayout.EndHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.EndArea();

        GUILayout.BeginArea(PadRect(topbarAreaTwo, 0, 0), "", "backgroundBox");
        GUILayout.BeginHorizontal();
        for (int i = 0; i < Pages.Length; i++)
        {
            if (GUILayout.Button(Pages[i].ToString(), "menuButton"))
            {
                if (ShowSubMenu && CurrentSubMenu == Pages[i])
                {
                    ShowSubMenu = false;
                }
                else
                {
                    CurrentSubMenu = Pages[i];
                    ShowSubMenu    = true;
                }
            }
        }

        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        switch (CurrentPage)
        {
        case CurrentPage.Main:
            if (CurrentPageIndex == Array.IndexOf(MainPages, "Home"))
            {
                Rme_Main_Main.Home(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(MainPages, "Preferences"))
            {
                Rme_Main_Main.Preferences(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Game:
            if (CurrentPageIndex == Array.IndexOf(GamePages, "Options"))
            {
                Rme_Main_Game.Options(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(GamePages, "Game Info"))
            {
                Rme_Main_Main.GameInfo(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(GamePages, "Settings and Controls"))
            {
                Rme_Main_Main.GameSettings(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(GamePages, "Save Options"))
            {
                Rme_Main_Main.SaveOptions(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(GamePages, "Credits"))
            {
                Rme_Main_Main.Credits(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(GamePages, "Global Playlist"))
            {
                Rme_Main_Game.GlobalPlaylist(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(GamePages, "Minimap"))
            {
                Rme_Main_Main.Minimap(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(GamePages, "World Map"))
            {
                Rme_Main_Game.WorldMap(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Stats:
            if (CurrentPageIndex == Array.IndexOf(StatsPages, "Options"))
            {
                Rme_Main_Stats.Options(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(StatsPages, "Attributes"))
            {
                Rme_Main_Stats.Attributes(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(StatsPages, "Vitals"))
            {
                Rme_Main_Stats.Vitals(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(StatsPages, "Statistics"))
            {
                Rme_Main_Stats.Statistics(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(StatsPages, "Traits"))
            {
                Rme_Main_Stats.Traits(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(StatsPages, "Experience"))
            {
                Rme_Main_Player.Experience(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Player:
            if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Options"))
            {
                Rme_Main_Player.Options(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Class-Names"))
            {
                Rme_Main_Player.ClassNames(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Races"))
            {
                Rme_Main_Player.Races(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Sub-Races"))
            {
                Rme_Main_Player.SubRaces(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Meta-Datas"))
            {
                Rme_Main_Player.MetaDatas(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Characters"))
            {
                Rme_Main_Player.Classes(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Genders"))
            {
                Rme_Main_Player.Genders(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Pets"))
            {
                Rme_Main_Player.Pets(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Enemies:
            if (CurrentPageIndex == Array.IndexOf(EnemiesPages, "Options"))
            {
                Rme_Main_Enemies.Options(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(EnemiesPages, "Enemies"))
            {
                Rme_Main_Enemies.Enemies(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.NPC:
            if (CurrentPageIndex == Array.IndexOf(NPCPages, "NPCs"))
            {
                Rme_Main_NPC.NPCs(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(NPCPages, "Vendor Shops"))
            {
                Rme_Main_NPC.VendorShops(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(NPCPages, "Reputations"))
            {
                Rme_Main_NPC.Reputations(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Items:
            if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Options"))
            {
                Rme_Main_Items.Options(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Item DB"))
            {
                Rme_Main_Items.ItemDB(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Craftable Items"))
            {
                Rme_Main_Items.CraftableItems(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Craft Lists"))
            {
                Rme_Main_Items.CraftLists(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Dismantling"))
            {
                Rme_Main_Items.Dismantling(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Quest Items"))
            {
                Rme_Main_Items.QuestItems(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Loot-Tables"))
            {
                Rme_Main_Items.LootTables(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Costume Designer"))
            {
                Rme_Main_Items_CostumeDesigner.Main(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Tiers"))
            {
                Rme_Main_Items.Tiers(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Combat:
            if (CurrentPageIndex == Array.IndexOf(CombatPages, "Options"))
            {
                Rme_Main_Combat.Options(fullArea, leftBar, mainArea, Window);
            }
            else if (CurrentPageIndex == Array.IndexOf(CombatPages, "Skills"))
            {
                Rme_Main_Combat.Skills(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(CombatPages, "Talents"))
            {
                Rme_Main_Combat.Talents(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(CombatPages, "Talent Groups"))
            {
                Rme_Main_Combat.TalentGroups(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(CombatPages, "Status Effects"))
            {
                Rme_Main_Combat.StatusEffects(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(CombatPages, "Visualiser"))
            {
                Rme_Main_Combat_SkillVisualiser.Main(fullArea, leftBar, mainArea, Window);
            }
            break;

        case CurrentPage.Objectives:
            if (CurrentPageIndex == Array.IndexOf(ObjectivesPages, "Quest Chains"))
            {
                Rme_Main_Questing.QuestChains(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ObjectivesPages, "Options"))
            {
                Rme_Main_Questing.Options(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ObjectivesPages, "Quests"))
            {
                Rme_Main_Questing.Quests(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Interactables:
            if (CurrentPageIndex == Array.IndexOf(InteractablesPages, "Options"))
            {
                Rme_Main_Interactables.Options(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(InteractablesPages, "Interactable Objects"))
            {
                Rme_Main_Interactables.InteractableObjects(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(InteractablesPages, "Harvestable Objects"))
            {
                Rme_Main_Interactables.HarvestableObjects(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Custom:
            if (CurrentPageIndex == Array.IndexOf(CustomPages, "Custom Variables"))
            {
                Rme_Main_Custom.CustomVariables(fullArea, leftBar, mainArea);
            }
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        if (ShowSubMenu)
        {
            GUI.Box(subMenu, "");
            GUILayout.BeginArea(PadRect(subMenu, 0, 0), "", "subMenuBackground");

            String[] arrayToUse;
            switch (CurrentSubMenu)
            {
            case CurrentPage.Main:
                arrayToUse = MainPages;
                break;

            case CurrentPage.Game:
                arrayToUse = GamePages;
                break;

            case CurrentPage.Stats:
                arrayToUse = StatsPages;
                break;

            case CurrentPage.Player:
                arrayToUse = PlayerPages;
                break;

            case CurrentPage.Enemies:
                arrayToUse = EnemiesPages;
                break;

            case CurrentPage.NPC:
                arrayToUse = NPCPages;
                break;

            case CurrentPage.Items:
                arrayToUse = ItemsPages;
                break;

            case CurrentPage.Combat:
                arrayToUse = CombatPages;
                break;

            case CurrentPage.Objectives:
                arrayToUse = ObjectivesPages;
                break;

            case CurrentPage.Interactables:
                arrayToUse = InteractablesPages;
                break;

            case CurrentPage.Custom:
                arrayToUse = CustomPages;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            for (int i = 0; i < arrayToUse.Length; i++)
            {
                if (GUILayout.Button(arrayToUse[i], "subMenuButton"))
                {
                    CurrentPageIndex = Array.IndexOf(arrayToUse, arrayToUse[i]);
                    CurrentPage      = CurrentSubMenu;
                    ShowSubMenu      = false;
                    GUI.FocusControl("");
                    RPGMakerGUI.ResetScrollPositions();
                }
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.EndArea();
        }

        GUILayout.BeginArea(PadRect(bottomArea, 5, 5));
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();

        if (GUILayout.Button("Save Data", "genericButton"))
        {
            EditorGameDataSaveLoad.SaveGameData();
            GameSettingsSaveLoadManager.Instance.SaveSettings();
        }
        if (GUILayout.Button("Reload Data", "genericButton"))
        {
            Rm_RPGHandler.Instance = null;
            EditorGameDataSaveLoad.LoadGameDataFromEditor();
            GameSettingsSaveLoadManager.Instance.LoadSettings();
            AssetDatabase.Refresh();
        }
        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }