mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Merge remote-tracking branch 'Aergwyn/master' into netstandard
This commit is contained in:
@ -261,6 +261,7 @@ namespace osu.Game.Screens.Select
|
||||
description.Text = null;
|
||||
source.Text = null;
|
||||
tags.Text = null;
|
||||
|
||||
advanced.Beatmap = new BeatmapInfo
|
||||
{
|
||||
StarDifficulty = 0,
|
||||
@ -306,36 +307,16 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private class MetadataSection : Container
|
||||
{
|
||||
private readonly TextFlowContainer textFlow;
|
||||
|
||||
public string Text
|
||||
{
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
this.FadeOut(transition_duration);
|
||||
return;
|
||||
}
|
||||
|
||||
this.FadeIn(transition_duration);
|
||||
textFlow.Clear();
|
||||
textFlow.AddText(value, s => s.TextSize = 14);
|
||||
}
|
||||
}
|
||||
|
||||
public Color4 TextColour
|
||||
{
|
||||
get { return textFlow.Colour; }
|
||||
set { textFlow.Colour = value; }
|
||||
}
|
||||
private readonly FillFlowContainer textContainer;
|
||||
private TextFlowContainer textFlow;
|
||||
|
||||
public MetadataSection(string title)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Alpha = 0;
|
||||
|
||||
InternalChild = new FillFlowContainer
|
||||
InternalChild = textContainer = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
@ -361,6 +342,44 @@ namespace osu.Game.Screens.Select
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
this.FadeOut(transition_duration);
|
||||
return;
|
||||
}
|
||||
|
||||
setTextAsync(value);
|
||||
}
|
||||
}
|
||||
|
||||
private void setTextAsync(string text)
|
||||
{
|
||||
LoadComponentAsync(new TextFlowContainer(s => s.TextSize = 14)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Colour = textFlow.Colour,
|
||||
Text = text
|
||||
}, loaded =>
|
||||
{
|
||||
textFlow?.Expire();
|
||||
textContainer.Add(textFlow = loaded);
|
||||
|
||||
// fade in if we haven't yet.
|
||||
this.FadeIn(transition_duration);
|
||||
});
|
||||
}
|
||||
|
||||
public Color4 TextColour
|
||||
{
|
||||
get { return textFlow.Colour; }
|
||||
set { textFlow.Colour = value; }
|
||||
}
|
||||
}
|
||||
|
||||
private class DimmedLoadingAnimation : VisibilityContainer
|
||||
|
@ -29,11 +29,17 @@ namespace osu.Game.Screens.Select.Details
|
||||
if (value == metrics) return;
|
||||
metrics = value;
|
||||
|
||||
var ratings = Metrics.Ratings.ToList();
|
||||
negativeRatings.Text = ratings.GetRange(0, ratings.Count / 2 + 1).Sum().ToString();
|
||||
positiveRatings.Text = ratings.GetRange(ratings.Count / 2 + 1, ratings.Count / 2).Sum().ToString();
|
||||
ratingsBar.Length = (float)ratings.GetRange(0, ratings.Count / 2 + 1).Sum() / ratings.Sum();
|
||||
graph.Values = Metrics.Ratings.Select(r => (float)r);
|
||||
const int rating_range = 10;
|
||||
|
||||
var ratings = Metrics.Ratings.Skip(1).Take(rating_range); // adjust for API returning weird empty data at 0.
|
||||
|
||||
var negativeCount = ratings.Take(rating_range / 2).Sum();
|
||||
var totalCount = ratings.Sum();
|
||||
|
||||
negativeRatings.Text = negativeCount.ToString();
|
||||
positiveRatings.Text = (totalCount - negativeCount).ToString();
|
||||
ratingsBar.Length = totalCount == 0 ? 0 : (float)negativeCount / totalCount;
|
||||
graph.Values = ratings.Take(rating_range).Select(r => (float)r);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@ using osu.Game.Screens.Select.Filter;
|
||||
using Container = osu.Framework.Graphics.Containers.Container;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
@ -60,6 +61,7 @@ namespace osu.Game.Screens.Select
|
||||
Group = group,
|
||||
Sort = sort,
|
||||
SearchText = searchTextBox.Text,
|
||||
AllowConvertedBeatmaps = showConverted,
|
||||
Ruleset = ruleset
|
||||
};
|
||||
|
||||
@ -163,17 +165,24 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
|
||||
private Bindable<bool> showConverted;
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuColour colours, OsuGame osu)
|
||||
private void load(OsuColour colours, OsuGame osu, OsuConfigManager config)
|
||||
{
|
||||
sortTabs.AccentColour = colours.GreenLight;
|
||||
|
||||
showConverted = config.GetBindable<bool>(OsuSetting.ShowConvertedBeatmaps);
|
||||
showConverted.ValueChanged += val => updateCriteria();
|
||||
|
||||
if (osu != null)
|
||||
ruleset.BindTo(osu.Ruleset);
|
||||
ruleset.ValueChanged += val => FilterChanged?.Invoke(CreateCriteria());
|
||||
ruleset.ValueChanged += val => updateCriteria();
|
||||
ruleset.TriggerChange();
|
||||
}
|
||||
|
||||
private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria());
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
||||
|
||||
protected override bool OnMouseMove(InputState state) => true;
|
||||
@ -182,4 +191,4 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
protected override bool OnDragStart(InputState state) => true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ namespace osu.Game.Screens.Select
|
||||
public SortMode Sort;
|
||||
public string SearchText;
|
||||
public RulesetInfo Ruleset;
|
||||
public bool AllowConvertedBeatmaps;
|
||||
|
||||
public void Filter(List<BeatmapGroup> groups)
|
||||
{
|
||||
@ -23,7 +24,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
var set = g.BeatmapSet;
|
||||
|
||||
bool hasCurrentMode = set.Beatmaps.Any(bm => bm.RulesetID == (Ruleset?.ID ?? 0));
|
||||
bool hasCurrentMode = AllowConvertedBeatmaps || set.Beatmaps.Any(bm => bm.RulesetID == (Ruleset?.ID ?? 0));
|
||||
|
||||
bool match = hasCurrentMode;
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
|
||||
private Box background;
|
||||
private Container content;
|
||||
private Container avatar;
|
||||
private Drawable avatar;
|
||||
private DrawableRank scoreRank;
|
||||
private OsuSpriteText nameLabel;
|
||||
private GlowingSpriteText scoreLabel;
|
||||
@ -98,7 +98,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding(edge_margin),
|
||||
Children = new Drawable[]
|
||||
Children = new[]
|
||||
{
|
||||
avatar = new DelayedLoadWrapper(
|
||||
new Avatar(Score.User)
|
||||
@ -115,7 +115,6 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
},
|
||||
})
|
||||
{
|
||||
TimeBeforeLoad = 500,
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2),
|
||||
},
|
||||
@ -212,7 +211,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
foreach (var d in new Drawable[] { avatar, nameLabel, scoreLabel, scoreRank, flagBadgeContainer, maxCombo, accuracy, modsContainer })
|
||||
foreach (var d in new[] { avatar, nameLabel, scoreLabel, scoreRank, flagBadgeContainer, maxCombo, accuracy, modsContainer })
|
||||
d.FadeOut();
|
||||
|
||||
Alpha = 0;
|
||||
|
@ -4,6 +4,8 @@
|
||||
using System.Linq;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
@ -42,9 +44,13 @@ namespace osu.Game.Screens.Select
|
||||
beatmapDetails.Leaderboard.ScoreSelected += s => Push(new Results(s));
|
||||
}
|
||||
|
||||
private SampleChannel sampleConfirm;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OsuColour colours, AudioManager audio)
|
||||
{
|
||||
sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");
|
||||
|
||||
Footer.AddButton(@"mods", colours.Yellow, modSelect, Key.F1, float.MaxValue);
|
||||
|
||||
BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1);
|
||||
@ -128,6 +134,8 @@ namespace osu.Game.Screens.Select
|
||||
Beatmap.Value.Track.Looping = false;
|
||||
Beatmap.Disabled = true;
|
||||
|
||||
sampleConfirm?.Play();
|
||||
|
||||
LoadComponentAsync(player = new PlayerLoader(new Player()), l => Push(player));
|
||||
}
|
||||
}
|
||||
|
@ -203,15 +203,15 @@ namespace osu.Game.Screens.Select
|
||||
Push(new Editor());
|
||||
}
|
||||
|
||||
private void onBeatmapRestored(BeatmapInfo b) => carousel.UpdateBeatmap(b);
|
||||
private void onBeatmapHidden(BeatmapInfo b) => carousel.UpdateBeatmap(b);
|
||||
private void onBeatmapRestored(BeatmapInfo b) => Schedule(() => carousel.UpdateBeatmap(b));
|
||||
private void onBeatmapHidden(BeatmapInfo b) => Schedule(() => carousel.UpdateBeatmap(b));
|
||||
|
||||
private void carouselBeatmapsLoaded()
|
||||
{
|
||||
if (Beatmap.Value.BeatmapSetInfo?.DeletePending == false)
|
||||
carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false);
|
||||
else
|
||||
carousel.SelectNext();
|
||||
carousel.SelectNextRandom();
|
||||
}
|
||||
|
||||
private void carouselRaisedStart(InputState state = null)
|
||||
@ -332,7 +332,11 @@ namespace osu.Game.Screens.Select
|
||||
logo.FadeIn(logo_transition, Easing.OutQuint);
|
||||
logo.ScaleTo(0.4f, logo_transition, Easing.OutQuint);
|
||||
|
||||
logo.Action = () => carouselRaisedStart();
|
||||
logo.Action = () =>
|
||||
{
|
||||
carouselRaisedStart();
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LogoExiting(OsuLogo logo)
|
||||
@ -413,7 +417,7 @@ namespace osu.Game.Screens.Select
|
||||
if (backgroundModeBeatmap != null)
|
||||
{
|
||||
backgroundModeBeatmap.Beatmap = beatmap;
|
||||
backgroundModeBeatmap.BlurTo(background_blur, 1000);
|
||||
backgroundModeBeatmap.BlurTo(background_blur, 750, Easing.OutQuint);
|
||||
backgroundModeBeatmap.FadeTo(1, 250);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user