Combined hidden with traceable as multi mod

This commit is contained in:
MaxOhn
2019-07-02 04:04:07 +02:00
parent d753f446e4
commit 4145173ac9
6 changed files with 44 additions and 42 deletions

View File

@ -17,7 +17,6 @@ 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;

View File

@ -11,15 +11,15 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
namespace osu.Game.Rulesets.Osu.Mods namespace osu.Game.Rulesets.Osu.Mods
{ {
internal class OsuModTraceable : OsuModHidden, IReadFromConfig, IApplicableToDrawableHitObjects internal class OsuModTraceable : OsuModHidden
{ {
public override string Name => "Traceable"; public override string Name => "Traceable";
public override string Acronym => "TC"; public override string Acronym => "TC";
public override IconUsage Icon => FontAwesome.Brands.SnapchatGhost; public override IconUsage Icon => FontAwesome.Brands.SnapchatGhost;
public override ModType Type => ModType.Fun; public override ModType Type => ModType.DifficultyIncrease;
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 override Type[] IncompatibleMods => new[] { typeof(OsuModGrow) };
public override void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables) public override void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
{ {
@ -30,10 +30,12 @@ namespace osu.Game.Rulesets.Osu.Mods
case DrawableHitCircle _: case DrawableHitCircle _:
drawable.ApplyCustomUpdateState += ApplyTraceableState; drawable.ApplyCustomUpdateState += ApplyTraceableState;
break; break;
case DrawableSlider slider: case DrawableSlider slider:
slider.ApplyCustomUpdateState += ApplyHiddenState; slider.ApplyCustomUpdateState += ApplyHiddenState;
slider.HeadCircle.ApplyCustomUpdateState += ApplyTraceableState; slider.HeadCircle.ApplyCustomUpdateState += ApplyTraceableState;
break; break;
default: default:
drawable.ApplyCustomUpdateState += ApplyHiddenState; drawable.ApplyCustomUpdateState += ApplyHiddenState;
break; break;
@ -51,13 +53,13 @@ namespace osu.Game.Rulesets.Osu.Mods
// we only want to see the approach circle // we only want to see the approach circle
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true)) using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
{ {
circle.circle.Hide(); // CirclePiece circle.Circle.Hide(); // CirclePiece
circle.circle.AlwaysPresent = true; circle.Circle.AlwaysPresent = true;
circle.ring.Hide(); circle.Ring.Hide();
circle.flash.Hide(); circle.Flash.Hide();
circle.explode.Hide(); circle.Explode.Hide();
circle.number.Hide(); circle.Number.Hide();
circle.glow.Hide(); circle.Glow.Hide();
circle.ApproachCircle.Show(); circle.ApproachCircle.Show();
} }
} }

View File

@ -17,18 +17,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach
{ {
public ApproachCircle ApproachCircle; public ApproachCircle ApproachCircle;
public readonly CirclePiece circle; public readonly CirclePiece Circle;
public readonly RingPiece ring; public readonly RingPiece Ring;
public readonly FlashPiece flash; public readonly FlashPiece Flash;
public readonly ExplodePiece explode; public readonly ExplodePiece Explode;
public readonly NumberPiece number; public readonly NumberPiece Number;
public 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>();
private readonly IBindable<float> scaleBindable = new Bindable<float>(); private readonly IBindable<float> scaleBindable = new Bindable<float>();
public OsuAction? HitAction => circle.HitAction; public OsuAction? HitAction => Circle.HitAction;
private readonly Container explodeContainer; private readonly Container explodeContainer;
@ -55,8 +55,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Children = new Drawable[] Children = new Drawable[]
{ {
glow = new GlowPiece(), Glow = new GlowPiece(),
circle = new CirclePiece Circle = new CirclePiece
{ {
Hit = () => Hit = () =>
{ {
@ -67,13 +67,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
return true; return true;
}, },
}, },
number = new NumberPiece Number = new NumberPiece
{ {
Text = (HitObject.IndexInCurrentCombo + 1).ToString(), Text = (HitObject.IndexInCurrentCombo + 1).ToString(),
}, },
ring = new RingPiece(), Ring = new RingPiece(),
flash = new FlashPiece(), Flash = new FlashPiece(),
explode = new ExplodePiece(), Explode = new ExplodePiece(),
ApproachCircle = new ApproachCircle ApproachCircle = new ApproachCircle
{ {
Alpha = 0, Alpha = 0,
@ -85,7 +85,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}; };
//may not be so correct //may not be so correct
Size = circle.DrawSize; Size = Circle.DrawSize;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -106,9 +106,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
set set
{ {
base.AccentColour = value; base.AccentColour = value;
explode.Colour = AccentColour; Explode.Colour = AccentColour;
glow.Colour = AccentColour; Glow.Colour = AccentColour;
circle.Colour = AccentColour; Circle.Colour = AccentColour;
ApproachCircle.Colour = AccentColour; ApproachCircle.Colour = AccentColour;
} }
} }
@ -145,7 +145,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected override void UpdateCurrentState(ArmedState state) protected override void UpdateCurrentState(ArmedState state)
{ {
glow.FadeOut(400); Glow.FadeOut(400);
switch (state) switch (state)
{ {
@ -154,7 +154,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Expire(true); Expire(true);
circle.HitAction = null; Circle.HitAction = null;
// override lifetime end as FadeIn may have been changed externally, causing out expiration to be too early. // override lifetime end as FadeIn may have been changed externally, causing out expiration to be too early.
LifetimeEnd = HitObject.StartTime + HitObject.HitWindows.HalfWindowFor(HitResult.Miss); LifetimeEnd = HitObject.StartTime + HitObject.HitWindows.HalfWindowFor(HitResult.Miss);
@ -170,18 +170,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
ApproachCircle.FadeOut(50); ApproachCircle.FadeOut(50);
const double flash_in = 40; const double flash_in = 40;
flash.FadeTo(0.8f, flash_in) Flash.FadeTo(0.8f, flash_in)
.Then() .Then()
.FadeOut(100); .FadeOut(100);
explode.FadeIn(flash_in); Explode.FadeIn(flash_in);
using (BeginDelayedSequence(flash_in, true)) using (BeginDelayedSequence(flash_in, true))
{ {
//after the flash, we can hide some elements that were behind it //after the flash, we can hide some elements that were behind it
ring.FadeOut(); Ring.FadeOut();
circle.FadeOut(); Circle.FadeOut();
number.FadeOut(); Number.FadeOut();
this.FadeOut(800); this.FadeOut(800);
explodeContainer.ScaleTo(1.5f, 400, Easing.OutQuad); explodeContainer.ScaleTo(1.5f, 400, Easing.OutQuad);

View File

@ -111,7 +111,7 @@ namespace osu.Game.Rulesets.Osu
new OsuModHardRock(), new OsuModHardRock(),
new MultiMod(new OsuModSuddenDeath(), new OsuModPerfect()), new MultiMod(new OsuModSuddenDeath(), new OsuModPerfect()),
new MultiMod(new OsuModDoubleTime(), new OsuModNightcore()), new MultiMod(new OsuModDoubleTime(), new OsuModNightcore()),
new OsuModHidden(), new MultiMod(new OsuModHidden(), new OsuModTraceable()),
new MultiMod(new OsuModFlashlight(), new OsuModBlinds()), new MultiMod(new OsuModFlashlight(), new OsuModBlinds()),
}; };
@ -136,8 +136,6 @@ namespace osu.Game.Rulesets.Osu
new OsuModWiggle(), new OsuModWiggle(),
new OsuModGrow(), new OsuModGrow(),
new MultiMod(new ModWindUp<OsuHitObject>(), new ModWindDown<OsuHitObject>()), new MultiMod(new ModWindUp<OsuHitObject>(), new ModWindDown<OsuHitObject>()),
new OsuModTraceable(),
}; };
default: default:

View File

@ -85,7 +85,7 @@ namespace osu.Game.Tests.Visual.UserInterface
var assistMods = instance.GetModsFor(ModType.Automation); var assistMods = instance.GetModsFor(ModType.Automation);
var noFailMod = easierMods.FirstOrDefault(m => m is OsuModNoFail); var noFailMod = easierMods.FirstOrDefault(m => m is OsuModNoFail);
var hiddenMod = harderMods.FirstOrDefault(m => m is OsuModHidden); var hiddenMod = harderMods.OfType<MultiMod>().FirstOrDefault(m => m.Mods.Any(a => a is OsuModHidden));
var doubleTimeMod = harderMods.OfType<MultiMod>().FirstOrDefault(m => m.Mods.Any(a => a is OsuModDoubleTime)); var doubleTimeMod = harderMods.OfType<MultiMod>().FirstOrDefault(m => m.Mods.Any(a => a is OsuModDoubleTime));
@ -96,10 +96,11 @@ namespace osu.Game.Tests.Visual.UserInterface
testSingleMod(noFailMod); testSingleMod(noFailMod);
testMultiMod(doubleTimeMod); testMultiMod(doubleTimeMod);
testMultiMod(hiddenMod);
testIncompatibleMods(easy, hardRock); testIncompatibleMods(easy, hardRock);
testDeselectAll(easierMods.Where(m => !(m is MultiMod))); testDeselectAll(easierMods.Where(m => !(m is MultiMod)));
testMultiplierTextColour(noFailMod, modSelect.LowMultiplierColour); testMultiplierTextColour(noFailMod, modSelect.LowMultiplierColour);
testMultiplierTextColour(hiddenMod, modSelect.HighMultiplierColour); testMultiplierTextColour(hardRock, modSelect.HighMultiplierColour);
testUnimplementedMod(autoPilotMod); testUnimplementedMod(autoPilotMod);
} }

View File

@ -112,13 +112,15 @@ 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) && !selected.GetType().IsSubclassOf(type)) {
if (type.IsInstanceOfType(selected))
{ {
if (immediate) if (immediate)
button.Deselect(); button.Deselect();
else else
Scheduler.AddDelayed(button.Deselect, delay += 50); Scheduler.AddDelayed(button.Deselect, delay += 50);
} }
}
} }
} }
@ -130,7 +132,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) && !m.GetType().IsSubclassOf(t))); int i = Array.FindIndex(button.Mods, m => modTypes.Any(t => t.IsInstanceOfType(m)));
if (i >= 0) if (i >= 0)
button.SelectAt(i); button.SelectAt(i);