#undef DEBUG using System.Collections.Generic; using System.ComponentModel; using System.Linq; using RageCoop.Core; namespace RageCoop.Client { /// /// ? /// public static class API { public static class Config { /// /// Enable automatic respawn. /// public static bool EnableAutoRespawn { get; set; } = true; /// /// Don't show other player's name tag /// public static bool DisplayNameTag { get; set; }=true; /// /// Show other players' blip on map /// public static bool DisplayBlip { get; set; } = true; } #region DELEGATES /// /// ? /// /// /// The player's id /// public delegate void ConnectEvent(bool connected, int from, string reason = null); /// /// ? /// /// /// The Lidgren-Network net handle /// public delegate void ChatMessage(string from, string message, CancelEventArgs args); /// /// ? /// /// The Lidgren-Network net handle /// /// /// #endregion /// /// ? /// public static event ChatMessage OnChatMessage; /// /// Send a local chat message to this player /// /// Username of the player who sent this message /// The player's message public static void LocalChatMessage(string from, string message) { Main.MainChat.AddMessage(from, message); } /// /// Disconnect from the server /// public static void Disconnect() { Networking.ToggleConnection(null); } /// /// Check if the player is already on a server /// public static bool IsOnServer { get { return Networking.IsOnServer; } } /// /// Get the local player's ID /// /// PlayerID public static int LocalPlayerID { get { return Main.LocalPlayerID; } } /// /// Check if a RAGECOOP menu is visible /// public static bool IsMenuVisible { get { return Menus.CoopMenu.MenuPool.AreAnyVisible; } } /// /// Check if the RAGECOOP chat is visible /// public static bool IsChatFocused { get { return Main.MainChat.Focused; } } /// /// Check if the RAGECOOP list of players is visible /// public static bool IsPlayerListVisible { get { return Util.GetTickCount64() - PlayerList.Pressed < 5000; } } /// /// Get the version of RAGECOOP /// public static string CurrentVersion { get { return Main.CurrentVersion; } } /// /// Get or set local player's username, set won't be effective if already connected to a server. /// public static string Username { get { return Main.Settings.Username; } set { if (IsOnServer || string.IsNullOrEmpty(value)) { return; } Main.Settings.Username = value; } } } }