public void Awake() { var harmony = new Harmony(GUID); harmony.PatchAll(); Settings = new PluginSettings(Config); InitialiseCommands(); LastChatType.Set(Settings.DefaultChatChannel); CurrentInputChatType.Set(LastChatType); Log($"Initialised {Name} ({Version})"); // Get the latest release from github and notify if there is a newer version. var latestReleaseVersion = GithubHelper.GetLatestGithubRelease(RepositoryAuthor, RepositoryName); if (!string.IsNullOrEmpty(latestReleaseVersion)) { if (VersionHelper.IsNewerVersion(Version, latestReleaseVersion)) { LogWarning($"Version {latestReleaseVersion} of VChat has been released, please see {RepositoryUrl}"); } else { Log($"{Name} ({Version}) is up to date."); } } }
public static bool UpdateCurrentChatTypeAndColor(InputField inputField, string text) { if (inputField != null && text != null) { bool foundCommand = false; var messageType = new CombinedMessageType(LastChatType.Value); // Attempt to look for the used chat channel if we're starting with the command prefix. if (text.StartsWith(CommandHandler.Prefix, StringComparison.CurrentCultureIgnoreCase)) { if (CommandHandler.IsValidCommandString(text, PluginCommandType.SendLocalMessage)) { messageType.Set(Talker.Type.Normal); foundCommand = true; } else if (CommandHandler.IsValidCommandString(text, PluginCommandType.SendWhisperMessage)) { messageType.Set(Talker.Type.Whisper); foundCommand = true; } else if (CommandHandler.IsValidCommandString(text, PluginCommandType.SendShoutMessage)) { messageType.Set(Talker.Type.Shout); foundCommand = true; } else if (CommandHandler.IsValidCommandString(text, PluginCommandType.SendGlobalMessage)) { messageType.Set(CustomMessageType.Global); foundCommand = true; } } // Use the default if we didn't bind /s yet. if ((!foundCommand || CommandHandler.Prefix != "/") && text.StartsWith("/s ", StringComparison.CurrentCultureIgnoreCase)) { messageType.Set(Talker.Type.Shout); } // Update the text to the used channel in the input box. if (!CurrentInputChatType.Equals(messageType)) { CurrentInputChatType = messageType; UpdateChatInputColor(inputField, CurrentInputChatType); } return(true); } return(false); }