2020-12-08 20:29:03 +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.
|
|
|
|
|
|
|
|
using osu.Framework.Bindables;
|
2020-12-10 19:43:01 +08:00
|
|
|
using osuTK;
|
2020-12-08 20:29:03 +08:00
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|
|
|
{
|
2020-12-08 22:11:22 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Provides a visual state of a <see cref="PalpableCatchHitObject"/>.
|
|
|
|
/// </summary>
|
2020-12-08 20:29:03 +08:00
|
|
|
public interface IHasCatchObjectState
|
|
|
|
{
|
2020-12-08 21:38:10 +08:00
|
|
|
PalpableCatchHitObject HitObject { get; }
|
2020-12-08 20:29:03 +08:00
|
|
|
Bindable<Color4> AccentColour { get; }
|
|
|
|
Bindable<bool> HyperDash { get; }
|
2021-06-07 13:49:37 +08:00
|
|
|
Bindable<int> IndexInBeatmap { get; }
|
2024-08-13 17:07:52 +08:00
|
|
|
double DisplayStartTime { get; }
|
|
|
|
Vector2 DisplayPosition { get; }
|
2020-12-10 19:43:01 +08:00
|
|
|
Vector2 DisplaySize { get; }
|
|
|
|
float DisplayRotation { get; }
|
2024-08-13 17:07:52 +08:00
|
|
|
|
|
|
|
void RestoreState(CatchObjectState state);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static class HasCatchObjectStateExtensions
|
|
|
|
{
|
|
|
|
public static CatchObjectState SaveState(this IHasCatchObjectState target) => new CatchObjectState(
|
|
|
|
target.HitObject,
|
|
|
|
target.AccentColour.Value,
|
|
|
|
target.HyperDash.Value,
|
|
|
|
target.IndexInBeatmap.Value,
|
|
|
|
target.DisplayPosition,
|
|
|
|
target.DisplaySize,
|
|
|
|
target.DisplayRotation);
|
2020-12-08 20:29:03 +08:00
|
|
|
}
|
2024-08-13 17:07:52 +08:00
|
|
|
|
|
|
|
public readonly record struct CatchObjectState(
|
|
|
|
PalpableCatchHitObject HitObject,
|
|
|
|
Color4 AccentColour,
|
|
|
|
bool HyperDash,
|
|
|
|
int IndexInBeatmap,
|
|
|
|
Vector2 DisplayPosition,
|
|
|
|
Vector2 DisplaySize,
|
|
|
|
float DisplayRotation);
|
2020-12-08 20:29:03 +08:00
|
|
|
}
|