forked from Yurihaia/HollowKnight-Timer
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Catch error if invalid keybind is present
(invalid keys will now be logged in the logger)
- Loading branch information
Showing
5 changed files
with
52 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using UnityEngine; | ||
|
||
namespace HKTimer { | ||
public class StringInputManager | ||
{ | ||
public static void LogBindErors(string[] keys) | ||
{ | ||
foreach(var s in keys) | ||
{ | ||
try | ||
{ | ||
if(s != null) Input.GetKeyDown(s); | ||
} | ||
catch | ||
{ | ||
Modding.Logger.LogError("Invalid key code '" + s + "'"); | ||
} | ||
} | ||
} | ||
|
||
public static bool GetKeyDown(string key) | ||
{ | ||
try | ||
{ | ||
return key != null && Input.GetKeyDown(key); | ||
} | ||
catch | ||
{ | ||
return false; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters