mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Pass through method instead of instantiating object.
This commit is contained in:
@ -6,6 +6,8 @@ using OpenTK;
|
|||||||
using osu.Game.Modes.Osu.Objects.Drawables;
|
using osu.Game.Modes.Osu.Objects.Drawables;
|
||||||
using osu.Game.Modes.Objects.Types;
|
using osu.Game.Modes.Objects.Types;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Game.Beatmaps.Timing;
|
||||||
|
using osu.Game.Database;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu.Objects
|
namespace osu.Game.Modes.Osu.Objects
|
||||||
{
|
{
|
||||||
@ -66,11 +68,11 @@ namespace osu.Game.Modes.Osu.Objects
|
|||||||
return OsuScoreResult.Miss;
|
return OsuScoreResult.Miss;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ApplyDefaults(HitObjectDefaults defaults)
|
public override void ApplyDefaults(TimingInfo timing, BaseDifficulty difficulty)
|
||||||
{
|
{
|
||||||
base.ApplyDefaults(defaults);
|
base.ApplyDefaults(timing, difficulty);
|
||||||
|
|
||||||
Scale = (1.0f - 0.7f * (defaults.Difficulty.CircleSize - 5) / 5) / 2;
|
Scale = (1.0f - 0.7f * (difficulty.CircleSize - 5) / 5) / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using osu.Game.Modes.Objects.Types;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
|
using osu.Game.Database;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu.Objects
|
namespace osu.Game.Modes.Osu.Objects
|
||||||
{
|
{
|
||||||
@ -46,17 +47,17 @@ namespace osu.Game.Modes.Osu.Objects
|
|||||||
public double Velocity;
|
public double Velocity;
|
||||||
public double TickDistance;
|
public double TickDistance;
|
||||||
|
|
||||||
public override void ApplyDefaults(HitObjectDefaults defaults)
|
public override void ApplyDefaults(TimingInfo timing, BaseDifficulty difficulty)
|
||||||
{
|
{
|
||||||
base.ApplyDefaults(defaults);
|
base.ApplyDefaults(timing, difficulty);
|
||||||
|
|
||||||
ControlPoint overridePoint;
|
ControlPoint overridePoint;
|
||||||
ControlPoint timingPoint = defaults.Timing.TimingPointAt(StartTime, out overridePoint);
|
ControlPoint timingPoint = timing.TimingPointAt(StartTime, out overridePoint);
|
||||||
var velocityAdjustment = overridePoint?.VelocityAdjustment ?? 1;
|
var velocityAdjustment = overridePoint?.VelocityAdjustment ?? 1;
|
||||||
var baseVelocity = 100 * defaults.Difficulty.SliderMultiplier / velocityAdjustment;
|
var baseVelocity = 100 * difficulty.SliderMultiplier / velocityAdjustment;
|
||||||
|
|
||||||
Velocity = baseVelocity / timingPoint.BeatLength;
|
Velocity = baseVelocity / timingPoint.BeatLength;
|
||||||
TickDistance = baseVelocity / defaults.Difficulty.SliderTickRate;
|
TickDistance = baseVelocity / difficulty.SliderTickRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<SliderTick> Ticks
|
public IEnumerable<SliderTick> Ticks
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// 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 osu.Game.Beatmaps.Samples;
|
using osu.Game.Beatmaps.Samples;
|
||||||
|
using osu.Game.Beatmaps.Timing;
|
||||||
|
using osu.Game.Database;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Objects
|
namespace osu.Game.Modes.Objects
|
||||||
{
|
{
|
||||||
@ -26,7 +28,8 @@ namespace osu.Game.Modes.Objects
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Applies default values to this HitObject.
|
/// Applies default values to this HitObject.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="defaults">The default values to apply.</param>
|
/// <param name="difficulty">The difficulty settings to use.</param>
|
||||||
public virtual void ApplyDefaults(HitObjectDefaults defaults) { }
|
/// <param name="timing">The timing settings to use.</param>
|
||||||
|
public virtual void ApplyDefaults(TimingInfo timing, BaseDifficulty difficulty) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +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 osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Beatmaps.Timing;
|
|
||||||
using osu.Game.Database;
|
|
||||||
|
|
||||||
namespace osu.Game.Modes.Objects
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A set of default Beatmap values for HitObjects to consume.
|
|
||||||
/// </summary>
|
|
||||||
public class HitObjectDefaults
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The Beatmap timing.
|
|
||||||
/// </summary>
|
|
||||||
public TimingInfo Timing;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The Beatmap difficulty.
|
|
||||||
/// </summary>
|
|
||||||
public BaseDifficulty Difficulty;
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,7 +9,6 @@ using osu.Game.Modes.Judgements;
|
|||||||
using osu.Game.Modes.Mods;
|
using osu.Game.Modes.Mods;
|
||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Modes.Objects.Types;
|
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -96,14 +95,8 @@ namespace osu.Game.Modes.UI
|
|||||||
Beatmap = converter.Convert(beatmap.Beatmap);
|
Beatmap = converter.Convert(beatmap.Beatmap);
|
||||||
|
|
||||||
// Apply defaults
|
// Apply defaults
|
||||||
HitObjectDefaults defaults = new HitObjectDefaults
|
|
||||||
{
|
|
||||||
Timing = Beatmap.TimingInfo,
|
|
||||||
Difficulty = Beatmap.BeatmapInfo.BaseDifficulty
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var h in Beatmap.HitObjects)
|
foreach (var h in Beatmap.HitObjects)
|
||||||
h.ApplyDefaults(defaults);
|
h.ApplyDefaults(Beatmap.TimingInfo, Beatmap.BeatmapInfo.BaseDifficulty);
|
||||||
|
|
||||||
// Post-process the beatmap
|
// Post-process the beatmap
|
||||||
processor.PostProcess(Beatmap);
|
processor.PostProcess(Beatmap);
|
||||||
|
@ -100,7 +100,6 @@
|
|||||||
<Compile Include="Modes\Objects\BezierApproximator.cs" />
|
<Compile Include="Modes\Objects\BezierApproximator.cs" />
|
||||||
<Compile Include="Modes\Objects\CircularArcApproximator.cs" />
|
<Compile Include="Modes\Objects\CircularArcApproximator.cs" />
|
||||||
<Compile Include="Modes\Objects\CurvedHitObject.cs" />
|
<Compile Include="Modes\Objects\CurvedHitObject.cs" />
|
||||||
<Compile Include="Modes\Objects\HitObjectDefaults.cs" />
|
|
||||||
<Compile Include="Modes\Objects\Legacy\LegacyHit.cs" />
|
<Compile Include="Modes\Objects\Legacy\LegacyHit.cs" />
|
||||||
<Compile Include="Modes\Objects\LegacyHitObjectParser.cs" />
|
<Compile Include="Modes\Objects\LegacyHitObjectParser.cs" />
|
||||||
<Compile Include="Modes\Objects\Legacy\LegacyHold.cs" />
|
<Compile Include="Modes\Objects\Legacy\LegacyHold.cs" />
|
||||||
|
Reference in New Issue
Block a user