public override void Initialize() { StageCoach = DarkestDungeonManager.Campaign.Estate.StageCoach; recruitPanel.UpdateRecruitPanel(DarkestDungeonManager.Campaign.Estate.StageCoach.Heroes); float ratio = DarkestDungeonManager.Campaign.Estate.GetBuildingUpgradeRatio(BuildingType.StageCoach); 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[] { StageCoach.GetUpgradeByCode(tree.treeId, currentUpgrades[i].Code) }); tree.upgrades[i].onClick += WagonWindow_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); } }
public void UpdateEvent(TownEvent townEvent) { switch (townEvent.Tone) { case TownEventTone.Good: eventTone.sprite = tones.Find(sprite => sprite.name.EndsWith("good")); break; case TownEventTone.Bad: eventTone.sprite = tones.Find(sprite => sprite.name.EndsWith("bad")); break; case TownEventTone.Neutral: eventTone.sprite = tones.Find(sprite => sprite.name.EndsWith("neutral")); break; } eventImage.sprite = eventImages.Find(sprite => sprite.name.EndsWith(townEvent.Id)); eventName.text = LocalizationManager.GetString("town_event_title_" + townEvent.Id); eventDescription.text = LocalizationManager.GetString("town_event_description_" + townEvent.Id); bool isRecruitEvent = townEvent.Data.Find(data => data.Type == TownEventDataType.BonusRecruit || data.Type == TownEventDataType.DeadRecruit) != null; if (isRecruitEvent) { eventRecruits.gameObject.SetActive(true); eventRecruits.UpdateRecruitPanel(DarkestDungeonManager.Campaign.Estate.StageCoach.EventHeroes); eventEffects.gameObject.SetActive(false); } else { eventRecruits.gameObject.SetActive(false); eventEffects.gameObject.SetActive(true); eventEffects.text = townEvent.EffectTooltip; } }