mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 06:33:20 +08:00
Add hold note conversion.
This commit is contained in:
parent
fdd98e23bd
commit
17466a662c
@ -82,6 +82,10 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
protected override DrawableHitObject<ManiaHitObject, ManiaJudgement> GetVisualRepresentation(ManiaHitObject h)
|
||||
{
|
||||
var holdNote = h as HoldNote;
|
||||
if (holdNote != null)
|
||||
return new DrawableHoldNote(holdNote);
|
||||
|
||||
var note = h as Note;
|
||||
if (note != null)
|
||||
return new DrawableNote(note);
|
||||
|
@ -43,5 +43,10 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
||||
EndTime = endTime
|
||||
};
|
||||
}
|
||||
|
||||
protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Audio;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects.Legacy
|
||||
{
|
||||
@ -26,7 +27,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
var soundType = (LegacySoundType)int.Parse(split[4]);
|
||||
var bankInfo = new SampleBankInfo();
|
||||
|
||||
HitObject result;
|
||||
HitObject result = null;
|
||||
|
||||
if ((type & ConvertHitObjectType.Circle) > 0)
|
||||
{
|
||||
@ -140,17 +141,19 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
{
|
||||
// Note: Hold is generated by BMS converts
|
||||
|
||||
// Todo: Apparently end time is determined by samples??
|
||||
// Shouldn't need implementation until mania
|
||||
double endTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture);
|
||||
|
||||
result = new ConvertHold
|
||||
if (split.Length > 5 && !string.IsNullOrEmpty(split[5]))
|
||||
{
|
||||
Position = new Vector2(int.Parse(split[0]), int.Parse(split[1])),
|
||||
NewCombo = combo
|
||||
};
|
||||
endTime = Convert.ToDouble(split[0], CultureInfo.InvariantCulture);
|
||||
readCustomSampleBanks(string.Join(":", split.Skip(1)), bankInfo);
|
||||
}
|
||||
|
||||
result = CreateHold(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, endTime);
|
||||
}
|
||||
else
|
||||
throw new InvalidOperationException($@"Unknown hit object type {type}");
|
||||
|
||||
if (result == null)
|
||||
throw new InvalidOperationException($@"Unknown hit object type {type}.");
|
||||
|
||||
result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture);
|
||||
result.Samples = convertSoundType(soundType, bankInfo);
|
||||
@ -214,6 +217,14 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
/// <returns>The hit object.</returns>
|
||||
protected abstract HitObject CreateSpinner(Vector2 position, double endTime);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a legacy Hold-type hit object.
|
||||
/// </summary>
|
||||
/// <param name="position">The position of the hit object.</param>
|
||||
/// <param name="newCombo">Whether the hit object creates a new combo.</param>
|
||||
/// <param name="endTime">The hold end time.</param>
|
||||
protected abstract HitObject CreateHold(Vector2 position, bool newCombo, double endTime);
|
||||
|
||||
private SampleInfoList convertSoundType(LegacySoundType type, SampleBankInfo bankInfo)
|
||||
{
|
||||
var soundTypes = new SampleInfoList
|
||||
|
@ -1,22 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects.Legacy
|
||||
{
|
||||
/// <summary>
|
||||
/// Legacy Hold-type, used for parsing "specials" in beatmaps.
|
||||
/// </summary>
|
||||
internal sealed class ConvertHold : HitObject, IHasPosition, IHasCombo, IHasHold
|
||||
{
|
||||
public Vector2 Position { get; set; }
|
||||
|
||||
public float X => Position.X;
|
||||
|
||||
public float Y => Position.Y;
|
||||
|
||||
public bool NewCombo { get; set; }
|
||||
}
|
||||
}
|
@ -44,5 +44,14 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
||||
EndTime = endTime
|
||||
};
|
||||
}
|
||||
|
||||
protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime)
|
||||
{
|
||||
return new ConvertHold
|
||||
{
|
||||
X = position.X,
|
||||
EndTime = endTime
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
16
osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHold.cs
Normal file
16
osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHold.cs
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
||||
{
|
||||
internal sealed class ConvertHold : HitObject, IHasXPosition, IHasEndTime
|
||||
{
|
||||
public float X { get; set; }
|
||||
|
||||
public double EndTime { get; set; }
|
||||
|
||||
public double Duration => EndTime - StartTime;
|
||||
}
|
||||
}
|
@ -44,5 +44,10 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
||||
EndTime = endTime
|
||||
};
|
||||
}
|
||||
|
||||
protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,5 +41,10 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
||||
EndTime = endTime
|
||||
};
|
||||
}
|
||||
|
||||
protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,5 +8,9 @@ namespace osu.Game.Rulesets.Objects.Types
|
||||
/// </summary>
|
||||
public interface IHasHold
|
||||
{
|
||||
/// <summary>
|
||||
/// The time at which the hold ends.
|
||||
/// </summary>
|
||||
double EndTime { get; }
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +125,7 @@
|
||||
<Compile Include="Rulesets\Objects\Legacy\ConvertSlider.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Mania\ConvertHit.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Mania\ConvertHitObjectParser.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Mania\ConvertHold.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Mania\ConvertSlider.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Mania\ConvertSpinner.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Osu\ConvertHitObjectParser.cs" />
|
||||
@ -161,7 +162,6 @@
|
||||
<Compile Include="Rulesets\Objects\CircularArcApproximator.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Osu\ConvertHit.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\ConvertHitObjectParser.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\ConvertHold.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Osu\ConvertSlider.cs" />
|
||||
<Compile Include="Rulesets\Objects\Legacy\Osu\ConvertSpinner.cs" />
|
||||
<Compile Include="Rulesets\Objects\SliderCurve.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user