void ConsoleMessageHandler(string command, string argument) { if (command == "phys_debug_draw") { if (string.IsNullOrEmpty(argument)) { console.Write("phys_debug_draw is " + (debugDraw ? "1" : "0")); } else { try { int arg = Convert.ToInt32(argument); if (arg == 0) { debugDraw = false; } else { debugDraw = true; } } catch (Exception) { console.Write(argument + " is not a valid argument. Use 0/1.", ConsoleMessageType.Error); } } console.CommandHandled = true; } else if (command == "phys_pause") { if (string.IsNullOrEmpty(argument)) { console.Write("phys_pause is " + (paused ? "1" : "0")); } else { try { int arg = Convert.ToInt32(argument); if (arg == 0) { Paused = false; } else { Paused = true; } } catch (Exception) { console.Write(argument + " is not a valid argument. Use 0/1", ConsoleMessageType.Error); } } console.CommandHandled = true; } }
void ConsoleMessageHandler(string command, string argument) { switch (command) { case "movecamera": string[] coords = argument.Split(','); if (coords.Length != 2) { console.Write("Invalid coordinates: " + argument, ConsoleMessageType.Error); console.CommandHandled = true; break; } console.Write("Moving Camera to : " + argument); SetTarget(new Vector2(float.Parse(coords[0]), float.Parse(coords[1])), true); console.CommandHandled = true; break; } }
/// <summary> /// Initialises the level editor GUI /// </summary> public void InitEditor() { // Set up GUI GUIButton but_loadtexture = guimanager.AddButton(new Vector2(10, 10), "loadtexture", "Load Texture", new GUIButton.MouseClickHandler(testFunction)); guimanager.AddButton(new Vector2(10, 40), "physobj", "Add PhysObj", new GUIButton.MouseClickHandler(addPhysObj)); guimanager.AddEditBox(new Vector2(10, 70), "levelname", 100, "levelname"); guimanager.AddButton(new Vector2(10, 100), "loadlevel", "Load Level"); guimanager.AddButton(new Vector2(10, 130), "savelevel", "Save Level"); //guimanager.AddLabel(new Vector2(50, 150), "label", "THIS IS A LABEL! WOOO!"); console.Write("Level Editor Loaded."); }