mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Merge branch 'master' into fix-dodgy-test
This commit is contained in:
commit
10c78459ab
@ -27,17 +27,23 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public override void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public override void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
||||||
{
|
{
|
||||||
foreach (var d in drawables)
|
foreach (var d in drawables)
|
||||||
d.ApplyCustomUpdateState += applyFadeInAdjustment;
|
{
|
||||||
|
d.HitObjectApplied += applyFadeInAdjustment;
|
||||||
|
applyFadeInAdjustment(d);
|
||||||
|
}
|
||||||
|
|
||||||
base.ApplyToDrawableHitObjects(drawables);
|
base.ApplyToDrawableHitObjects(drawables);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyFadeInAdjustment(DrawableHitObject hitObject, ArmedState state)
|
private void applyFadeInAdjustment(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
if (!(hitObject is DrawableOsuHitObject d))
|
if (!(hitObject is DrawableOsuHitObject d))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
d.HitObject.TimeFadeIn = d.HitObject.TimePreempt * fade_in_duration_multiplier;
|
d.HitObject.TimeFadeIn = d.HitObject.TimePreempt * fade_in_duration_multiplier;
|
||||||
|
|
||||||
|
foreach (var nested in d.NestedHitObjects)
|
||||||
|
applyFadeInAdjustment(nested);
|
||||||
}
|
}
|
||||||
|
|
||||||
private double lastSliderHeadFadeOutStartTime;
|
private double lastSliderHeadFadeOutStartTime;
|
||||||
|
@ -16,8 +16,6 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
public class LegacyBeatmapDecoder : LegacyDecoder<Beatmap>
|
public class LegacyBeatmapDecoder : LegacyDecoder<Beatmap>
|
||||||
{
|
{
|
||||||
public const int LATEST_VERSION = 14;
|
|
||||||
|
|
||||||
private Beatmap beatmap;
|
private Beatmap beatmap;
|
||||||
|
|
||||||
private ConvertHitObjectParser parser;
|
private ConvertHitObjectParser parser;
|
||||||
|
@ -16,6 +16,8 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
public abstract class LegacyDecoder<T> : Decoder<T>
|
public abstract class LegacyDecoder<T> : Decoder<T>
|
||||||
where T : new()
|
where T : new()
|
||||||
{
|
{
|
||||||
|
public const int LATEST_VERSION = 14;
|
||||||
|
|
||||||
protected readonly int FormatVersion;
|
protected readonly int FormatVersion;
|
||||||
|
|
||||||
protected LegacyDecoder(int version)
|
protected LegacyDecoder(int version)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps.Legacy;
|
using osu.Game.Beatmaps.Legacy;
|
||||||
@ -23,15 +24,15 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
private readonly Dictionary<string, string> variables = new Dictionary<string, string>();
|
private readonly Dictionary<string, string> variables = new Dictionary<string, string>();
|
||||||
|
|
||||||
public LegacyStoryboardDecoder()
|
public LegacyStoryboardDecoder(int version = LATEST_VERSION)
|
||||||
: base(0)
|
: base(version)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Register()
|
public static void Register()
|
||||||
{
|
{
|
||||||
// note that this isn't completely correct
|
// note that this isn't completely correct
|
||||||
AddDecoder<Storyboard>(@"osu file format v", m => new LegacyStoryboardDecoder());
|
AddDecoder<Storyboard>(@"osu file format v", m => new LegacyStoryboardDecoder(Parsing.ParseInt(m.Split('v').Last())));
|
||||||
AddDecoder<Storyboard>(@"[Events]", m => new LegacyStoryboardDecoder());
|
AddDecoder<Storyboard>(@"[Events]", m => new LegacyStoryboardDecoder());
|
||||||
SetFallbackDecoder<Storyboard>(() => new LegacyStoryboardDecoder());
|
SetFallbackDecoder<Storyboard>(() => new LegacyStoryboardDecoder());
|
||||||
}
|
}
|
||||||
@ -133,6 +134,11 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
var y = Parsing.ParseFloat(split[5], Parsing.MAX_COORDINATE_VALUE);
|
var y = Parsing.ParseFloat(split[5], Parsing.MAX_COORDINATE_VALUE);
|
||||||
var frameCount = Parsing.ParseInt(split[6]);
|
var frameCount = Parsing.ParseInt(split[6]);
|
||||||
var frameDelay = Parsing.ParseDouble(split[7]);
|
var frameDelay = Parsing.ParseDouble(split[7]);
|
||||||
|
|
||||||
|
if (FormatVersion < 6)
|
||||||
|
// this is random as hell but taken straight from osu-stable.
|
||||||
|
frameDelay = Math.Round(0.015 * frameDelay) * 1.186 * (1000 / 60f);
|
||||||
|
|
||||||
var loopType = split.Length > 8 ? (AnimationLoopType)Enum.Parse(typeof(AnimationLoopType), split[8]) : AnimationLoopType.LoopForever;
|
var loopType = split.Length > 8 ? (AnimationLoopType)Enum.Parse(typeof(AnimationLoopType), split[8]) : AnimationLoopType.LoopForever;
|
||||||
storyboardSprite = new StoryboardAnimation(path, origin, new Vector2(x, y), frameCount, frameDelay, loopType);
|
storyboardSprite = new StoryboardAnimation(path, origin, new Vector2(x, y), frameCount, frameDelay, loopType);
|
||||||
storyboard.GetLayer(layer).Add(storyboardSprite);
|
storyboard.GetLayer(layer).Add(storyboardSprite);
|
||||||
|
@ -26,8 +26,16 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
[Cached(typeof(DrawableHitObject))]
|
[Cached(typeof(DrawableHitObject))]
|
||||||
public abstract class DrawableHitObject : SkinReloadableDrawable
|
public abstract class DrawableHitObject : SkinReloadableDrawable
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked after this <see cref="DrawableHitObject"/>'s applied <see cref="HitObject"/> has had its defaults applied.
|
||||||
|
/// </summary>
|
||||||
public event Action<DrawableHitObject> DefaultsApplied;
|
public event Action<DrawableHitObject> DefaultsApplied;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked after a <see cref="HitObject"/> has been applied to this <see cref="DrawableHitObject"/>.
|
||||||
|
/// </summary>
|
||||||
|
public event Action<DrawableHitObject> HitObjectApplied;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="HitObject"/> currently represented by this <see cref="DrawableHitObject"/>.
|
/// The <see cref="HitObject"/> currently represented by this <see cref="DrawableHitObject"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -192,6 +200,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
HitObject.DefaultsApplied += onDefaultsApplied;
|
HitObject.DefaultsApplied += onDefaultsApplied;
|
||||||
|
|
||||||
OnApply(hitObject);
|
OnApply(hitObject);
|
||||||
|
HitObjectApplied?.Invoke(this);
|
||||||
|
|
||||||
// If not loaded, the state update happens in LoadComplete(). Otherwise, the update is scheduled to allow for lifetime updates.
|
// If not loaded, the state update happens in LoadComplete(). Otherwise, the update is scheduled to allow for lifetime updates.
|
||||||
if (IsLoaded)
|
if (IsLoaded)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user