mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge branch 'master' into prev-button-revamp
This commit is contained in:
@ -1,52 +1,51 @@
|
||||
// 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.Diagnostics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Users;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
{
|
||||
public class FavouriteButton : HeaderButton
|
||||
public class FavouriteButton : HeaderButton, IHasTooltip
|
||||
{
|
||||
public readonly Bindable<BeatmapSetInfo> BeatmapSet = new Bindable<BeatmapSetInfo>();
|
||||
|
||||
private readonly Bindable<bool> favourited = new Bindable<bool>();
|
||||
private readonly BindableBool favourited = new BindableBool();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private PostBeatmapFavouriteRequest request;
|
||||
private DimmedLoadingLayer loading;
|
||||
|
||||
private readonly Bindable<User> localUser = new Bindable<User>();
|
||||
|
||||
public string TooltipText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Enabled.Value) return string.Empty;
|
||||
|
||||
return (favourited.Value ? "Unfavourite" : "Favourite") + " this beatmapset";
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(IAPIProvider api, NotificationOverlay notifications)
|
||||
{
|
||||
Container pink;
|
||||
SpriteIcon icon;
|
||||
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
pink = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.FromHex(@"9f015f"),
|
||||
},
|
||||
new Triangles
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ColourLight = OsuColour.FromHex(@"cb2187"),
|
||||
ColourDark = OsuColour.FromHex(@"9f015f"),
|
||||
TriangleScale = 1.5f,
|
||||
},
|
||||
},
|
||||
},
|
||||
icon = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
@ -55,31 +54,58 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
Size = new Vector2(18),
|
||||
Shadow = false,
|
||||
},
|
||||
loading = new DimmedLoadingLayer(0.8f, 0.5f),
|
||||
});
|
||||
|
||||
BeatmapSet.BindValueChanged(setInfo =>
|
||||
Action = () =>
|
||||
{
|
||||
if (setInfo.NewValue?.OnlineInfo?.HasFavourited == null)
|
||||
if (loading.State.Value == Visibility.Visible)
|
||||
return;
|
||||
|
||||
favourited.Value = setInfo.NewValue.OnlineInfo.HasFavourited;
|
||||
});
|
||||
// guaranteed by disabled state above.
|
||||
Debug.Assert(BeatmapSet.Value.OnlineBeatmapSetID != null);
|
||||
|
||||
favourited.ValueChanged += favourited =>
|
||||
{
|
||||
if (favourited.NewValue)
|
||||
loading.Show();
|
||||
|
||||
request?.Cancel();
|
||||
|
||||
request = new PostBeatmapFavouriteRequest(BeatmapSet.Value.OnlineBeatmapSetID.Value, favourited.Value ? BeatmapFavouriteAction.UnFavourite : BeatmapFavouriteAction.Favourite);
|
||||
|
||||
request.Success += () =>
|
||||
{
|
||||
pink.FadeIn(200);
|
||||
icon.Icon = FontAwesome.Solid.Heart;
|
||||
}
|
||||
else
|
||||
favourited.Toggle();
|
||||
loading.Hide();
|
||||
};
|
||||
|
||||
request.Failure += e =>
|
||||
{
|
||||
pink.FadeOut(200);
|
||||
icon.Icon = FontAwesome.Regular.Heart;
|
||||
}
|
||||
notifications?.Post(new SimpleNotification
|
||||
{
|
||||
Text = e.Message,
|
||||
Icon = FontAwesome.Solid.Times,
|
||||
});
|
||||
|
||||
loading.Hide();
|
||||
};
|
||||
|
||||
api.Queue(request);
|
||||
};
|
||||
|
||||
favourited.ValueChanged += favourited => icon.Icon = favourited.NewValue ? FontAwesome.Solid.Heart : FontAwesome.Regular.Heart;
|
||||
|
||||
localUser.BindTo(api.LocalUser);
|
||||
localUser.BindValueChanged(_ => updateEnabled());
|
||||
|
||||
// must be run after setting the Action to ensure correct enabled state (setting an Action forces a button to be enabled).
|
||||
BeatmapSet.BindValueChanged(setInfo =>
|
||||
{
|
||||
updateEnabled();
|
||||
favourited.Value = setInfo.NewValue?.OnlineInfo?.HasFavourited ?? false;
|
||||
}, true);
|
||||
}
|
||||
|
||||
private void updateEnabled() => Enabled.Value = !(localUser.Value is GuestUser) && BeatmapSet.Value?.OnlineBeatmapSetID > 0;
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
@ -130,6 +130,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
});
|
||||
|
||||
if (entry.GithubUser.UserId != null)
|
||||
{
|
||||
title.AddUserLink(new User
|
||||
{
|
||||
Username = entry.GithubUser.OsuUsername,
|
||||
@ -139,18 +140,23 @@ namespace osu.Game.Overlays.Changelog
|
||||
t.Font = fontMedium;
|
||||
t.Colour = entryColour;
|
||||
});
|
||||
}
|
||||
else if (entry.GithubUser.GithubUrl != null)
|
||||
{
|
||||
title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, t =>
|
||||
{
|
||||
t.Font = fontMedium;
|
||||
t.Colour = entryColour;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
title.AddText(entry.GithubUser.DisplayName, t =>
|
||||
{
|
||||
t.Font = fontSmall;
|
||||
t.Colour = entryColour;
|
||||
});
|
||||
}
|
||||
|
||||
ChangelogEntries.Add(titleContainer);
|
||||
|
||||
|
@ -68,11 +68,13 @@ namespace osu.Game.Overlays.Changelog
|
||||
}
|
||||
|
||||
if (build != null)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ChangelogBuildWithNavigation(build) { SelectBuild = SelectBuild },
|
||||
new Comments(build)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class ChangelogBuildWithNavigation : ChangelogBuild
|
||||
|
@ -99,7 +99,7 @@ namespace osu.Game.Overlays.Chat.Tabs
|
||||
private void tabCloseRequested(TabItem<Channel> tab)
|
||||
{
|
||||
int totalTabs = TabContainer.Count - 1; // account for selectorTab
|
||||
int currentIndex = MathHelper.Clamp(TabContainer.IndexOf(tab), 1, totalTabs);
|
||||
int currentIndex = Math.Clamp(TabContainer.IndexOf(tab), 1, totalTabs);
|
||||
|
||||
if (tab == SelectedTab && totalTabs > 1)
|
||||
// Select the tab after tab-to-be-removed's index, or the tab before if current == last
|
||||
|
@ -162,10 +162,12 @@ namespace osu.Game.Overlays.Comments
|
||||
foreach (var c in response.Comments)
|
||||
{
|
||||
if (c.IsTopLevel)
|
||||
{
|
||||
page.Add(new DrawableComment(c)
|
||||
{
|
||||
ShowDeleted = { BindTarget = ShowDeleted }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
LoadComponentAsync(page, loaded =>
|
||||
|
80
osu.Game/Overlays/Comments/TotalCommentsCounter.cs
Normal file
80
osu.Game/Overlays/Comments/TotalCommentsCounter.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 osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osuTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
|
||||
namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
public class TotalCommentsCounter : CompositeDrawable
|
||||
{
|
||||
public readonly BindableInt Current = new BindableInt();
|
||||
|
||||
private readonly SpriteText counter;
|
||||
|
||||
public TotalCommentsCounter()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 50;
|
||||
AddInternal(new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Margin = new MarginPadding { Left = 50 },
|
||||
Spacing = new Vector2(5, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Font = OsuFont.GetFont(size: 20, italics: true),
|
||||
Text = @"Comments"
|
||||
},
|
||||
new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(0.05f)
|
||||
},
|
||||
counter = new SpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Margin = new MarginPadding { Horizontal = 10, Vertical = 5 },
|
||||
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
counter.Colour = colours.BlueLighter;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
Current.BindValueChanged(value => counter.Text = value.NewValue.ToString("N0"), true);
|
||||
base.LoadComplete();
|
||||
}
|
||||
}
|
||||
}
|
@ -48,8 +48,6 @@ namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
this.comment = comment;
|
||||
|
||||
Action = onAction;
|
||||
|
||||
AutoSizeAxes = Axes.X;
|
||||
Height = 20;
|
||||
LoadingAnimationSize = new Vector2(10);
|
||||
@ -60,6 +58,9 @@ namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
AccentColour = borderContainer.BorderColour = sideNumber.Colour = colours.GreenLight;
|
||||
hoverLayer.Colour = Color4.Black.Opacity(0.5f);
|
||||
|
||||
if (api.IsLoggedIn && api.LocalUser.Value.Id != comment.UserId)
|
||||
Action = onAction;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -157,6 +158,9 @@ namespace osu.Game.Overlays.Comments
|
||||
|
||||
private void updateDisplay()
|
||||
{
|
||||
if (Action == null)
|
||||
return;
|
||||
|
||||
if (isVoted.Value)
|
||||
{
|
||||
hoverLayer.FadeTo(IsHovered ? 1 : 0);
|
||||
|
@ -241,7 +241,7 @@ namespace osu.Game.Overlays.Dialog
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
if (!actionInvoked)
|
||||
if (!actionInvoked && content.IsPresent)
|
||||
// In the case a user did not choose an action before a hide was triggered, press the last button.
|
||||
// This is presumed to always be a sane default "cancel" action.
|
||||
buttonsContainer.Last().Click();
|
||||
|
@ -149,8 +149,10 @@ namespace osu.Game.Overlays.Direct
|
||||
icons.Add(new GroupedDifficultyIcon(SetInfo.Beatmaps.FindAll(b => b.Ruleset.Equals(ruleset)), ruleset, this is DirectListPanel ? Color4.White : colours.Gray5));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var b in SetInfo.Beatmaps.OrderBy(beatmap => beatmap.StarDifficulty))
|
||||
icons.Add(new DifficultyIcon(b));
|
||||
}
|
||||
|
||||
return icons;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace osu.Game.Overlays
|
||||
get => beatmapSets;
|
||||
set
|
||||
{
|
||||
if (beatmapSets?.Equals(value) ?? false) return;
|
||||
if (ReferenceEquals(beatmapSets, value)) return;
|
||||
|
||||
beatmapSets = value?.ToList();
|
||||
|
||||
|
@ -194,8 +194,10 @@ namespace osu.Game.Overlays.Mods
|
||||
start = Mods.Length - 1;
|
||||
|
||||
for (int i = start; i < Mods.Length && i >= 0; i += direction)
|
||||
{
|
||||
if (SelectAt(i))
|
||||
return;
|
||||
}
|
||||
|
||||
Deselect();
|
||||
}
|
||||
|
@ -112,6 +112,7 @@ namespace osu.Game.Overlays.Mods
|
||||
if (selected == null) continue;
|
||||
|
||||
foreach (var type in modTypes)
|
||||
{
|
||||
if (type.IsInstanceOfType(selected))
|
||||
{
|
||||
if (immediate)
|
||||
@ -119,6 +120,7 @@ namespace osu.Game.Overlays.Mods
|
||||
else
|
||||
Scheduler.AddDelayed(button.Deselect, delay += 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,7 +160,8 @@ namespace osu.Game.Overlays.Mods
|
||||
},
|
||||
ButtonsContainer = new FillFlowContainer<ModButtonEmpty>
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Spacing = new Vector2(50f, 0f),
|
||||
|
@ -217,7 +217,7 @@ namespace osu.Game.Overlays.Music
|
||||
break;
|
||||
}
|
||||
|
||||
dstIndex = MathHelper.Clamp(dstIndex, 0, items.Count - 1);
|
||||
dstIndex = Math.Clamp(dstIndex, 0, items.Count - 1);
|
||||
|
||||
if (srcIndex == dstIndex)
|
||||
return;
|
||||
|
@ -246,6 +246,24 @@ namespace osu.Game.Overlays
|
||||
queuedDirection = null;
|
||||
}
|
||||
|
||||
private bool allowRateAdjustments;
|
||||
|
||||
/// <summary>
|
||||
/// Whether mod rate adjustments are allowed to be applied.
|
||||
/// </summary>
|
||||
public bool AllowRateAdjustments
|
||||
{
|
||||
get => allowRateAdjustments;
|
||||
set
|
||||
{
|
||||
if (allowRateAdjustments == value)
|
||||
return;
|
||||
|
||||
allowRateAdjustments = value;
|
||||
ResetTrackAdjustments();
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetTrackAdjustments()
|
||||
{
|
||||
var track = current?.Track;
|
||||
@ -254,8 +272,11 @@ namespace osu.Game.Overlays
|
||||
|
||||
track.ResetSpeedAdjustments();
|
||||
|
||||
foreach (var mod in mods.Value.OfType<IApplicableToClock>())
|
||||
mod.ApplyToClock(track);
|
||||
if (allowRateAdjustments)
|
||||
{
|
||||
foreach (var mod in mods.Value.OfType<IApplicableToClock>())
|
||||
mod.ApplyToClock(track);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
19
osu.Game/Overlays/News/NewsContent.cs
Normal file
19
osu.Game/Overlays/News/NewsContent.cs
Normal file
@ -0,0 +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.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.News
|
||||
{
|
||||
public abstract class NewsContent : FillFlowContainer
|
||||
{
|
||||
protected NewsContent()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Direction = FillDirection.Vertical;
|
||||
Padding = new MarginPadding { Bottom = 100, Top = 20, Horizontal = 50 };
|
||||
}
|
||||
}
|
||||
}
|
109
osu.Game/Overlays/News/NewsHeader.cs
Normal file
109
osu.Game/Overlays/News/NewsHeader.cs
Normal file
@ -0,0 +1,109 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
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 System;
|
||||
|
||||
namespace osu.Game.Overlays.News
|
||||
{
|
||||
public class NewsHeader : OverlayHeader
|
||||
{
|
||||
private const string front_page_string = "Front Page";
|
||||
|
||||
private NewsHeaderTitle title;
|
||||
|
||||
public readonly Bindable<string> Current = new Bindable<string>(null);
|
||||
|
||||
public Action ShowFrontPage;
|
||||
|
||||
public NewsHeader()
|
||||
{
|
||||
TabControl.AddItem(front_page_string);
|
||||
|
||||
TabControl.Current.ValueChanged += e =>
|
||||
{
|
||||
if (e.NewValue == front_page_string)
|
||||
ShowFrontPage?.Invoke();
|
||||
};
|
||||
|
||||
Current.ValueChanged += showArticle;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour)
|
||||
{
|
||||
TabControl.AccentColour = colour.Violet;
|
||||
}
|
||||
|
||||
private void showArticle(ValueChangedEvent<string> e)
|
||||
{
|
||||
if (e.OldValue != null)
|
||||
TabControl.RemoveItem(e.OldValue);
|
||||
|
||||
if (e.NewValue != null)
|
||||
{
|
||||
TabControl.AddItem(e.NewValue);
|
||||
TabControl.Current.Value = e.NewValue;
|
||||
|
||||
title.IsReadingArticle = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TabControl.Current.Value = front_page_string;
|
||||
title.IsReadingArticle = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override Drawable CreateBackground() => new NewsHeaderBackground();
|
||||
|
||||
protected override Drawable CreateContent() => new Container();
|
||||
|
||||
protected override ScreenTitle CreateTitle() => title = new NewsHeaderTitle();
|
||||
|
||||
private class NewsHeaderBackground : Sprite
|
||||
{
|
||||
public NewsHeaderBackground()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
FillMode = FillMode.Fill;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
Texture = textures.Get(@"Headers/news");
|
||||
}
|
||||
}
|
||||
|
||||
private class NewsHeaderTitle : ScreenTitle
|
||||
{
|
||||
private const string article_string = "Article";
|
||||
|
||||
public bool IsReadingArticle
|
||||
{
|
||||
set => Section = value ? article_string : front_page_string;
|
||||
}
|
||||
|
||||
public NewsHeaderTitle()
|
||||
{
|
||||
Title = "News";
|
||||
IsReadingArticle = false;
|
||||
}
|
||||
|
||||
protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/news");
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AccentColour = colours.Violet;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
68
osu.Game/Overlays/NewsOverlay.cs
Normal file
68
osu.Game/Overlays/NewsOverlay.cs
Normal file
@ -0,0 +1,68 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Overlays.News;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class NewsOverlay : FullscreenOverlay
|
||||
{
|
||||
private NewsHeader header;
|
||||
|
||||
//ReSharper disable NotAccessedField.Local
|
||||
private Container<NewsContent> content;
|
||||
|
||||
public readonly Bindable<string> Current = new Bindable<string>(null);
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colours.PurpleDarkAlternative
|
||||
},
|
||||
new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
header = new NewsHeader
|
||||
{
|
||||
ShowFrontPage = ShowFrontPage
|
||||
},
|
||||
content = new Container<NewsContent>
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
header.Current.BindTo(Current);
|
||||
Current.TriggerChange();
|
||||
}
|
||||
|
||||
public void ShowFrontPage()
|
||||
{
|
||||
Current.Value = null;
|
||||
Show();
|
||||
}
|
||||
}
|
||||
}
|
@ -86,7 +86,7 @@ namespace osu.Game.Overlays
|
||||
/// <param name="source">The object that registered the <see cref="ConfigManager{T}"/> to be tracked.</param>
|
||||
/// <param name="configManager">The <see cref="ConfigManager{T}"/> that is being tracked.</param>
|
||||
/// <exception cref="ArgumentNullException">If <paramref name="configManager"/> is null.</exception>
|
||||
/// <exception cref="InvalidOperationException">If <paramref name="configManager"/> is not being tracked from the same <see cref="source"/>.</exception>
|
||||
/// <exception cref="InvalidOperationException">If <paramref name="configManager"/> is not being tracked from the same <paramref name="source"/>.</exception>
|
||||
public void StopTracking(object source, ITrackableConfigManager configManager)
|
||||
{
|
||||
if (configManager == null) throw new ArgumentNullException(nameof(configManager));
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -8,7 +9,6 @@ using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
set
|
||||
{
|
||||
int count = MathHelper.Clamp(value, 0, 3);
|
||||
int count = Math.Clamp(value, 0, 3);
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
|
@ -60,7 +60,10 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
dropdown = new AudioDeviceSettingsDropdown()
|
||||
dropdown = new AudioDeviceSettingsDropdown
|
||||
{
|
||||
Keywords = new[] { "speaker", "headphone", "output" }
|
||||
}
|
||||
};
|
||||
|
||||
updateItems();
|
||||
|
@ -34,6 +34,12 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
||||
Bindable = config.GetBindable<IntroSequence>(OsuSetting.IntroSequence),
|
||||
Items = Enum.GetValues(typeof(IntroSequence)).Cast<IntroSequence>()
|
||||
},
|
||||
new SettingsDropdown<BackgroundSource>
|
||||
{
|
||||
LabelText = "Background source",
|
||||
Bindable = config.GetBindable<BackgroundSource>(OsuSetting.MenuBackgroundSource),
|
||||
Items = Enum.GetValues(typeof(BackgroundSource)).Cast<BackgroundSource>()
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Overlays.Settings.Sections.Audio;
|
||||
@ -10,6 +12,9 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
public class AudioSection : SettingsSection
|
||||
{
|
||||
public override string Header => "Audio";
|
||||
|
||||
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(new[] { "sound" });
|
||||
|
||||
public override IconUsage Icon => FontAwesome.Solid.VolumeUp;
|
||||
|
||||
public AudioSection()
|
||||
|
@ -38,6 +38,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
{
|
||||
LabelText = "Show health display even when you can't fail",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
|
||||
Keywords = new[] { "hp", "bar" }
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Configuration;
|
||||
|
||||
@ -10,6 +12,8 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
{
|
||||
protected override string Header => "Mods";
|
||||
|
||||
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(new[] { "mod" });
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
@ -18,7 +22,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Increase visibility of first object when visual impairment mods are enabled",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.IncreaseFirstObjectVisibility)
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.IncreaseFirstObjectVisibility),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -31,13 +31,15 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
{
|
||||
LabelText = "Display beatmaps from",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMinimum),
|
||||
KeyboardStep = 0.1f
|
||||
KeyboardStep = 0.1f,
|
||||
Keywords = new[] { "star", "difficulty" }
|
||||
},
|
||||
new SettingsSlider<double, StarSlider>
|
||||
{
|
||||
LabelText = "up to",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum),
|
||||
KeyboardStep = 0.1f
|
||||
KeyboardStep = 0.1f,
|
||||
Keywords = new[] { "star", "difficulty" }
|
||||
},
|
||||
new SettingsEnumDropdown<RandomSelectAlgorithm>
|
||||
{
|
||||
|
@ -75,12 +75,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
LabelText = "UI Scaling",
|
||||
TransferValueOnCommit = true,
|
||||
Bindable = osuConfig.GetBindable<float>(OsuSetting.UIScale),
|
||||
KeyboardStep = 0.01f
|
||||
KeyboardStep = 0.01f,
|
||||
Keywords = new[] { "scale", "letterbox" },
|
||||
},
|
||||
new SettingsEnumDropdown<ScalingMode>
|
||||
{
|
||||
LabelText = "Screen Scaling",
|
||||
Bindable = osuConfig.GetBindable<ScalingMode>(OsuSetting.Scaling),
|
||||
Keywords = new[] { "scale", "letterbox" },
|
||||
},
|
||||
scalingSettings = new FillFlowContainer<SettingsSlider<float>>
|
||||
{
|
||||
|
@ -76,7 +76,9 @@ namespace osu.Game.Overlays.Settings
|
||||
}
|
||||
}
|
||||
|
||||
public virtual IEnumerable<string> FilterTerms => new[] { LabelText };
|
||||
public virtual IEnumerable<string> FilterTerms => Keywords == null ? new[] { LabelText } : new List<string>(Keywords) { LabelText }.ToArray();
|
||||
|
||||
public IEnumerable<string> Keywords { get; set; }
|
||||
|
||||
public bool MatchingFilter
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Settings
|
||||
public abstract string Header { get; }
|
||||
|
||||
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
|
||||
public IEnumerable<string> FilterTerms => new[] { Header };
|
||||
public virtual IEnumerable<string> FilterTerms => new[] { Header };
|
||||
|
||||
private const int header_size = 26;
|
||||
private const int header_margin = 25;
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Settings
|
||||
protected abstract string Header { get; }
|
||||
|
||||
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
|
||||
public IEnumerable<string> FilterTerms => new[] { Header };
|
||||
public virtual IEnumerable<string> FilterTerms => new[] { Header };
|
||||
|
||||
public bool MatchingFilter
|
||||
{
|
||||
|
@ -12,6 +12,7 @@ namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
Margin = new MarginPadding { Top = 5 },
|
||||
RelativeSizeAxes = Axes.X,
|
||||
CommitOnFocusLost = true,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Overlays
|
||||
get => users;
|
||||
set
|
||||
{
|
||||
if (users?.Equals(value) ?? false)
|
||||
if (ReferenceEquals(users, value))
|
||||
return;
|
||||
|
||||
users = value?.ToList();
|
||||
|
@ -18,8 +18,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public class ToolbarRulesetSelector : RulesetSelector
|
||||
{
|
||||
private const float padding = 10;
|
||||
|
||||
protected Drawable ModeButtonLine { get; private set; }
|
||||
|
||||
public ToolbarRulesetSelector()
|
||||
@ -39,7 +37,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
},
|
||||
ModeButtonLine = new Container
|
||||
{
|
||||
Size = new Vector2(padding * 2 + ToolbarButton.WIDTH, 3),
|
||||
Size = new Vector2(ToolbarButton.WIDTH, 3),
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
Masking = true,
|
||||
@ -91,7 +89,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Padding = new MarginPadding { Left = padding, Right = padding },
|
||||
};
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
|
Reference in New Issue
Block a user