private void Recalculate() { if (this._hero.Clan?.Kingdom != null && Clan.PlayerClan?.Kingdom != null && this._hero.Clan.Kingdom == Clan.PlayerClan.Kingdom) { this.CanGrantFief = GrantFiefAction.CanGrantFief(this._hero.Clan, out _); } this.RefreshValues(); }
public EncyclopediaHeroPageVMExtensionVM(EncyclopediaPageArgs args) : base(args) { this._grantFiefInterface = new GrantFiefInterface(); _hero = (base.Obj as Hero); this.SendMessengerInfluenceCost = (int)DiplomacyCostCalculator.DetermineInfluenceCostForSendingMessenger(); this.SendMessengerActionName = new TextObject("{=cXfcwzPp}Send Messenger").ToString(); this.GrantFiefActionName = new TextObject("{=LpoyhORp}Grant Fief").ToString(); this.CanGrantFief = GrantFiefAction.CanGrantFief(this._hero.Clan, out _); base.RefreshValues(); }
public override void RefreshValues() { base.RefreshValues(); // this is called before the constructor the first time if (_hero is null) { return; } if (_hero.Clan?.Kingdom is not null && Clan.PlayerClan?.Kingdom is not null && _hero.Clan.Kingdom == Clan.PlayerClan.Kingdom) { CanGrantFief = GrantFiefAction.CanGrantFief(_hero.Clan, out _); } UpdateIsMessengerAvailable(); }
private void RefreshCanGrantFief() { this.CanGrantFiefToClan = GrantFiefAction.CanGrantFief(this.CurrentSelectedClan.Clan, out string hint); this.GrantFiefHint = this.CanGrantFiefToClan ? new HintViewModel() : new HintViewModel(hint, null); }
private void RefreshCanGrantFief() { CanGrantFiefToClan = GrantFiefAction.CanGrantFief(CurrentSelectedClan.Clan, out var hint); GrantFiefHint = CanGrantFiefToClan ? new HintViewModel() : Compat.HintViewModel.Create(new TextObject(hint)); }