1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-14 01:33:20 +08:00

Merge branch 'master' into fix-overlapping-object-undoredo

This commit is contained in:
Dean Herbert 2020-05-01 10:45:29 +09:00 committed by GitHub
commit d470e092a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 111 additions and 32 deletions

View File

@ -9,6 +9,7 @@ using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Taiko.Beatmaps;
using osu.Game.Rulesets.Taiko.Skinning; using osu.Game.Rulesets.Taiko.Skinning;
using osu.Game.Rulesets.Taiko.UI; using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
@ -34,6 +35,18 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
public TestSceneTaikoPlayfield() public TestSceneTaikoPlayfield()
{ {
TaikoBeatmap beatmap;
bool kiai = false;
AddStep("set beatmap", () =>
{
Beatmap.Value = CreateWorkingBeatmap(beatmap = new TaikoBeatmap());
beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 1000 });
Beatmap.Value.Track.Start();
});
AddStep("Load playfield", () => SetContents(() => new TaikoPlayfield(new ControlPointInfo()) AddStep("Load playfield", () => SetContents(() => new TaikoPlayfield(new ControlPointInfo())
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
@ -41,6 +54,11 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
})); }));
AddRepeatStep("change height", () => this.ChildrenOfType<TaikoPlayfield>().ForEach(p => p.Height = Math.Max(0.2f, (p.Height + 0.2f) % 1f)), 50); AddRepeatStep("change height", () => this.ChildrenOfType<TaikoPlayfield>().ForEach(p => p.Height = Math.Max(0.2f, (p.Height + 0.2f) % 1f)), 50);
AddStep("Toggle kiai", () =>
{
Beatmap.Value.Beatmap.ControlPointInfo.Add(0, new EffectControlPoint { KiaiMode = (kiai = !kiai) });
});
} }
} }
} }

View File

@ -30,6 +30,8 @@ namespace osu.Game.Rulesets.Taiko.Skinning
.Then().ScaleTo(1.1f, animation_time * 0.8) .Then().ScaleTo(1.1f, animation_time * 0.8)
.Then().ScaleTo(0.9f, animation_time * 0.4) .Then().ScaleTo(0.9f, animation_time * 0.4)
.Then().ScaleTo(1f, animation_time * 0.2); .Then().ScaleTo(1f, animation_time * 0.2);
Expire(true);
} }
} }
} }

View File

@ -0,0 +1,57 @@
// 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.Audio.Track;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Taiko.Skinning
{
public class TaikoLegacyPlayfieldBackgroundRight : BeatSyncedContainer
{
private Sprite kiai;
private bool kiaiDisplayed;
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
new Sprite
{
Texture = skin.GetTexture("taiko-bar-right"),
RelativeSizeAxes = Axes.Both,
Size = Vector2.One,
},
kiai = new Sprite
{
Texture = skin.GetTexture("taiko-bar-right-glow"),
RelativeSizeAxes = Axes.Both,
Size = Vector2.One,
Alpha = 0,
}
};
}
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
{
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
if (effectPoint.KiaiMode != kiaiDisplayed)
{
kiaiDisplayed = effectPoint.KiaiMode;
kiai.ClearTransforms();
kiai.FadeTo(kiaiDisplayed ? 1 : 0, 200);
}
}
}
}

View File

@ -9,7 +9,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Taiko.Skinning namespace osu.Game.Rulesets.Taiko.Skinning
{ {
@ -60,13 +59,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning
case TaikoSkinComponents.PlayfieldBackgroundRight: case TaikoSkinComponents.PlayfieldBackgroundRight:
if (GetTexture("taiko-bar-right") != null) if (GetTexture("taiko-bar-right") != null)
{ return new TaikoLegacyPlayfieldBackgroundRight();
return this.GetAnimation("taiko-bar-right", false, false).With(d =>
{
d.RelativeSizeAxes = Axes.Both;
d.Size = Vector2.One;
});
}
return null; return null;

View File

@ -797,6 +797,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
AddStep("create song select", () => LoadScreen(songSelect = new TestSongSelect())); AddStep("create song select", () => LoadScreen(songSelect = new TestSongSelect()));
AddUntilStep("wait for present", () => songSelect.IsCurrentScreen()); AddUntilStep("wait for present", () => songSelect.IsCurrentScreen());
AddUntilStep("wait for carousel loaded", () => songSelect.Carousel.IsAlive);
} }
private void addManyTestMaps() private void addManyTestMaps()

View File

@ -197,7 +197,7 @@ namespace osu.Game.Beatmaps
public override string ToString() => BeatmapInfo.ToString(); public override string ToString() => BeatmapInfo.ToString();
public bool BeatmapLoaded => beatmapLoadTask?.IsCompleted ?? false; public virtual bool BeatmapLoaded => beatmapLoadTask?.IsCompleted ?? false;
public IBeatmap Beatmap public IBeatmap Beatmap
{ {
@ -233,7 +233,7 @@ namespace osu.Game.Beatmaps
protected abstract Texture GetBackground(); protected abstract Texture GetBackground();
private readonly RecyclableLazy<Texture> background; private readonly RecyclableLazy<Texture> background;
public bool TrackLoaded => track.IsResultAvailable; public virtual bool TrackLoaded => track.IsResultAvailable;
public Track Track => track.Value; public Track Track => track.Value;
protected abstract Track GetTrack(); protected abstract Track GetTrack();
private RecyclableLazy<Track> track; private RecyclableLazy<Track> track;

View File

@ -914,10 +914,7 @@ namespace osu.Game
if (ScreenStack.CurrentScreen is Loader) if (ScreenStack.CurrentScreen is Loader)
return false; return false;
if (introScreen == null) if (introScreen.DidLoadMenu && !(ScreenStack.CurrentScreen is IntroScreen))
return true;
if (!introScreen.DidLoadMenu || !(ScreenStack.CurrentScreen is IntroScreen))
{ {
Scheduler.Add(introScreen.MakeCurrent); Scheduler.Add(introScreen.MakeCurrent);
return true; return true;

View File

@ -86,7 +86,11 @@ namespace osu.Game.Screens.Edit
{ {
using (var stream = new MemoryStream(state)) using (var stream = new MemoryStream(state))
using (var reader = new LineBufferedReader(stream, true)) using (var reader = new LineBufferedReader(stream, true))
return new PassThroughWorkingBeatmap(Decoder.GetDecoder<Beatmap>(reader).Decode(reader)).GetPlayableBeatmap(editorBeatmap.BeatmapInfo.Ruleset); {
var decoded = Decoder.GetDecoder<Beatmap>(reader).Decode(reader);
decoded.BeatmapInfo.Ruleset = editorBeatmap.BeatmapInfo.Ruleset;
return new PassThroughWorkingBeatmap(decoded).GetPlayableBeatmap(editorBeatmap.BeatmapInfo.Ruleset);
}
} }
private class PassThroughWorkingBeatmap : WorkingBeatmap private class PassThroughWorkingBeatmap : WorkingBeatmap

View File

@ -96,8 +96,6 @@ namespace osu.Game.Screens.Menu
Track = introBeatmap.Track; Track = introBeatmap.Track;
} }
public override bool OnExiting(IScreen next) => !DidLoadMenu;
public override void OnResuming(IScreen last) public override void OnResuming(IScreen last)
{ {
this.FadeIn(300); this.FadeIn(300);

View File

@ -34,6 +34,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Game.Graphics.UserInterface;
using osu.Game.Scoring; using osu.Game.Scoring;
namespace osu.Game.Screens.Select namespace osu.Game.Screens.Select
@ -77,7 +78,7 @@ namespace osu.Game.Screens.Select
protected BeatmapCarousel Carousel { get; private set; } protected BeatmapCarousel Carousel { get; private set; }
private DifficultyRecommender recommender; private readonly DifficultyRecommender recommender = new DifficultyRecommender();
private BeatmapInfoWedge beatmapInfoWedge; private BeatmapInfoWedge beatmapInfoWedge;
private DialogOverlay dialogOverlay; private DialogOverlay dialogOverlay;
@ -92,6 +93,8 @@ namespace osu.Game.Screens.Select
private SampleChannel sampleChangeDifficulty; private SampleChannel sampleChangeDifficulty;
private SampleChannel sampleChangeBeatmap; private SampleChannel sampleChangeBeatmap;
private Container carouselContainer;
protected BeatmapDetailArea BeatmapDetails { get; private set; } protected BeatmapDetailArea BeatmapDetails { get; private set; }
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>(); private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
@ -105,9 +108,22 @@ namespace osu.Game.Screens.Select
// initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter). // initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter).
transferRulesetValue(); transferRulesetValue();
LoadComponentAsync(Carousel = new BeatmapCarousel
{
AllowSelection = false, // delay any selection until our bindables are ready to make a good choice.
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.Both,
BleedTop = FilterControl.HEIGHT,
BleedBottom = Footer.HEIGHT,
SelectionChanged = updateSelectedBeatmap,
BeatmapSetsChanged = carouselBeatmapsLoaded,
GetRecommendedBeatmap = recommender.GetRecommendedBeatmap,
}, c => carouselContainer.Child = c);
AddRangeInternal(new Drawable[] AddRangeInternal(new Drawable[]
{ {
recommender = new DifficultyRecommender(), recommender,
new ResetScrollContainer(() => Carousel.ScrollToSelected()) new ResetScrollContainer(() => Carousel.ScrollToSelected())
{ {
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
@ -139,7 +155,7 @@ namespace osu.Game.Screens.Select
Padding = new MarginPadding { Right = -150 }, Padding = new MarginPadding { Right = -150 },
}, },
}, },
new Container carouselContainer = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding Padding = new MarginPadding
@ -147,18 +163,7 @@ namespace osu.Game.Screens.Select
Top = FilterControl.HEIGHT, Top = FilterControl.HEIGHT,
Bottom = Footer.HEIGHT Bottom = Footer.HEIGHT
}, },
Child = Carousel = new BeatmapCarousel Child = new LoadingSpinner(true) { State = { Value = Visibility.Visible } }
{
AllowSelection = false, // delay any selection until our bindables are ready to make a good choice.
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.Both,
BleedTop = FilterControl.HEIGHT,
BleedBottom = Footer.HEIGHT,
SelectionChanged = updateSelectedBeatmap,
BeatmapSetsChanged = carouselBeatmapsLoaded,
GetRecommendedBeatmap = recommender.GetRecommendedBeatmap,
},
} }
}, },
} }

View File

@ -27,6 +27,10 @@ namespace osu.Game.Tests.Beatmaps
this.storyboard = storyboard; this.storyboard = storyboard;
} }
public override bool TrackLoaded => true;
public override bool BeatmapLoaded => true;
protected override IBeatmap GetBeatmap() => beatmap; protected override IBeatmap GetBeatmap() => beatmap;
protected override Storyboard GetStoryboard() => storyboard ?? base.GetStoryboard(); protected override Storyboard GetStoryboard() => storyboard ?? base.GetStoryboard();