static public axis fromJson(string json) { if (jsonParser == null) { jsonParser = new Regex("\"input\": \"(.*)\",.*" + "\"key\": \"(.*)\",.*" + "\"type\": \"(.*)\",.*" + "\"isKey\": \"(.*)\",.*" + "\"name\": \"(.*)\",.*" + "\"rest\": \"(.*)\""); } MatchCollection matches = jsonParser.Matches(json); GroupCollection groups = matches[0].Groups; string input = groups[1].Value; int ikey = Int32.Parse(groups[2].Value); KeyCode key = (KeyCode)ikey; int itype = Int32.Parse(groups[3].Value); axisType type = (axisType)itype; int iIsKey = Int32.Parse(groups[4].Value); bool isKey = (iIsKey != 0); string name = groups[5].Value; float rest = float.Parse(groups[6].Value, CultureInfo.InvariantCulture); axis a = new axis(); a.input = input; a.key = key; a.type = type; a.isKey = isKey; a.name = name; a.rest = rest; return(a); }
public axis(KeyCode key) { this.key = key; this.isKey = true; this.type = axisType.none; this.input = ""; this.name = $"Key: {this.key}"; }
private void initGamepad(string input, axisType type, float rest) { this.type = type; this.input = input; this.isKey = false; this.rest = rest; this.key = KeyCode.None; if (this.type == axisType.positiveAxis) { this.name = $"{this.input} +"; } else if (this.type == axisType.negativeAxis) { this.name = $"{this.input} -"; } else { this.name = this.input; } }
public LFAxisInputMap(string _id, axisType _aType, KeyCode _keyNeg, KeyCode _keyPos, int _joystickNumber, int _joystickAxis) { id = _id; aType = _aType; keyPos = _keyPos; keyNeg = _keyNeg; joystickNumber = _joystickNumber; joystickAxis = _joystickAxis; }
public axis(string input, axisType type) { this.initGamepad(input, type, 0.0f); }
public axis(string input, axisType type, float rest) { this.initGamepad(input, type, rest); }