static void Postfix() { Update.publicCached = false; HandlePublicCommands.RequestPublicCommands(); }
static void Prefix(PLNetworkManager __instance) { currentChatText = __instance.CurrentChatText; if (__instance.IsTyping && (HarmonyHandleChat.cursorPos > 0 || HarmonyHandleChat.cursorPos2 > 0)) { foreach (char c in Input.inputString) { if (c == "\b"[0]) { if (HarmonyHandleChat.cursorPos2 != -1 && HarmonyHandleChat.cursorPos2 != HarmonyHandleChat.cursorPos) { DeleteSelected(); } else { if (HarmonyHandleChat.cursorPos != currentChatText.Length) { currentChatText = currentChatText.Remove(currentChatText.Length - HarmonyHandleChat.cursorPos - 1, 1); } } textModified = true; } else if (c == Environment.NewLine[0] || c == "\r"[0]) { //Do nothing } else { if (HarmonyHandleChat.cursorPos2 != -1 && HarmonyHandleChat.cursorPos2 != HarmonyHandleChat.cursorPos) { DeleteSelected(); } currentChatText = currentChatText.Insert(currentChatText.Length - HarmonyHandleChat.cursorPos, c.ToString()); textModified = true; } } if (Input.GetKeyDown(KeyCode.Delete)) { lastTimeDelete = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond + /*(SystemInformation.KeyboardDelay + 1) **/ 250; if (HarmonyHandleChat.cursorPos2 != -1 && HarmonyHandleChat.cursorPos2 != HarmonyHandleChat.cursorPos) { DeleteSelected(); } else { currentChatText = currentChatText.Remove(currentChatText.Length - HarmonyHandleChat.cursorPos, 1); HarmonyHandleChat.cursorPos--; } textModified = true; } if (Input.GetKey(KeyCode.Delete) && DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond > lastTimeDelete) { lastTimeDelete += 30 /*(long)(1 / ((SystemInformation.KeyboardSpeed + 1) * 0.859375))*/; currentChatText = currentChatText.Remove(currentChatText.Length - HarmonyHandleChat.cursorPos, 1); HarmonyHandleChat.cursorPos--; textModified = true; } } else if (__instance.IsTyping) { if (Input.GetKeyDown(KeyCode.Tab)) { if (currentChatText.StartsWith("/")) { currentChatText = AutoComplete(currentChatText, GetCommands()); textModified = true; } else if (currentChatText.StartsWith("!")) { if (publicCached) { currentChatText = AutoComplete(currentChatText, publicCommands); textModified = true; } else { HandlePublicCommands.RequestPublicCommands(); } } } } }