public void Awake() { DevConsole.RegisterConsoleCommand(this, "mplayer", false); DevConsole.RegisterConsoleCommand(this, "warpto", false); DevConsole.RegisterConsoleCommand(this, "disconnect", false); ClientLogger.SetLogLevel(ClientLogger.LogLevel.ConsoleMessages | ClientLogger.LogLevel.InGameMessages); this.gameObject.AddComponent <PlayerMovement>(); main = this; }
/// <summary> /// Execute this command. /// </summary> /// <param name="arguments"> The arguments to pass in. </param> public override void ExecuteCommand(string arguments) { try { FunctionsManager.DevConsole.CallWithError(FunctionName, ParseArguments(arguments)); } catch (Exception e) { DevConsole.LogError(e.Message); } }
private void SetPotatoMode(string[] args) { QualitySettings.vSyncCount = 0; QualitySettings.maxQueuedFrames = 2; QualitySettings.maximumLODLevel = 0; QualitySettings.skinWeights = SkinWeights.OneBone; SetFancy(false); DevConsole.ExecuteLine("graphics.postprocessing false"); DevConsole.ExecuteLine("graphics.antialiasing 1"); DevConsole.ExecuteLine("graphics.shadows false"); }
public IEnumerator StartSession() { DevConsole.RegisterConsoleCommand(this, "execute"); OnBeforeMultiplayerStart?.Invoke(); yield return(StartCoroutine(InitializeLocalPlayerState())); multiplayerSession.JoinSession(); InitMonoBehaviours(); Utils.SetContinueMode(true); SceneManager.sceneLoaded += SceneManager_sceneLoaded; }
protected override void _Initialize() { _dropdown.ClearOptions(); _enumType = DevConsole.GetVariableType(SettingName); if (_enumType == null || !_enumType.IsEnum) { Debug.LogError("SettingEnum on wrong type: " + SettingName); return; } _dropdown.AddOptions(Enum.GetNames(_enumType).ToList()); _dropdown.onValueChanged.AddListener(OnValueChanged); }
public void Start() { _controller = GetComponent <CharacterController>(); _footstepClip = ResourceManager.Load <ToriiAudioClip>( PathUtil.Combine(Application.streamingAssetsPath, "sfx", "SE_00003.ogg"), "global"); // this is the amount we want to travel along the head bob sine wave every second _sineStep = 2 * Mathf.PI / StepTimeSeconds; resetHeadbob(); DevConsole.Register(this); }
/// <summary> /// Executes the command. /// </summary> /// <param name="arguments"> Passes the arguments.</param> public void ExecuteCommand(string arguments) { try { Method(ParseArguments(arguments)); } catch (Exception e) { DevConsole.LogError(Errors.UnknownError(this)); UnityDebugger.Debugger.LogError("DevConsole", e.ToString()); } }
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"); } } }
public static void ExecuteCommand(object message, object command) { if (message != null) { ErrorMessage.AddMessage(message.ToString()); } if (command != null) { DevConsole.SendConsoleCommand(command.ToString()); } }
protected override void _Initialize() { base._Initialize(); DevConsole.RegisterVariable("net.downloadurl", "", () => _downloadUrl, delegate(string value) { _downloadUrl = value; FileSystem.Build(); }, this); }
public void Unpack() { if (this.unpackedMessages != null) { return; } this.breakdown.Add(NCPacketDataType.ExtraData, 64); this.unpackedMessages = new MultiMap <NetMessagePriority, NetMessage>(); foreach (NetMessagePriority key1 in Enum.GetValues(typeof(NetMessagePriority)).Cast <NetMessagePriority>()) { this.breakdown.Add(NCPacketDataType.ExtraData, 1); if (this._data.ReadBool()) { do { this.breakdown.Add(NCPacketDataType.ExtraData, 16); ushort key2 = this._data.ReadUShort(); NetMessage instance = Activator.CreateInstance(Network.typeToMessageID[key2], (object[])null) as NetMessage; instance.connection = this._receivedFrom; instance.priority = key1; instance.session = this.sessionIndex; instance.typeIndex = key2; int num = this._data.position + this._data.bitOffset; instance.Deserialize(this._data); int bits = this._data.position + this._data.bitOffset - num; switch (instance) { case NMEvent _: this.breakdown.Add(NCPacketDataType.Event, bits); break; case NMGhostState _: this.breakdown.Add(NCPacketDataType.Ghost, bits); break; default: this.breakdown.Add(NCPacketDataType.Other, bits); break; } if (!this.connection.hadConnection && !(instance is NMNetworkCoreMessage)) { DevConsole.Log(DCSection.NetCore, "|DGYELLOW|Received non-connection message during connection."); this.dropPacket = true; } else { this.unpackedMessages.Add(key1, instance); } this.breakdown.Add(NCPacketDataType.ExtraData, 1); }while (this._data.ReadBool()); } } }
public override void Execute(params string[] args) { GlobalConfig tss = (GlobalConfig)ConfigManager.GetOrLoadOrAdd <GlobalConfig>(); if (args == null || args.Length < 2) { DevConsole.WriteLine($"FPS Menu {tss.FPSMenu} Game {tss.FPSInGame}"); DevConsole.WriteLine("fps menu/game/current IntValue"); return; } int value = -1; if (!int.TryParse(args[1], out value)) { DevConsole.WriteLine($"Could not parse {value} to int32"); return; } if (args[0].Equals("menu", StringComparison.CurrentCultureIgnoreCase)) { tss.FPSMenu = value; DevConsole.WriteLine("Updated menu fps"); } else if (args[0].Equals("game", StringComparison.CurrentCultureIgnoreCase)) { tss.FPSInGame = value; DevConsole.WriteLine("Updated game fps"); } else if (args[0].Equals("current", StringComparison.CurrentCultureIgnoreCase)) { if (tss.FPSMenu == Application.targetFrameRate) { tss.FPSMenu = value; } else { tss.FPSInGame = value; } Application.targetFrameRate = value; DevConsole.WriteLine("Updated current fps"); } else { DevConsole.WriteLine($"Could not find '{args[0]}'"); return; } tss.Save(); }
private static IEnumerator ExecuteScript(string filename, string[] lines) { if (Executing != "") { ErrorMessage.AddMessage($"Script {Executing} already running, please wait before starting another."); yield break; } Executing = filename; ErrorMessage.AddMessage($"Executing script {filename}"); foreach (string s in lines) { //Logger.Log(Logger.Level.Debug, $"Read line '{s}' from file", null, true); ErrorMessage.AddMessage(s); //DevConsole.InternalSendConsoleCommand(s); string[] args = s.Split(new string[] { " " }, 2, System.StringSplitOptions.RemoveEmptyEntries); // Process special commands "wait" and "waitRT" // These differ in that "wait" is affected by the day/night speed and also by game pause, while "waitRT" is not. if (args[0].Substring(0, 4).ToLower() == "wait") { if (Single.TryParse(args[1], out float delay)) { bool bWaitRT = (args[0].Substring(4, 2).ToLower() == "rt"); if (bWaitRT) { yield return(new WaitForSecondsRealtime(delay)); ErrorMessage.AddMessage($"Waiting for {delay} seconds realtime..."); } else { yield return(new WaitForSeconds(delay)); ErrorMessage.AddMessage($"Waiting for {delay} seconds in-game..."); } } else { ErrorMessage.AddMessage($"Could not parse '{args[1]}' as number"); } } else { DevConsole.SendConsoleCommand(s); yield return(new WaitForEndOfFrame()); } } Executing = ""; yield break; }
public override void Activate() { Profile pro = DuckNetwork.profiles[profile]; if (!Reskin.Exists(md5)) { DevConsole.Log("recieved request for non existing md5", Color.Red); return; } DataTransferManager.SendLotsOfData(Reskin.hatData[md5], "reskin", connection); }
public void ResourceOverloadOptions_ToggleChanged(object sender, ToggleChangedEventArgs e) { if (e.Id != "ResourceMultiplierEnabled" && e.Id != "RegenSpawnsEnabled" && e.Id != "ResourceRandomizerEnabled" && e.Id != "ShowConfig" && e.Id != "resetDefaults") { return; } if (e.Id == "ResourceMultiplierEnabled") { Config.ToggleValue = e.Value; PlayerPrefsExtra.SetBool("ResourceMultiplierEnabled", e.Value); } if (e.Id == "RegenSpawnsEnabled") { Config.RegenSpawns = e.Value; PlayerPrefsExtra.SetBool("RegenSpawnsEnabled", e.Value); if (e.Value) { Config.ShowConfig = false; IngameMenu.main.Close(); DevConsole.SendConsoleCommand("entreset"); } } if (e.Id == "ShowConfig") { Config.ShowConfig = e.Value; PlayerPrefsExtra.SetBool("ShowConfig", e.Value); IngameMenu.main.Close(); IngameMenu.main.Open(); IngameMenu.main.ChangeSubscreen("Options"); } if (e.Id == "ResourceRandomizerEnabled") { Config.Randomization = e.Value; PlayerPrefsExtra.SetBool("ResourceRandomizerEnabled", e.Value); Config.ShowConfig = false; Config.RegenSpawns = true; IngameMenu.main.Close(); DevConsole.SendConsoleCommand("entreset"); } if (e.Id == "resetDefaults") { Config.resetDefaults = e.Value; PlayerPrefsExtra.SetBool("resetDefaults", e.Value); if (Config.resetDefaults) { Config.ShowConfig = false; Config.RegenSpawns = true; IngameMenu.main.Close(); DevConsole.SendConsoleCommand("entreset"); } } }
private SettingElement GetSettingElement(string settingName) { var custom = _customElements.FirstOrDefault(x => x.SettingName.Equals(settingName, StringComparison.OrdinalIgnoreCase)); if (custom != null) { return(custom.Element); } if (settingName.StartsWith("bind/")) { return(_bindElement); } var type = DevConsole.GetVariableType(settingName); if (type == null) { return(null); } if (type.IsEnum) { return(_enumElement); } if (type == typeof(Color)) { return(_colorElement); } switch (Type.GetTypeCode(type)) { case TypeCode.Int32: case TypeCode.Int64: case TypeCode.Int16: return(_integerElement); case TypeCode.Single: case TypeCode.Double: case TypeCode.Decimal: return(_floatElement); case TypeCode.String: return(_stringElement); case TypeCode.Boolean: return(_boolElement); default: return(null); } }
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 void ExecuteCommand(object message, object command) { if (message != null) { ErrorMessage.AddMessage(message.ToString()); } if (command != null) { SNLogger.Log((string)command); DevConsole.SendConsoleCommand(command.ToString()); } }
public void ExecuteCommand(string cmd, DevConsole console) { string lvlPath = cmd.Replace("edit_lvl ", ""); if (!lvlPath.EndsWith(".plvl")) { console.WriteLine("Error: Level files have to end with \".plvl\""); return; } ScreenHandler.SelectedScreen = new EditorScreen(lvlPath); console.WriteLine("Loading level..."); }
protected override void _Initialize() { DevConsole.RegisterCommand("net.disconnect", "Disconnects from the host", this, Cmd_Disconnect); DevConsole.RegisterCommand("disconnect", "Disconnects from the host", this, Cmd_Disconnect); DevConsole.RegisterCommand("net.fakelag", "", this, (e) => { _socket?.SetFakeLag(int.Parse(e[1])); }); DevConsole.RegisterCommand("net.fakeloss", "", this, (e) => { _socket?.SetFakeLoss(int.Parse(e[1])); }); }
internal static void Postfix(DevConsole __instance, string value, bool __result) { if (__result) { if (Main.Instance != null) { lock (value) { Main.Instance.onConsoleCommandEntered.Trigger(value); } } } }
/// <summary> /// Executes the command. /// </summary> /// <param name="arguments"> Passes the arguments.</param> public void ExecuteCommand(string arguments) { try { Method.Method.Invoke(Method.Target, ParseArguments(arguments)); } catch (Exception e) { // Debug Error DevConsole.LogError(Errors.ExecuteConsoleError.Description(this)); Debug.ULogErrorChannel("DevConsole", e.ToString()); } }
private static void ReadProjectData() { string projectPath = File.ReadAllText(GetDataPath() + @"\project_data.txt"); if (!string.IsNullOrEmpty(projectPath)) { Utilities.projectPath = projectPath; } else { DevConsole.Log(LogType.Error, "No project path found. Please write the path to 'Assets' folder in the project in this path: " + GetDataPath() + @"\project_data.txt"); } }
public override void Close() { if (!this.fixView) { this._showingMenu = false; this._editModMenu.Close(); Layer.HUD.camera.width /= 2f; Layer.HUD.camera.height /= 2f; this.fixView = true; DevConsole.RestoreDevConsole(); } base.Close(); }
protected override void OnPostInitialize() { base.OnPostInitialize(); if (configuration.isWorkshop) { DevConsole.Log("DuckUtils has been loaded as a workshop mod", Color.Purple); } else { DevConsole.Log("DuckUtils has been loaded as a local mod", Color.Yellow); } }
public override void OnExit(GameTime gameTime) { MouseEventDispatcher.OnMousePress -= OnMP; KeyboardEventDispatcher.OnKeyPressed -= OnKP; DestroyTools(); DestroyWidgets(); DestroyVoxWorld(); game.mRenderer.Texture = game.tMouseMain; if (DevConsole.IsActivated) { DevConsole.Toggle(OnDC); } }
protected override void _Initialize() { base._Initialize(); DevConsole.RegisterCommand("say", "Sends a chat message", this, (e) => { if (e.Length < 2 || Game.IsLocalServer) { return; } MessageAll(e[1]); }, true); }
public void NoCommandCouldBeFound_SHOULD_LogAnError() { // ARRANGE string command = "non_existent test"; string message = ""; // PERFORM DevConsole.RunCommand(command); message = logger.LogHistory.Dequeue().Text; // ASSERT Assert.IsTrue(message.StartsWith("'non_existent' is an unknown command, type 'help' for list")); }
internal static void Postfix(DevConsole __instance) { if (hooksLoaded) { return; } hooksLoaded = true; __instance.gameObject.AddComponent <QMMHooks>(); Logger.Debug("Old hooks loaded"); Start?.Invoke(); }
protected unsafe override void OnPlayerPacketReceived(IPlayer player, IBasePacket packet) { if (!(packet is CompressedVoiceData voicePacket)) { return; } if (Game.IsHost) { var packetToSend = PacketUtility.TakePacket <CompressedVoiceData>(); packetToSend.SetData(voicePacket.Data, voicePacket.DataLength); packetToSend.ClientIndex = player.ClientIndex; Server.GameServer.Instance.Socket.BroadcastPacket(packetToSend); } else { var vol = DevConsole.GetVariable <float>("audio.voiceoutput"); if (vol == 0) { return; } var clientIndex = voicePacket.ClientIndex; if (clientIndex == Game.ClientIndex && !_loopback) { return; } int uncompressedDataLength = 0; var speakingPlayer = Game.PlayerManager.FindPlayer(clientIndex); fixed(byte *src = voicePacket.Data) { fixed(byte *dst = _data) { uncompressedDataLength = SteamUser.DecompressVoice((IntPtr)src, voicePacket.DataLength, (IntPtr)dst, _data.Length); } } if (uncompressedDataLength == 0 || speakingPlayer == null) { return; } throw new System.NotImplementedException(); // _data to audio.. //UnityEngine.Debug.Log($"size: {data.Length} - group: {getChannelGroupResult} - create: {createSoundResult} - play: {playSoundResult}"); } }