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
|
|
|
|
|
2018-10-09 16:36:12 +00:00
|
|
|
|
using System;
|
2019-07-01 18:11:50 +00:00
|
|
|
|
using System.Linq;
|
2019-07-03 19:40:14 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
2018-10-09 11:16:27 +00:00
|
|
|
|
using System.Collections.Generic;
|
2019-09-18 11:04:49 +00:00
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
2019-07-03 19:40:14 +00:00
|
|
|
|
using osu.Game.Configuration;
|
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;
|
2019-12-17 10:29:27 +00:00
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
2018-10-09 11:16:27 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Mods
|
|
|
|
|
{
|
2019-07-03 19:40:14 +00:00
|
|
|
|
internal class OsuModTraceable : Mod, IReadFromConfig, IApplicableToDrawableHitObjects
|
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
|
|
|
|
|
2019-12-26 06:25:41 +00:00
|
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(OsuModHidden), typeof(OsuModSpinIn), typeof(OsuModObjectScaleTween) };
|
2019-07-03 19:40:14 +00:00
|
|
|
|
private Bindable<bool> increaseFirstObjectVisibility = new Bindable<bool>();
|
2018-10-09 11:16:27 +00:00
|
|
|
|
|
2019-07-03 19:40:14 +00:00
|
|
|
|
public void ReadFromConfig(OsuConfigManager config)
|
2018-10-09 11:16:27 +00:00
|
|
|
|
{
|
2019-07-03 19:40:14 +00:00
|
|
|
|
increaseFirstObjectVisibility = config.GetBindable<bool>(OsuSetting.IncreaseFirstObjectVisibility);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
|
|
|
|
{
|
|
|
|
|
foreach (var drawable in drawables.Skip(increaseFirstObjectVisibility.Value ? 1 : 0))
|
2019-07-03 16:42:02 +00:00
|
|
|
|
drawable.ApplyCustomUpdateState += ApplyTraceableState;
|
2018-10-09 16:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void ApplyTraceableState(DrawableHitObject drawable, ArmedState state)
|
|
|
|
|
{
|
2019-09-18 11:04:49 +00:00
|
|
|
|
if (!(drawable is DrawableOsuHitObject drawableOsu))
|
2018-10-09 16:36:12 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2019-09-18 11:04:49 +00:00
|
|
|
|
var h = drawableOsu.HitObject;
|
2018-10-09 16:36:12 +00:00
|
|
|
|
|
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
|
|
|
|
|
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
|
2019-09-18 11:04:49 +00:00
|
|
|
|
circle.CirclePiece.Hide();
|
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
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|