mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Rewrote traceable mod to inherit from hidden
This commit is contained in:
parent
845bf21f7f
commit
5496b8bc58
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -28,6 +29,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
public override double ScoreMultiplier => 1;
|
public override double ScoreMultiplier => 1;
|
||||||
|
|
||||||
|
public override Type[] IncompatibleMods => new[] { typeof(OsuModTraceable) };
|
||||||
|
|
||||||
private Bindable<bool> increaseFirstObjectVisibility = new Bindable<bool>();
|
private Bindable<bool> increaseFirstObjectVisibility = new Bindable<bool>();
|
||||||
|
|
||||||
public void ReadFromConfig(OsuConfigManager config)
|
public void ReadFromConfig(OsuConfigManager config)
|
||||||
|
@ -17,6 +17,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
{
|
{
|
||||||
public override string Description => @"Play with no approach circles and fading circles/sliders.";
|
public override string Description => @"Play with no approach circles and fading circles/sliders.";
|
||||||
public override double ScoreMultiplier => 1.06;
|
public override double ScoreMultiplier => 1.06;
|
||||||
|
public override Type[] IncompatibleMods => new[] { typeof(OsuModTraceable) };
|
||||||
|
|
||||||
private const double fade_in_duration_multiplier = 0.4;
|
private const double fade_in_duration_multiplier = 0.4;
|
||||||
private const double fade_out_duration_multiplier = 0.3;
|
private const double fade_out_duration_multiplier = 0.3;
|
||||||
|
|
||||||
|
@ -2,83 +2,63 @@
|
|||||||
// 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;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Graphics;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
internal class OsuModTraceable : Mod, IApplicableToDrawableHitObjects
|
internal class OsuModTraceable : OsuModHidden, IReadFromConfig, IApplicableToDrawableHitObjects
|
||||||
{
|
{
|
||||||
public override string Name => "Traceable";
|
public override string Name => "Traceable";
|
||||||
public override string ShortenedName => "TC";
|
public override string Acronym => "TC";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_snapchat_ghost;
|
public override IconUsage Icon => FontAwesome.Brands.SnapchatGhost;
|
||||||
public override ModType Type => ModType.Fun;
|
public override ModType Type => ModType.Fun;
|
||||||
public override string Description => "Put your faith in the approach circles...";
|
public override string Description => "Put your faith in the approach circles...";
|
||||||
public override double ScoreMultiplier => 1;
|
public override double ScoreMultiplier => 1;
|
||||||
|
public override Type[] IncompatibleMods => new[] { typeof(OsuModHidden), typeof(OsuModGrow) };
|
||||||
|
|
||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public override void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
||||||
{
|
{
|
||||||
foreach (var drawable in drawables)
|
foreach (var drawable in drawables.Skip(IncreaseFirstObjectVisibility.Value ? 1 : 0))
|
||||||
drawable.ApplyCustomUpdateState += ApplyTraceableState;
|
{
|
||||||
|
switch (drawable)
|
||||||
|
{
|
||||||
|
case DrawableHitCircle _:
|
||||||
|
drawable.ApplyCustomUpdateState += ApplyTraceableState;
|
||||||
|
break;
|
||||||
|
case DrawableSlider slider:
|
||||||
|
slider.ApplyCustomUpdateState += ApplyHiddenState;
|
||||||
|
slider.HeadCircle.ApplyCustomUpdateState += ApplyTraceableState;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
drawable.ApplyCustomUpdateState += ApplyHiddenState;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Similar to ApplyHiddenState, only different if drawable is DrawableHitCircle.
|
|
||||||
* If we'd use ApplyHiddenState instead but only on non-DrawableHitCircle's, then
|
|
||||||
* the nested object HeadCircle of DrawableSlider would still use ApplyHiddenState,
|
|
||||||
* thus treating the DrawableHitCircle with the hidden mod instead of the traceable mod.
|
|
||||||
*/
|
|
||||||
protected void ApplyTraceableState(DrawableHitObject drawable, ArmedState state)
|
protected void ApplyTraceableState(DrawableHitObject drawable, ArmedState state)
|
||||||
{
|
{
|
||||||
if (!(drawable is DrawableOsuHitObject d))
|
if (!(drawable is DrawableHitCircle circle))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var h = d.HitObject;
|
var h = circle.HitObject;
|
||||||
|
|
||||||
var fadeOutStartTime = h.StartTime - h.TimePreempt + h.TimeFadeIn;
|
// we only want to see the approach circle
|
||||||
|
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
|
||||||
// new duration from completed fade in to end (before fading out)
|
|
||||||
var longFadeDuration = ((h as IHasEndTime)?.EndTime ?? h.StartTime) - fadeOutStartTime;
|
|
||||||
|
|
||||||
switch (drawable)
|
|
||||||
{
|
{
|
||||||
case DrawableHitCircle circle:
|
circle.circle.Hide(); // CirclePiece
|
||||||
// we only want to see the approach circle
|
circle.circle.AlwaysPresent = true;
|
||||||
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
|
circle.ring.Hide();
|
||||||
circle.HideButApproachCircle();
|
circle.flash.Hide();
|
||||||
|
circle.explode.Hide();
|
||||||
// approach circle fades out quickly at StartTime
|
circle.number.Hide();
|
||||||
using (drawable.BeginAbsoluteSequence(h.StartTime, true))
|
circle.glow.Hide();
|
||||||
circle.ApproachCircle.FadeOut(50);
|
circle.ApproachCircle.Show();
|
||||||
|
|
||||||
break;
|
|
||||||
case DrawableSlider slider:
|
|
||||||
using (slider.BeginAbsoluteSequence(fadeOutStartTime, true))
|
|
||||||
slider.Body.FadeOut(longFadeDuration, Easing.Out);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case DrawableSliderTick sliderTick:
|
|
||||||
// slider ticks fade out over up to one second
|
|
||||||
var tickFadeOutDuration = Math.Min(sliderTick.HitObject.TimePreempt - DrawableSliderTick.ANIM_DURATION, 1000);
|
|
||||||
|
|
||||||
using (sliderTick.BeginAbsoluteSequence(sliderTick.HitObject.StartTime - tickFadeOutDuration, true))
|
|
||||||
sliderTick.FadeOut(tickFadeOutDuration);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case DrawableSpinner spinner:
|
|
||||||
// hide elements we don't care about.
|
|
||||||
spinner.Disc.Hide();
|
|
||||||
spinner.Ticks.Hide();
|
|
||||||
spinner.Background.Hide();
|
|
||||||
|
|
||||||
using (spinner.BeginAbsoluteSequence(fadeOutStartTime + longFadeDuration, true))
|
|
||||||
spinner.FadeOut(h.TimePreempt);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach
|
public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach
|
||||||
{
|
{
|
||||||
public ApproachCircle ApproachCircle;
|
public ApproachCircle ApproachCircle;
|
||||||
private readonly CirclePiece circle;
|
public readonly CirclePiece circle;
|
||||||
private readonly RingPiece ring;
|
public readonly RingPiece ring;
|
||||||
private readonly FlashPiece flash;
|
public readonly FlashPiece flash;
|
||||||
private readonly ExplodePiece explode;
|
public readonly ExplodePiece explode;
|
||||||
private readonly NumberPiece number;
|
public readonly NumberPiece number;
|
||||||
private readonly GlowPiece glow;
|
public readonly GlowPiece glow;
|
||||||
|
|
||||||
private readonly IBindable<Vector2> positionBindable = new Bindable<Vector2>();
|
private readonly IBindable<Vector2> positionBindable = new Bindable<Vector2>();
|
||||||
private readonly IBindable<int> stackHeightBindable = new Bindable<int>();
|
private readonly IBindable<int> stackHeightBindable = new Bindable<int>();
|
||||||
@ -113,17 +113,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HideButApproachCircle()
|
|
||||||
{
|
|
||||||
circle.Hide();
|
|
||||||
circle.AlwaysPresent = true;
|
|
||||||
ring.Hide();
|
|
||||||
flash.Hide();
|
|
||||||
explode.Hide();
|
|
||||||
number.Hide();
|
|
||||||
glow.Hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
{
|
{
|
||||||
if (!userTriggered)
|
if (!userTriggered)
|
||||||
|
@ -112,7 +112,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
if (selected == null) continue;
|
if (selected == null) continue;
|
||||||
|
|
||||||
foreach (var type in modTypes)
|
foreach (var type in modTypes)
|
||||||
if (type.IsInstanceOfType(selected))
|
if (type.IsInstanceOfType(selected) && !selected.GetType().IsSubclassOf(type))
|
||||||
{
|
{
|
||||||
if (immediate)
|
if (immediate)
|
||||||
button.Deselect();
|
button.Deselect();
|
||||||
@ -130,7 +130,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
foreach (var button in buttons)
|
foreach (var button in buttons)
|
||||||
{
|
{
|
||||||
int i = Array.FindIndex(button.Mods, m => modTypes.Any(t => t.IsInstanceOfType(m)));
|
int i = Array.FindIndex(button.Mods, m => modTypes.Any(t => t.IsInstanceOfType(m) && !m.GetType().IsSubclassOf(t)));
|
||||||
|
|
||||||
if (i >= 0)
|
if (i >= 0)
|
||||||
button.SelectAt(i);
|
button.SelectAt(i);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user