Example #1
0
 static void Postfix(PLInGameUI __instance, ref string __state)
 {
     if (PLNetworkManager.Instance.IsTyping)
     {
         PLNetworkManager.Instance.CurrentChatText = __state;
     }
 }
        static void Postfix(PLInGameUI __instance)
        {
            if (DebugModeCommand.DebugMode && PLServer.Instance != null && PLEncounterManager.Instance != null && PLNetworkManager.Instance != null && GameVersion.Version != string.Empty)
            {
                Vector3 pos;
                if (PLNetworkManager.Instance.LocalPlayer != null)
                {
                    PLPawn localPawn = PLNetworkManager.Instance.LocalPlayer.GetPawn();
                    pos = localPawn != null ? localPawn.transform.position : Vector3.zero;
                }
                else
                {
                    pos = Vector3.zero;
                }

                PLPersistantEncounterInstance encounter = PLEncounterManager.Instance.GetCurrentPersistantEncounterInstance();
                int levelID = encounter != null?encounter.LevelID.GetDecrypted() : -1;

                PLSectorInfo sectorInfo = PLServer.GetCurrentSector();
                string       visualType = sectorInfo != null?sectorInfo.VisualIndication.ToString() : "--";

                int sector = sectorInfo != null ? sectorInfo.ID : -1;

                PLGlobal.SafeLabelSetText(__instance.CurrentVersionLabel, $"{GameVersion.Version}\nPOS: {pos}, Level ID: {levelID}, Sector: {sector}, Visual: {visualType}");
            }
        }
Example #3
0
 static void Prefix(PLInGameUI __instance, ref string inMsg, bool isShadow, float alpha)
 {
     if (isShadow)
     {
         while (true)
         {
             int index = inMsg.IndexOf("<color=");
             if (index < 0)
             {
                 break;
             }
             int endIndex = index;
             for (; true; endIndex++)
             {
                 if (inMsg[endIndex] == '>')
                 {
                     break;
                 }
             }
             inMsg = inMsg.Remove(index, endIndex - index + 1);
             int index2 = inMsg.IndexOf("</color>");
             if (index2 < 0)
             {
                 break;
             }
             inMsg = inMsg.Remove(index2, 8);
         }
     }
 }
Example #4
0
        static void Prefix(PLInGameUI __instance, ref bool ___evenChatString, ref string __state)
        {
            PLNetworkManager networkManager = PLNetworkManager.Instance;

            if (networkManager.IsTyping)
            {
                ___evenChatString = false;
                __state           = networkManager.CurrentChatText;

                if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
                {
                    if (cursorPos2 == -1)
                    {
                        cursorPos2 = cursorPos;
                    }
                    HandleArrows(__state);
                    if (Input.GetKeyDown(KeyCode.Home))
                    {
                        cursorPos = __state.Length;
                    }
                    if (Input.GetKeyDown(KeyCode.End))
                    {
                        cursorPos = 0;
                    }
                }
                else
                {
                    if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.RightArrow) ||
                        (Input.GetKey(KeyCode.LeftArrow) && DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond > lastTimeLeft) ||
                        (Input.GetKey(KeyCode.RightArrow) && DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond > lastTimeRight))
                    {
                        cursorPos2 = -1;
                        HandleArrows(__state);
                    }
                    if (Input.GetKeyDown(KeyCode.Home))
                    {
                        cursorPos2 = -1;
                        cursorPos  = __state.Length;
                    }
                    if (Input.GetKeyDown(KeyCode.End))
                    {
                        cursorPos2 = -1;
                        cursorPos  = 0;
                    }
                }

                if (networkManager.CurrentChatText != null)
                {
                    if (TagFound(__state, networkManager, cursorPos) || TagFound(__state, networkManager, cursorPos2))
                    {
                        __instance.ChatLabel.supportRichText        = false;
                        __instance.ChatShadowLabel.supportRichText  = false;
                        __instance.ChatShadow2Label.supportRichText = false;
                    }
                    else
                    {
                        __instance.ChatLabel.supportRichText        = true;
                        __instance.ChatShadowLabel.supportRichText  = true;
                        __instance.ChatShadow2Label.supportRichText = true;
                    }
                    networkManager.CurrentChatText = networkManager.CurrentChatText.Insert(__state.Length - cursorPos, DateTime.Now.Millisecond >= 500 ? "|" : "'");
                    if (cursorPos2 != -1 && cursorPos2 != cursorPos)
                    {
                        networkManager.CurrentChatText = networkManager.CurrentChatText.Insert(__state.Length - cursorPos2 + (cursorPos > cursorPos2 ? 1 : 0), DateTime.Now.Millisecond >= 500 ? "¦" : "'");
                    }
                }
            }
            else
            {
                if (ChatHelper.isTyping)
                {
                    ChatHelper.isTyping      = false;
                    ChatHelper.typingHistory = null;
                }

                cursorPos  = 0;
                cursorPos2 = -1;
                __instance.ChatLabel.supportRichText        = true;
                __instance.ChatShadowLabel.supportRichText  = true;
                __instance.ChatShadow2Label.supportRichText = true;
            }
        }
Example #5
0
        static void Prefix(PLInGameUI __instance, ref bool ___evenChatString, ref string __state)
        {
            PLNetworkManager networkManager = PLNetworkManager.Instance;

            if (networkManager.IsTyping)
            {
                ___evenChatString = false;
                __state           = networkManager.CurrentChatText;

                if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
                {
                    if (cursorPos2 == -1)
                    {
                        cursorPos2 = cursorPos;
                    }
                    if (Input.GetKeyDown(KeyCode.LeftArrow))
                    {
                        lastTimeLeft = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond + /*(SystemInformation.KeyboardDelay + 1) **/ 250;
                        if (cursorPos < __state.Length)
                        {
                            cursorPos++;
                        }
                    }
                    if (Input.GetKeyDown(KeyCode.RightArrow))
                    {
                        lastTimeRight = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond + /*(SystemInformation.KeyboardDelay + 1) **/ 250;
                        if (cursorPos > 0)
                        {
                            cursorPos--;
                        }
                    }
                    if (Input.GetKeyDown(KeyCode.Home))
                    {
                        cursorPos = __state.Length;
                    }
                    if (Input.GetKeyDown(KeyCode.End))
                    {
                        cursorPos = 0;
                    }
                    if (Input.GetKey(KeyCode.LeftArrow) && DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond > lastTimeLeft)
                    {
                        lastTimeLeft += 30 /*(long)(1 / ((SystemInformation.KeyboardSpeed + 1) * 0.859375))*/;
                        if (cursorPos < __state.Length)
                        {
                            cursorPos++;
                        }
                    }
                    if (Input.GetKey(KeyCode.RightArrow) && DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond > lastTimeRight)
                    {
                        lastTimeRight += 30 /*(long)(1 / ((SystemInformation.KeyboardSpeed + 1) * 0.859375))*/;
                        if (cursorPos > 0)
                        {
                            cursorPos--;
                        }
                    }
                }
                else
                {
                    if (Input.GetKeyDown(KeyCode.LeftArrow))
                    {
                        cursorPos2   = -1;
                        lastTimeLeft = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond + 500 /*(SystemInformation.KeyboardDelay + 1) * 250*/;
                        if (cursorPos < __state.Length)
                        {
                            cursorPos++;
                        }
                    }
                    if (Input.GetKeyDown(KeyCode.RightArrow))
                    {
                        cursorPos2    = -1;
                        lastTimeRight = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond + 500 /*(SystemInformation.KeyboardDelay + 1) * 250*/;
                        if (cursorPos > 0)
                        {
                            cursorPos--;
                        }
                    }
                    if (Input.GetKeyDown(KeyCode.Home))
                    {
                        cursorPos2 = -1;
                        cursorPos  = __state.Length;
                    }
                    if (Input.GetKeyDown(KeyCode.End))
                    {
                        cursorPos2 = -1;
                        cursorPos  = 0;
                    }
                    if (Input.GetKey(KeyCode.LeftArrow) && DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond > lastTimeLeft)
                    {
                        cursorPos2    = -1;
                        lastTimeLeft += 30 /*(long)(1 / ((SystemInformation.KeyboardSpeed + 1) * 0.859375))*/;
                        if (cursorPos < __state.Length)
                        {
                            cursorPos++;
                        }
                    }
                    if (Input.GetKey(KeyCode.RightArrow) && DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond > lastTimeRight)
                    {
                        cursorPos2     = -1;
                        lastTimeRight += 30 /*(long)(1 / ((SystemInformation.KeyboardSpeed + 1) * 0.859375))*/;
                        if (cursorPos > 0)
                        {
                            cursorPos--;
                        }
                    }
                }

                if (networkManager.CurrentChatText != null)
                {
                    if (TagFound(__state, networkManager, cursorPos) || TagFound(__state, networkManager, cursorPos2))
                    {
                        __instance.ChatLabel.supportRichText        = false;
                        __instance.ChatShadowLabel.supportRichText  = false;
                        __instance.ChatShadow2Label.supportRichText = false;
                    }
                    else
                    {
                        __instance.ChatLabel.supportRichText        = true;
                        __instance.ChatShadowLabel.supportRichText  = true;
                        __instance.ChatShadow2Label.supportRichText = true;
                    }
                    networkManager.CurrentChatText = networkManager.CurrentChatText.Insert(__state.Length - cursorPos, DateTime.Now.Millisecond >= 500 ? "|" : " ");
                    if (cursorPos2 != -1 && cursorPos2 != cursorPos)
                    {
                        networkManager.CurrentChatText = networkManager.CurrentChatText.Insert(__state.Length - cursorPos2 + (cursorPos > cursorPos2 ? 1 : 0), DateTime.Now.Millisecond >= 500 ? "¦" : " ");
                    }
                }
            }
            else
            {
                cursorPos  = 0;
                cursorPos2 = -1;
                __instance.ChatLabel.supportRichText        = true;
                __instance.ChatShadowLabel.supportRichText  = true;
                __instance.ChatShadow2Label.supportRichText = true;
            }
        }