コード例 #1
0
        public void DoGameSave(DungeonCrawlerGame.CharacterSaveFile gameSave)
        {
            IAsyncResult  result = StorageDevice.BeginShowSelector(PlayerIndex.One, null, null);
            StorageDevice device = StorageDevice.EndShowSelector(result);

            if (device != null && device.IsConnected)
            {
                DungeonCrawlerGame.DoSaveGame(device, gameSave);
            }
        }
コード例 #2
0
        /// <summary>
        /// Go through the components and save the pertinent information for the entity id
        /// Use this when saving the character in-game (possibly from a save menu or via autosaving)
        /// By: Joseph Shaw
        /// </summary>
        /// <param name="entityId">The entityID of the character we are saving</param>
        public static void SavePlayer(uint entityId)
        {
            DungeonCrawlerGame.CharacterSaveFile gameSave;
            PlayerInfo info      = game.PlayerInfoComponent[entityId];
            Equipment  equipment = game.EquipmentComponent[entityId];

            IAsyncResult  result = StorageDevice.BeginShowSelector(PlayerIndex.One, null, null);
            StorageDevice device = StorageDevice.EndShowSelector(result);

            if (device != null && device.IsConnected)
            {
                // Load file for this entityID
                gameSave = DoLoadGame(device, info.FileName);

                // Populate save info
                // Level information
                gameSave.level      = info.Level;
                gameSave.experience = info.Experience;

                // Other skills/stats
                gameSave.stats  = game.StatsComponent[entityId];
                gameSave.health = info.MaxHealth;
                gameSave.psi    = info.MaxPsiOrFatigue;
                gameSave.skill1 = info.skill1;
                gameSave.skill2 = info.skill2;
                gameSave.skill3 = info.skill3;
                gameSave.skill4 = info.skill4;
                gameSave.skill5 = info.skill5;
                gameSave.skill6 = info.skill6;
                gameSave.skill7 = info.skill7;
                gameSave.skill8 = info.skill8;
                gameSave.skill9 = info.skill9;

                gameSave.skillInfo = game.PlayerSkillInfoComponent[entityId];

                // Inventory Quantities and Weapon
                gameSave.healthPotions = equipment.HealthPotsQty;
                gameSave.manaPotions   = equipment.PsiPotsQty;
                gameSave.pogs          = equipment.PogsQty;
                gameSave.weaponType    = (int)equipment.WeaponID;

                // Quest information
                gameSave.quests = DungeonCrawlerGame.game.Quests;

                // Resave file
                DungeonCrawlerGame.DoSaveGame(device, gameSave, true);
            }
        }
コード例 #3
0
        /// <summary>
        /// Go through the components and save the pertinent information for the entity id
        /// Use this when saving the character in-game (possibly from a save menu or via autosaving)
        /// </summary>
        /// <param name="entityId">The entityID of the character we are saving</param>
        public static void SavePlayer(uint entityId)
        {
            DungeonCrawlerGame.CharacterSaveFile gameSave;
            PlayerInfo info = game.PlayerInfoComponent[entityId];

            IAsyncResult  result = StorageDevice.BeginShowSelector(PlayerIndex.One, null, null);
            StorageDevice device = StorageDevice.EndShowSelector(result);

            if (device != null && device.IsConnected)
            {
                // Load file for this entityID
                gameSave = DoLoadGame(device, info.FileName);

                // Redo save info
                gameSave.stats  = game.StatsComponent[entityId];
                gameSave.health = info.Health;
                gameSave.psi    = info.Psi;
                //gameSave.Level = ?

                // Resave file
                DungeonCrawlerGame.DoSaveGame(device, gameSave);
            }
        }