// -------------------------------------------------------------------------------
        //
        // -------------------------------------------------------------------------------
        private void OnEnable()
        {
            labelBtnNewGame.text  = Finder.txt.buttonNames.NewGame;
            labelBtnLoad.text     = Finder.txt.buttonNames.Load;
            labelBtnSettings.text = Finder.txt.buttonNames.Options;
            labelBtnCredits.text  = Finder.txt.buttonNames.Credits;
            labelBtnQuit.text     = Finder.txt.buttonNames.Quit;

            if (Finder.save.HasSaveFiles())
            {
                btnLoad.SetActive(true);
            }
            else
            {
                btnLoad.SetActive(false);
            }

            // -- Builds the Dictionaries
            DictionaryAttribute.load();
            DictionaryCharacterClass.load();
            DictionaryCharacterHero.load();
            DictionaryCombatStyle.load();
            DictionaryDungeon.load();
            DictionaryElement.load();
            DictionaryEquipment.load();
            DictionaryEquipmentSlot.load();
            DictionaryGossip.load();
            DictionaryItem.load();
            DictionarySkill.load();
            DictionarySpecies.load();
            DictionaryStatus.load();
            DictionaryTile.load();
            DictionaryTown.load();
        }
Ejemplo n.º 2
0
        // -------------------------------------------------------------------------------
        //
        // -------------------------------------------------------------------------------
        public TemplateMetaTown GetTown(string name)
        {
            string town = ExploredTowns.Find(x => x == name);

            return(DictionaryTown.Get(town));
        }
Ejemplo n.º 3
0
        // -------------------------------------------------------------------------------
        // LoadState
        // -------------------------------------------------------------------------------
        public void LoadState(int index)
        {
            Savegame state = Load(index);

            if (state != null)
            {
                // -------------------------------------------------------------------------------
                // Restore: Currencies
                // -------------------------------------------------------------------------------
                Finder.party.currencies.gold = state.gold;

                // -------------------------------------------------------------------------------
                // Restore: Interacted & Deactivated Objects
                // -------------------------------------------------------------------------------
                Finder.party.InteractedObjects  = state.InteractedObjects;
                Finder.party.DeactivatedObjects = state.DeactivatedObjects;

                // -------------------------------------------------------------------------------
                // Restore: Exploration Data
                // -------------------------------------------------------------------------------
                Finder.party.MapExplorationInfo  = state.MapExplorationInfo;
                Finder.party.TownExplorationInfo = state.TownExplorationInfo;

                // -------------------------------------------------------------------------------
                // Restore: Party Equipment
                // -------------------------------------------------------------------------------
                Finder.party.equipment = state.equipment;
                Finder.party.equipment.LoadTemplates();

                // -------------------------------------------------------------------------------
                // Restore: Party Inventory
                // -------------------------------------------------------------------------------
                Finder.party.inventory = state.inventory;
                Finder.party.inventory.LoadTemplates();

                // -------------------------------------------------------------------------------
                // Restore: Characters in Party
                // -------------------------------------------------------------------------------
                Finder.party.characters.Clear();
                foreach (SavegameCharacter character in state.characters)
                {
                    CharacterHero hero = new CharacterHero();
                    hero.LoadFromSavegame(character);
                    Finder.party.characters.Add(hero);
                }

                // -------------------------------------------------------------------------------
                // Restore: Last visited Town
                // -------------------------------------------------------------------------------
                if (!string.IsNullOrEmpty(state.lastTown))
                {
                    Finder.party.lastTown = DictionaryTown.Get(state.lastTown);
                }

                // -------------------------------------------------------------------------------
                // Restore: Current Location
                // -------------------------------------------------------------------------------
                Location restoredLocation = new Location
                {
                    locationType    = state.locationType,
                    name            = state.mapName,
                    facingDirection = state.facingDirection,
                    X = state.X,
                    Y = state.Y
                };

                Finder.battle.Reset();
                Finder.ui.DeactivateAll();
                Finder.audio.StopBGM();
                Finder.audio.StopSFX();

                SaveDate        = state.SaveDate;
                StartDate       = state.StartDate;
                LastLoadedIndex = index;

                Finder.map.TeleportPlayer(restoredLocation);

                GameInProgress = true;
            }
        }