Пример #1
0
        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("SaveVersion", 24);
            info.AddValue("money", money.ToString());
            info.AddValue("moneyFloor", moneyFloor.ToString());
            //info.AddValue("lifetimeMoney", StatisticsTracker.lifetimeMoney.ToString());
            info.AddValue("renown", renown.ToString());
            info.AddValue("totalRenown", totalRenown.ToString());
            info.AddValue("maxVendors", maxVendors);
            info.AddValue("currentVendors", currentVendors);
            info.AddValue("maxApprentices", maxApprentices);
            info.AddValue("journeymen", journeymen);
            info.AddValue("currentApprentices", currentApprentices);
            info.AddValue("totalQuestsCompleted", totalQuestsCompletedRenown);
            info.AddValue("questsCompleted", questsCompletedRenown);
            info.AddValue("skillPoints", skillPoints.ToString());
            info.AddValue("totalSkillPoints", totalSkillPoints.ToString());
            info.AddValue("resetLevel", resetLevel);
            info.AddValue("researchTime", researchTime);
            info.AddValue("miscInventorySize", miscInventory.Count);
            for (int i = 0; i < miscInventory.Count; i++)
            {
                info.AddValue("miscInventory_" + i, miscInventory[i], typeof(ItemStack));
            }
            info.AddValue("unidentifiedRelicsSize", unidentifiedRelics.Count);
            for (int i = 0; i < unidentifiedRelics.Count; i++)
            {
                info.AddValue("unidentifiedRelics_" + i, unidentifiedRelics[i], typeof(ItemStack));
            }
            info.AddValue("builtItemsSize", builtItems.Count);
            for (int i = 0; i < builtItems.Count; i++)
            {
                info.AddValue("buildItemID_" + i, builtItems[i].saveName);
                info.AddValue("builtItems_" + i, builtItems[i], typeof(Industry));
            }

            FieldInfo[] fields = typeof(Industries).GetFields();
            info.AddValue("allIndustries", fields.Length);
            for (int i = 0; i < fields.Length; i++)
            {
                FieldInfo field = fields[i];
                Industry  item  = (Industry)field.GetValue(null);

                info.AddValue("allIndustriesID_" + i, item.saveName);
                info.AddValue("allIndustriesX_" + i, item.getGridPos().x);
                info.AddValue("allIndustriesY_" + i, item.getGridPos().y);
                info.AddValue("allIndustriesAB_" + i, item.doAutobuild);
                info.AddValue("allIndustriesABLvl_" + i, item.autoBuildLevel);
                info.AddValue("allIndustriesABMag_" + i, item.autoBuildMagnitude);
                info.AddValue("allIndustriesABVend_" + i, item.startingVendors);
            }

            //Debug.Log("Saving " + QuestManager.activeQuests.Count + " active quests");
            info.AddValue("activeQuestsSize", QuestManager.activeQuests.Count);
            for (int i = 0; i < QuestManager.activeQuests.Count; i++)
            {
                info.AddValue("activeQuests_" + i, QuestManager.activeQuests[i], typeof(Quest));
            }
            //Debug.Log("Saving " + QuestManager.availableQuests.Count + " available quests");
            info.AddValue("availableQuestsSize", QuestManager.availableQuests.Count);
            for (int i = 0; i < QuestManager.availableQuests.Count; i++)
            {
                info.AddValue("availableQuests_" + i, QuestManager.availableQuests[i], typeof(Quest));
            }
            info.AddValue("availableRelicsSize", QuestManager.availableRelics.Count);
            for (int i = 0; i < QuestManager.availableRelics.Count; i++)
            {
                info.AddValue("availableRelics_" + i, QuestManager.availableRelics[i], typeof(ItemStack));
            }
            info.AddValue("questTypeCompletion", questTypeCompletion, typeof(Dictionary <string, long>));
            info.AddValue("newQuestTimer", QuestManager.getNewQuestTimer());
            info.AddValue("questEquipTimer", QuestManager.getEquipTimer());
            GuildManager.writeSaveData(ref info, ref context);
            StatisticsTracker.serializeAllStats(ref info, ref context);
            info.AddValue("currentGuildmaster", currentGuildmaster, typeof(Master));
            DeepGoalsTypes.serialize(ref info, ref context);
            info.AddValue("ResearchManager.lastViewDate", ResearchManager.lastViewDate.ToLongTimeString());
            TutorialManager.serialize(ref info, ref context);
        }