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