/// <summary> /// Runs the help method of the passed interface. /// </summary> public static void ShowHelpMethod(CommandBase help) { if (string.IsNullOrEmpty(help.DetailedDescriptiveText) && string.IsNullOrEmpty(help.DescriptiveText)) { DevConsole.Log("<color=yellow>Command Info:</color> <color=red>There's no help for this command</color>"); return; } Log("<color=yellow>Command Info:</color> " + (string.IsNullOrEmpty(help.DetailedDescriptiveText) ? help.DescriptiveText : help.DetailedDescriptiveText)); Log("<color=yellow>Call it like </color><color=orange> " + help.Title + GetParameters(help) + "</color>"); }
public static void IsWorkSpotClear(string type, Vector3 pos) { if (GetCurrentWorld().FurnitureManager.IsWorkSpotClear(type, GetTileAt(pos))) { DevConsole.Log("Work spot is clear!", "green"); } else { DevConsole.LogWarning("Work spot isn't clear!"); } }
public static void IsPlacementValid(string type, Vector3 pos, float rotation) { if (GetCurrentWorld().FurnitureManager.IsPlacementValid(type, GetTileAt(pos), rotation)) { DevConsole.Log("Spot is valid!", "green"); } else { DevConsole.LogWarning("Spot isn't valid!"); } }
public static void GetCharacterNames() { World world; if (ModUtils.GetCurrentWorld(out world)) { foreach (Character character in world.CharacterManager) { DevConsole.Log("Say hello to " + character.GetName(), "green"); } } }
private static void Help() { foreach (var command in DevConsole.GetCommands()) { DevConsole.LogMessage(command.ToString()); } foreach (var command in DevConsole.GetConVars()) { DevConsole.LogMessage(command.ToString()); } }
public static void GetAllRoomIDs() { World world; if (ModUtils.GetCurrentWorld(out world)) { DevConsole.Log("Room IDs:"); foreach (Room room in world.RoomManager) { DevConsole.Log("Room " + room.ID, "green"); } } }
public static void SetFontSize(int size) { if (size < 10) { DevConsole.LogError("Font size would be too small"); } else if (size > 20) { DevConsole.LogError("Font size would be too big"); } else { DevConsole.TextObject().fontSize = size; DevConsole.Log("Change successful :D", "green"); } }
public static void IsWorkSpotClear(string type, Vector3 pos) { World world; Tile t; if (ModUtils.GetCurrentWorld(out world) && ModUtils.GetTileAt(pos, out t)) { if (world.FurnitureManager.IsWorkSpotClear(type, t)) { DevConsole.Log("Work spot is clear!", "green"); } else { DevConsole.LogWarning("Work spot isn't clear!"); } } }
/// <summary> /// Instance/Singleton management. /// </summary> private void Awake() { // Guard if (instance != this && instance != null) { // Destroy instance. UnityDebugger.Debugger.LogError("DevConsole", "There can only be one Console per 'game'. Deleting instance with name: " + gameObject.name); Destroy(gameObject); } else { instance = this; KeyboardManager.Instance.RegisterModalInputField(inputField); KeyboardManager.Instance.RegisterInputAction("DevConsole", KeyboardMappedInputType.KeyUp, ToggleConsole); } }
public static void IsPlacementValid(string type, Vector3 pos, float rotation) { World world; Tile t; if (ModUtils.GetCurrentWorld(out world) && ModUtils.GetTileAt(pos, out t)) { if (world.FurnitureManager.IsPlacementValid(type, t, rotation)) { DevConsole.Log("Spot is valid!", "green"); } else { DevConsole.LogWarning("Spot isn't valid!"); } } }
public static void Help() { DevConsole.Log("-- Help --", "green"); string text = string.Empty; CommandBase[] consoleCommands = DevConsole.CommandArray(); for (int i = 0; i < consoleCommands.Length; i++) { text += "\n<color=orange>" + consoleCommands[i].Title + DevConsole.GetParameters(consoleCommands[i]) + "</color>" + (consoleCommands[i].DescriptiveText == null ? string.Empty : " //" + consoleCommands[i].DescriptiveText); } DevConsole.Log(text); DevConsole.Log("<color=orange>Note:</color> If the function has no parameters you <color=red> don't</color> need to use the parameter modifier."); DevConsole.Log("<color=orange>Note:</color> You <color=red>don't</color> need to use the trailing parameter modifier either"); }
public static void NewCharacter(Vector3 pos, string name = "") { World world; Tile t; if (ModUtils.GetCurrentWorld(out world) && ModUtils.GetTileAt(pos, out t)) { Character character = world.CharacterManager.Create(t); if (character != null) { if (name != string.Empty) { character.name = name; } DevConsole.Log("Say hello to: " + character.GetName()); } } }
private bool InformFailedParse(int argPos, FailReason reason) { switch (reason) { case FailReason.ParseFailed: DevConsole.LogError($"Failed to run command. Failed to parse arg at pos {argPos}."); break; case FailReason.NoArgsPassed: DevConsole.LogError("Failed to run command. This command requires args to be passed."); break; case FailReason.NotEnoughArgs: DevConsole.LogError("Failed to run command. Not enough args passed."); break; default: DevConsole.LogError($"Failed to run command. Arg type unknown or failed to parse an arg at pos {argPos}."); break; } return(false); }
/// <summary> /// Raises the enable event. It just does some instance checking. /// </summary> private void OnEnable() { // Guard if (instance != this && instance != null) { // Destroy instance. UnityDebugger.Debugger.LogError("DevConsole", "There can only be one Console per project. Deleting instance with name: " + instance.gameObject.name); Destroy(instance.gameObject); } // Saves a small amount of extra calls and what not if (instance != this) { instance = this; KeyboardManager.Instance.RegisterModalInputField(inputField); KeyboardManager.Instance.RegisterInputAction("DevConsole", KeyboardMappedInputType.KeyUp, ToggleConsole); } if (CommandSettings.DeveloperConsoleToggle == false || closed) { Close(); } }
public static void SetText(string text) { DevConsole.TextObject().text = "\n" + text; }
public static void GetTemperature(Vector3 pos) { DevConsole.Log("Temperature: " + GetCurrentWorld().temperature.GetTemperature((int)pos.x, (int)pos.y, (int)pos.z), "green"); }
public static void GetThermallDiffusivity(Vector3 pos) { DevConsole.Log("Thermal Diffusivity: " + GetCurrentWorld().temperature.GetThermalDiffusivity((int)pos.x, (int)pos.y, (int)pos.z), "green"); }
/// <summary> /// Clears the text area and history. /// </summary> public static void Clear() { DevConsole.ClearHistory(); SetText("\n<color=green>Clear Successful :D</color>"); }
public static void DoBuildHelp() { DevConsole.Log("Does build mode using the furniture/floor/whatever type provided at position pos"); DevConsole.Log("The options for build mode are: FLOOR = 0, ROOMBEHAVIOUR= 1, FURNITURE= 2, UTILITY = 3, and DECONSTRUCT= 4"); }
public static void Exit() { DevConsole.Close(); }
public static void Status() { DevConsole.Log("Developer Mode is " + (CommandSettings.DeveloperModeToggle ? "on" : "off"), "yellow"); DevConsole.Log("Time is " + (TimeManager.Instance.IsPaused ? "paused" : TimeManager.Instance.TimeScale + "x"), "yellow"); }