Пример #1
0
        internal override void Update()
        {
            if (mod.config.StatsDisplayAttachToObjectivePanel.Value)
            {
                if (stupidBuffer != null)
                {
                    stupidBuffer.transform.SetAsLastSibling();
                }
                if (statsDisplayContainer != null)
                {
                    statsDisplayContainer.transform.SetAsLastSibling();
                }
            }
            if (mod.HUD != null && textMesh != null)
            {
                playerBody = mod.HUD.targetBodyObject ? mod.HUD.targetBodyObject.GetComponent <CharacterBody>() : null;
                if (playerBody != null)
                {
                    bool customBindPressed = Input.GetKey(mod.config.StatsDisplayCustomBind.Value);
                    if (Input.GetKeyDown(mod.config.StatsDisplayCustomBind.Value))
                    {
                        statsDisplayToggle = !statsDisplayToggle;
                    }
                    bool showStatsDisplay = mod.config.StatsDisplayToggleOnBind.Value ? statsDisplayToggle : !(mod.config.StatsDisplayShowCustomBindOnly.Value && !customBindPressed);

                    highestMultikill = playerBody.multiKillCount > highestMultikill ? playerBody.multiKillCount : highestMultikill;

                    statsDisplayContainer.SetActive(showStatsDisplay);
                    if (showStatsDisplay)
                    {
                        BetterUI.sharedStringBuilder.Clear();
                        if (customBindPressed)
                        {
                            for (int i = 0; i < altText.Length; i++)
                            {
                                if (i % 2 == 0)
                                {
                                    BetterUI.sharedStringBuilder.Append(altText[i]);
                                }
                                else
                                {
                                    BetterUI.sharedStringBuilder.Append(regexmap[altText[i]](playerBody));
                                }
                            }
                        }
                        else
                        {
                            for (int i = 0; i < normalText.Length; i++)
                            {
                                if (i % 2 == 0)
                                {
                                    BetterUI.sharedStringBuilder.Append(normalText[i]);
                                }
                                else
                                {
                                    BetterUI.sharedStringBuilder.Append(regexmap[normalText[i]](playerBody));
                                }
                            }
                        }
                        textMesh.SetText(BetterUI.sharedStringBuilder);
                    }
                }
            }
        }