mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 06:13:04 +08:00
Merge remote-tracking branch 'upstream/master' into timline-beat-lines
This commit is contained in:
commit
dbb89cfde7
@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
typeof(ProfileHeader),
|
typeof(ProfileHeader),
|
||||||
typeof(RankGraph),
|
typeof(RankGraph),
|
||||||
typeof(LineGraph),
|
typeof(LineGraph),
|
||||||
typeof(TabControlOverlayHeader.OverlayHeaderTabControl),
|
typeof(TabControlOverlayHeader<>.OverlayHeaderTabControl),
|
||||||
typeof(CentreHeaderContainer),
|
typeof(CentreHeaderContainer),
|
||||||
typeof(BottomHeaderContainer),
|
typeof(BottomHeaderContainer),
|
||||||
typeof(DetailHeaderContainer),
|
typeof(DetailHeaderContainer),
|
||||||
|
@ -14,6 +14,7 @@ using osu.Framework.Extensions;
|
|||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
@ -25,6 +26,7 @@ using osu.Game.Rulesets.Taiko;
|
|||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
using osu.Game.Screens.Select.Carousel;
|
using osu.Game.Screens.Select.Carousel;
|
||||||
using osu.Game.Screens.Select.Filter;
|
using osu.Game.Screens.Select.Filter;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.SongSelect
|
namespace osu.Game.Tests.Visual.SongSelect
|
||||||
{
|
{
|
||||||
@ -95,6 +97,123 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddAssert("filter count is 1", () => songSelect.FilterCount == 1);
|
AddAssert("filter count is 1", () => songSelect.FilterCount == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangeBeatmapBeforeEnter()
|
||||||
|
{
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
|
||||||
|
createSongSelect();
|
||||||
|
|
||||||
|
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||||
|
|
||||||
|
WorkingBeatmap selected = null;
|
||||||
|
|
||||||
|
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||||
|
|
||||||
|
AddStep("select next and enter", () =>
|
||||||
|
{
|
||||||
|
InputManager.PressKey(Key.Down);
|
||||||
|
InputManager.ReleaseKey(Key.Down);
|
||||||
|
InputManager.PressKey(Key.Enter);
|
||||||
|
InputManager.ReleaseKey(Key.Enter);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("ensure selection changed", () => selected != Beatmap.Value);
|
||||||
|
|
||||||
|
AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
|
||||||
|
AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangeBeatmapAfterEnter()
|
||||||
|
{
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
|
||||||
|
createSongSelect();
|
||||||
|
|
||||||
|
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||||
|
|
||||||
|
WorkingBeatmap selected = null;
|
||||||
|
|
||||||
|
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||||
|
|
||||||
|
AddStep("select next and enter", () =>
|
||||||
|
{
|
||||||
|
InputManager.PressKey(Key.Enter);
|
||||||
|
InputManager.ReleaseKey(Key.Enter);
|
||||||
|
InputManager.PressKey(Key.Down);
|
||||||
|
InputManager.ReleaseKey(Key.Down);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("ensure selection didn't change", () => selected == Beatmap.Value);
|
||||||
|
|
||||||
|
AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
|
||||||
|
AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangeBeatmapViaMouseBeforeEnter()
|
||||||
|
{
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
|
||||||
|
createSongSelect();
|
||||||
|
|
||||||
|
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||||
|
|
||||||
|
WorkingBeatmap selected = null;
|
||||||
|
|
||||||
|
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||||
|
|
||||||
|
AddStep("select next and enter", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmap>()
|
||||||
|
.First(b => ((CarouselBeatmap)b.Item).Beatmap != songSelect.Carousel.SelectedBeatmap));
|
||||||
|
|
||||||
|
InputManager.PressButton(MouseButton.Left);
|
||||||
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
|
|
||||||
|
InputManager.PressKey(Key.Enter);
|
||||||
|
InputManager.ReleaseKey(Key.Enter);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("ensure selection changed", () => selected != Beatmap.Value);
|
||||||
|
|
||||||
|
AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
|
||||||
|
AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangeBeatmapViaMouseAfterEnter()
|
||||||
|
{
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
|
||||||
|
createSongSelect();
|
||||||
|
|
||||||
|
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||||
|
|
||||||
|
WorkingBeatmap selected = null;
|
||||||
|
|
||||||
|
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||||
|
|
||||||
|
AddStep("select next and enter", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmap>()
|
||||||
|
.First(b => ((CarouselBeatmap)b.Item).Beatmap != songSelect.Carousel.SelectedBeatmap));
|
||||||
|
|
||||||
|
InputManager.PressButton(MouseButton.Left);
|
||||||
|
|
||||||
|
InputManager.PressKey(Key.Enter);
|
||||||
|
InputManager.ReleaseKey(Key.Enter);
|
||||||
|
|
||||||
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("ensure selection didn't change", () => selected == Beatmap.Value);
|
||||||
|
|
||||||
|
AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
|
||||||
|
AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestNoFilterOnSimpleResume()
|
public void TestNoFilterOnSimpleResume()
|
||||||
{
|
{
|
||||||
|
175
osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs
Normal file
175
osu.Game.Tests/Visual/UserInterface/TestSceneOverlayHeader.cs
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
// 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.Containers;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
|
{
|
||||||
|
public class TestSceneOverlayHeader : OsuTestScene
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(OverlayHeader),
|
||||||
|
typeof(TabControlOverlayHeader<>),
|
||||||
|
typeof(BreadcrumbControlOverlayHeader),
|
||||||
|
typeof(TestNoControlHeader),
|
||||||
|
typeof(TestStringTabControlHeader),
|
||||||
|
typeof(TestEnumTabControlHeader),
|
||||||
|
typeof(TestBreadcrumbControlHeader),
|
||||||
|
};
|
||||||
|
|
||||||
|
private readonly FillFlowContainer flow;
|
||||||
|
|
||||||
|
public TestSceneOverlayHeader()
|
||||||
|
{
|
||||||
|
AddRange(new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.Black,
|
||||||
|
},
|
||||||
|
new BasicScrollContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = flow = new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Direction = FillDirection.Vertical
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addHeader("Blue OverlayHeader", new TestNoControlHeader(), OverlayColourScheme.Blue);
|
||||||
|
addHeader("Green TabControlOverlayHeader (string)", new TestStringTabControlHeader(), OverlayColourScheme.Green);
|
||||||
|
addHeader("Pink TabControlOverlayHeader (enum)", new TestEnumTabControlHeader(), OverlayColourScheme.Pink);
|
||||||
|
addHeader("Red BreadcrumbControlOverlayHeader", new TestBreadcrumbControlHeader(), OverlayColourScheme.Red);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addHeader(string name, OverlayHeader header, OverlayColourScheme colourScheme)
|
||||||
|
{
|
||||||
|
flow.Add(new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
Margin = new MarginPadding(20),
|
||||||
|
Text = name,
|
||||||
|
},
|
||||||
|
new ColourProvidedContainer(colourScheme, header)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ColourProvidedContainer : Container
|
||||||
|
{
|
||||||
|
[Cached]
|
||||||
|
private readonly OverlayColourProvider colourProvider;
|
||||||
|
|
||||||
|
public ColourProvidedContainer(OverlayColourScheme colourScheme, OverlayHeader header)
|
||||||
|
{
|
||||||
|
colourProvider = new OverlayColourProvider(colourScheme);
|
||||||
|
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
Add(header);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestNoControlHeader : OverlayHeader
|
||||||
|
{
|
||||||
|
protected override Drawable CreateBackground() => new TestBackground();
|
||||||
|
|
||||||
|
protected override ScreenTitle CreateTitle() => new TestTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestStringTabControlHeader : TabControlOverlayHeader<string>
|
||||||
|
{
|
||||||
|
protected override Drawable CreateBackground() => new TestBackground();
|
||||||
|
|
||||||
|
protected override ScreenTitle CreateTitle() => new TestTitle();
|
||||||
|
|
||||||
|
public TestStringTabControlHeader()
|
||||||
|
{
|
||||||
|
TabControl.AddItem("tab1");
|
||||||
|
TabControl.AddItem("tab2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestEnumTabControlHeader : TabControlOverlayHeader<TestEnum>
|
||||||
|
{
|
||||||
|
protected override Drawable CreateBackground() => new TestBackground();
|
||||||
|
|
||||||
|
protected override ScreenTitle CreateTitle() => new TestTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum TestEnum
|
||||||
|
{
|
||||||
|
Some,
|
||||||
|
Cool,
|
||||||
|
Tabs
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestBreadcrumbControlHeader : BreadcrumbControlOverlayHeader
|
||||||
|
{
|
||||||
|
protected override Drawable CreateBackground() => new TestBackground();
|
||||||
|
|
||||||
|
protected override ScreenTitle CreateTitle() => new TestTitle();
|
||||||
|
|
||||||
|
public TestBreadcrumbControlHeader()
|
||||||
|
{
|
||||||
|
TabControl.AddItem("tab1");
|
||||||
|
TabControl.AddItem("tab2");
|
||||||
|
TabControl.Current.Value = "tab2";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestBackground : Sprite
|
||||||
|
{
|
||||||
|
public TestBackground()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
FillMode = FillMode.Fill;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(TextureStore textures)
|
||||||
|
{
|
||||||
|
Texture = textures.Get(@"Headers/changelog");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestTitle : ScreenTitle
|
||||||
|
{
|
||||||
|
public TestTitle()
|
||||||
|
{
|
||||||
|
Title = "title";
|
||||||
|
Section = "section";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/changelog");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -21,6 +21,22 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public class OsuTabControl<T> : TabControl<T>
|
public class OsuTabControl<T> : TabControl<T>
|
||||||
{
|
{
|
||||||
|
private Color4 accentColour;
|
||||||
|
|
||||||
|
public virtual Color4 AccentColour
|
||||||
|
{
|
||||||
|
get => accentColour;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
accentColour = value;
|
||||||
|
|
||||||
|
if (Dropdown is IHasAccentColour dropdown)
|
||||||
|
dropdown.AccentColour = value;
|
||||||
|
foreach (var i in TabContainer.Children.OfType<IHasAccentColour>())
|
||||||
|
i.AccentColour = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private readonly Box strip;
|
private readonly Box strip;
|
||||||
|
|
||||||
protected override Dropdown<T> CreateDropdown() => new OsuTabDropdown();
|
protected override Dropdown<T> CreateDropdown() => new OsuTabDropdown();
|
||||||
@ -62,21 +78,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
AccentColour = colours.Blue;
|
AccentColour = colours.Blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4 accentColour;
|
|
||||||
|
|
||||||
public Color4 AccentColour
|
|
||||||
{
|
|
||||||
get => accentColour;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
accentColour = value;
|
|
||||||
if (Dropdown is IHasAccentColour dropdown)
|
|
||||||
dropdown.AccentColour = value;
|
|
||||||
foreach (var i in TabContainer.Children.OfType<IHasAccentColour>())
|
|
||||||
i.AccentColour = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color4 StripColour
|
public Color4 StripColour
|
||||||
{
|
{
|
||||||
get => strip.Colour;
|
get => strip.Colour;
|
||||||
|
@ -130,91 +130,91 @@ namespace osu.Game.IO.Legacy
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (obj.GetType().Name)
|
switch (obj)
|
||||||
{
|
{
|
||||||
case "Boolean":
|
case bool boolObj:
|
||||||
Write((byte)ObjType.boolType);
|
Write((byte)ObjType.boolType);
|
||||||
Write((bool)obj);
|
Write(boolObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Byte":
|
case byte byteObj:
|
||||||
Write((byte)ObjType.byteType);
|
Write((byte)ObjType.byteType);
|
||||||
Write((byte)obj);
|
Write(byteObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "UInt16":
|
case ushort ushortObj:
|
||||||
Write((byte)ObjType.uint16Type);
|
Write((byte)ObjType.uint16Type);
|
||||||
Write((ushort)obj);
|
Write(ushortObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "UInt32":
|
case uint uintObj:
|
||||||
Write((byte)ObjType.uint32Type);
|
Write((byte)ObjType.uint32Type);
|
||||||
Write((uint)obj);
|
Write(uintObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "UInt64":
|
case ulong ulongObj:
|
||||||
Write((byte)ObjType.uint64Type);
|
Write((byte)ObjType.uint64Type);
|
||||||
Write((ulong)obj);
|
Write(ulongObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "SByte":
|
case sbyte sbyteObj:
|
||||||
Write((byte)ObjType.sbyteType);
|
Write((byte)ObjType.sbyteType);
|
||||||
Write((sbyte)obj);
|
Write(sbyteObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Int16":
|
case short shortObj:
|
||||||
Write((byte)ObjType.int16Type);
|
Write((byte)ObjType.int16Type);
|
||||||
Write((short)obj);
|
Write(shortObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Int32":
|
case int intObj:
|
||||||
Write((byte)ObjType.int32Type);
|
Write((byte)ObjType.int32Type);
|
||||||
Write((int)obj);
|
Write(intObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Int64":
|
case long longObj:
|
||||||
Write((byte)ObjType.int64Type);
|
Write((byte)ObjType.int64Type);
|
||||||
Write((long)obj);
|
Write(longObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Char":
|
case char charObj:
|
||||||
Write((byte)ObjType.charType);
|
Write((byte)ObjType.charType);
|
||||||
base.Write((char)obj);
|
base.Write(charObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "String":
|
case string stringObj:
|
||||||
Write((byte)ObjType.stringType);
|
Write((byte)ObjType.stringType);
|
||||||
base.Write((string)obj);
|
base.Write(stringObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Single":
|
case float floatObj:
|
||||||
Write((byte)ObjType.singleType);
|
Write((byte)ObjType.singleType);
|
||||||
Write((float)obj);
|
Write(floatObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Double":
|
case double doubleObj:
|
||||||
Write((byte)ObjType.doubleType);
|
Write((byte)ObjType.doubleType);
|
||||||
Write((double)obj);
|
Write(doubleObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Decimal":
|
case decimal decimalObj:
|
||||||
Write((byte)ObjType.decimalType);
|
Write((byte)ObjType.decimalType);
|
||||||
Write((decimal)obj);
|
Write(decimalObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "DateTime":
|
case DateTime dateTimeObj:
|
||||||
Write((byte)ObjType.dateTimeType);
|
Write((byte)ObjType.dateTimeType);
|
||||||
Write((DateTime)obj);
|
Write(dateTimeObj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Byte[]":
|
case byte[] byteArray:
|
||||||
Write((byte)ObjType.byteArrayType);
|
Write((byte)ObjType.byteArrayType);
|
||||||
base.Write((byte[])obj);
|
base.Write(byteArray);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Char[]":
|
case char[] charArray:
|
||||||
Write((byte)ObjType.charArrayType);
|
Write((byte)ObjType.charArrayType);
|
||||||
base.Write((char[])obj);
|
base.Write(charArray);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1,24 +1,15 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public abstract class BreadcrumbControlOverlayHeader : OverlayHeader
|
public abstract class BreadcrumbControlOverlayHeader : TabControlOverlayHeader<string>
|
||||||
{
|
{
|
||||||
protected OverlayHeaderBreadcrumbControl BreadcrumbControl;
|
protected override OsuTabControl<string> CreateTabControl() => new OverlayHeaderBreadcrumbControl();
|
||||||
|
|
||||||
protected override TabControl<string> CreateTabControl() => BreadcrumbControl = new OverlayHeaderBreadcrumbControl();
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OverlayColourProvider colourProvider)
|
|
||||||
{
|
|
||||||
BreadcrumbControl.AccentColour = colourProvider.Highlight1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class OverlayHeaderBreadcrumbControl : BreadcrumbControl<string>
|
public class OverlayHeaderBreadcrumbControl : BreadcrumbControl<string>
|
||||||
{
|
{
|
||||||
|
@ -27,8 +27,8 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
|
|
||||||
public ChangelogHeader()
|
public ChangelogHeader()
|
||||||
{
|
{
|
||||||
BreadcrumbControl.AddItem(listing_string);
|
TabControl.AddItem(listing_string);
|
||||||
BreadcrumbControl.Current.ValueChanged += e =>
|
TabControl.Current.ValueChanged += e =>
|
||||||
{
|
{
|
||||||
if (e.NewValue == listing_string)
|
if (e.NewValue == listing_string)
|
||||||
ListingSelected?.Invoke();
|
ListingSelected?.Invoke();
|
||||||
@ -48,12 +48,12 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
private void showBuild(ValueChangedEvent<APIChangelogBuild> e)
|
private void showBuild(ValueChangedEvent<APIChangelogBuild> e)
|
||||||
{
|
{
|
||||||
if (e.OldValue != null)
|
if (e.OldValue != null)
|
||||||
BreadcrumbControl.RemoveItem(e.OldValue.ToString());
|
TabControl.RemoveItem(e.OldValue.ToString());
|
||||||
|
|
||||||
if (e.NewValue != null)
|
if (e.NewValue != null)
|
||||||
{
|
{
|
||||||
BreadcrumbControl.AddItem(e.NewValue.ToString());
|
TabControl.AddItem(e.NewValue.ToString());
|
||||||
BreadcrumbControl.Current.Value = e.NewValue.ToString();
|
TabControl.Current.Value = e.NewValue.ToString();
|
||||||
|
|
||||||
updateCurrentStream();
|
updateCurrentStream();
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BreadcrumbControl.Current.Value = listing_string;
|
TabControl.Current.Value = listing_string;
|
||||||
Streams.Current.Value = null;
|
Streams.Current.Value = null;
|
||||||
title.Version = null;
|
title.Version = null;
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,9 @@ namespace osu.Game.Overlays.News
|
|||||||
|
|
||||||
public NewsHeader()
|
public NewsHeader()
|
||||||
{
|
{
|
||||||
BreadcrumbControl.AddItem(front_page_string);
|
TabControl.AddItem(front_page_string);
|
||||||
|
|
||||||
BreadcrumbControl.Current.ValueChanged += e =>
|
TabControl.Current.ValueChanged += e =>
|
||||||
{
|
{
|
||||||
if (e.NewValue == front_page_string)
|
if (e.NewValue == front_page_string)
|
||||||
ShowFrontPage?.Invoke();
|
ShowFrontPage?.Invoke();
|
||||||
@ -37,18 +37,18 @@ namespace osu.Game.Overlays.News
|
|||||||
private void showPost(ValueChangedEvent<string> e)
|
private void showPost(ValueChangedEvent<string> e)
|
||||||
{
|
{
|
||||||
if (e.OldValue != null)
|
if (e.OldValue != null)
|
||||||
BreadcrumbControl.RemoveItem(e.OldValue);
|
TabControl.RemoveItem(e.OldValue);
|
||||||
|
|
||||||
if (e.NewValue != null)
|
if (e.NewValue != null)
|
||||||
{
|
{
|
||||||
BreadcrumbControl.AddItem(e.NewValue);
|
TabControl.AddItem(e.NewValue);
|
||||||
BreadcrumbControl.Current.Value = e.NewValue;
|
TabControl.Current.Value = e.NewValue;
|
||||||
|
|
||||||
title.IsReadingPost = true;
|
title.IsReadingPost = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BreadcrumbControl.Current.Value = front_page_string;
|
TabControl.Current.Value = front_page_string;
|
||||||
title.IsReadingPost = false;
|
title.IsReadingPost = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -15,10 +14,11 @@ namespace osu.Game.Overlays
|
|||||||
public abstract class OverlayHeader : Container
|
public abstract class OverlayHeader : Container
|
||||||
{
|
{
|
||||||
private readonly Box titleBackground;
|
private readonly Box titleBackground;
|
||||||
private readonly Box controlBackground;
|
|
||||||
private readonly Container background;
|
private readonly Container background;
|
||||||
private readonly ScreenTitle title;
|
private readonly ScreenTitle title;
|
||||||
|
|
||||||
|
protected readonly FillFlowContainer HeaderInfo;
|
||||||
|
|
||||||
protected float BackgroundHeight
|
protected float BackgroundHeight
|
||||||
{
|
{
|
||||||
set => background.Height = value;
|
set => background.Height = value;
|
||||||
@ -36,46 +36,42 @@ namespace osu.Game.Overlays
|
|||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
background = new Container
|
HeaderInfo = new FillFlowContainer
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = 80,
|
|
||||||
Masking = true,
|
|
||||||
Child = CreateBackground()
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
titleBackground = new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
},
|
|
||||||
title = CreateTitle().With(title =>
|
|
||||||
{
|
|
||||||
title.Margin = new MarginPadding
|
|
||||||
{
|
|
||||||
Vertical = 10,
|
|
||||||
Left = UserProfileOverlay.CONTENT_X_MARGIN
|
|
||||||
};
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
Depth = -float.MaxValue,
|
Depth = -float.MaxValue,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
controlBackground = new Box
|
background = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.X,
|
||||||
Colour = Color4.Gray,
|
Height = 80,
|
||||||
|
Masking = true,
|
||||||
|
Child = CreateBackground()
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
titleBackground = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.Gray,
|
||||||
|
},
|
||||||
|
title = CreateTitle().With(title =>
|
||||||
|
{
|
||||||
|
title.Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Vertical = 10,
|
||||||
|
Left = UserProfileOverlay.CONTENT_X_MARGIN
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
CreateTabControl().With(control => control.Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN })
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CreateContent()
|
CreateContent()
|
||||||
@ -88,7 +84,6 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
titleBackground.Colour = colourProvider.Dark5;
|
titleBackground.Colour = colourProvider.Dark5;
|
||||||
title.AccentColour = colourProvider.Highlight1;
|
title.AccentColour = colourProvider.Highlight1;
|
||||||
controlBackground.Colour = colourProvider.Dark4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Drawable CreateBackground();
|
protected abstract Drawable CreateBackground();
|
||||||
@ -97,7 +92,5 @@ namespace osu.Game.Overlays
|
|||||||
protected virtual Drawable CreateContent() => new Container();
|
protected virtual Drawable CreateContent() => new Container();
|
||||||
|
|
||||||
protected abstract ScreenTitle CreateTitle();
|
protected abstract ScreenTitle CreateTitle();
|
||||||
|
|
||||||
protected abstract TabControl<string> CreateTabControl();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,41 +13,25 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public abstract class OverlayTabControl<T> : TabControl<T>
|
public abstract class OverlayTabControl<T> : OsuTabControl<T>
|
||||||
{
|
{
|
||||||
private readonly Box bar;
|
private readonly Box bar;
|
||||||
|
|
||||||
private Color4 accentColour = Color4.White;
|
|
||||||
|
|
||||||
public Color4 AccentColour
|
|
||||||
{
|
|
||||||
get => accentColour;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (accentColour == value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
accentColour = value;
|
|
||||||
bar.Colour = value;
|
|
||||||
|
|
||||||
foreach (TabItem<T> tabItem in TabContainer)
|
|
||||||
{
|
|
||||||
((OverlayTabItem)tabItem).AccentColour = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public new MarginPadding Padding
|
|
||||||
{
|
|
||||||
get => TabContainer.Padding;
|
|
||||||
set => TabContainer.Padding = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected float BarHeight
|
protected float BarHeight
|
||||||
{
|
{
|
||||||
set => bar.Height = value;
|
set => bar.Height = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Color4 AccentColour
|
||||||
|
{
|
||||||
|
get => base.AccentColour;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
base.AccentColour = value;
|
||||||
|
bar.Colour = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected OverlayTabControl()
|
protected OverlayTabControl()
|
||||||
{
|
{
|
||||||
TabContainer.Masking = false;
|
TabContainer.Masking = false;
|
||||||
@ -66,7 +50,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
protected override TabItem<T> CreateTabItem(T value) => new OverlayTabItem(value);
|
protected override TabItem<T> CreateTabItem(T value) => new OverlayTabItem(value);
|
||||||
|
|
||||||
protected class OverlayTabItem : TabItem<T>
|
protected class OverlayTabItem : TabItem<T>, IHasAccentColour
|
||||||
{
|
{
|
||||||
protected readonly ExpandingBar Bar;
|
protected readonly ExpandingBar Bar;
|
||||||
protected readonly OsuSpriteText Text;
|
protected readonly OsuSpriteText Text;
|
||||||
|
@ -14,7 +14,7 @@ using osu.Game.Users;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Profile
|
namespace osu.Game.Overlays.Profile
|
||||||
{
|
{
|
||||||
public class ProfileHeader : TabControlOverlayHeader
|
public class ProfileHeader : TabControlOverlayHeader<string>
|
||||||
{
|
{
|
||||||
private UserCoverBackground coverContainer;
|
private UserCoverBackground coverContainer;
|
||||||
|
|
||||||
|
@ -1,28 +1,56 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public abstract class TabControlOverlayHeader : OverlayHeader
|
/// <summary>
|
||||||
|
/// An overlay header which contains a <see cref="OsuTabControl{T}"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The type of item to be represented by tabs.</typeparam>
|
||||||
|
public abstract class TabControlOverlayHeader<T> : OverlayHeader
|
||||||
{
|
{
|
||||||
protected OverlayHeaderTabControl TabControl;
|
protected OsuTabControl<T> TabControl;
|
||||||
|
|
||||||
protected override TabControl<string> CreateTabControl() => TabControl = new OverlayHeaderTabControl();
|
private readonly Box controlBackground;
|
||||||
|
|
||||||
|
protected TabControlOverlayHeader()
|
||||||
|
{
|
||||||
|
HeaderInfo.Add(new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
controlBackground = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
TabControl = CreateTabControl().With(control => control.Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN })
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
TabControl.AccentColour = colourProvider.Highlight1;
|
TabControl.AccentColour = colourProvider.Highlight1;
|
||||||
|
controlBackground.Colour = colourProvider.Dark4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OverlayHeaderTabControl : OverlayTabControl<string>
|
[NotNull]
|
||||||
|
protected virtual OsuTabControl<T> CreateTabControl() => new OverlayHeaderTabControl();
|
||||||
|
|
||||||
|
public class OverlayHeaderTabControl : OverlayTabControl<T>
|
||||||
{
|
{
|
||||||
public OverlayHeaderTabControl()
|
public OverlayHeaderTabControl()
|
||||||
{
|
{
|
||||||
@ -34,10 +62,7 @@ namespace osu.Game.Overlays
|
|||||||
Height = 35;
|
Height = 35;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override TabItem<string> CreateTabItem(string value) => new OverlayHeaderTabItem(value)
|
protected override TabItem<T> CreateTabItem(T value) => new OverlayHeaderTabItem(value);
|
||||||
{
|
|
||||||
AccentColour = AccentColour,
|
|
||||||
};
|
|
||||||
|
|
||||||
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
|
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
|
||||||
{
|
{
|
||||||
@ -49,10 +74,10 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private class OverlayHeaderTabItem : OverlayTabItem
|
private class OverlayHeaderTabItem : OverlayTabItem
|
||||||
{
|
{
|
||||||
public OverlayHeaderTabItem(string value)
|
public OverlayHeaderTabItem(T value)
|
||||||
: base(value)
|
: base(value)
|
||||||
{
|
{
|
||||||
Text.Text = value;
|
Text.Text = value.ToString().ToLower();
|
||||||
Text.Font = OsuFont.GetFont(size: 14);
|
Text.Font = OsuFont.GetFont(size: 14);
|
||||||
Bar.ExpandedSize = 5;
|
Bar.ExpandedSize = 5;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,9 @@ namespace osu.Game.Screens.Select
|
|||||||
public override bool HandleNonPositionalInput => AllowSelection;
|
public override bool HandleNonPositionalInput => AllowSelection;
|
||||||
public override bool HandlePositionalInput => AllowSelection;
|
public override bool HandlePositionalInput => AllowSelection;
|
||||||
|
|
||||||
|
public override bool PropagatePositionalInputSubTree => AllowSelection;
|
||||||
|
public override bool PropagateNonPositionalInputSubTree => AllowSelection;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether carousel items have completed asynchronously loaded.
|
/// Whether carousel items have completed asynchronously loaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -449,8 +452,6 @@ namespace osu.Game.Screens.Select
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) => ReceivePositionalInputAt(screenSpacePos);
|
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Testing.Input;
|
|||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -30,7 +31,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
InputManager = new ManualInputManager
|
InputManager = new ManualInputManager
|
||||||
{
|
{
|
||||||
UseParentInput = true,
|
UseParentInput = true,
|
||||||
Child = content = new MenuCursorContainer { RelativeSizeAxes = Axes.Both },
|
Child = new GlobalActionContainer(null)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = content = new MenuCursorContainer { RelativeSizeAxes = Axes.Both }
|
||||||
|
},
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user