mirror of https://github.com/ppy/osu
Replace ScreenTitle with OverlayTitle and update titles to match new design
This commit is contained in:
parent
127c16fccd
commit
a5781d7fc5
|
@ -100,21 +100,21 @@ public ColourProvidedContainer(OverlayColourScheme colourScheme, OverlayHeader h
|
|||
|
||||
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 @@ private class TestEnumTabControlHeader : TabControlOverlayHeader<TestEnum>
|
|||
{
|
||||
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 @@ private enum TestEnum
|
|||
|
||||
private class TestBreadcrumbControlHeader : BreadcrumbControlOverlayHeader
|
||||
{
|
||||
protected override ScreenTitle CreateTitle() => new TestTitle();
|
||||
protected override OverlayTitle CreateTitle() => new TestTitle();
|
||||
|
||||
public TestBreadcrumbControlHeader()
|
||||
{
|
||||
|
@ -151,15 +151,13 @@ public TestBreadcrumbControlHeader()
|
|||
}
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 @@ public class BeatmapSetHeader : OverlayHeader
|
|||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
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 @@ private void load(OverlayColourProvider colourProvider)
|
|||
streamsBackground.Colour = colourProvider.Background5;
|
||||
}
|
||||
|
||||
private ChangelogHeaderTitle title;
|
||||
|
||||
private void showBuild(ValueChangedEvent<APIChangelogBuild> e)
|
||||
{
|
||||
if (e.OldValue != null)
|
||||
|
@ -63,14 +60,11 @@ private void showBuild(ValueChangedEvent<APIChangelogBuild> e)
|
|||
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 @@ private void showBuild(ValueChangedEvent<APIChangelogBuild> e)
|
|||
}
|
||||
};
|
||||
|
||||
protected override ScreenTitle CreateTitle() => title = new ChangelogHeaderTitle();
|
||||
protected override OverlayTitle CreateTitle() => new ChangelogHeaderTitle();
|
||||
|
||||
public void Populate(List<APIUpdateStream> streams)
|
||||
{
|
||||
|
@ -116,20 +110,13 @@ private void updateCurrentStream()
|
|||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 @@ public class NewsHeader : BreadcrumbControlOverlayHeader
|
|||
{
|
||||
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 @@ private void showPost(ValueChangedEvent<string> e)
|
|||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 @@ protected OverlayHeader()
|
|||
Padding = new MarginPadding
|
||||
{
|
||||
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
|
||||
Vertical = 10,
|
||||
},
|
||||
Children = new[]
|
||||
{
|
||||
|
@ -86,7 +85,6 @@ protected OverlayHeader()
|
|||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
titleBackground.Colour = colourProvider.Dark5;
|
||||
title.AccentColour = colourProvider.Highlight1;
|
||||
}
|
||||
|
||||
[NotNull]
|
||||
|
@ -96,11 +94,11 @@ private void load(OverlayColourProvider colourProvider)
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ private class OverlayTitleIcon : Sprite
|
|||
public OverlayTitleIcon(string textureName)
|
||||
{
|
||||
this.textureName = textureName;
|
||||
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
@ -77,4 +77,4 @@ private void load(TextureStore textures)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
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 @@ protected override Drawable CreateBackground() =>
|
|||
}
|
||||
};
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 @@ public class RankingsOverlayHeader : TabControlOverlayHeader<RankingsScope>
|
|||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue