protected override IEnumerator OnShow(params object[] parameters) { yield return(base.OnShow(parameters)); if (this.guiNotification != null && this.notificationItem != null) { base.SetHeader(); GuiNotificationHeroBase guiNotificationHeroBase = this.guiNotification as GuiNotificationHeroBase; if (guiNotificationHeroBase != null) { GuiElement guiElement; if (base.GuiService.GuiPanelHelper.TryGetGuiElement(guiNotificationHeroBase.RaisedEvent.EventName, out guiElement)) { this.Description.AgeTransform.Height = this.DescriptionSW.Viewport.Height; this.Description.Text = guiNotificationHeroBase.FormatDescription(guiElement.Description, base.GuiService); this.DescriptionSW.ResetUp(); } Unit unit = this.FetchHero(); if (unit != null) { GuiHero guiHero = new GuiHero(unit, null); if (base.GuiService.GuiPanelHelper.TryGetGuiElement(unit.UnitDesign.Name, out guiElement)) { Texture2D image; if (guiHero != null && guiHero.IsShifted) { if (base.GuiService.GuiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.ShiftedLarge, out image)) { this.ImmersiveImage.Image = image; } } else if (base.GuiService.GuiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Large, out image)) { this.ImmersiveImage.Image = image; } } AgeTooltip ageTooltip = this.ImmersiveImage.AgeTransform.AgeTooltip; if (guiHero != null) { ageTooltip.Class = "Unit"; ageTooltip.ClientData = guiHero; ageTooltip.Content = guiHero.Title; } } } if (this.guiNotification is GuiNotificationHeroLevelUp) { this.RefreshContent(); } } yield break; }
private Unit FetchHero() { Unit result = null; GuiNotificationHeroBase guiNotificationHeroBase = this.guiNotification as GuiNotificationHeroBase; if (guiNotificationHeroBase != null) { IGameEntityRepositoryService service = base.Game.Services.GetService <IGameEntityRepositoryService>(); IGameEntity gameEntity = null; if (service.TryGetValue(guiNotificationHeroBase.HeroGuid, out gameEntity)) { result = (gameEntity as Unit); } } return(result); }