Added Autoplay and Metronome Hotkeys

A - Autoplay
M - Metronome
This commit is contained in:
Carson Kompon 2022-02-26 02:03:33 -05:00
parent 78825c9216
commit 66ab560817

View file

@ -144,29 +144,11 @@ namespace RhythmHeavenMania.Editor.Track
MetronomeBTN.onClick.AddListener(delegate MetronomeBTN.onClick.AddListener(delegate
{ {
if (!Conductor.instance.metronome) MetronomeToggle();
{
MetronomeBTN.transform.GetChild(0).GetComponent<Image>().color = "009FC6".Hex2RGB();
Conductor.instance.metronome = true;
}
else
{
MetronomeBTN.transform.GetChild(0).GetComponent<Image>().color = Color.gray;
Conductor.instance.metronome = false;
}
}); });
AutoplayBTN.onClick.AddListener(delegate AutoplayBTN.onClick.AddListener(delegate
{ {
if (!GameManager.instance.autoplay) AutoPlayToggle();
{
AutoplayBTN.GetComponent<Animator>().Play("Idle", 0, 0);
GameManager.instance.autoplay = true;
}
else
{
AutoplayBTN.GetComponent<Animator>().Play("Disabled", 0, 0);
GameManager.instance.autoplay = false;
}
}); });
SelectionsBTN.onClick.AddListener(delegate SelectionsBTN.onClick.AddListener(delegate
@ -190,8 +172,8 @@ namespace RhythmHeavenMania.Editor.Track
Tooltip.AddTooltip(PauseBTN.gameObject, "Pause <color=#adadad>[Shift + Space]</color>"); Tooltip.AddTooltip(PauseBTN.gameObject, "Pause <color=#adadad>[Shift + Space]</color>");
Tooltip.AddTooltip(StopBTN.gameObject, "Stop <color=#adadad>[Space]</color>"); Tooltip.AddTooltip(StopBTN.gameObject, "Stop <color=#adadad>[Space]</color>");
Tooltip.AddTooltip(MetronomeBTN.gameObject, "Metronome"); Tooltip.AddTooltip(MetronomeBTN.gameObject, "Metronome <color=#adadad>[M]</color>");
Tooltip.AddTooltip(AutoplayBTN.gameObject, "Autoplay"); Tooltip.AddTooltip(AutoplayBTN.gameObject, "Autoplay <color=#adadad>[A]</color>");
Tooltip.AddTooltip(SelectionsBTN.gameObject, "Tool: Selection <color=#adadad>[1]</color>"); Tooltip.AddTooltip(SelectionsBTN.gameObject, "Tool: Selection <color=#adadad>[1]</color>");
Tooltip.AddTooltip(TempoChangeBTN.gameObject, "Tool: Tempo Change <color=#adadad>[2]</color>"); Tooltip.AddTooltip(TempoChangeBTN.gameObject, "Tool: Tempo Change <color=#adadad>[2]</color>");
@ -213,6 +195,35 @@ namespace RhythmHeavenMania.Editor.Track
AutoplayBTN.GetComponent<Animator>().Play(animName, 0, 0); AutoplayBTN.GetComponent<Animator>().Play(animName, 0, 0);
} }
public void AutoPlayToggle()
{
if (!GameManager.instance.autoplay)
{
AutoplayBTN.GetComponent<Animator>().Play("Idle", 0, 0);
GameManager.instance.autoplay = true;
}
else
{
AutoplayBTN.GetComponent<Animator>().Play("Disabled", 0, 0);
GameManager.instance.autoplay = false;
}
}
public void MetronomeToggle()
{
if (!Conductor.instance.metronome)
{
MetronomeBTN.transform.GetChild(0).GetComponent<Image>().color = "009FC6".Hex2RGB();
Conductor.instance.metronome = true;
}
else
{
MetronomeBTN.transform.GetChild(0).GetComponent<Image>().color = Color.gray;
Conductor.instance.metronome = false;
}
}
public static string RandomID() public static string RandomID()
{ {
return Starpelly.Random.Strings.RandomString(Starpelly.Enums.Strings.StringType.Alphanumeric, 128); return Starpelly.Random.Strings.RandomString(Starpelly.Enums.Strings.StringType.Alphanumeric, 128);
@ -247,6 +258,16 @@ namespace RhythmHeavenMania.Editor.Track
} }
} }
if (Input.GetKeyDown(KeyCode.A))
{
AutoPlayToggle();
}
if (Input.GetKeyDown(KeyCode.M))
{
MetronomeToggle();
}
if (Input.GetMouseButton(1) && !Conductor.instance.isPlaying && Editor.MouseInRectTransform(TimelineGridSelect)) if (Input.GetMouseButton(1) && !Conductor.instance.isPlaying && Editor.MouseInRectTransform(TimelineGridSelect))
{ {