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-01 18:11:50 +00:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
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;
|
|
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
public override IconUsage Icon => FontAwesome.Brands.SnapchatGhost;
|
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-09-18 11:07:44 +00:00
|
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(OsuModHidden), typeof(OsuModSpinIn), typeof(OsuModeObjectScaleTween) };
|
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
|
|
|
|
|
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-09-18 11:04:49 +00:00
|
|
|
|
slider.AccentColour.BindValueChanged(_ =>
|
|
|
|
|
{
|
|
|
|
|
//will trigger on skin change.
|
|
|
|
|
slider.Body.AccentColour = slider.AccentColour.Value.Opacity(0);
|
|
|
|
|
slider.Body.BorderColour = slider.AccentColour.Value;
|
|
|
|
|
}, true);
|
|
|
|
|
|
2019-07-03 16:42:02 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2019-07-03 19:40:14 +00:00
|
|
|
|
case DrawableSpinner spinner:
|
|
|
|
|
spinner.Disc.Hide();
|
|
|
|
|
spinner.Background.Hide();
|
2019-07-03 16:42:02 +00:00
|
|
|
|
break;
|
2018-10-09 11:16:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|