1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-18 20:22:56 +08:00
osu-lazer/osu.Game/Replays/Legacy/LegacyReplayFrame.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
2.0 KiB
C#
Raw Normal View History

// 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-04-13 17:19:50 +08:00
using MessagePack;
using Newtonsoft.Json;
2021-02-25 14:38:56 +08:00
using osu.Framework.Extensions.EnumExtensions;
2018-11-28 16:20:37 +08:00
using osu.Game.Rulesets.Replays;
2018-11-20 15:51:59 +08:00
using osuTK;
2018-04-13 17:19:50 +08:00
2018-11-28 16:20:37 +08:00
namespace osu.Game.Replays.Legacy
{
[MessagePackObject]
public class LegacyReplayFrame : ReplayFrame
{
[JsonIgnore]
[IgnoreMember]
public Vector2 Position => new Vector2(MouseX ?? 0, MouseY ?? 0);
2018-04-13 17:19:50 +08:00
[Key(1)]
public float? MouseX;
[Key(2)]
public float? MouseY;
2018-04-13 17:19:50 +08:00
[JsonIgnore]
[IgnoreMember]
public bool MouseLeft => MouseLeft1 || MouseLeft2;
[JsonIgnore]
[IgnoreMember]
public bool MouseRight => MouseRight1 || MouseRight2;
2018-04-13 17:19:50 +08:00
[JsonIgnore]
[IgnoreMember]
2021-02-25 14:38:56 +08:00
public bool MouseLeft1 => ButtonState.HasFlagFast(ReplayButtonState.Left1);
[JsonIgnore]
[IgnoreMember]
2021-02-25 14:38:56 +08:00
public bool MouseRight1 => ButtonState.HasFlagFast(ReplayButtonState.Right1);
[JsonIgnore]
[IgnoreMember]
2021-02-25 14:38:56 +08:00
public bool MouseLeft2 => ButtonState.HasFlagFast(ReplayButtonState.Left2);
[JsonIgnore]
[IgnoreMember]
2021-02-25 14:38:56 +08:00
public bool MouseRight2 => ButtonState.HasFlagFast(ReplayButtonState.Right2);
2018-04-13 17:19:50 +08:00
2022-09-19 08:55:06 +08:00
[JsonIgnore]
[IgnoreMember]
public bool Smoke => ButtonState.HasFlagFast(ReplayButtonState.Smoke);
[Key(3)]
public ReplayButtonState ButtonState;
2018-04-13 17:19:50 +08:00
public LegacyReplayFrame(double time, float? mouseX, float? mouseY, ReplayButtonState buttonState)
: base(time)
{
MouseX = mouseX;
MouseY = mouseY;
ButtonState = buttonState;
}
2018-04-13 17:19:50 +08:00
public override string ToString()
{
return $"{Time}\t({MouseX},{MouseY})\t{MouseLeft}\t{MouseRight}\t{MouseLeft1}\t{MouseRight1}\t{MouseLeft2}\t{MouseRight2}\t{ButtonState}";
}
}
}