1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:07:38 +08:00

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

View File

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