1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Rename Memento class

This commit is contained in:
Roman Kapustin 2018-07-22 23:13:06 +03:00
parent d387048057
commit ecd51d70f9
4 changed files with 22 additions and 22 deletions

View File

@ -139,8 +139,8 @@ namespace osu.Game.Screens.Play
public void ResetCount() => CountPresses = 0;
public KeyCounterMemento SaveState() => new KeyCounterMemento(AudioClock.CurrentTime, CountPresses);
public KeyCounterState SaveState() => new KeyCounterState(AudioClock.CurrentTime, CountPresses);
public void RestoreState(KeyCounterMemento memento) => CountPresses = memento.CountPresses;
public void RestoreState(KeyCounterState state) => CountPresses = state.Count;
}
}

View File

@ -24,7 +24,7 @@ namespace osu.Game.Screens.Play
public readonly Bindable<bool> Visible = new Bindable<bool>(true);
private readonly Bindable<bool> configVisibility = new Bindable<bool>();
private readonly Dictionary<string, List<KeyCounterMemento>> keyCountersState = new Dictionary<string, List<KeyCounterMemento>>();
private readonly Dictionary<string, List<KeyCounterState>> keyCountersState = new Dictionary<string, List<KeyCounterState>>();
public KeyCounterCollection()
{
@ -43,7 +43,7 @@ namespace osu.Game.Screens.Play
key.KeyUpTextColor = KeyUpTextColor;
key.AudioClock = AudioClock;
keyCountersState.Add(key.Name, new List<KeyCounterMemento>());
keyCountersState.Add(key.Name, new List<KeyCounterState>());
key.KeyPressed += () => keyCountersState[key.Name].Add(key.SaveState());
}
@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play
{
foreach (var counter in Children)
{
var targetState = keyCountersState[counter.Name].LastOrDefault(state => state.CurrentTime <= time);
var targetState = keyCountersState[counter.Name].LastOrDefault(state => state.Time <= time);
counter.RestoreState(targetState);
}
}

View File

@ -1,17 +0,0 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Screens.Play
{
public class KeyCounterMemento
{
public KeyCounterMemento(double currentTime, int countPresses)
{
CurrentTime = currentTime;
CountPresses = countPresses;
}
public double CurrentTime { get; }
public int CountPresses { get; }
}
}

View File

@ -0,0 +1,17 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Screens.Play
{
public class KeyCounterState
{
public KeyCounterState(double time, int count)
{
Time = time;
Count = count;
}
public readonly double Time;
public readonly int Count;
}
}