From 9b0aeac8dd9e5f618fc6c7f363fe07e9b0a39ba7 Mon Sep 17 00:00:00 2001 From: Cassandra de la Cruz-Munoz Date: Wed, 16 Aug 2023 14:07:50 -0400 Subject: [PATCH] use new VmcExtCon and remove now unused code --- Marionette.cs | 61 +-------------------------------------------------- 1 file changed, 1 insertion(+), 60 deletions(-) diff --git a/Marionette.cs b/Marionette.cs index 513b262..afd9291 100644 --- a/Marionette.cs +++ b/Marionette.cs @@ -69,7 +69,7 @@ namespace godotVmcSharp new VmcExtCam(m); break; case "/VMC/Ext/Con": - ControllerInput(m.Data); + new VmcExtCon(m); break; case "/VMC/Ext/Key": KeyInput(m.Data); @@ -106,65 +106,6 @@ namespace godotVmcSharp break; } } - private void ControllerInput(List data) - { - var addr = "VMC/Ext/Con"; - if (data.Count != 8) - { - GD.Print($"Invalid number of arguments for /VMC/Ext/Con. Expected 8, received {data.Count}."); - return; - } - if (data[0].Type != 'i') - { - GD.Print(InvalidArgumentType.GetErrorString(addr, "active", 'i', data[0].Type)); - return; - } - if (data[1].Type != 's') - { - GD.Print(InvalidArgumentType.GetErrorString(addr, "name", 's', data[1].Type)); - return; - } - if (data[2].Type != 'i') - { - GD.Print(InvalidArgumentType.GetErrorString(addr, "IsLeft", 'i', data[2].Type)); - } - if (data[3].Type != 'i') - { - GD.Print(InvalidArgumentType.GetErrorString(addr, "IsTouch", 'i', data[3].Type)); - } - if (data[4].Type != 'i') - { - GD.Print(InvalidArgumentType.GetErrorString(addr, "IsAxis", 'i', data[4].Type)); - } - if (data[5].Type != 'f') - { - GD.Print(InvalidArgumentType.GetErrorString(addr, "Axis.x", 'f', data[5].Type)); - } - if (data[6].Type != 'f') - { - GD.Print(InvalidArgumentType.GetErrorString(addr, "Axis.y", 'f', data[6].Type)); - } - if (data[7].Type != 'f') - { - GD.Print(InvalidArgumentType.GetErrorString(addr, "Axis.z", 'f', data[7].Type)); - } - switch ((int)data[0].Value) - { - case 0: - GD.Print("controller release"); - break; - case 1: - GD.Print("controller press"); - break; - case 2: - GD.Print("controller change axis"); - break; - default: - GD.Print($"Invalid value for \"active\" 'i' argument of /VMC/Ext/Con. Expected 0-2, received {(int)data[0].Value}"); - return; - } - GD.Print($"\t\"Name\": \"{(string)data[1].Value}\",\n\t\"IsLeft\": {(int)data[2].Value},\n\t\"IsTouch\": {(int)data[3].Value},\n\t\"IsAxis\": {(int)data[4].Value}\n\t\"Axis\"\n\t\t\"x\": {(float)data[5].Value}\n\t\t\"y\": {(float)data[6].Value}\n\t\t\"z\": {(float)data[7].Value}\n"); - } private void KeyInput(List data) { var addr = "/VMC/Ext/Key";