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