mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 10:42:55 +08:00
Rename timing changes, simplify + improve columns/dictionary usage.
This commit is contained in:
parent
7aee8ee547
commit
6f191193a1
@ -49,14 +49,14 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
if (gravity)
|
if (gravity)
|
||||||
{
|
{
|
||||||
return new DrawableGravityTimingChange(new TimingChange
|
return new DrawableManiaGravityTimingChange(new TimingChange
|
||||||
{
|
{
|
||||||
BeatLength = 1000,
|
BeatLength = 1000,
|
||||||
Time = time
|
Time = time
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DrawableScrollingTimingChange(new TimingChange
|
return new DrawableManiaScrollingTimingChange(new TimingChange
|
||||||
{
|
{
|
||||||
BeatLength = 1000,
|
BeatLength = 1000,
|
||||||
Time = time
|
Time = time
|
||||||
|
@ -31,20 +31,19 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
{
|
{
|
||||||
var maniaHitRenderer = (ManiaHitRenderer)hitRenderer;
|
var maniaHitRenderer = (ManiaHitRenderer)hitRenderer;
|
||||||
|
|
||||||
maniaHitRenderer.HitObjectTimingChanges = new Dictionary<int, List<DrawableTimingChange>>();
|
maniaHitRenderer.HitObjectTimingChanges = new List<DrawableTimingChange>[maniaHitRenderer.PreferredColumns];
|
||||||
maniaHitRenderer.BarlineTimingChanges = new List<DrawableTimingChange>();
|
maniaHitRenderer.BarlineTimingChanges = new List<DrawableTimingChange>();
|
||||||
|
|
||||||
|
for (int i = 0; i < maniaHitRenderer.PreferredColumns; i++)
|
||||||
|
maniaHitRenderer.HitObjectTimingChanges[i] = new List<DrawableTimingChange>();
|
||||||
|
|
||||||
foreach (HitObject obj in maniaHitRenderer.Objects)
|
foreach (HitObject obj in maniaHitRenderer.Objects)
|
||||||
{
|
{
|
||||||
var maniaObject = obj as ManiaHitObject;
|
var maniaObject = obj as ManiaHitObject;
|
||||||
if (maniaObject == null)
|
if (maniaObject == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
List<DrawableTimingChange> timingChanges;
|
maniaHitRenderer.HitObjectTimingChanges[maniaObject.Column].Add(new DrawableManiaGravityTimingChange(new TimingChange
|
||||||
if (!maniaHitRenderer.HitObjectTimingChanges.TryGetValue(maniaObject.Column, out timingChanges))
|
|
||||||
maniaHitRenderer.HitObjectTimingChanges[maniaObject.Column] = timingChanges = new List<DrawableTimingChange>();
|
|
||||||
|
|
||||||
timingChanges.Add(new DrawableGravityTimingChange(new TimingChange
|
|
||||||
{
|
{
|
||||||
Time = obj.StartTime,
|
Time = obj.StartTime,
|
||||||
BeatLength = 1000
|
BeatLength = 1000
|
||||||
@ -63,7 +62,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
|
|
||||||
for (double t = timingPoints[i].Time; Precision.DefinitelyBigger(endTime, t); t += point.BeatLength)
|
for (double t = timingPoints[i].Time; Precision.DefinitelyBigger(endTime, t); t += point.BeatLength)
|
||||||
{
|
{
|
||||||
maniaHitRenderer.BarlineTimingChanges.Add(new DrawableGravityTimingChange(new TimingChange
|
maniaHitRenderer.BarlineTimingChanges.Add(new DrawableManiaGravityTimingChange(new TimingChange
|
||||||
{
|
{
|
||||||
Time = t,
|
Time = t,
|
||||||
BeatLength = 1000
|
BeatLength = 1000
|
||||||
|
@ -5,9 +5,9 @@ using osu.Game.Rulesets.Timing;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Timing.Drawables
|
namespace osu.Game.Rulesets.Mania.Timing.Drawables
|
||||||
{
|
{
|
||||||
public class DrawableGravityTimingChange : DrawableManiaTimingChange
|
public class DrawableManiaGravityTimingChange : DrawableManiaTimingChange
|
||||||
{
|
{
|
||||||
public DrawableGravityTimingChange(TimingChange timingChange)
|
public DrawableManiaGravityTimingChange(TimingChange timingChange)
|
||||||
: base(timingChange)
|
: base(timingChange)
|
||||||
{
|
{
|
||||||
}
|
}
|
@ -5,9 +5,12 @@ using osu.Game.Rulesets.Timing;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Timing.Drawables
|
namespace osu.Game.Rulesets.Mania.Timing.Drawables
|
||||||
{
|
{
|
||||||
public class DrawableScrollingTimingChange : DrawableManiaTimingChange
|
/// <summary>
|
||||||
|
/// A basic timing change which scrolls along with a timing change.
|
||||||
|
/// </summary>
|
||||||
|
public class DrawableManiaScrollingTimingChange : DrawableManiaTimingChange
|
||||||
{
|
{
|
||||||
public DrawableScrollingTimingChange(TimingChange timingChange)
|
public DrawableManiaScrollingTimingChange(TimingChange timingChange)
|
||||||
: base(timingChange)
|
: base(timingChange)
|
||||||
{
|
{
|
||||||
}
|
}
|
@ -7,7 +7,7 @@ using osu.Game.Rulesets.Timing.Drawables;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Timing.Drawables
|
namespace osu.Game.Rulesets.Mania.Timing.Drawables
|
||||||
{
|
{
|
||||||
public class DrawableManiaTimingChange : DrawableTimingChange
|
public abstract class DrawableManiaTimingChange : DrawableTimingChange
|
||||||
{
|
{
|
||||||
public DrawableManiaTimingChange(TimingChange timingChange)
|
public DrawableManiaTimingChange(TimingChange timingChange)
|
||||||
: base(timingChange, Axes.Y)
|
: base(timingChange, Axes.Y)
|
||||||
|
@ -32,19 +32,31 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
{
|
{
|
||||||
public class ManiaHitRenderer : HitRenderer<ManiaHitObject, ManiaJudgement>
|
public class ManiaHitRenderer : HitRenderer<ManiaHitObject, ManiaJudgement>
|
||||||
{
|
{
|
||||||
private int? columns;
|
/// <summary>
|
||||||
public int Columns
|
/// Preferred column count. This will only have an effect during the initialization of the play field.
|
||||||
{
|
/// </summary>
|
||||||
get { return columns ?? (int)Math.Round(Beatmap.BeatmapInfo.Difficulty.CircleSize); }
|
public int PreferredColumns;
|
||||||
set { columns = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dictionary<int, List<DrawableTimingChange>> HitObjectTimingChanges;
|
/// <summary>
|
||||||
|
/// Per-column timing changes.
|
||||||
|
/// </summary>
|
||||||
|
public List<DrawableTimingChange>[] HitObjectTimingChanges;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Bar line timing changes.
|
||||||
|
/// </summary>
|
||||||
public List<DrawableTimingChange> BarlineTimingChanges;
|
public List<DrawableTimingChange> BarlineTimingChanges;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of columns in the playfield of this hit renderer. Null if the play field hasn't been generated yet.
|
||||||
|
/// </summary>
|
||||||
|
public int? Columns { get; private set; }
|
||||||
|
|
||||||
public ManiaHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
public ManiaHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||||
: base(beatmap, isForCurrentRuleset)
|
: base(beatmap, isForCurrentRuleset)
|
||||||
{
|
{
|
||||||
|
Columns = PreferredColumns;
|
||||||
|
|
||||||
generateDefaultTimingChanges();
|
generateDefaultTimingChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,9 +65,12 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
if (HitObjectTimingChanges != null || BarlineTimingChanges != null)
|
if (HitObjectTimingChanges != null || BarlineTimingChanges != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
HitObjectTimingChanges = new Dictionary<int, List<DrawableTimingChange>>();
|
HitObjectTimingChanges = new List<DrawableTimingChange>[Columns.Value];
|
||||||
BarlineTimingChanges = new List<DrawableTimingChange>();
|
BarlineTimingChanges = new List<DrawableTimingChange>();
|
||||||
|
|
||||||
|
for (int i = 0; i < Columns.Value; i++)
|
||||||
|
HitObjectTimingChanges[i] = new List<DrawableTimingChange>();
|
||||||
|
|
||||||
double lastSpeedMultiplier = 1;
|
double lastSpeedMultiplier = 1;
|
||||||
double lastBeatLength = 500;
|
double lastBeatLength = 500;
|
||||||
|
|
||||||
@ -98,22 +113,22 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
timingChanges.ForEach(t =>
|
timingChanges.ForEach(t =>
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Columns; i++)
|
for (int i = 0; i < Columns.Value; i++)
|
||||||
{
|
HitObjectTimingChanges[i].Add(new DrawableManiaScrollingTimingChange(t));
|
||||||
List<DrawableTimingChange> columnTimingChanges;
|
|
||||||
if (!HitObjectTimingChanges.TryGetValue(i, out columnTimingChanges))
|
|
||||||
HitObjectTimingChanges[i] = columnTimingChanges = new List<DrawableTimingChange>();
|
|
||||||
|
|
||||||
columnTimingChanges.Add(new DrawableScrollingTimingChange(t));
|
BarlineTimingChanges.Add(new DrawableManiaScrollingTimingChange(t));
|
||||||
}
|
|
||||||
|
|
||||||
BarlineTimingChanges.Add(new DrawableScrollingTimingChange(t));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void ApplyBeatmap()
|
||||||
|
{
|
||||||
|
base.ApplyBeatmap();
|
||||||
|
PreferredColumns = (int)Math.Round(Beatmap.BeatmapInfo.Difficulty.CircleSize);
|
||||||
|
}
|
||||||
|
|
||||||
protected override Playfield<ManiaHitObject, ManiaJudgement> CreatePlayfield()
|
protected override Playfield<ManiaHitObject, ManiaJudgement> CreatePlayfield()
|
||||||
{
|
{
|
||||||
var playfield = new ManiaPlayfield(Columns)
|
var playfield = new ManiaPlayfield(Columns.Value)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -121,13 +136,10 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
Scale = new Vector2(1, -1)
|
Scale = new Vector2(1, -1)
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var kvp in HitObjectTimingChanges)
|
for (int i = 0; i < Columns; i++)
|
||||||
{
|
{
|
||||||
int column = kvp.Key;
|
foreach (var change in HitObjectTimingChanges[i])
|
||||||
List<DrawableTimingChange> timingChanges = kvp.Value;
|
playfield.Columns.ElementAt(i).Add(change);
|
||||||
|
|
||||||
foreach (var change in timingChanges)
|
|
||||||
playfield.Columns.ElementAt(column).Add(change);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var change in BarlineTimingChanges)
|
foreach (var change in BarlineTimingChanges)
|
||||||
|
@ -84,9 +84,9 @@
|
|||||||
<Compile Include="Mods\ManiaMod.cs" />
|
<Compile Include="Mods\ManiaMod.cs" />
|
||||||
<Compile Include="Mods\ManiaModGravity.cs" />
|
<Compile Include="Mods\ManiaModGravity.cs" />
|
||||||
<Compile Include="UI\SpecialColumnPosition.cs" />
|
<Compile Include="UI\SpecialColumnPosition.cs" />
|
||||||
<Compile Include="Timing\Drawables\DrawableGravityTimingChange.cs" />
|
<Compile Include="Timing\Drawables\DrawableManiaGravityTimingChange.cs" />
|
||||||
<Compile Include="Timing\Drawables\DrawableManiaTimingChange.cs" />
|
<Compile Include="Timing\Drawables\DrawableManiaTimingChange.cs" />
|
||||||
<Compile Include="Timing\Drawables\DrawableScrollingTimingChange.cs" />
|
<Compile Include="Timing\Drawables\DrawableManiaScrollingTimingChange.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\osu-framework\osu.Framework\osu.Framework.csproj">
|
<ProjectReference Include="..\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||||
|
@ -148,6 +148,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
// Post-process the beatmap
|
// Post-process the beatmap
|
||||||
processor.PostProcess(Beatmap);
|
processor.PostProcess(Beatmap);
|
||||||
|
|
||||||
|
ApplyBeatmap();
|
||||||
|
|
||||||
// Add mods, should always be the last thing applied to give full control to mods
|
// Add mods, should always be the last thing applied to give full control to mods
|
||||||
applyMods(beatmap.Mods.Value);
|
applyMods(beatmap.Mods.Value);
|
||||||
}
|
}
|
||||||
@ -165,6 +167,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
mod.ApplyToHitRenderer(this);
|
mod.ApplyToHitRenderer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when the beatmap of this hit renderer has been set. Used to apply any default values from the beatmap.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void ApplyBeatmap() { }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a processor to perform post-processing operations
|
/// Creates a processor to perform post-processing operations
|
||||||
/// on HitObjects in converted Beatmaps.
|
/// on HitObjects in converted Beatmaps.
|
||||||
|
Loading…
Reference in New Issue
Block a user