Example #1
0
    public override void Initialize()
    {
        heroOverview.Initialize(TownManager);

        CampingTrainer = DarkestDungeonManager.Campaign.Estate.CampingTrainer;
        float ratio = DarkestDungeonManager.Campaign.Estate.GetBuildingUpgradeRatio(BuildingType.CampingTrainer);

        upgradeWindow.upgradedValue.text = Mathf.RoundToInt(ratio * 100).ToString() + "%";

        foreach (var tree in upgradeWindow.upgradeTrees)
        {
            var currentUpgrades   = DarkestDungeonManager.Data.UpgradeTrees[tree.treeId].Upgrades;
            int lastPurchaseIndex = -1;
            for (int i = 0; i < tree.upgrades.Count; i++)
            {
                tree.upgrades[i].Tree         = DarkestDungeonManager.Data.UpgradeTrees[tree.treeId];
                tree.upgrades[i].UpgradeInfo  = currentUpgrades[i];
                tree.upgrades[i].TownUpgrades = new List <ITownUpgrade>(new ITownUpgrade[] {
                    CampingTrainer.GetUpgradeByCode(currentUpgrades[i].Code)
                });
                tree.upgrades[i].onClick += BlacksmithWindow_onUpgradeClick;
                var status = DarkestDungeonManager.Campaign.Estate.GetUpgradeStatus(tree.treeId, currentUpgrades[i]);
                TownManager.UpdateUpgradeSlot(status, tree.upgrades[i]);
                if (status == UpgradeStatus.Purchased)
                {
                    lastPurchaseIndex = i;
                }
            }
            tree.UpdateConnector(lastPurchaseIndex);
        }
    }
Example #2
0
    public Estate(SaveCampaignData saveData)
    {
        RosterIds = new List <int>();
        for (int i = 1; i < 100; i++)
        {
            RosterIds.Add(i);
        }

        EstateTitle = saveData.HamletTitle;

        Currencies = new Dictionary <string, int>();
        Currencies.Add("gold", saveData.GoldAmount);
        Currencies.Add("bust", saveData.BustsAmount);
        Currencies.Add("deed", saveData.DeedsAmount);
        Currencies.Add("portrait", saveData.PortraitsAmount);
        Currencies.Add("crest", saveData.CrestsAmount);

        HeroPurchases = saveData.InstancedPurchases;
        TownPurchases = saveData.BuildingUpgrades;

        Buildings = new Dictionary <BuildingType, Building>();
        Abbey     = DarkestDungeonManager.Data.Buildings["abbey"] as Abbey;
        Buildings.Add(BuildingType.Abbey, Abbey);
        Tavern = DarkestDungeonManager.Data.Buildings["tavern"] as Tavern;
        Buildings.Add(BuildingType.Tavern, Tavern);
        Sanitarium = DarkestDungeonManager.Data.Buildings["sanitarium"] as Sanitarium;
        Buildings.Add(BuildingType.Sanitarium, Sanitarium);
        Blacksmith = DarkestDungeonManager.Data.Buildings["blacksmith"] as Blacksmith;
        Buildings.Add(BuildingType.Blacksmith, Blacksmith);
        Guild = DarkestDungeonManager.Data.Buildings["guild"] as Guild;
        Buildings.Add(BuildingType.Guild, Guild);
        NomadWagon = DarkestDungeonManager.Data.Buildings["nomad_wagon"] as NomadWagon;
        Buildings.Add(BuildingType.NomadWagon, NomadWagon);
        StageCoach = DarkestDungeonManager.Data.Buildings["stage_coach"] as StageCoach;
        Buildings.Add(BuildingType.StageCoach, StageCoach);
        CampingTrainer = DarkestDungeonManager.Data.Buildings["camping_trainer"] as CampingTrainer;
        Buildings.Add(BuildingType.CampingTrainer, CampingTrainer);
        Graveyard = new Graveyard();
        Buildings.Add(BuildingType.Graveyard, Graveyard);
        Statue = new Statue();
        Buildings.Add(BuildingType.Statue, Statue);

        Abbey.InitializeBuilding(TownPurchases);
        Tavern.InitializeBuilding(TownPurchases);
        Sanitarium.InitializeBuilding(TownPurchases);
        Blacksmith.InitializeBuilding(TownPurchases);
        Guild.InitializeBuilding(TownPurchases);
        CampingTrainer.InitializeBuilding(TownPurchases);
        NomadWagon.InitializeBuilding(TownPurchases);
        StageCoach.InitializeBuilding(TownPurchases);
        Graveyard.Records.AddRange(saveData.DeathRecords);
    }
Example #3
0
    public Estate(SaveCampaignData saveData)
    {
        rosterIds = new List <int>();
        for (int i = 1; i < 100; i++)
        {
            rosterIds.Add(i);
        }

        EstateTitle = saveData.hamletTitle;

        Currencies = new Dictionary <string, EstateCurrency>();
        Currencies.Add("gold", new EstateCurrency(saveData.goldAmount, false));
        Currencies.Add("bust", new EstateCurrency(saveData.bustsAmount, true));
        Currencies.Add("deed", new EstateCurrency(saveData.deedsAmount, true));
        Currencies.Add("portrait", new EstateCurrency(saveData.portraitsAmount, true));
        Currencies.Add("crest", new EstateCurrency(saveData.crestsAmount, true));

        HeroPurchases = saveData.instancedPurchases;
        TownPurchases = saveData.buildingUpgrades;

        Abbey          = DarkestDungeonManager.Data.Buildings["abbey"] as Abbey;
        Tavern         = DarkestDungeonManager.Data.Buildings["tavern"] as Tavern;
        Sanitarium     = DarkestDungeonManager.Data.Buildings["sanitarium"] as Sanitarium;
        Blacksmith     = DarkestDungeonManager.Data.Buildings["blacksmith"] as Blacksmith;
        Guild          = DarkestDungeonManager.Data.Buildings["guild"] as Guild;
        NomadWagon     = DarkestDungeonManager.Data.Buildings["nomad_wagon"] as NomadWagon;
        StageCoach     = DarkestDungeonManager.Data.Buildings["stage_coach"] as StageCoach;
        CampingTrainer = DarkestDungeonManager.Data.Buildings["camping_trainer"] as CampingTrainer;
        Graveyard      = new Graveyard();
        Statue         = new Statue();
        Abbey.InitializeBuilding(TownPurchases);
        Tavern.InitializeBuilding(TownPurchases);
        Sanitarium.InitializeBuilding(TownPurchases);
        Blacksmith.InitializeBuilding(TownPurchases);
        Guild.InitializeBuilding(TownPurchases);
        CampingTrainer.InitializeBuilding(TownPurchases);
        NomadWagon.InitializeBuilding(TownPurchases);
        StageCoach.InitializeBuilding(TownPurchases);
        Graveyard.Records.AddRange(saveData.deathRecords);
    }