mirror of
https://github.com/osukey/osukey.git
synced 2025-05-21 21:47:31 +09:00
Save KeyCounter state when keypress happens
This commit is contained in:
parent
72959691e9
commit
0632c59e60
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -15,6 +16,8 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
public abstract class KeyCounter : Container
|
public abstract class KeyCounter : Container
|
||||||
{
|
{
|
||||||
|
public event Action KeyPressed;
|
||||||
|
|
||||||
private Sprite buttonSprite;
|
private Sprite buttonSprite;
|
||||||
private Sprite glowSprite;
|
private Sprite glowSprite;
|
||||||
private Container textLayer;
|
private Container textLayer;
|
||||||
@ -46,7 +49,10 @@ namespace osu.Game.Screens.Play
|
|||||||
isLit = value;
|
isLit = value;
|
||||||
updateGlowSprite(value);
|
updateGlowSprite(value);
|
||||||
if (value && IsCounting)
|
if (value && IsCounting)
|
||||||
|
{
|
||||||
CountPresses++;
|
CountPresses++;
|
||||||
|
KeyPressed?.Invoke();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
@ -22,6 +23,8 @@ namespace osu.Game.Screens.Play
|
|||||||
public readonly Bindable<bool> Visible = new Bindable<bool>(true);
|
public readonly Bindable<bool> Visible = new Bindable<bool>(true);
|
||||||
private readonly Bindable<bool> configVisibility = new Bindable<bool>();
|
private readonly Bindable<bool> configVisibility = new Bindable<bool>();
|
||||||
|
|
||||||
|
private readonly Dictionary<string, List<KeyCounterMemento>> keyCountersState = new Dictionary<string, List<KeyCounterMemento>>();
|
||||||
|
|
||||||
public KeyCounterCollection()
|
public KeyCounterCollection()
|
||||||
{
|
{
|
||||||
Direction = FillDirection.Horizontal;
|
Direction = FillDirection.Horizontal;
|
||||||
@ -38,6 +41,9 @@ namespace osu.Game.Screens.Play
|
|||||||
key.KeyDownTextColor = KeyDownTextColor;
|
key.KeyDownTextColor = KeyDownTextColor;
|
||||||
key.KeyUpTextColor = KeyUpTextColor;
|
key.KeyUpTextColor = KeyUpTextColor;
|
||||||
key.AudioClock = AudioClock;
|
key.AudioClock = AudioClock;
|
||||||
|
|
||||||
|
keyCountersState.Add(key.Name, new List<KeyCounterMemento>());
|
||||||
|
key.KeyPressed += () => keyCountersState[key.Name].Add(key.SaveState());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetCount()
|
public void ResetCount()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user