1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-19 16:52:56 +08:00

Merge remote-tracking branch 'refs/remotes/ppy/master' into friends-sorting

This commit is contained in:
Andrei Zavatski 2019-08-27 22:22:28 +03:00
commit f9841369e8
21 changed files with 188 additions and 178 deletions

View File

@ -58,14 +58,12 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
ApplyResult(r => r.Type = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss); ApplyResult(r => r.Type = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss);
} }
protected override bool UseTransformStateManagement => false; protected sealed override double InitialLifetimeOffset => HitObject.TimePreempt;
protected override void UpdateState(ArmedState state) protected override void UpdateInitialTransforms() => this.FadeIn(200);
protected override void UpdateStateTransforms(ArmedState state)
{ {
// TODO: update to use new state management.
using (BeginAbsoluteSequence(HitObject.StartTime - HitObject.TimePreempt))
this.FadeIn(200);
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
using (BeginAbsoluteSequence(endTime, true)) using (BeginAbsoluteSequence(endTime, true))

View File

@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Catch.UI
if (lastPlateableFruit == null) if (lastPlateableFruit == null)
return; return;
// this is required to make this run after the last caught fruit runs UpdateState at least once. // this is required to make this run after the last caught fruit runs updateState() at least once.
// TODO: find a better alternative // TODO: find a better alternative
if (lastPlateableFruit.IsLoaded) if (lastPlateableFruit.IsLoaded)
action(); action();

View File

@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
Alpha = 0.2f; Alpha = 0.2f;
} }
protected override void UpdateState(ArmedState state) protected override void UpdateStateTransforms(ArmedState state)
{ {
} }
} }

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
@ -104,6 +105,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
bodyPiece.Height = DrawHeight - Head.Height / 2 + Tail.Height / 2; bodyPiece.Height = DrawHeight - Head.Height / 2 + Tail.Height / 2;
} }
protected override void UpdateStateTransforms(ArmedState state)
{
using (BeginDelayedSequence(HitObject.Duration, true))
base.UpdateStateTransforms(state);
}
protected void BeginHold() protected void BeginHold()
{ {
holdStartTime = Time.Current; holdStartTime = Time.Current;

View File

@ -45,24 +45,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
{ {
Anchor = Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; Anchor = Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
} }
}
public abstract class DrawableManiaHitObject<TObject> : DrawableManiaHitObject protected override void UpdateInitialTransforms() => this.FadeIn();
where TObject : ManiaHitObject
{
public new readonly TObject HitObject;
protected DrawableManiaHitObject(TObject hitObject) protected override void UpdateStateTransforms(ArmedState state)
: base(hitObject)
{ {
HitObject = hitObject;
}
protected override bool UseTransformStateManagement => false;
protected override void UpdateState(ArmedState state)
{
// TODO: update to use new state management.
switch (state) switch (state)
{ {
case ArmedState.Miss: case ArmedState.Miss:
@ -75,4 +62,16 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
} }
} }
} }
public abstract class DrawableManiaHitObject<TObject> : DrawableManiaHitObject
where TObject : ManiaHitObject
{
public new readonly TObject HitObject;
protected DrawableManiaHitObject(TObject hitObject)
: base(hitObject)
{
HitObject = hitObject;
}
}
} }

View File

@ -247,10 +247,6 @@ namespace osu.Game.Rulesets.Taiko.Tests
: base(hitObject) : base(hitObject)
{ {
} }
protected override void UpdateState(ArmedState state)
{
}
} }
} }
} }

View File

@ -53,9 +53,5 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
Alpha = 0.75f Alpha = 0.75f
}); });
} }
protected override void UpdateState(ArmedState state)
{
}
} }
} }

View File

@ -88,13 +88,13 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
ApplyResult(r => r.Type = HitResult.Miss); ApplyResult(r => r.Type = HitResult.Miss);
} }
protected override void UpdateState(ArmedState state) protected override void UpdateStateTransforms(ArmedState state)
{ {
switch (state) switch (state)
{ {
case ArmedState.Hit: case ArmedState.Hit:
case ArmedState.Miss: case ArmedState.Miss:
this.FadeOut(100).Expire(); this.Delay(HitObject.Duration).FadeOut(100).Expire();
break; break;
} }
} }

View File

@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
ApplyResult(r => r.Type = HitResult.Great); ApplyResult(r => r.Type = HitResult.Great);
} }
protected override void UpdateState(ArmedState state) protected override void UpdateStateTransforms(ArmedState state)
{ {
switch (state) switch (state)
{ {

View File

@ -92,56 +92,42 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
Size = BaseSize * Parent.RelativeChildSize; Size = BaseSize * Parent.RelativeChildSize;
} }
protected override void UpdateState(ArmedState state) protected override void UpdateStateTransforms(ArmedState state)
{ {
// TODO: update to use new state management. switch (state)
var circlePiece = MainPiece as CirclePiece;
circlePiece?.FlashBox.FinishTransforms();
var offset = !AllJudged ? 0 : Time.Current - HitObject.StartTime;
using (BeginDelayedSequence(HitObject.StartTime - Time.Current + offset, true))
{ {
switch (State.Value) case ArmedState.Idle:
{ validActionPressed = false;
case ArmedState.Idle:
validActionPressed = false;
UnproxyContent(); UnproxyContent();
this.Delay(HitObject.HitWindows.HalfWindowFor(HitResult.Miss)).Expire(); this.Delay(HitObject.HitWindows.HalfWindowFor(HitResult.Miss)).Expire();
break; break;
case ArmedState.Miss: case ArmedState.Miss:
this.FadeOut(100) this.FadeOut(100)
.Expire(); .Expire();
break; break;
case ArmedState.Hit: case ArmedState.Hit:
// If we're far enough away from the left stage, we should bring outselves in front of it // If we're far enough away from the left stage, we should bring outselves in front of it
ProxyContent(); ProxyContent();
var flash = circlePiece?.FlashBox; var flash = (MainPiece as CirclePiece)?.FlashBox;
flash?.FadeTo(0.9f).FadeOut(300);
if (flash != null) const float gravity_time = 300;
{ const float gravity_travel_height = 200;
flash.FadeTo(0.9f);
flash.FadeOut(300);
}
const float gravity_time = 300; this.ScaleTo(0.8f, gravity_time * 2, Easing.OutQuad);
const float gravity_travel_height = 200;
this.ScaleTo(0.8f, gravity_time * 2, Easing.OutQuad); this.MoveToY(-gravity_travel_height, gravity_time, Easing.Out)
.Then()
.MoveToY(gravity_travel_height * 2, gravity_time * 2, Easing.In);
this.MoveToY(-gravity_travel_height, gravity_time, Easing.Out) this.FadeOut(800)
.Then() .Expire();
.MoveToY(gravity_travel_height * 2, gravity_time * 2, Easing.In);
this.FadeOut(800) break;
.Expire();
break;
}
} }
} }

View File

@ -18,9 +18,5 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
MainObject = mainObject; MainObject = mainObject;
} }
protected override void UpdateState(ArmedState state)
{
}
} }
} }

View File

@ -25,6 +25,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
private const float target_ring_scale = 5f; private const float target_ring_scale = 5f;
private const float inner_ring_alpha = 0.65f; private const float inner_ring_alpha = 0.65f;
/// <summary>
/// Offset away from the start time of the swell at which the ring starts appearing.
/// </summary>
private const double ring_appear_offset = 100;
private readonly List<DrawableSwellTick> ticks = new List<DrawableSwellTick>(); private readonly List<DrawableSwellTick> ticks = new List<DrawableSwellTick>();
private readonly Container bodyContainer; private readonly Container bodyContainer;
@ -179,26 +184,34 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
} }
} }
protected override void UpdateState(ArmedState state) protected override void UpdateInitialTransforms()
{ {
const float preempt = 100; base.UpdateInitialTransforms();
const float out_transition_time = 300;
using (BeginAbsoluteSequence(HitObject.StartTime - ring_appear_offset, true))
targetRing.ScaleTo(target_ring_scale, 400, Easing.OutQuint);
}
protected override void UpdateStateTransforms(ArmedState state)
{
const double transition_duration = 300;
switch (state) switch (state)
{ {
case ArmedState.Idle: case ArmedState.Idle:
UnproxyContent();
expandingRing.FadeTo(0); expandingRing.FadeTo(0);
using (BeginAbsoluteSequence(HitObject.StartTime - preempt, true))
targetRing.ScaleTo(target_ring_scale, preempt * 4, Easing.OutQuint);
break; break;
case ArmedState.Miss: case ArmedState.Miss:
case ArmedState.Hit: case ArmedState.Hit:
this.FadeOut(out_transition_time, Easing.Out); using (BeginAbsoluteSequence(Time.Current, true))
bodyContainer.ScaleTo(1.4f, out_transition_time); {
this.FadeOut(transition_duration, Easing.Out);
bodyContainer.ScaleTo(1.4f, transition_duration);
Expire();
}
Expire();
break; break;
} }
} }
@ -212,9 +225,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
// Make the swell stop at the hit target // Make the swell stop at the hit target
X = Math.Max(0, X); X = Math.Max(0, X);
double t = Math.Min(HitObject.StartTime, Time.Current); if (Time.Current >= HitObject.StartTime - ring_appear_offset)
if (t == HitObject.StartTime)
ProxyContent(); ProxyContent();
else
UnproxyContent();
} }
private bool? lastWasCentre; private bool? lastWasCentre;

View File

@ -1,7 +1,6 @@
// 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.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables namespace osu.Game.Rulesets.Taiko.Objects.Drawables
@ -21,10 +20,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
} }
protected override void UpdateState(ArmedState state)
{
}
public override bool OnPressed(TaikoAction action) => false; public override bool OnPressed(TaikoAction action) => false;
} }
} }

View File

@ -78,10 +78,31 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
public abstract bool OnPressed(TaikoAction action); public abstract bool OnPressed(TaikoAction action);
public virtual bool OnReleased(TaikoAction action) => false; public virtual bool OnReleased(TaikoAction action) => false;
protected override void UpdateInitialTransforms() => this.FadeIn();
public override double LifetimeStart
{
get => base.LifetimeStart;
set
{
base.LifetimeStart = value;
proxiedContent.LifetimeStart = value;
}
}
public override double LifetimeEnd
{
get => base.LifetimeEnd;
set
{
base.LifetimeEnd = value;
proxiedContent.LifetimeEnd = value;
}
}
private class ProxiedContentContainer : Container private class ProxiedContentContainer : Container
{ {
public override double LifetimeStart => Parent?.LifetimeStart ?? base.LifetimeStart; public override bool RemoveWhenNotAlive => false;
public override double LifetimeEnd => Parent?.LifetimeEnd ?? base.LifetimeEnd;
} }
} }
@ -121,8 +142,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
} }
} }
protected override bool UseTransformStateManagement => false;
// Normal and clap samples are handled by the drum // Normal and clap samples are handled by the drum
protected override IEnumerable<HitSampleInfo> GetSamples() => HitObject.Samples.Where(s => s.Name != HitSampleInfo.HIT_NORMAL && s.Name != HitSampleInfo.HIT_CLAP); protected override IEnumerable<HitSampleInfo> GetSamples() => HitObject.Samples.Where(s => s.Name != HitSampleInfo.HIT_NORMAL && s.Name != HitSampleInfo.HIT_CLAP);

View File

@ -200,10 +200,6 @@ namespace osu.Game.Tests.Visual.Gameplay
break; break;
} }
} }
protected override void UpdateState(ArmedState state)
{
}
} }
private class TestDrawableHitObject : DrawableHitObject<HitObject> private class TestDrawableHitObject : DrawableHitObject<HitObject>
@ -216,10 +212,6 @@ namespace osu.Game.Tests.Visual.Gameplay
AddInternal(new Box { Size = new Vector2(75) }); AddInternal(new Box { Size = new Vector2(75) });
} }
protected override void UpdateState(ArmedState state)
{
}
} }
} }
} }

View File

@ -15,6 +15,7 @@ using osu.Framework.MathUtils;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu;
@ -79,8 +80,12 @@ namespace osu.Game.Tests.Visual.SongSelect
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default)); Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default));
Beatmap.SetDefault(); Beatmap.SetDefault();
Dependencies.Cache(config = new OsuConfigManager(LocalStorage));
} }
private OsuConfigManager config;
[SetUp] [SetUp]
public virtual void SetUp() => Schedule(() => public virtual void SetUp() => Schedule(() =>
{ {
@ -111,13 +116,15 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);
AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); var sortMode = config.GetBindable<SortMode>(OsuSetting.SongSelectSortingMode);
AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; });
AddStep(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; }); AddStep(@"Sort by Artist", delegate { sortMode.Value = SortMode.Artist; });
AddStep(@"Sort by DateAdded", delegate { songSelect.FilterControl.Sort = SortMode.DateAdded; }); AddStep(@"Sort by Title", delegate { sortMode.Value = SortMode.Title; });
AddStep(@"Sort by BPM", delegate { songSelect.FilterControl.Sort = SortMode.BPM; }); AddStep(@"Sort by Author", delegate { sortMode.Value = SortMode.Author; });
AddStep(@"Sort by Length", delegate { songSelect.FilterControl.Sort = SortMode.Length; }); AddStep(@"Sort by DateAdded", delegate { sortMode.Value = SortMode.DateAdded; });
AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; }); AddStep(@"Sort by BPM", delegate { sortMode.Value = SortMode.BPM; });
AddStep(@"Sort by Length", delegate { sortMode.Value = SortMode.Length; });
AddStep(@"Sort by Difficulty", delegate { sortMode.Value = SortMode.Difficulty; });
} }
[Test] [Test]

View File

@ -8,6 +8,7 @@ using osu.Framework.Platform;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Select; using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
namespace osu.Game.Configuration namespace osu.Game.Configuration
{ {
@ -25,6 +26,9 @@ namespace osu.Game.Configuration
Set(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10, 0.1); Set(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10, 0.1);
Set(OsuSetting.DisplayStarsMaximum, 10.0, 0, 10, 0.1); Set(OsuSetting.DisplayStarsMaximum, 10.0, 0, 10, 0.1);
Set(OsuSetting.SongSelectGroupingMode, GroupMode.All);
Set(OsuSetting.SongSelectSortingMode, SortMode.Title);
Set(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation); Set(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation);
Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1); Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1);
@ -150,6 +154,8 @@ namespace osu.Game.Configuration
SaveUsername, SaveUsername,
DisplayStarsMinimum, DisplayStarsMinimum,
DisplayStarsMaximum, DisplayStarsMaximum,
SongSelectGroupingMode,
SongSelectSortingMode,
RandomSelectAlgorithm, RandomSelectAlgorithm,
ShowFpsDisplay, ShowFpsDisplay,
ChatDisplayHeight, ChatDisplayHeight,

View File

@ -132,6 +132,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// </summary> /// </summary>
public event Action<DrawableHitObject, ArmedState> ApplyCustomUpdateState; public event Action<DrawableHitObject, ArmedState> ApplyCustomUpdateState;
#pragma warning disable 618 // (legacy state management) - can be removed 20200227
/// <summary> /// <summary>
/// Enables automatic transform management of this hitobject. Implementation of transforms should be done in <see cref="UpdateInitialTransforms"/> and <see cref="UpdateStateTransforms"/> only. Rewinding and removing previous states is done automatically. /// Enables automatic transform management of this hitobject. Implementation of transforms should be done in <see cref="UpdateInitialTransforms"/> and <see cref="UpdateStateTransforms"/> only. Rewinding and removing previous states is done automatically.
/// </summary> /// </summary>
@ -139,6 +141,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// Going forward, this is the preferred way of implementing <see cref="DrawableHitObject"/>s. Previous functionality /// Going forward, this is the preferred way of implementing <see cref="DrawableHitObject"/>s. Previous functionality
/// is offered as a compatibility layer until all rulesets have been migrated across. /// is offered as a compatibility layer until all rulesets have been migrated across.
/// </remarks> /// </remarks>
[Obsolete("Use UpdateInitialTransforms()/UpdateStateTransforms() instead")] // can be removed 20200227
protected virtual bool UseTransformStateManagement => true; protected virtual bool UseTransformStateManagement => true;
protected override void ClearInternal(bool disposeChildren = true) => throw new InvalidOperationException($"Should never clear a {nameof(DrawableHitObject)}"); protected override void ClearInternal(bool disposeChildren = true) => throw new InvalidOperationException($"Should never clear a {nameof(DrawableHitObject)}");
@ -219,10 +222,13 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// Should generally not be used when <see cref="UseTransformStateManagement"/> is true; use <see cref="UpdateStateTransforms"/> instead. /// Should generally not be used when <see cref="UseTransformStateManagement"/> is true; use <see cref="UpdateStateTransforms"/> instead.
/// </summary> /// </summary>
/// <param name="state">The new armed state.</param> /// <param name="state">The new armed state.</param>
[Obsolete("Use UpdateInitialTransforms()/UpdateStateTransforms() instead")] // can be removed 20200227
protected virtual void UpdateState(ArmedState state) protected virtual void UpdateState(ArmedState state)
{ {
} }
#pragma warning restore 618
#endregion #endregion
protected override void SkinChanged(ISkinSource skin, bool allowFallback) protected override void SkinChanged(ISkinSource skin, bool allowFallback)

View File

@ -220,14 +220,23 @@ namespace osu.Game.Screens.Select.Carousel
public class FilterableGroupedDifficultyIcon : GroupedDifficultyIcon public class FilterableGroupedDifficultyIcon : GroupedDifficultyIcon
{ {
private readonly List<CarouselBeatmap> items;
public FilterableGroupedDifficultyIcon(List<CarouselBeatmap> items, RulesetInfo ruleset) public FilterableGroupedDifficultyIcon(List<CarouselBeatmap> items, RulesetInfo ruleset)
: base(items.Select(i => i.Beatmap).ToList(), ruleset, Color4.White) : base(items.Select(i => i.Beatmap).ToList(), ruleset, Color4.White)
{ {
items.ForEach(item => item.Filtered.ValueChanged += _ => this.items = items;
{
// for now, fade the whole group based on the ratio of hidden items. foreach (var item in items)
this.FadeTo(1 - 0.9f * ((float)items.Count(i => i.Filtered.Value) / items.Count), 100); item.Filtered.BindValueChanged(_ => Scheduler.AddOnce(updateFilteredDisplay));
});
updateFilteredDisplay();
}
private void updateFilteredDisplay()
{
// for now, fade the whole group based on the ratio of hidden items.
this.FadeTo(1 - 0.9f * ((float)items.Count(i => i.Filtered.Value) / items.Count), 100);
} }
} }
} }

View File

@ -29,40 +29,14 @@ namespace osu.Game.Screens.Select
private readonly TabControl<GroupMode> groupTabs; private readonly TabControl<GroupMode> groupTabs;
private SortMode sort = SortMode.Title; private Bindable<SortMode> sortMode;
public SortMode Sort private Bindable<GroupMode> groupMode;
{
get => sort;
set
{
if (sort != value)
{
sort = value;
FilterChanged?.Invoke(CreateCriteria());
}
}
}
private GroupMode group = GroupMode.All;
public GroupMode Group
{
get => group;
set
{
if (group != value)
{
group = value;
FilterChanged?.Invoke(CreateCriteria());
}
}
}
public FilterCriteria CreateCriteria() => new FilterCriteria public FilterCriteria CreateCriteria() => new FilterCriteria
{ {
Group = group, Group = groupMode.Value,
Sort = sort, Sort = sortMode.Value,
SearchText = searchTextBox.Text, SearchText = searchTextBox.Text,
AllowConvertedBeatmaps = showConverted.Value, AllowConvertedBeatmaps = showConverted.Value,
Ruleset = ruleset.Value Ruleset = ruleset.Value
@ -122,7 +96,6 @@ namespace osu.Game.Screens.Select
Height = 24, Height = 24,
Width = 0.5f, Width = 0.5f,
AutoSort = true, AutoSort = true,
Current = { Value = GroupMode.Title }
}, },
//spriteText = new OsuSpriteText //spriteText = new OsuSpriteText
//{ //{
@ -141,7 +114,6 @@ namespace osu.Game.Screens.Select
Width = 0.5f, Width = 0.5f,
Height = 24, Height = 24,
AutoSort = true, AutoSort = true,
Current = { Value = SortMode.Title }
} }
} }
}, },
@ -153,8 +125,6 @@ namespace osu.Game.Screens.Select
groupTabs.PinItem(GroupMode.All); groupTabs.PinItem(GroupMode.All);
groupTabs.PinItem(GroupMode.RecentlyPlayed); groupTabs.PinItem(GroupMode.RecentlyPlayed);
groupTabs.Current.ValueChanged += group => Group = group.NewValue;
sortTabs.Current.ValueChanged += sort => Sort = sort.NewValue;
} }
public void Deactivate() public void Deactivate()
@ -184,7 +154,18 @@ namespace osu.Game.Screens.Select
showConverted.ValueChanged += _ => updateCriteria(); showConverted.ValueChanged += _ => updateCriteria();
ruleset.BindTo(parentRuleset); ruleset.BindTo(parentRuleset);
ruleset.BindValueChanged(_ => updateCriteria(), true); ruleset.BindValueChanged(_ => updateCriteria());
sortMode = config.GetBindable<SortMode>(OsuSetting.SongSelectSortingMode);
groupMode = config.GetBindable<GroupMode>(OsuSetting.SongSelectGroupingMode);
sortTabs.Current.BindTo(sortMode);
groupTabs.Current.BindTo(groupMode);
groupMode.BindValueChanged(_ => updateCriteria());
sortMode.BindValueChanged(_ => updateCriteria());
updateCriteria();
} }
private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria()); private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria());

View File

@ -155,16 +155,40 @@ namespace osu.Game.Skinning
// Spacing value was reverse-engineered from the ratio of the rendered sprite size in the visual inspector vs the actual texture size // Spacing value was reverse-engineered from the ratio of the rendered sprite size in the visual inspector vs the actual texture size
Spacing = new Vector2(-Configuration.HitCircleOverlap * 0.89f, 0) Spacing = new Vector2(-Configuration.HitCircleOverlap * 0.89f, 0)
}; };
default:
string lastPiece = componentName.Split('/').Last();
componentName = componentName.StartsWith("Gameplay/taiko/") ? "taiko-" + lastPiece : lastPiece;
break;
} }
return getAnimation(componentName, animatable, looping); return getAnimation(componentName, animatable, looping);
} }
public override Texture GetTexture(string componentName)
{
componentName = getFallbackName(componentName);
float ratio = 2;
var texture = Textures.Get($"{componentName}@2x");
if (texture == null)
{
ratio = 1;
texture = Textures.Get(componentName);
}
if (texture != null)
texture.ScaleAdjust = ratio;
return texture;
}
public override SampleChannel GetSample(string sampleName) => Samples.Get(getFallbackName(sampleName));
private bool hasFont(string fontName) => GetTexture($"{fontName}-0") != null;
private string getFallbackName(string componentName)
{
string lastPiece = componentName.Split('/').Last();
return componentName.StartsWith("Gameplay/taiko/") ? "taiko-" + lastPiece : lastPiece;
}
private Drawable getAnimation(string componentName, bool animatable, bool looping, string animationSeparator = "-") private Drawable getAnimation(string componentName, bool animatable, bool looping, string animationSeparator = "-")
{ {
Texture texture; Texture texture;
@ -200,27 +224,6 @@ namespace osu.Game.Skinning
return null; return null;
} }
public override Texture GetTexture(string componentName)
{
float ratio = 2;
var texture = Textures.Get($"{componentName}@2x");
if (texture == null)
{
ratio = 1;
texture = Textures.Get(componentName);
}
if (texture != null)
texture.ScaleAdjust = ratio;
return texture;
}
public override SampleChannel GetSample(string sampleName) => Samples.Get(sampleName);
private bool hasFont(string fontName) => GetTexture($"{fontName}-0") != null;
protected class LegacySkinResourceStore<T> : IResourceStore<byte[]> protected class LegacySkinResourceStore<T> : IResourceStore<byte[]>
where T : INamedFileInfo where T : INamedFileInfo
{ {