1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 11:42:56 +08:00

Replace ScreenTitle with OverlayTitle and update titles to match new design

This commit is contained in:
TheWildTree 2020-03-24 22:08:20 +01:00
parent 127c16fccd
commit a5781d7fc5
9 changed files with 34 additions and 90 deletions

View File

@ -100,21 +100,21 @@ namespace osu.Game.Tests.Visual.UserInterface
private class TestNoBackgroundHeader : OverlayHeader
{
protected override ScreenTitle CreateTitle() => new TestTitle();
protected override OverlayTitle CreateTitle() => new TestTitle();
}
private class TestNoControlHeader : OverlayHeader
{
protected override Drawable CreateBackground() => new OverlayHeaderBackground(@"Headers/changelog");
protected override ScreenTitle CreateTitle() => new TestTitle();
protected override OverlayTitle CreateTitle() => new TestTitle();
}
private class TestStringTabControlHeader : TabControlOverlayHeader<string>
{
protected override Drawable CreateBackground() => new OverlayHeaderBackground(@"Headers/news");
protected override ScreenTitle CreateTitle() => new TestTitle();
protected override OverlayTitle CreateTitle() => new TestTitle();
protected override Drawable CreateTitleContent() => new OverlayRulesetSelector();
@ -129,7 +129,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{
protected override Drawable CreateBackground() => new OverlayHeaderBackground(@"Headers/rankings");
protected override ScreenTitle CreateTitle() => new TestTitle();
protected override OverlayTitle CreateTitle() => new TestTitle();
}
private enum TestEnum
@ -141,7 +141,7 @@ namespace osu.Game.Tests.Visual.UserInterface
private class TestBreadcrumbControlHeader : BreadcrumbControlOverlayHeader
{
protected override ScreenTitle CreateTitle() => new TestTitle();
protected override OverlayTitle CreateTitle() => new TestTitle();
public TestBreadcrumbControlHeader()
{
@ -151,15 +151,13 @@ namespace osu.Game.Tests.Visual.UserInterface
}
}
private class TestTitle : ScreenTitle
private class TestTitle : OverlayTitle
{
public TestTitle()
{
Title = "title";
Section = "section";
IconTexture = "Icons/changelog";
}
protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/changelog");
}
}
}

View File

@ -1,24 +1,19 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.BeatmapListing
{
public class BeatmapListingHeader : OverlayHeader
{
protected override ScreenTitle CreateTitle() => new BeatmapListingTitle();
protected override OverlayTitle CreateTitle() => new BeatmapListingTitle();
private class BeatmapListingTitle : ScreenTitle
private class BeatmapListingTitle : OverlayTitle
{
public BeatmapListingTitle()
{
Title = @"beatmap";
Section = @"listing";
Title = "beatmap listing";
IconTexture = "Icons/changelog";
}
protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/changelog");
}
}
}

View File

@ -3,7 +3,6 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
namespace osu.Game.Overlays.BeatmapSet
@ -14,22 +13,20 @@ namespace osu.Game.Overlays.BeatmapSet
public BeatmapRulesetSelector RulesetSelector { get; private set; }
protected override ScreenTitle CreateTitle() => new BeatmapHeaderTitle();
protected override OverlayTitle CreateTitle() => new BeatmapHeaderTitle();
protected override Drawable CreateTitleContent() => RulesetSelector = new BeatmapRulesetSelector
{
Current = Ruleset
};
private class BeatmapHeaderTitle : ScreenTitle
private class BeatmapHeaderTitle : OverlayTitle
{
public BeatmapHeaderTitle()
{
Title = @"beatmap";
Section = @"info";
Title = "beatmap info";
IconTexture = "Icons/changelog";
}
protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/changelog");
}
}
}

View File

@ -9,7 +9,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Overlays.Changelog
@ -50,8 +49,6 @@ namespace osu.Game.Overlays.Changelog
streamsBackground.Colour = colourProvider.Background5;
}
private ChangelogHeaderTitle title;
private void showBuild(ValueChangedEvent<APIChangelogBuild> e)
{
if (e.OldValue != null)
@ -63,14 +60,11 @@ namespace osu.Game.Overlays.Changelog
Current.Value = e.NewValue.ToString();
updateCurrentStream();
title.Version = e.NewValue.UpdateStream.DisplayName;
}
else
{
Current.Value = listing_string;
Streams.Current.Value = null;
title.Version = null;
}
}
@ -100,7 +94,7 @@ namespace osu.Game.Overlays.Changelog
}
};
protected override ScreenTitle CreateTitle() => title = new ChangelogHeaderTitle();
protected override OverlayTitle CreateTitle() => new ChangelogHeaderTitle();
public void Populate(List<APIUpdateStream> streams)
{
@ -116,20 +110,13 @@ namespace osu.Game.Overlays.Changelog
Streams.Current.Value = Streams.Items.FirstOrDefault(s => s.Name == Build.Value.UpdateStream.Name);
}
private class ChangelogHeaderTitle : ScreenTitle
private class ChangelogHeaderTitle : OverlayTitle
{
public string Version
{
set => Section = value ?? listing_string;
}
public ChangelogHeaderTitle()
{
Title = "changelog";
Version = null;
IconTexture = "Icons/changelog";
}
protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/changelog");
}
}
}

View File

@ -3,7 +3,6 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
using System;
namespace osu.Game.Overlays.News
@ -12,8 +11,6 @@ namespace osu.Game.Overlays.News
{
private const string front_page_string = "frontpage";
private NewsHeaderTitle title;
public readonly Bindable<string> Post = new Bindable<string>(null);
public Action ShowFrontPage;
@ -40,36 +37,24 @@ namespace osu.Game.Overlays.News
{
TabControl.AddItem(e.NewValue);
Current.Value = e.NewValue;
title.IsReadingPost = true;
}
else
{
Current.Value = front_page_string;
title.IsReadingPost = false;
}
}
protected override Drawable CreateBackground() => new OverlayHeaderBackground(@"Headers/news");
protected override ScreenTitle CreateTitle() => title = new NewsHeaderTitle();
protected override OverlayTitle CreateTitle() => new NewsHeaderTitle();
private class NewsHeaderTitle : ScreenTitle
private class NewsHeaderTitle : OverlayTitle
{
private const string post_string = "post";
public bool IsReadingPost
{
set => Section = value ? post_string : front_page_string;
}
public NewsHeaderTitle()
{
Title = "news";
IsReadingPost = false;
IconTexture = "Icons/news";
}
protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/news");
}
}
}

View File

@ -14,7 +14,7 @@ namespace osu.Game.Overlays
public abstract class OverlayHeader : Container
{
private readonly Box titleBackground;
private readonly ScreenTitle title;
private readonly OverlayTitle title;
protected readonly FillFlowContainer HeaderInfo;
@ -57,7 +57,6 @@ namespace osu.Game.Overlays
Padding = new MarginPadding
{
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
Vertical = 10,
},
Children = new[]
{
@ -86,7 +85,6 @@ namespace osu.Game.Overlays
private void load(OverlayColourProvider colourProvider)
{
titleBackground.Colour = colourProvider.Dark5;
title.AccentColour = colourProvider.Highlight1;
}
[NotNull]
@ -96,11 +94,11 @@ namespace osu.Game.Overlays
protected virtual Drawable CreateBackground() => Empty();
/// <summary>
/// Creates a <see cref="Drawable"/> on the opposite side of the <see cref="ScreenTitle"/>. Used mostly to create <see cref="OverlayRulesetSelector"/>.
/// Creates a <see cref="Drawable"/> on the opposite side of the <see cref="OverlayTitle"/>. Used mostly to create <see cref="OverlayRulesetSelector"/>.
/// </summary>
[NotNull]
protected virtual Drawable CreateTitleContent() => Empty();
protected abstract ScreenTitle CreateTitle();
protected abstract OverlayTitle CreateTitle();
}
}

View File

@ -63,7 +63,7 @@ namespace osu.Game.Overlays
public OverlayTitleIcon(string textureName)
{
this.textureName = textureName;
RelativeSizeAxes = Axes.Both;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
@ -77,4 +77,4 @@ namespace osu.Game.Overlays
}
}
}
}
}

View File

@ -7,7 +7,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Profile.Header;
using osu.Game.Users;
@ -87,19 +86,17 @@ namespace osu.Game.Overlays.Profile
}
};
protected override ScreenTitle CreateTitle() => new ProfileHeaderTitle();
protected override OverlayTitle CreateTitle() => new ProfileHeaderTitle();
private void updateDisplay(User user) => coverContainer.User = user;
private class ProfileHeaderTitle : ScreenTitle
private class ProfileHeaderTitle : OverlayTitle
{
public ProfileHeaderTitle()
{
Title = "player";
Section = "info";
Title = "player info";
IconTexture = "Icons/profile";
}
protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/profile");
}
}
}

View File

@ -3,7 +3,6 @@
using osu.Framework.Graphics;
using osu.Framework.Bindables;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
using osu.Game.Users;
@ -18,33 +17,21 @@ namespace osu.Game.Overlays.Rankings
private OverlayRulesetSelector rulesetSelector;
private CountryFilter countryFilter;
protected override ScreenTitle CreateTitle() => new RankingsTitle
{
Scope = { BindTarget = Current }
};
protected override OverlayTitle CreateTitle() => new RankingsTitle();
protected override Drawable CreateTitleContent() => rulesetSelector = new OverlayRulesetSelector();
protected override Drawable CreateContent() => countryFilter = new CountryFilter();
protected override Drawable CreateBackground() => new OverlayHeaderBackground(@"Headers/rankings");
protected override Drawable CreateBackground() => new OverlayHeaderBackground("Headers/rankings");
private class RankingsTitle : ScreenTitle
private class RankingsTitle : OverlayTitle
{
public readonly Bindable<RankingsScope> Scope = new Bindable<RankingsScope>();
public RankingsTitle()
{
Title = "ranking";
IconTexture = "Icons/rankings";
}
protected override void LoadComplete()
{
base.LoadComplete();
Scope.BindValueChanged(scope => Section = scope.NewValue.ToString().ToLowerInvariant(), true);
}
protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/rankings");
}
}