2019-07-01 18:20:25 +00:00
|
|
|
|
// 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.
|
2018-10-09 11:16:27 +00:00
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2018-10-09 16:36:12 +00:00
|
|
|
|
using System;
|
2019-09-18 11:04:49 +00:00
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
2020-10-25 22:24:14 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
2018-10-09 11:16:27 +00:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
2020-12-04 11:21:53 +00:00
|
|
|
|
using osu.Game.Rulesets.Osu.Skinning.Default;
|
2018-10-09 11:16:27 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Mods
|
|
|
|
|
{
|
2021-06-28 15:52:39 +00:00
|
|
|
|
public class OsuModTraceable : ModWithVisibilityAdjustment, IRequiresApproachCircles
|
2018-10-09 11:16:27 +00:00
|
|
|
|
{
|
|
|
|
|
public override string Name => "Traceable";
|
2019-07-01 18:11:50 +00:00
|
|
|
|
public override string Acronym => "TC";
|
2019-07-03 19:40:14 +00:00
|
|
|
|
public override ModType Type => ModType.Fun;
|
2018-10-09 11:16:27 +00:00
|
|
|
|
public override string Description => "Put your faith in the approach circles...";
|
|
|
|
|
public override double ScoreMultiplier => 1;
|
2019-09-18 11:04:49 +00:00
|
|
|
|
|
2021-06-28 15:52:39 +00:00
|
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(IHidesApproachCircles) };
|
2018-10-09 11:16:27 +00:00
|
|
|
|
|
2020-11-05 07:03:10 +00:00
|
|
|
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
2018-10-09 11:16:27 +00:00
|
|
|
|
{
|
2019-07-03 19:40:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-05 07:03:10 +00:00
|
|
|
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) => applyTraceableState(hitObject, state);
|
|
|
|
|
|
2020-11-05 06:52:06 +00:00
|
|
|
|
private void applyTraceableState(DrawableHitObject drawable, ArmedState state)
|
2018-10-09 16:36:12 +00:00
|
|
|
|
{
|
2020-10-25 22:55:22 +00:00
|
|
|
|
if (!(drawable is DrawableOsuHitObject))
|
2018-10-09 16:36:12 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2020-07-30 04:06:53 +00:00
|
|
|
|
//todo: expose and hide spinner background somehow
|
|
|
|
|
|
2019-07-03 16:42:02 +00:00
|
|
|
|
switch (drawable)
|
2018-10-09 11:16:27 +00:00
|
|
|
|
{
|
2019-07-03 16:42:02 +00:00
|
|
|
|
case DrawableHitCircle circle:
|
|
|
|
|
// we only want to see the approach circle
|
2020-10-25 22:24:14 +00:00
|
|
|
|
applyCirclePieceState(circle, circle.CirclePiece);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DrawableSliderTail sliderTail:
|
|
|
|
|
applyCirclePieceState(sliderTail);
|
|
|
|
|
break;
|
2019-07-03 16:42:02 +00:00
|
|
|
|
|
2020-10-25 22:24:14 +00:00
|
|
|
|
case DrawableSliderRepeat sliderRepeat:
|
|
|
|
|
// show only the repeat arrow
|
|
|
|
|
applyCirclePieceState(sliderRepeat, sliderRepeat.CirclePiece);
|
2019-07-03 16:42:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DrawableSlider slider:
|
2019-12-17 10:49:13 +00:00
|
|
|
|
slider.Body.OnSkinChanged += () => applySliderState(slider);
|
|
|
|
|
applySliderState(slider);
|
2019-07-03 16:42:02 +00:00
|
|
|
|
break;
|
2018-10-09 11:16:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-17 10:49:13 +00:00
|
|
|
|
|
2020-10-25 22:24:14 +00:00
|
|
|
|
private void applyCirclePieceState(DrawableOsuHitObject hitObject, IDrawable hitCircle = null)
|
|
|
|
|
{
|
|
|
|
|
var h = hitObject.HitObject;
|
2021-07-05 15:52:39 +00:00
|
|
|
|
using (hitObject.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
|
2020-10-25 22:24:14 +00:00
|
|
|
|
(hitCircle ?? hitObject).Hide();
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-17 10:49:13 +00:00
|
|
|
|
private void applySliderState(DrawableSlider slider)
|
|
|
|
|
{
|
|
|
|
|
((PlaySliderBody)slider.Body.Drawable).AccentColour = slider.AccentColour.Value.Opacity(0);
|
|
|
|
|
((PlaySliderBody)slider.Body.Drawable).BorderColour = slider.AccentColour.Value;
|
|
|
|
|
}
|
2018-10-09 11:16:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|