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
|
|
|
|
|
2018-02-28 07:34:47 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using osu.Game.Beatmaps;
|
2018-11-28 08:20:37 +00:00
|
|
|
|
using osu.Game.Replays.Legacy;
|
2018-01-25 12:37:38 +00:00
|
|
|
|
using osu.Game.Rulesets.Replays;
|
2018-02-28 07:34:47 +00:00
|
|
|
|
using osu.Game.Rulesets.Replays.Types;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-01-25 12:37:38 +00:00
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Replays
|
|
|
|
|
{
|
2018-02-28 07:34:47 +00:00
|
|
|
|
public class TaikoReplayFrame : ReplayFrame, IConvertibleReplayFrame
|
2018-01-25 12:37:38 +00:00
|
|
|
|
{
|
2018-02-28 07:34:47 +00:00
|
|
|
|
public List<TaikoAction> Actions = new List<TaikoAction>();
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-02-28 15:57:35 +00:00
|
|
|
|
public TaikoReplayFrame()
|
|
|
|
|
{
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-02-28 07:34:47 +00:00
|
|
|
|
public TaikoReplayFrame(double time, params TaikoAction[] actions)
|
|
|
|
|
: base(time)
|
2018-01-25 12:37:38 +00:00
|
|
|
|
{
|
2018-02-28 07:34:47 +00:00
|
|
|
|
Actions.AddRange(actions);
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2022-07-02 05:33:05 +00:00
|
|
|
|
public void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame? lastFrame = null)
|
2018-02-28 07:34:47 +00:00
|
|
|
|
{
|
2019-09-12 09:33:46 +00:00
|
|
|
|
if (currentFrame.MouseRight1) Actions.Add(TaikoAction.LeftRim);
|
|
|
|
|
if (currentFrame.MouseRight2) Actions.Add(TaikoAction.RightRim);
|
|
|
|
|
if (currentFrame.MouseLeft1) Actions.Add(TaikoAction.LeftCentre);
|
|
|
|
|
if (currentFrame.MouseLeft2) Actions.Add(TaikoAction.RightCentre);
|
2018-01-25 12:37:38 +00:00
|
|
|
|
}
|
2020-03-24 05:13:46 +00:00
|
|
|
|
|
2020-03-25 11:21:34 +00:00
|
|
|
|
public LegacyReplayFrame ToLegacy(IBeatmap beatmap)
|
2020-03-24 05:13:46 +00:00
|
|
|
|
{
|
|
|
|
|
ReplayButtonState state = ReplayButtonState.None;
|
|
|
|
|
|
|
|
|
|
if (Actions.Contains(TaikoAction.LeftRim)) state |= ReplayButtonState.Right1;
|
|
|
|
|
if (Actions.Contains(TaikoAction.RightRim)) state |= ReplayButtonState.Right2;
|
|
|
|
|
if (Actions.Contains(TaikoAction.LeftCentre)) state |= ReplayButtonState.Left1;
|
|
|
|
|
if (Actions.Contains(TaikoAction.RightCentre)) state |= ReplayButtonState.Left2;
|
|
|
|
|
|
|
|
|
|
return new LegacyReplayFrame(Time, null, null, state);
|
|
|
|
|
}
|
2018-01-25 12:37:38 +00:00
|
|
|
|
}
|
|
|
|
|
}
|