public static void EndPrompts() { var mymod = HamstarHelpersMod.Instance; mymod.Config.IsServerPromptingForBrowser = false; mymod.ConfigJson.SaveFile(); if (Main.netMode == 2) { PacketProtocol.QuickSendToClient <ModSettingsProtocol>(-1, -1); } }
public static void QuickSendData <T>(int to_who, int ignore_who, bool sync_to_clients) where T : PacketProtocol, new() { if (Main.netMode == 1) { if (sync_to_clients) { PacketProtocol.QuickSyncToServerAndClients <T>(); } else { PacketProtocol.QuickSendToServer <T>(); } } else if (Main.netMode == 2) { PacketProtocol.QuickSendToClient <T>(to_who, ignore_who); } }
/// <summary> /// "Quick" method for sending packets with any PacketProtocolSendToClient class. Intended to be wrapped with a `public static` method. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="toWho">Player "whoAmI" value to send the packet to. -1 for everyone.</param> /// <param name="ignoreWho">Player "whoAmI" value to skip sending packet to. -1 for no one.</param> protected static void QuickSend <T>(int toWho, int ignoreWho) where T : PacketProtocolSendToClient { PacketProtocol.QuickSendToClient <T>(toWho, ignoreWho); }
/// <summary> /// "Quick" method for syncing packets from server to a given client with any PacketProtocolSyncClient class. /// Intended to be wrapped with a `public static` method. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="toWho"></param> /// <param name="ignoreWho"></param> protected static void SyncFromServer <T>(int toWho, int ignoreWho) where T : PacketProtocolSyncClient { PacketProtocol.QuickSendToClient <T>(toWho, ignoreWho); }