Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Commit

Permalink
Simplify checking bind type from string
Browse files Browse the repository at this point in the history
  • Loading branch information
ForLoveOfCats committed Mar 12, 2019
1 parent ef383ec commit 98046d6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Scripting/Bindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
public class Bindings : Node
{
public enum BIND_TYPE {SCANCODE, MOUSEBUTTON, MOUSEWHEEL, AXIS}
private static string[] MouseButtonList = {"MouseOne", "MouseTwo", "MouseThree"};
private static string[] MouseWheelList = {"WheelUp", "WheelDown"};
private static string[] AxisList = {"MouseUp", "MouseDown", "MouseRight", "MouseLeft"};
private static List<string> MouseButtonList = new List<string>{"MouseOne", "MouseTwo", "MouseThree"};
private static List<string> MouseWheelList = new List<string>{"WheelUp", "WheelDown"};
private static List<string> AxisList = new List<string>{"MouseUp", "MouseDown", "MouseRight", "MouseLeft"};
private static List<BindingObject> BindingsWithArg = new List<BindingObject>();
private static List<BindingObject> BindingsWithoutArg = new List<BindingObject>();

Expand Down Expand Up @@ -62,15 +62,15 @@ public static void Bind(string FunctionName, string InputString)
}

BIND_TYPE Type = BIND_TYPE.SCANCODE;
if(System.Array.IndexOf(MouseButtonList, InputString) >= 0)
if(MouseButtonList.Contains(InputString))
{
Type = BIND_TYPE.MOUSEBUTTON;
}
if(System.Array.IndexOf(MouseWheelList, InputString) >= 0)
if(MouseWheelList.Contains(InputString))
{
Type = BIND_TYPE.MOUSEWHEEL;
}
if(System.Array.IndexOf(AxisList, InputString) >= 0)
if(AxisList.Contains(InputString))
{
Type = BIND_TYPE.AXIS;
}
Expand Down

0 comments on commit 98046d6

Please sign in to comment.