static void Main(string[] args) { _presence = new RichPresence(); _presence.Initialize("407040311819370497"); _presence.Ready += Rpc_Ready; _presence.Disconnected += Rpc_Disconnected; _presence.Errored += Rpc_Errored; var callbackTask = RunCallbacks(); while (true) { var presence = Console.ReadLine(); if (presence == "q") { break; } _presence.Update(new RichPresenceBuilder().WithState("Testing discord-rpc.net", presence)); } Console.WriteLine("Disposing Discord RPC"); _presence.Shutdown(); callbackTask.Wait(3000); _presence.Dispose(); Console.WriteLine("Disposed."); Console.ReadLine(); }
public override void OnUpdate() { RichPresence.Update(); if (!client.isConnected && !server.IsRunning) { // This used to be used to connect to a server by using the SteamID in a config file, // but now it only causes confusion. if (Input.GetKeyDown(KeyCode.C)) { MelonLogger.LogError("Manually connecting to a server with the C keybind has been removed. Please use Discord invites."); } // If the user is not hosting, start their server if (Input.GetKeyDown(KeyCode.S)) { server.StartServer(); } } else { // If the user is connected, disconnect them if (Input.GetKeyDown(KeyCode.C)) { client.Disconnect(); } // If the user is hosting, stop their server if (Input.GetKeyDown(KeyCode.S)) { MelonLogger.Log("Stopping server..."); server.StopServer(); } } if (Input.GetKeyDown(KeyCode.X)) { Features.ClientSettings.hiddenNametags = !Features.ClientSettings.hiddenNametags; } }
public override void OnUpdate() { RichPresence.Update(); if (!client.isConnected && !server.IsRunning) { // If the user is not connected, start their client and attempt a connection if (Input.GetKeyDown(KeyCode.C)) { client.Connect(ModPrefs.GetString("MPMod", "HostSteamID")); } // If the user is not hosting, start their server if (Input.GetKeyDown(KeyCode.S)) { server.StartServer(); } if (Input.GetKeyDown(KeyCode.P)) { new PlayerRep("Dummy", SteamClient.SteamId); } } else { // If the user is connected, disconnect them if (Input.GetKeyDown(KeyCode.C)) { client.Disconnect(); } // If the user is hosting, stop their server if (Input.GetKeyDown(KeyCode.S)) { MelonModLogger.Log("Stopping server..."); server.StopServer(); } } }
private static void Rpc_Ready() { Console.WriteLine("Discord RPC is ready, type a message to update the game state. Type 'q' to exit."); _presence.Update(new RichPresenceBuilder().WithState("Ready to go!")); }