From 66ab5608174bb008b46b2005164d35d9f5aa6cc0 Mon Sep 17 00:00:00 2001 From: Carson Kompon Date: Sat, 26 Feb 2022 02:03:33 -0500 Subject: [PATCH] Added Autoplay and Metronome Hotkeys A - Autoplay M - Metronome --- .../Scripts/LevelEditor/Timeline/Timeline.cs | 65 ++++++++++++------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs index 33971df4..6096d7eb 100644 --- a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs @@ -144,29 +144,11 @@ namespace RhythmHeavenMania.Editor.Track MetronomeBTN.onClick.AddListener(delegate { - if (!Conductor.instance.metronome) - { - MetronomeBTN.transform.GetChild(0).GetComponent().color = "009FC6".Hex2RGB(); - Conductor.instance.metronome = true; - } - else - { - MetronomeBTN.transform.GetChild(0).GetComponent().color = Color.gray; - Conductor.instance.metronome = false; - } + MetronomeToggle(); }); AutoplayBTN.onClick.AddListener(delegate { - if (!GameManager.instance.autoplay) - { - AutoplayBTN.GetComponent().Play("Idle", 0, 0); - GameManager.instance.autoplay = true; - } - else - { - AutoplayBTN.GetComponent().Play("Disabled", 0, 0); - GameManager.instance.autoplay = false; - } + AutoPlayToggle(); }); SelectionsBTN.onClick.AddListener(delegate @@ -190,8 +172,8 @@ namespace RhythmHeavenMania.Editor.Track Tooltip.AddTooltip(PauseBTN.gameObject, "Pause [Shift + Space]"); Tooltip.AddTooltip(StopBTN.gameObject, "Stop [Space]"); - Tooltip.AddTooltip(MetronomeBTN.gameObject, "Metronome"); - Tooltip.AddTooltip(AutoplayBTN.gameObject, "Autoplay"); + Tooltip.AddTooltip(MetronomeBTN.gameObject, "Metronome [M]"); + Tooltip.AddTooltip(AutoplayBTN.gameObject, "Autoplay [A]"); Tooltip.AddTooltip(SelectionsBTN.gameObject, "Tool: Selection [1]"); Tooltip.AddTooltip(TempoChangeBTN.gameObject, "Tool: Tempo Change [2]"); @@ -213,6 +195,35 @@ namespace RhythmHeavenMania.Editor.Track AutoplayBTN.GetComponent().Play(animName, 0, 0); } + public void AutoPlayToggle() + { + if (!GameManager.instance.autoplay) + { + AutoplayBTN.GetComponent().Play("Idle", 0, 0); + GameManager.instance.autoplay = true; + } + else + { + AutoplayBTN.GetComponent().Play("Disabled", 0, 0); + GameManager.instance.autoplay = false; + } + } + + + public void MetronomeToggle() + { + if (!Conductor.instance.metronome) + { + MetronomeBTN.transform.GetChild(0).GetComponent().color = "009FC6".Hex2RGB(); + Conductor.instance.metronome = true; + } + else + { + MetronomeBTN.transform.GetChild(0).GetComponent().color = Color.gray; + Conductor.instance.metronome = false; + } + } + public static string RandomID() { 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)) {