2017-09-12 15:21:32 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
2017-09-12 14:52:18 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-09-12 15:21:32 +08:00
|
|
|
|
using System.Collections.Generic;
|
2017-11-28 14:27:20 +08:00
|
|
|
|
using System.Linq;
|
2017-09-12 15:21:32 +08:00
|
|
|
|
using osu.Framework.Input;
|
2017-11-28 14:27:20 +08:00
|
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
2017-09-12 14:52:18 +08:00
|
|
|
|
using osu.Game.Rulesets.Replays;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Replays
|
|
|
|
|
{
|
|
|
|
|
internal class ManiaFramedReplayInputHandler : FramedReplayInputHandler
|
|
|
|
|
{
|
2017-11-28 14:27:20 +08:00
|
|
|
|
private readonly ManiaRulesetContainer container;
|
|
|
|
|
|
|
|
|
|
public ManiaFramedReplayInputHandler(Replay replay, ManiaRulesetContainer container)
|
2017-09-12 14:52:18 +08:00
|
|
|
|
: base(replay)
|
|
|
|
|
{
|
2017-11-28 14:27:20 +08:00
|
|
|
|
this.container = container;
|
2017-09-12 14:52:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-28 14:27:20 +08:00
|
|
|
|
private ManiaPlayfield playfield;
|
2017-09-12 14:52:18 +08:00
|
|
|
|
public override List<InputState> GetPendingStates()
|
|
|
|
|
{
|
|
|
|
|
var actions = new List<ManiaAction>();
|
|
|
|
|
|
2017-11-28 14:27:20 +08:00
|
|
|
|
if (playfield == null)
|
|
|
|
|
playfield = (ManiaPlayfield)container.Playfield;
|
2017-09-12 14:52:18 +08:00
|
|
|
|
|
2017-11-28 14:27:20 +08:00
|
|
|
|
int activeColumns = (int)(CurrentFrame.MouseX ?? 0);
|
2017-09-12 14:52:18 +08:00
|
|
|
|
int counter = 0;
|
|
|
|
|
while (activeColumns > 0)
|
|
|
|
|
{
|
|
|
|
|
if ((activeColumns & 1) > 0)
|
2017-11-28 14:27:20 +08:00
|
|
|
|
actions.Add(playfield.Columns.ElementAt(counter).Action);
|
2017-09-12 14:52:18 +08:00
|
|
|
|
counter++;
|
|
|
|
|
activeColumns >>= 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new List<InputState> { new ReplayState<ManiaAction> { PressedActions = actions } };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|