Пример #1
0
 public void ReadFromCopy(Industry copy)
 {
     // THIS DOES NOT HANDLE UNBUILT INDUSTRIES
     // SEE PlayerInfo's SERIALIZATION "allIndustries"
     level          = copy.level;
     quantityStored = copy.quantityStored;
     if (quantityStored == null)
     {
         quantityStored = 0;
     }
     isSellingStores    = copy.isSellingStores;
     isConsumersHalted  = copy.isConsumersHalted;
     isProductionHalted = copy.isProductionHalted;
     doAutobuild        = copy.doAutobuild;
     autoBuildLevel     = copy.autoBuildLevel;
     startingVendors    = copy.startingVendors;
     autoBuildMagnitude = copy.autoBuildMagnitude;
     apprentices        = copy.apprentices;
     vendors            = copy.vendors;
     timeRemaining      = copy.timeRemaining;
     //halvesAndDoubles = copy.halvesAndDoubles; //applied via upgrade deserialization
     gridPos = MathHelper.snap(copy.gridPos, 24);
 }
Пример #2
0
 public IndustryInput(Industry i, int count)
 {
     item     = i;
     quantity = count;
 }
Пример #3
0
 public ItemStack(Industry indust, int count)
 {
     industry  = indust;
     item      = industry.industryItem;
     stackSize = count;
 }
Пример #4
0
        public ItemStack(SerializationInfo info, StreamingContext context)
        {
            bool b = info.GetBoolean("is_produced");

            if (Main.saveVersionFromDisk >= 14)
            {
                string i = info.GetString("item_id");
                if (b)
                {
                    industry = GameRegistry.GetIndustryByID(i);
                    item     = industry.industryItem;
                }
                else
                {
                    item = GameRegistry.GetItemByID(i);
                }
            }
            else
            {
                int i = info.GetInt32("item_id");
                if (b)
                {
#pragma warning disable CS0612 // Type or member is obsolete
                    industry = GameRegistry.GetIndustryByID(i);
#pragma warning restore CS0612 // Type or member is obsolete
                    item = industry.industryItem;
                }
                else
                {
#pragma warning disable CS0612 // Type or member is obsolete
                    item = GameRegistry.GetItemByID(i);
#pragma warning restore CS0612 // Type or member is obsolete
                }
            }
            stackSize = info.GetInt32("stacksize");
            int num;
            if (info.GetBoolean("relic"))
            {
                num       = info.GetInt32("relicDataSize");
                relicData = new List <RelicInfo>();
                for (int o = 0; o < num; o++)
                {
                    relicData.Add((RelicInfo)info.GetValue("relicData_" + o, typeof(RelicInfo)));
                }
            }
            antiquity           = info.GetInt32("antiquity");
            numTimesUsedOnQuest = info.GetInt32("numTimesUsedOnQuest");
            isIDedByPlayer      = info.GetBoolean("isIDedByPlayer");
            num      = info.GetInt32("enchantsSize");
            enchants = new List <Enchantment>();
            for (int o = 0; o < num; o++)
            {
                if (Main.saveVersionFromDisk >= 15)
                {
                    enchants.Add(GameRegistry.GetEnchantmentByID(info.GetString("enchants_" + o)));
                }
                else
                {
                    enchants.Add(GameRegistry.GetEnchantmentByID(info.GetInt32("enchants_" + o)));
                }
            }
            enchants.RemoveAll(x => x == null);
            if (Main.saveVersionFromDisk >= 6)
            {
                wasAddedByJourneyman = info.GetBoolean("wasAddedByJourneyman");
            }
            if (Main.saveVersionFromDisk >= 21)
            {
                addedToInvenTime = DateTime.Parse(info.GetString("addedToInvenTime"));
            }
        }