protected override void ClientTooltipCreateControlsInternal(IItem item, List <UIElement> controls)
        {
            base.ClientTooltipCreateControlsInternal(item, controls);

            if (this.CooldownDuration > 0)
            {
                var control = ItemTooltipInfoEntryControl.Create(
                    Api.GetProtoEntity <StatusEffectMedicalCooldown>().Name,
                    ClientTimeFormatHelper.FormatTimeDuration(this.CooldownDuration));
                ((FrameworkElement)control).Margin = new Thickness(0, 7, 0, 7);
                controls.Add(control);
            }

            if (this.Effects.Count > 0)
            {
                controls.Add(ItemTooltipInfoEffectActionsControl.Create(this.Effects));
            }
        }
Exemple #2
0
        protected override void ClientTooltipCreateControlsInternal(IItem item, List <UIElement> controls)
        {
            base.ClientTooltipCreateControlsInternal(item, controls);

            if (this.CooldownDuration > 0)
            {
                var stackPanel = new StackPanel();
                stackPanel.Orientation = Orientation.Horizontal;

                var statusEffectMedicalCooldown = Api.GetProtoEntity <StatusEffectMedicalCooldown>();
                var icon = new Rectangle()
                {
                    Fill = Api.Client.UI.GetTextureBrush(
                        ((IProtoStatusEffect)statusEffectMedicalCooldown).Icon),
                    Width             = 26,
                    Height            = 26,
                    UseLayoutRounding = true
                };

                var controlInfoEntry = ItemTooltipInfoEntryControl.Create(
                    statusEffectMedicalCooldown.Name,
                    ClientTimeFormatHelper.FormatTimeDuration(
                        Math.Min(this.CooldownDuration, StatusEffectMedicalCooldown.MaxDuration)));
                controlInfoEntry.Margin            = new Thickness(4, 0, 0, -5);
                controlInfoEntry.VerticalAlignment = VerticalAlignment.Center;
                controlInfoEntry.Foreground
                      = controlInfoEntry.ValueBrush
                      = Api.Client.UI.GetApplicationResource <Brush>("BrushColorAltLabelForeground");

                stackPanel.Children.Add(icon);
                stackPanel.Children.Add(controlInfoEntry);
                stackPanel.Margin = new Thickness(0, 7, 0, 7);
                controls.Add(stackPanel);
            }

            if (this.Effects.Count > 0)
            {
                controls.Add(ItemTooltipInfoEffectActionsControl.Create(this.Effects));
            }
        }