From d27c4a55c9dbfb76b6e7bde46885a2496b9610ae Mon Sep 17 00:00:00 2001 From: Ian Bennett Date: Wed, 26 Jul 2017 15:02:21 +0100 Subject: [PATCH 1/2] Add Twitch Plays support --- Assets/buttonMasherNeedy.cs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/Assets/buttonMasherNeedy.cs b/Assets/buttonMasherNeedy.cs index c8373ed..81255c8 100644 --- a/Assets/buttonMasherNeedy.cs +++ b/Assets/buttonMasherNeedy.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using System.Collections; using System; @@ -76,4 +76,29 @@ protected void OnTimerExpired() } isActive = 0; } -} \ No newline at end of file + + public KMSelectable[] ProcessTwitchCommand(string command) + { + command = command.ToLowerInvariant(); + if ( !command.StartsWith("press ") && + !command.StartsWith("tap ") && + !command.StartsWith("mash ") ) + { + return null; + } + + command = command.Substring(command.IndexOf(" ") + 1); + int presses; + if (!int.TryParse(command, out presses)) + { + return null; + } + + KMSelectable[] interacts = new KMSelectable[presses]; + for (int i = 0; i < presses; i++) + { + interacts[i] = Solvebutton; + } + return interacts; + } +} From e9c57ddd8e904ee939b0cc0c2666a14510be948e Mon Sep 17 00:00:00 2001 From: Ian Bennett Date: Wed, 26 Jul 2017 15:39:32 +0100 Subject: [PATCH 2/2] Twitch Plays help/manual --- Assets/buttonMasherNeedy.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Assets/buttonMasherNeedy.cs b/Assets/buttonMasherNeedy.cs index 81255c8..469eea6 100644 --- a/Assets/buttonMasherNeedy.cs +++ b/Assets/buttonMasherNeedy.cs @@ -77,6 +77,8 @@ protected void OnTimerExpired() isActive = 0; } + public string TwitchManualCode = "Button Masher"; + public string TwitchHelpMessage = "!{0} press 13, !{0} tap 13, !{0} mash 13 (mash the button 13 times)"; public KMSelectable[] ProcessTwitchCommand(string command) { command = command.ToLowerInvariant();