Ejemplo n.º 1
0
        public void SaveShop()
        {
            SortedDictionary <String, String> saveData = new SortedDictionary <string, string>();

            saveData.Add("count", shopInventory.Count.ToString());
            Game.saveFile.Save(Game1.SaveFilePath, "save.ini", "shop" + identifyer, saveData);

            for (int i = 0; i < shopInventory.Count; i++)
            {
                saveData.Clear();
                saveData.Add("name", shopInventory[i].ToString());
                saveData.Add("kind", shopInventory[i].Kind);
                if (shopInventory[i] is ShipPart)
                {
                    ShipPart tmp = (ShipPart)shopInventory[i];
                    saveData.Add("variety", tmp.GetShipPartVariety().ToString());
                }
                if (shopInventory[i] is QuantityItem)
                {
                    QuantityItem foo = (QuantityItem)shopInventory[i];
                    saveData.Add("quantity", foo.Quantity.ToString());
                }
                Game.saveFile.Save(Game1.SaveFilePath, "save.ini", "shop" + identifyer + i, saveData);
            }
        }
Ejemplo n.º 2
0
        public void Save()
        {
            SortedDictionary <String, String> saveData = new SortedDictionary <string, string>();

            saveData.Add("count", shipItems.Count.ToString());
            Game.saveFile.Save(Game1.SaveFilePath, "save.ini", "shipitems", saveData);

            for (int i = 0; i < shipItems.Count; i++)
            {
                saveData.Clear();
                saveData.Add("name", shipItems[i].ToString());
                saveData.Add("kind", shipItems[i].Kind);
                if (shipItems[i] is ShipPart)
                {
                    ShipPart tmp = (ShipPart)shipItems[i];
                    saveData.Add("variety", tmp.GetShipPartVariety().ToString());
                }
                if (shipItems[i] is QuantityItem)
                {
                    QuantityItem foo = (QuantityItem)shipItems[i];
                    saveData.Add("quantity", foo.Quantity.ToString());
                }
                if (shipItems[i] is PlayerPlating)
                {
                    PlayerPlating plating = (PlayerPlating)shipItems[i];
                    saveData.Add("currenthealth", plating.CurrentOverworldHealth.ToString());
                }
                Game.saveFile.Save(Game1.SaveFilePath, "save.ini", "shipinv" + i, saveData);
            }

            saveData.Clear();
            for (int i = 0; i < ownedPrimaryWeapons.Count; i++)
            {
                for (int n = 0; n < equippedPrimaryWeapons.Count; n++)
                {
                    if (ownedPrimaryWeapons[i] == equippedPrimaryWeapons[n])
                    {
                        saveData.Add("primaryinvpos" + n, i.ToString());
                    }
                }
            }
            for (int i = 0; i < ownedSecondary.Count; i++)
            {
                if (equippedSecondary == ownedSecondary[i])
                {
                    saveData.Add("secondaryinvpos", i.ToString());
                }
            }
            for (int i = 0; i < ownedEnergyCells.Count; i++)
            {
                if (equippedEnergyCell == ownedEnergyCells[i])
                {
                    saveData.Add("energyinvpos", i.ToString());
                }
            }
            for (int i = 0; i < ownedShields.Count; i++)
            {
                if (equippedShield == ownedShields[i])
                {
                    saveData.Add("shieldinvpos", i.ToString());
                }
            }
            for (int i = 0; i < ownedPlatings.Count; i++)
            {
                if (equippedPlating == ownedPlatings[i])
                {
                    saveData.Add("platinginvpos", i.ToString());
                }
            }
            Game.saveFile.Save(Game1.SaveFilePath, "save.ini", "shipequipped", saveData);
        }