mirror of
https://github.com/osukey/osukey.git
synced 2025-06-08 12:58:01 +09:00
Merge branch 'master' into fix-supporter-naming
This commit is contained in:
commit
be2d3d6ad4
@ -69,11 +69,22 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return new TrackVirtual();
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Waveform GetWaveform() => new Waveform(store.GetStream(getPathForFile(Metadata.AudioFile)));
|
protected override Waveform GetWaveform()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var trackData = store.GetStream(getPathForFile(Metadata.AudioFile));
|
||||||
|
return trackData == null ? null : new Waveform(trackData);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override Storyboard GetStoryboard()
|
protected override Storyboard GetStoryboard()
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
protected override Texture GetBackground() => game?.Textures.Get(@"Backgrounds/bg4");
|
protected override Texture GetBackground() => game?.Textures.Get(@"Backgrounds/bg4");
|
||||||
|
|
||||||
protected override Track GetTrack() => new TrackVirtual();
|
protected override Track GetTrack() => new TrackVirtual { Length = 1000 };
|
||||||
|
|
||||||
private class DummyRulesetInfo : RulesetInfo
|
private class DummyRulesetInfo : RulesetInfo
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ using osu.Game.Skinning;
|
|||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
public abstract class WorkingBeatmap : IDisposable
|
public abstract partial class WorkingBeatmap : IDisposable
|
||||||
{
|
{
|
||||||
public readonly BeatmapInfo BeatmapInfo;
|
public readonly BeatmapInfo BeatmapInfo;
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ namespace osu.Game.Beatmaps
|
|||||||
private Track populateTrack()
|
private Track populateTrack()
|
||||||
{
|
{
|
||||||
// we want to ensure that we always have a track, even if it's a fake one.
|
// we want to ensure that we always have a track, even if it's a fake one.
|
||||||
var t = GetTrack() ?? new TrackVirtual();
|
var t = GetTrack() ?? new VirtualBeatmapTrack(Beatmap);
|
||||||
applyRateAdjustments(t);
|
applyRateAdjustments(t);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
38
osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs
Normal file
38
osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps
|
||||||
|
{
|
||||||
|
public partial class WorkingBeatmap
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A type of <see cref="TrackVirtual"/> which provides a valid length based on the <see cref="HitObject"/>s of an <see cref="IBeatmap"/>.
|
||||||
|
/// </summary>
|
||||||
|
protected class VirtualBeatmapTrack : TrackVirtual
|
||||||
|
{
|
||||||
|
private const double excess_length = 1000;
|
||||||
|
|
||||||
|
public VirtualBeatmapTrack(IBeatmap beatmap)
|
||||||
|
{
|
||||||
|
var lastObject = beatmap.HitObjects.LastOrDefault();
|
||||||
|
|
||||||
|
switch (lastObject)
|
||||||
|
{
|
||||||
|
case null:
|
||||||
|
Length = excess_length;
|
||||||
|
break;
|
||||||
|
case IHasEndTime endTime:
|
||||||
|
Length = endTime.EndTime + excess_length;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Length = lastObject.StartTime + excess_length;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -84,10 +84,11 @@ namespace osu.Game.Rulesets
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var instance = r.CreateInstance();
|
var instanceInfo = ((Ruleset)Activator.CreateInstance(Type.GetType(r.InstantiationInfo), (RulesetInfo)null)).RulesetInfo;
|
||||||
|
|
||||||
r.Name = instance.Description;
|
r.Name = instanceInfo.Name;
|
||||||
r.ShortName = instance.ShortName;
|
r.ShortName = instanceInfo.ShortName;
|
||||||
|
r.InstantiationInfo = instanceInfo.InstantiationInfo;
|
||||||
|
|
||||||
r.Available = true;
|
r.Available = true;
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,6 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
if (Beatmap.Value == null)
|
if (Beatmap.Value == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Beatmap.Value.Track.Length == double.PositiveInfinity) return;
|
|
||||||
|
|
||||||
float markerPos = MathHelper.Clamp(ToLocalSpace(screenPosition).X, 0, DrawWidth);
|
float markerPos = MathHelper.Clamp(ToLocalSpace(screenPosition).X, 0, DrawWidth);
|
||||||
adjustableClock.Seek(markerPos / DrawWidth * Beatmap.Value.Track.Length);
|
adjustableClock.Seek(markerPos / DrawWidth * Beatmap.Value.Track.Length);
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Todo: This should be handled more gracefully
|
timeline.RelativeChildSize = new Vector2((float)Math.Max(1, Beatmap.Value.Track.Length), 1);
|
||||||
timeline.RelativeChildSize = Beatmap.Value.Track.Length == double.PositiveInfinity ? Vector2.One : new Vector2((float)Math.Max(1, Beatmap.Value.Track.Length), 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Add(Drawable visualisation) => timeline.Add(visualisation);
|
protected void Add(Drawable visualisation) => timeline.Add(visualisation);
|
||||||
|
@ -52,13 +52,11 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
|||||||
WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible ? 1 : 0, 200, Easing.OutQuint);
|
WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible ? 1 : 0, 200, Easing.OutQuint);
|
||||||
|
|
||||||
Beatmap.BindTo(beatmap);
|
Beatmap.BindTo(beatmap);
|
||||||
}
|
Beatmap.BindValueChanged(b =>
|
||||||
|
{
|
||||||
protected override void LoadComplete()
|
waveform.Waveform = b.Waveform;
|
||||||
{
|
track = b.Track;
|
||||||
base.LoadComplete();
|
}, true);
|
||||||
Beatmap.BindValueChanged(b => waveform.Waveform = b.Waveform);
|
|
||||||
waveform.Waveform = Beatmap.Value.Waveform;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -81,6 +79,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private bool trackWasPlaying;
|
private bool trackWasPlaying;
|
||||||
|
|
||||||
|
private Track track;
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
@ -118,21 +118,18 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
|||||||
|
|
||||||
private void seekTrackToCurrent()
|
private void seekTrackToCurrent()
|
||||||
{
|
{
|
||||||
var track = Beatmap.Value.Track;
|
if (!track.IsLoaded)
|
||||||
if (track is TrackVirtual || !track.IsLoaded)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(Beatmap.Value.Track is TrackVirtual))
|
adjustableClock.Seek(Current / Content.DrawWidth * track.Length);
|
||||||
adjustableClock.Seek(Current / Content.DrawWidth * Beatmap.Value.Track.Length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scrollToTrackTime()
|
private void scrollToTrackTime()
|
||||||
{
|
{
|
||||||
var track = Beatmap.Value.Track;
|
if (!track.IsLoaded)
|
||||||
if (track is TrackVirtual || !track.IsLoaded)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ScrollTo((float)(adjustableClock.CurrentTime / Beatmap.Value.Track.Length) * Content.DrawWidth, false);
|
ScrollTo((float)(adjustableClock.CurrentTime / track.Length) * Content.DrawWidth, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Beatmaps
|
namespace osu.Game.Tests.Beatmaps
|
||||||
{
|
{
|
||||||
@ -26,21 +24,6 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
private readonly IBeatmap beatmap;
|
private readonly IBeatmap beatmap;
|
||||||
protected override IBeatmap GetBeatmap() => beatmap;
|
protected override IBeatmap GetBeatmap() => beatmap;
|
||||||
protected override Texture GetBackground() => null;
|
protected override Texture GetBackground() => null;
|
||||||
|
protected override Track GetTrack() => null;
|
||||||
protected override Track GetTrack()
|
|
||||||
{
|
|
||||||
var lastObject = beatmap.HitObjects.LastOrDefault();
|
|
||||||
if (lastObject != null)
|
|
||||||
return new TestTrack(((lastObject as IHasEndTime)?.EndTime ?? lastObject.StartTime) + 1000);
|
|
||||||
return new TrackVirtual();
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TestTrack : TrackVirtual
|
|
||||||
{
|
|
||||||
public TestTrack(double length)
|
|
||||||
{
|
|
||||||
Length = length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user