mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Merge remote-tracking branch 'refs/remotes/ppy/master' into profile-scores-update-new
This commit is contained in:
@ -34,6 +34,7 @@ namespace osu.Game.Overlays
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
||||
|
||||
public BeatmapSetOverlay()
|
||||
: base(OverlayColourScheme.Blue)
|
||||
{
|
||||
OsuScrollContainer scroll;
|
||||
Info info;
|
||||
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
@ -15,15 +14,10 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected override TabControl<string> CreateTabControl() => BreadcrumbControl = new OverlayHeaderBreadcrumbControl();
|
||||
|
||||
protected BreadcrumbControlOverlayHeader(OverlayColourScheme colourScheme)
|
||||
: base(colourScheme)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
BreadcrumbControl.AccentColour = colours.ForOverlayElement(ColourScheme, 1, 0.75f);
|
||||
BreadcrumbControl.AccentColour = colourProvider.Highlight1;
|
||||
}
|
||||
|
||||
public class OverlayHeaderBreadcrumbControl : BreadcrumbControl<string>
|
||||
|
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -9,7 +10,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
@ -26,7 +26,6 @@ namespace osu.Game.Overlays.Changelog
|
||||
private const string listing_string = "listing";
|
||||
|
||||
public ChangelogHeader()
|
||||
: base(OverlayColourScheme.Purple)
|
||||
{
|
||||
BreadcrumbControl.AddItem(listing_string);
|
||||
BreadcrumbControl.Current.ValueChanged += e =>
|
||||
@ -39,7 +38,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
|
||||
Streams.Current.ValueChanged += e =>
|
||||
{
|
||||
if (e.NewValue?.LatestBuild != null && e.NewValue != Current.Value?.UpdateStream)
|
||||
if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Current.Value?.UpdateStream))
|
||||
Current.Value = e.NewValue.LatestBuild;
|
||||
};
|
||||
}
|
||||
@ -56,7 +55,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
BreadcrumbControl.AddItem(e.NewValue.ToString());
|
||||
BreadcrumbControl.Current.Value = e.NewValue.ToString();
|
||||
|
||||
Streams.Current.Value = Streams.Items.FirstOrDefault(s => s.Name == e.NewValue.UpdateStream.Name);
|
||||
updateCurrentStream();
|
||||
|
||||
title.Version = e.NewValue.UpdateStream.DisplayName;
|
||||
}
|
||||
@ -82,6 +81,20 @@ namespace osu.Game.Overlays.Changelog
|
||||
|
||||
protected override ScreenTitle CreateTitle() => title = new ChangelogHeaderTitle();
|
||||
|
||||
public void Populate(List<APIUpdateStream> streams)
|
||||
{
|
||||
Streams.Populate(streams);
|
||||
updateCurrentStream();
|
||||
}
|
||||
|
||||
private void updateCurrentStream()
|
||||
{
|
||||
if (Current.Value == null)
|
||||
return;
|
||||
|
||||
Streams.Current.Value = Streams.Items.FirstOrDefault(s => s.Name == Current.Value.UpdateStream.Name);
|
||||
}
|
||||
|
||||
public class HeaderBackground : Sprite
|
||||
{
|
||||
public HeaderBackground()
|
||||
|
@ -29,8 +29,6 @@ namespace osu.Game.Overlays.Changelog
|
||||
|
||||
public void Populate(List<APIUpdateStream> streams)
|
||||
{
|
||||
Current.Value = null;
|
||||
|
||||
foreach (APIUpdateStream updateStream in streams)
|
||||
AddItem(updateStream);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
public readonly Bindable<APIChangelogBuild> Current = new Bindable<APIChangelogBuild>();
|
||||
|
||||
private ChangelogHeader header;
|
||||
protected ChangelogHeader Header;
|
||||
|
||||
private Container<ChangelogContent> content;
|
||||
|
||||
@ -34,16 +34,16 @@ namespace osu.Game.Overlays
|
||||
|
||||
private List<APIChangelogBuild> builds;
|
||||
|
||||
private List<APIUpdateStream> streams;
|
||||
protected List<APIUpdateStream> Streams;
|
||||
|
||||
public ChangelogOverlay()
|
||||
: base(OverlayColourScheme.Purple)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuColour colour)
|
||||
{
|
||||
Waves.FirstWaveColour = colour.GreyVioletLight;
|
||||
Waves.SecondWaveColour = colour.GreyViolet;
|
||||
Waves.ThirdWaveColour = colour.GreyVioletDark;
|
||||
Waves.FourthWaveColour = colour.GreyVioletDarker;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
@ -62,7 +62,7 @@ namespace osu.Game.Overlays
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
header = new ChangelogHeader
|
||||
Header = new ChangelogHeader
|
||||
{
|
||||
ListingSelected = ShowListing,
|
||||
},
|
||||
@ -78,7 +78,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
sampleBack = audio.Samples.Get(@"UI/generic-select-soft");
|
||||
|
||||
header.Current.BindTo(Current);
|
||||
Header.Current.BindTo(Current);
|
||||
|
||||
Current.BindValueChanged(e =>
|
||||
{
|
||||
@ -117,7 +117,7 @@ namespace osu.Game.Overlays
|
||||
performAfterFetch(() =>
|
||||
{
|
||||
var build = builds.Find(b => b.Version == version && b.UpdateStream.Name == updateStream)
|
||||
?? streams.Find(s => s.Name == updateStream)?.LatestBuild;
|
||||
?? Streams.Find(s => s.Name == updateStream)?.LatestBuild;
|
||||
|
||||
if (build != null)
|
||||
ShowBuild(build);
|
||||
@ -179,9 +179,9 @@ namespace osu.Game.Overlays
|
||||
res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id));
|
||||
|
||||
builds = res.Builds;
|
||||
streams = res.Streams;
|
||||
Streams = res.Streams;
|
||||
|
||||
header.Streams.Populate(res.Streams);
|
||||
Header.Populate(res.Streams);
|
||||
|
||||
tcs.SetResult(true);
|
||||
});
|
||||
|
@ -9,6 +9,7 @@ using osuTK;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.Chat.Tabs
|
||||
{
|
||||
@ -113,5 +114,18 @@ namespace osu.Game.Overlays.Chat.Tabs
|
||||
|
||||
OnRequestLeave?.Invoke(tab.Value);
|
||||
}
|
||||
|
||||
protected override TabFillFlowContainer CreateTabFlow() => new ChannelTabFillFlowContainer
|
||||
{
|
||||
Direction = FillDirection.Full,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = -1,
|
||||
Masking = true
|
||||
};
|
||||
|
||||
private class ChannelTabFillFlowContainer : TabFillFlowContainer
|
||||
{
|
||||
protected override int Compare(Drawable x, Drawable y) => CompareReverseChildID(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,16 +141,13 @@ namespace osu.Game.Overlays.Chat.Tabs
|
||||
updateState();
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(MouseUpEvent e)
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
switch (e.Button)
|
||||
{
|
||||
case MouseButton.Middle:
|
||||
CloseButton.Click();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,10 +34,10 @@ namespace osu.Game.Overlays.Chat.Tabs
|
||||
return base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(MouseUpEvent e)
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
icon.ScaleTo(0.75f, 1000, Easing.OutElastic);
|
||||
return base.OnMouseUp(e);
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
|
@ -299,7 +299,7 @@ namespace osu.Game.Overlays
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnDrag(DragEvent e)
|
||||
protected override void OnDrag(DragEvent e)
|
||||
{
|
||||
if (isDragging)
|
||||
{
|
||||
@ -311,14 +311,12 @@ namespace osu.Game.Overlays
|
||||
|
||||
ChatHeight.Value = targetChatHeight;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnDragEnd(DragEndEvent e)
|
||||
protected override void OnDragEnd(DragEndEvent e)
|
||||
{
|
||||
isDragging = false;
|
||||
return base.OnDragEnd(e);
|
||||
base.OnDragEnd(e);
|
||||
}
|
||||
|
||||
private void selectTab(int index)
|
||||
|
@ -18,8 +18,8 @@ namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
public class CommentsContainer : CompositeDrawable
|
||||
{
|
||||
private readonly CommentableType type;
|
||||
private readonly long id;
|
||||
private CommentableType type;
|
||||
private long? id;
|
||||
|
||||
public readonly Bindable<CommentsSortCriteria> Sort = new Bindable<CommentsSortCriteria>();
|
||||
public readonly BindableBool ShowDeleted = new BindableBool();
|
||||
@ -38,12 +38,10 @@ namespace osu.Game.Overlays.Comments
|
||||
private readonly FillFlowContainer content;
|
||||
private readonly DeletedChildrenPlaceholder deletedChildrenPlaceholder;
|
||||
private readonly CommentsShowMoreButton moreButton;
|
||||
private readonly TotalCommentsCounter commentCounter;
|
||||
|
||||
public CommentsContainer(CommentableType type, long id)
|
||||
public CommentsContainer()
|
||||
{
|
||||
this.type = type;
|
||||
this.id = id;
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
AddRangeInternal(new Drawable[]
|
||||
@ -59,6 +57,7 @@ namespace osu.Game.Overlays.Comments
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
commentCounter = new TotalCommentsCounter(),
|
||||
new CommentsHeader
|
||||
{
|
||||
Sort = { BindTarget = Sort },
|
||||
@ -101,7 +100,8 @@ namespace osu.Game.Overlays.Comments
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Margin = new MarginPadding(5),
|
||||
Action = getComments
|
||||
Action = getComments,
|
||||
IsLoading = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -121,11 +121,27 @@ namespace osu.Game.Overlays.Comments
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
Sort.BindValueChanged(onSortChanged, true);
|
||||
Sort.BindValueChanged(_ => refetchComments(), true);
|
||||
base.LoadComplete();
|
||||
}
|
||||
|
||||
private void onSortChanged(ValueChangedEvent<CommentsSortCriteria> sort)
|
||||
/// <param name="type">The type of resource to get comments for.</param>
|
||||
/// <param name="id">The id of the resource to get comments for.</param>
|
||||
public void ShowComments(CommentableType type, long id)
|
||||
{
|
||||
this.type = type;
|
||||
this.id = id;
|
||||
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
|
||||
// only reset when changing ID/type. other refetch ops are generally just changing sort order.
|
||||
commentCounter.Current.Value = 0;
|
||||
|
||||
refetchComments();
|
||||
}
|
||||
|
||||
private void refetchComments()
|
||||
{
|
||||
clearComments();
|
||||
getComments();
|
||||
@ -133,9 +149,12 @@ namespace osu.Game.Overlays.Comments
|
||||
|
||||
private void getComments()
|
||||
{
|
||||
if (!id.HasValue)
|
||||
return;
|
||||
|
||||
request?.Cancel();
|
||||
loadCancellation?.Cancel();
|
||||
request = new GetCommentsRequest(type, id, Sort.Value, currentPage++);
|
||||
request = new GetCommentsRequest(type, id.Value, Sort.Value, currentPage++);
|
||||
request.Success += onSuccess;
|
||||
api.Queue(request);
|
||||
}
|
||||
@ -152,7 +171,7 @@ namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
loadCancellation = new CancellationTokenSource();
|
||||
|
||||
FillFlowContainer page = new FillFlowContainer
|
||||
var page = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
@ -185,6 +204,8 @@ namespace osu.Game.Overlays.Comments
|
||||
moreButton.IsLoading = false;
|
||||
}
|
||||
|
||||
commentCounter.Current.Value = response.Total;
|
||||
|
||||
moreButton.FadeTo(response.HasMore ? 1 : 0);
|
||||
}, loadCancellation.Token);
|
||||
}
|
||||
|
@ -84,14 +84,8 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
public DirectOverlay()
|
||||
: base(OverlayColourScheme.Blue)
|
||||
{
|
||||
// osu!direct colours are not part of the standard palette
|
||||
|
||||
Waves.FirstWaveColour = OsuColour.FromHex(@"19b0e2");
|
||||
Waves.SecondWaveColour = OsuColour.FromHex(@"2280a2");
|
||||
Waves.ThirdWaveColour = OsuColour.FromHex(@"005774");
|
||||
Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e");
|
||||
|
||||
ScrollFlow.Children = new Drawable[]
|
||||
{
|
||||
resultCountsContainer = new FillFlowContainer
|
||||
|
@ -6,7 +6,6 @@ using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.API;
|
||||
using osuTK.Graphics;
|
||||
@ -18,12 +17,12 @@ namespace osu.Game.Overlays
|
||||
[Resolved]
|
||||
protected IAPIProvider API { get; private set; }
|
||||
|
||||
protected FullscreenOverlay()
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider;
|
||||
|
||||
protected FullscreenOverlay(OverlayColourScheme colourScheme)
|
||||
{
|
||||
Waves.FirstWaveColour = OsuColour.Gray(0.4f);
|
||||
Waves.SecondWaveColour = OsuColour.Gray(0.3f);
|
||||
Waves.ThirdWaveColour = OsuColour.Gray(0.2f);
|
||||
Waves.FourthWaveColour = OsuColour.Gray(0.1f);
|
||||
colourProvider = new OverlayColourProvider(colourScheme);
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
RelativePositionAxes = Axes.Both;
|
||||
@ -41,6 +40,15 @@ namespace osu.Game.Overlays
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Waves.FirstWaveColour = colourProvider.Light4;
|
||||
Waves.SecondWaveColour = colourProvider.Light3;
|
||||
Waves.ThirdWaveColour = colourProvider.Dark4;
|
||||
Waves.FourthWaveColour = colourProvider.Dark3;
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
if (State.Value == Visibility.Visible)
|
||||
|
@ -177,17 +177,19 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(MouseUpEvent e)
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
// don't do anything until the last button is released.
|
||||
if (!HasFocus || e.HasAnyButtonPressed)
|
||||
return base.OnMouseUp(e);
|
||||
{
|
||||
base.OnMouseUp(e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (bindTarget.IsHovered)
|
||||
finalise();
|
||||
else
|
||||
updateBindTarget();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnScroll(ScrollEvent e)
|
||||
@ -216,12 +218,15 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnKeyUp(KeyUpEvent e)
|
||||
protected override void OnKeyUp(KeyUpEvent e)
|
||||
{
|
||||
if (!HasFocus) return base.OnKeyUp(e);
|
||||
if (!HasFocus)
|
||||
{
|
||||
base.OnKeyUp(e);
|
||||
return;
|
||||
}
|
||||
|
||||
finalise();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnJoystickPress(JoystickPressEvent e)
|
||||
@ -235,13 +240,15 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnJoystickRelease(JoystickReleaseEvent e)
|
||||
protected override void OnJoystickRelease(JoystickReleaseEvent e)
|
||||
{
|
||||
if (!HasFocus)
|
||||
return base.OnJoystickRelease(e);
|
||||
{
|
||||
base.OnJoystickRelease(e);
|
||||
return;
|
||||
}
|
||||
|
||||
finalise();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void clear()
|
||||
@ -313,14 +320,6 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
Size = new Vector2(80, 20);
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
base.OnMouseUp(e);
|
||||
|
||||
// without this, the mouse up triggers a finalise (and deselection) of the current binding target.
|
||||
return true;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ namespace osu.Game.Overlays.Mods
|
||||
return base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(MouseUpEvent e)
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
scaleContainer.ScaleTo(1, 500, Easing.OutElastic);
|
||||
|
||||
@ -172,8 +172,6 @@ namespace osu.Game.Overlays.Mods
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
|
@ -473,7 +473,10 @@ namespace osu.Game.Overlays.Mods
|
||||
if (selectedMod != null)
|
||||
{
|
||||
if (State.Value == Visibility.Visible) sampleOn?.Play();
|
||||
|
||||
DeselectTypes(selectedMod.IncompatibleMods, true);
|
||||
|
||||
if (selectedMod.RequiresConfiguration) ModSettingsContainer.Alpha = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -43,10 +43,10 @@ namespace osu.Game.Overlays.Music
|
||||
return base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(MouseUpEvent e)
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
IsDraggable = false;
|
||||
return base.OnMouseUp(e);
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
private bool selected;
|
||||
|
@ -136,29 +136,29 @@ namespace osu.Game.Overlays.Music
|
||||
return draggedItem != null || base.OnDragStart(e);
|
||||
}
|
||||
|
||||
protected override bool OnDrag(DragEvent e)
|
||||
protected override void OnDrag(DragEvent e)
|
||||
{
|
||||
nativeDragPosition = e.ScreenSpaceMousePosition;
|
||||
if (draggedItem == null)
|
||||
return base.OnDrag(e);
|
||||
|
||||
return true;
|
||||
if (draggedItem == null)
|
||||
base.OnDrag(e);
|
||||
}
|
||||
|
||||
protected override bool OnDragEnd(DragEndEvent e)
|
||||
protected override void OnDragEnd(DragEndEvent e)
|
||||
{
|
||||
nativeDragPosition = e.ScreenSpaceMousePosition;
|
||||
|
||||
if (draggedItem == null)
|
||||
return base.OnDragEnd(e);
|
||||
{
|
||||
base.OnDragEnd(e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (dragDestination != null)
|
||||
musicController.ChangeBeatmapSetPosition(draggedItem.BeatmapSetInfo, dragDestination.Value);
|
||||
|
||||
draggedItem = null;
|
||||
dragDestination = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -326,7 +326,9 @@ namespace osu.Game.Overlays
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(GlobalAction action) => false;
|
||||
public void OnReleased(GlobalAction action)
|
||||
{
|
||||
}
|
||||
|
||||
public class MusicControllerToast : Toast
|
||||
{
|
||||
|
@ -6,7 +6,6 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using System;
|
||||
|
||||
@ -23,7 +22,6 @@ namespace osu.Game.Overlays.News
|
||||
public Action ShowFrontPage;
|
||||
|
||||
public NewsHeader()
|
||||
: base(OverlayColourScheme.Purple)
|
||||
{
|
||||
BreadcrumbControl.AddItem(front_page_string);
|
||||
|
||||
|
@ -21,6 +21,11 @@ namespace osu.Game.Overlays
|
||||
|
||||
public readonly Bindable<string> Current = new Bindable<string>(null);
|
||||
|
||||
public NewsOverlay()
|
||||
: base(OverlayColourScheme.Purple)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
|
@ -385,7 +385,7 @@ namespace osu.Game.Overlays
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnDrag(DragEvent e)
|
||||
protected override void OnDrag(DragEvent e)
|
||||
{
|
||||
Vector2 change = e.MousePosition - e.MouseDownPosition;
|
||||
|
||||
@ -393,13 +393,12 @@ namespace osu.Game.Overlays
|
||||
change *= change.Length <= 0 ? 0 : MathF.Pow(change.Length, 0.7f) / change.Length;
|
||||
|
||||
this.MoveTo(change);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnDragEnd(DragEndEvent e)
|
||||
protected override void OnDragEnd(DragEndEvent e)
|
||||
{
|
||||
this.MoveTo(Vector2.Zero, 800, Easing.OutElastic);
|
||||
return base.OnDragEnd(e);
|
||||
base.OnDragEnd(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
80
osu.Game/Overlays/OverlayColourProvider.cs
Normal file
80
osu.Game/Overlays/OverlayColourProvider.cs
Normal file
@ -0,0 +1,80 @@
|
||||
// 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 System;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class OverlayColourProvider
|
||||
{
|
||||
private readonly OverlayColourScheme colourScheme;
|
||||
|
||||
public OverlayColourProvider(OverlayColourScheme colourScheme)
|
||||
{
|
||||
this.colourScheme = colourScheme;
|
||||
}
|
||||
|
||||
public Color4 Highlight1 => getColour(1, 0.7f);
|
||||
public Color4 Content1 => getColour(0.4f, 1);
|
||||
public Color4 Content2 => getColour(0.4f, 0.9f);
|
||||
public Color4 Light1 => getColour(0.4f, 0.8f);
|
||||
public Color4 Light2 => getColour(0.4f, 0.75f);
|
||||
public Color4 Light3 => getColour(0.4f, 0.7f);
|
||||
public Color4 Light4 => getColour(0.4f, 0.5f);
|
||||
public Color4 Dark1 => getColour(0.2f, 0.35f);
|
||||
public Color4 Dark2 => getColour(0.2f, 0.3f);
|
||||
public Color4 Dark3 => getColour(0.2f, 0.25f);
|
||||
public Color4 Dark4 => getColour(0.2f, 0.2f);
|
||||
public Color4 Dark5 => getColour(0.2f, 0.15f);
|
||||
public Color4 Dark6 => getColour(0.2f, 0.1f);
|
||||
public Color4 Foreground1 => getColour(0.1f, 0.6f);
|
||||
public Color4 Background1 => getColour(0.1f, 0.4f);
|
||||
public Color4 Background2 => getColour(0.1f, 0.3f);
|
||||
public Color4 Background3 => getColour(0.1f, 0.25f);
|
||||
public Color4 Background4 => getColour(0.1f, 0.2f);
|
||||
public Color4 Background5 => getColour(0.1f, 0.15f);
|
||||
public Color4 Background6 => getColour(0.1f, 0.1f);
|
||||
|
||||
private Color4 getColour(float saturation, float lightness) => Color4.FromHsl(new Vector4(getBaseHue(colourScheme), saturation, lightness, 1));
|
||||
|
||||
// See https://github.com/ppy/osu-web/blob/4218c288292d7c810b619075471eaea8bbb8f9d8/app/helpers.php#L1463
|
||||
private static float getBaseHue(OverlayColourScheme colourScheme)
|
||||
{
|
||||
switch (colourScheme)
|
||||
{
|
||||
default:
|
||||
throw new ArgumentException($@"{colourScheme} colour scheme does not provide a hue value in {nameof(getBaseHue)}.");
|
||||
|
||||
case OverlayColourScheme.Red:
|
||||
return 0;
|
||||
|
||||
case OverlayColourScheme.Pink:
|
||||
return 333 / 360f;
|
||||
|
||||
case OverlayColourScheme.Orange:
|
||||
return 46 / 360f;
|
||||
|
||||
case OverlayColourScheme.Green:
|
||||
return 115 / 360f;
|
||||
|
||||
case OverlayColourScheme.Purple:
|
||||
return 255 / 360f;
|
||||
|
||||
case OverlayColourScheme.Blue:
|
||||
return 200 / 360f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum OverlayColourScheme
|
||||
{
|
||||
Red,
|
||||
Pink,
|
||||
Orange,
|
||||
Green,
|
||||
Purple,
|
||||
Blue
|
||||
}
|
||||
}
|
@ -7,7 +7,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -25,12 +24,8 @@ namespace osu.Game.Overlays
|
||||
set => background.Height = value;
|
||||
}
|
||||
|
||||
protected OverlayColourScheme ColourScheme { get; }
|
||||
|
||||
protected OverlayHeader(OverlayColourScheme colourScheme)
|
||||
protected OverlayHeader()
|
||||
{
|
||||
ColourScheme = colourScheme;
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
@ -89,11 +84,11 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
titleBackground.Colour = colours.ForOverlayElement(ColourScheme, 0.2f, 0.15f);
|
||||
title.AccentColour = colours.ForOverlayElement(ColourScheme, 1, 0.7f);
|
||||
controlBackground.Colour = colours.ForOverlayElement(ColourScheme, 0.2f, 0.2f);
|
||||
titleBackground.Colour = colourProvider.Dark5;
|
||||
title.AccentColour = colourProvider.Highlight1;
|
||||
controlBackground.Colour = colourProvider.Dark4;
|
||||
}
|
||||
|
||||
protected abstract Drawable CreateBackground();
|
||||
|
@ -24,7 +24,6 @@ namespace osu.Game.Overlays.Profile
|
||||
private DetailHeaderContainer detailHeaderContainer;
|
||||
|
||||
public ProfileHeader()
|
||||
: base(OverlayColourScheme.Green)
|
||||
{
|
||||
BackgroundHeight = 150;
|
||||
|
||||
|
@ -25,7 +25,6 @@ namespace osu.Game.Overlays
|
||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
|
||||
private readonly BasicScrollContainer scrollFlow;
|
||||
private readonly Box background;
|
||||
private readonly Container tableContainer;
|
||||
private readonly DimmedLoadingLayer loading;
|
||||
|
||||
@ -36,12 +35,14 @@ namespace osu.Game.Overlays
|
||||
private IAPIProvider api { get; set; }
|
||||
|
||||
public RankingsOverlay()
|
||||
: base(OverlayColourScheme.Green)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(0.1f),
|
||||
},
|
||||
scrollFlow = new BasicScrollContainer
|
||||
{
|
||||
@ -85,17 +86,6 @@ namespace osu.Game.Overlays
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour)
|
||||
{
|
||||
Waves.FirstWaveColour = colour.Green;
|
||||
Waves.SecondWaveColour = colour.GreenLight;
|
||||
Waves.ThirdWaveColour = colour.GreenDark;
|
||||
Waves.FourthWaveColour = colour.GreenDarker;
|
||||
|
||||
background.Colour = OsuColour.Gray(0.1f);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
Country.BindValueChanged(_ =>
|
||||
|
@ -16,6 +16,11 @@ namespace osu.Game.Overlays.SearchableList
|
||||
public abstract class SearchableListOverlay : FullscreenOverlay
|
||||
{
|
||||
public const float WIDTH_PADDING = 80;
|
||||
|
||||
protected SearchableListOverlay(OverlayColourScheme colourScheme)
|
||||
: base(colourScheme)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class SearchableListOverlay<THeader, TTab, TCategory> : SearchableListOverlay
|
||||
@ -35,7 +40,8 @@ namespace osu.Game.Overlays.SearchableList
|
||||
protected abstract SearchableListHeader<THeader> CreateHeader();
|
||||
protected abstract SearchableListFilterControl<TTab, TCategory> CreateFilterControl();
|
||||
|
||||
protected SearchableListOverlay()
|
||||
protected SearchableListOverlay(OverlayColourScheme colourScheme)
|
||||
: base(colourScheme)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -40,6 +40,11 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.ShowInterface)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Show difficulty graph on progress bar",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.ShowProgressGraph)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Show health display even when you can't fail",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
|
||||
|
@ -1,7 +1,9 @@
|
||||
// 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 System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -10,11 +12,20 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
{
|
||||
public class SongSelectSettings : SettingsSubsection
|
||||
{
|
||||
private Bindable<double> minStars;
|
||||
private Bindable<double> maxStars;
|
||||
|
||||
protected override string Header => "Song Select";
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
minStars = config.GetBindable<double>(OsuSetting.DisplayStarsMinimum);
|
||||
maxStars = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum);
|
||||
|
||||
minStars.ValueChanged += min => maxStars.Value = Math.Max(min.NewValue, maxStars.Value);
|
||||
maxStars.ValueChanged += max => minStars.Value = Math.Min(max.NewValue, minStars.Value);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SettingsCheckbox
|
||||
@ -27,19 +38,19 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
LabelText = "Show converted beatmaps",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.ShowConvertedBeatmaps),
|
||||
},
|
||||
new SettingsSlider<double, StarSlider>
|
||||
new SettingsSlider<double, StarsSlider>
|
||||
{
|
||||
LabelText = "Display beatmaps from",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMinimum),
|
||||
KeyboardStep = 0.1f,
|
||||
Keywords = new[] { "star", "difficulty" }
|
||||
Keywords = new[] { "minimum", "maximum", "star", "difficulty" }
|
||||
},
|
||||
new SettingsSlider<double, StarSlider>
|
||||
new SettingsSlider<double, MaximumStarsSlider>
|
||||
{
|
||||
LabelText = "up to",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum),
|
||||
KeyboardStep = 0.1f,
|
||||
Keywords = new[] { "star", "difficulty" }
|
||||
Keywords = new[] { "minimum", "maximum", "star", "difficulty" }
|
||||
},
|
||||
new SettingsEnumDropdown<RandomSelectAlgorithm>
|
||||
{
|
||||
@ -49,7 +60,12 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
};
|
||||
}
|
||||
|
||||
private class StarSlider : OsuSliderBar<double>
|
||||
private class MaximumStarsSlider : StarsSlider
|
||||
{
|
||||
public override string TooltipText => Current.IsDefault ? "no limit" : base.TooltipText;
|
||||
}
|
||||
|
||||
private class StarsSlider : OsuSliderBar<double>
|
||||
{
|
||||
public override string TooltipText => Current.Value.ToString(@"0.## stars");
|
||||
}
|
||||
|
@ -52,12 +52,8 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
public SocialOverlay()
|
||||
: base(OverlayColourScheme.Pink)
|
||||
{
|
||||
Waves.FirstWaveColour = OsuColour.FromHex(@"cb5fa0");
|
||||
Waves.SecondWaveColour = OsuColour.FromHex(@"b04384");
|
||||
Waves.ThirdWaveColour = OsuColour.FromHex(@"9b2b6e");
|
||||
Waves.FourthWaveColour = OsuColour.FromHex(@"6d214d");
|
||||
|
||||
Add(loading = new LoadingAnimation());
|
||||
|
||||
Filter.Search.Current.ValueChanged += text =>
|
||||
|
@ -16,15 +16,10 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected override TabControl<string> CreateTabControl() => TabControl = new OverlayHeaderTabControl();
|
||||
|
||||
protected TabControlOverlayHeader(OverlayColourScheme colourScheme)
|
||||
: base(colourScheme)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
TabControl.AccentColour = colours.ForOverlayElement(ColourScheme, 1, 0.75f);
|
||||
TabControl.AccentColour = colourProvider.Highlight1;
|
||||
}
|
||||
|
||||
public class OverlayHeaderTabControl : OverlayTabControl<string>
|
||||
|
@ -29,6 +29,11 @@ namespace osu.Game.Overlays
|
||||
|
||||
public const float CONTENT_X_MARGIN = 70;
|
||||
|
||||
public UserProfileOverlay()
|
||||
: base(OverlayColourScheme.Green)
|
||||
{
|
||||
}
|
||||
|
||||
public void ShowUser(long userId) => ShowUser(new User { Id = userId });
|
||||
|
||||
public void ShowUser(User user, bool fetchOnline = true)
|
||||
|
@ -16,6 +16,9 @@ namespace osu.Game.Overlays.Volume
|
||||
|
||||
public bool OnPressed(GlobalAction action) => ActionRequested?.Invoke(action) ?? false;
|
||||
public bool OnScroll(GlobalAction action, float amount, bool isPrecise) => ScrollActionRequested?.Invoke(action, amount, isPrecise) ?? false;
|
||||
public bool OnReleased(GlobalAction action) => false;
|
||||
|
||||
public void OnReleased(GlobalAction action)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user