combine Text and TextBold

This commit is contained in:
Max Hübner
2019-07-28 12:40:21 +02:00
parent df8d4d8966
commit f7b9ddb48c
3 changed files with 10 additions and 17 deletions

View File

@ -13,6 +13,8 @@ namespace osu.Game.Overlays.Chat.Tabs
public override bool IsSwitchable => false; public override bool IsSwitchable => false;
protected override bool IsBoldWhenActive => false;
public ChannelSelectorTabItem() public ChannelSelectorTabItem()
: base(new ChannelSelectorTabChannel()) : base(new ChannelSelectorTabChannel())
{ {
@ -22,7 +24,6 @@ namespace osu.Game.Overlays.Chat.Tabs
Icon.Alpha = 0; Icon.Alpha = 0;
Text.Font = Text.Font.With(size: 45); Text.Font = Text.Font.With(size: 45);
TextBold.Font = Text.Font.With(size: 45);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -29,7 +29,6 @@ namespace osu.Game.Overlays.Chat.Tabs
public override bool IsRemovable => !Pinned; public override bool IsRemovable => !Pinned;
protected readonly SpriteText Text; protected readonly SpriteText Text;
protected readonly SpriteText TextBold;
protected readonly ClickableContainer CloseButton; protected readonly ClickableContainer CloseButton;
private readonly Box box; private readonly Box box;
private readonly Box highlightBox; private readonly Box highlightBox;
@ -92,16 +91,7 @@ namespace osu.Game.Overlays.Chat.Tabs
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Text = value.ToString(), Text = value.ToString(),
Font = OsuFont.GetFont(size: 18) Font = OsuFont.GetFont(size: 18),
},
TextBold = new OsuSpriteText
{
Alpha = 0,
Margin = new MarginPadding(5),
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Text = value.ToString(),
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold)
Width = 115f, Width = 115f,
Truncate = true, Truncate = true,
}, },
@ -125,6 +115,8 @@ namespace osu.Game.Overlays.Chat.Tabs
protected virtual bool ShowCloseOnHover => true; protected virtual bool ShowCloseOnHover => true;
protected virtual bool IsBoldWhenActive => true;
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
if (IsRemovable && ShowCloseOnHover) if (IsRemovable && ShowCloseOnHover)
@ -205,8 +197,10 @@ namespace osu.Game.Overlays.Chat.Tabs
box.FadeColour(BackgroundActive, TRANSITION_LENGTH, Easing.OutQuint); box.FadeColour(BackgroundActive, TRANSITION_LENGTH, Easing.OutQuint);
highlightBox.FadeIn(TRANSITION_LENGTH, Easing.OutQuint); highlightBox.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
Text.FadeOut(TRANSITION_LENGTH, Easing.OutQuint); if (IsBoldWhenActive)
TextBold.FadeIn(TRANSITION_LENGTH, Easing.OutQuint); {
Text.Font = Text.Font.With(weight: FontWeight.Bold);
}
} }
protected virtual void FadeInactive() protected virtual void FadeInactive()
@ -218,8 +212,7 @@ namespace osu.Game.Overlays.Chat.Tabs
box.FadeColour(BackgroundInactive, TRANSITION_LENGTH, Easing.OutQuint); box.FadeColour(BackgroundInactive, TRANSITION_LENGTH, Easing.OutQuint);
highlightBox.FadeOut(TRANSITION_LENGTH, Easing.OutQuint); highlightBox.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
Text.FadeIn(TRANSITION_LENGTH, Easing.OutQuint); Text.Font = Text.Font.With(weight: FontWeight.Medium);
TextBold.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
} }
protected override void OnActivated() => updateState(); protected override void OnActivated() => updateState();

View File

@ -64,7 +64,6 @@ namespace osu.Game.Overlays.Chat.Tabs
avatar.OnLoadComplete += d => d.FadeInFromZero(300, Easing.OutQuint); avatar.OnLoadComplete += d => d.FadeInFromZero(300, Easing.OutQuint);
Text.X = ChatOverlay.TAB_AREA_HEIGHT; Text.X = ChatOverlay.TAB_AREA_HEIGHT;
TextBold.X = ChatOverlay.TAB_AREA_HEIGHT;
Text.Width = 100f; Text.Width = 100f;
} }