static public GameObject SpawnButtonSize(GameObject parent, Sprite sprite, ColorBlock colourBlock, Vector2 pivot, Vector2 givenSize, bool isFallback = false)
            {
                GameObject button = new GameObject();

                button.name             = "Button";
                button.transform.parent = parent.transform;
                button.AddComponent <RoR2.UI.MPEventSystemLocator>();

                Image buttonImage = button.AddComponent <Image>();

                buttonImage.color         = new Color(1, 1, 1, 1);
                buttonImage.sprite        = sprite;
                buttonImage.type          = Image.Type.Sliced;
                buttonImage.raycastTarget = true;

                RoR2.UI.HGButton buttonButton = button.AddComponent <RoR2.UI.HGButton>();
                buttonButton.showImageOnHover = true;
                buttonButton.targetGraphic    = buttonImage;
                buttonButton.colors           = colourBlock;
                if (isFallback)
                {
                    buttonButton.defaultFallbackButton = true;
                }
                buttonButton.disableGamepadClick = true;

                RectTransform buttonTransform = button.GetComponent <RectTransform>();

                buttonTransform.pivot     = pivot;
                buttonTransform.anchorMin = new Vector2(0, 1);
                buttonTransform.anchorMax = new Vector2(0, 1);
                buttonTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, givenSize.x);
                buttonTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, givenSize.y);
                buttonTransform.localScale = new Vector3(1, 1, 1);
                return(button);
            }
示例#2
0
            static void DrawInfoPanel()
            {
                Transform background = ElementCreator.SpawnImageOffset(new List <Image>(), UIDrawer.rootTransform.transform.parent.gameObject, null, new Color(0, 0, 0, 0.95f), new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero).transform;

                background.GetComponent <Image>().raycastTarget = true;

                GameObject    panelOutline   = PanelCreator.CreatePanelSize(background);
                RectTransform panelTransform = panelOutline.GetComponent <RectTransform>();
                float         panelWidth     = 700 + UIConfig.panelPadding * 2 + 10;
                float         panelHeight    = 600 + UIConfig.panelPadding * 2 + 10;

                if (Data.mode == DataNoShop.mode)
                {
                    panelHeight = 500 + UIConfig.panelPadding * 2 + 10;
                }
                panelTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, panelWidth);
                panelTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, panelHeight);
                panelTransform.localPosition = new Vector3(-panelWidth / 2f, panelHeight / 2f, 0);
                RectTransform panelChildTransform = panelTransform.GetChild(0).GetComponent <RectTransform>();

                List <TMPro.TextMeshProUGUI> text = new List <TMPro.TextMeshProUGUI>();

                ElementCreator.SpawnTextOffset(text, panelChildTransform.gameObject, new Color(1, 1, 1), 24, 0, new Vector2(UIConfig.spacingHorizontal, UIConfig.spacingVertical + UIConfig.blackButtonHeight + UIConfig.spacingVertical), new Vector2(-UIConfig.spacingHorizontal, -UIConfig.spacingVertical));
                if (Data.mode == DataShop.mode)
                {
                    text[0].text  = "UES EMPLOYMENT CONTRACT";
                    text[0].text += "\nSUBSECTION 17b: SALVAGE";
                    text[0].text += "\n";
                    text[0].text += "\nShould the employee be deployed to the site of any crashed UES vessels they are to prioritize the recovery of any intact cargo. As part of our vertical integration policies (38d), the employee will be reimbursed for any cargo salvaged with increased UES Aptitude Scores (11a). The category of aptitude increased is dependant on the value of the cargo salvaged, as this demonstrates ability of the employee work to UES’s interests. Employees with sufficiently high scores may redeem them to enrol in approved UES corporate training courses, to be upskilled in the use of various UES products. Should the employee perish during deployment (41a), a drone will be dispatched to recover any cargo that was in their possession. Any Aptitude Score owing will be accredited to the employee’s next of kin, should they also be an employee of UES, as well as the right to enrol in any corporate training courses the employee had previously redeemed.";
                }
                else if (Data.mode == DataNoShop.mode)
                {
                    text[0].text  = "UES EMPLOYMENT CONTRACT";
                    text[0].text += "\nSUBSECTION 45a: TRAINING";
                    text[0].text += "\n";
                    text[0].text += "\nUES endeavours to ensure that all its employees are as equipped as necessary to complete their assigned duties. To this end numerous corporate training courses have been made available, to upskill employees in the use of various UES products. A thorough analysis of employee aptitude concluded that employees with a close familial relation on the Board of Directors (3b) are more capable than any others. To this end, any such employee is afforded the right to enrol in any course that they deem, in their own judgement, to be of a benefit in fulfilling their duties. UES will take aggressive legal action against any employee alleging bias or nepotism in regards to this matter. The employee agrees to waive their right to a lawyer (42a) should they be sued in regards to this matter.";
                }

                GameObject    backButton          = ButtonCreator.SpawnBlackButton(panelChildTransform.gameObject, new Vector2(UIConfig.blackButtonWidth, UIConfig.blackButtonHeight), "Back", new List <TMPro.TextMeshProUGUI>());
                RectTransform backButtonTransform = backButton.transform.parent.GetComponent <RectTransform>();

                backButtonTransform.localPosition = new Vector3(panelWidth / 2f - UIConfig.blackButtonWidth / 2f, -panelHeight + UIConfig.spacingVertical + UIConfig.blackButtonHeight, backButtonTransform.localPosition.z);

                RoR2.UI.HGButton previousSelectable = backButton.GetComponent <RoR2.UI.MPEventSystemLocator>().eventSystem.currentSelectedGameObject.GetComponent <RoR2.UI.HGButton>();
                Button           backButtonButton   = backButton.GetComponent <RoR2.UI.HGButton>();

                backButtonButton.onClick.AddListener(() => {
                    UIDrawer.rootTransform.GetComponent <CanvasGroup>().interactable = true;
                    if (backButtonButton.GetComponent <RoR2.UI.MPEventSystemLocator>().eventSystem.currentInputSource == RoR2.UI.MPEventSystem.InputSource.Gamepad)
                    {
                        previousSelectable.Select();
                    }
                    else
                    {
                        previousSelectable.enabled = false;
                        previousSelectable.enabled = true;
                    }
                    Destroy(background.gameObject);
                });
                backButtonButton.Select();

                UIDrawer.rootTransform.GetComponent <CanvasGroup>().interactable = false;
            }
            static void DrawInfoPanel()
            {
                rootTransform.GetComponent <CanvasGroup>().interactable = false;

                Transform background = ElementCreator.SpawnImageOffset(new List <Image>(), UIDrawer.rootTransform.transform.parent.gameObject, null, new Color(0, 0, 0, 0.95f), new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero).transform;

                background.GetComponent <Image>().raycastTarget = true;

                GameObject    panelOutline   = PanelCreator.CreatePanelSize(background);
                RectTransform panelTransform = panelOutline.GetComponent <RectTransform>();
                float         panelWidth     = 700 + UIConfig.panelPadding * 2 + 10;
                float         panelHeight    = 650 + UIConfig.panelPadding * 2 + 10;

                if (Data.earningMethod == 2 || Data.mode == DataFree.mode)
                {
                    panelHeight = 525 + UIConfig.panelPadding * 2 + 10;
                }
                panelTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, panelWidth);
                panelTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, panelHeight);
                panelTransform.localPosition = new Vector3(-panelWidth / 2f, panelHeight / 2f, 0);
                RectTransform panelChildTransform = panelTransform.GetChild(0).GetComponent <RectTransform>();

                List <TMPro.TextMeshProUGUI> text = new List <TMPro.TextMeshProUGUI>();

                ElementCreator.SpawnTextOffset(text, panelChildTransform.gameObject, new Color(1, 1, 1), 24, 0, new Vector2(UIConfig.spacingHorizontal, UIConfig.spacingVertical + UIConfig.blackButtonHeight + UIConfig.spacingVertical), new Vector2(-UIConfig.spacingHorizontal, -UIConfig.spacingVertical));
                if (Data.mode == DataFree.mode)
                {
                    text[0].text  = "UES EMPLOYMENT CONTRACT";
                    text[0].text += "\nSUBSECTION 45b: REQUSITION";
                    text[0].text += "\n";
                    text[0].text += "\nUES always strives to ensure that all its employees are as equipped as necessary to complete their assigned duties. However, UES has finite resources and must determine in who’s hands those resources can be put to the best use. A thorough analysis of employee aptitude concluded that employees with a close familial relation on the Board of Directors (3b) are most able to use the resources of UES to their fullest capacity. To this end, any such employee is afforded the right to requisition any items or equipment they deem, in their own judgement, to be of a benefit in fulfilling their duties. UES will take aggressive legal action against any employee alleging bias or nepotism in regards to this matter. The employee agrees to waive their right to a lawyer (42a) should they be sued in regards to this matter.";
                }
                else if (Data.mode == DataRandom.mode)
                {
                    text[0].text  = "UES EMPLOYMENT CONTRACT";
                    text[0].text += "\nSUBSECTION 50a: EQUIPPING";
                    text[0].text += "\n";
                    text[0].text += "\nUES always strives to ensure that all its employees are as equipped as necessary to complete their assigned duties. However, UES has finite resources and must determine in who’s hands those resources can be put to the best use. To this end, a thorough analysis is conducted prior to any deployment to determine which, if any, equipment will give the employee the greatest chance of success. The employee agrees that this analysis its conclusions are infallible and that the manner in which the employee is equipped cannot be the basis for any suit against UES. UES will take aggressive legal action against any employee alleging that equipment is, instead, assigned arbitrarily. The employee agrees to waive their right to a lawyer (42a) should they be sued in regards to this matter.";
                }
                else if (Data.earningMethod == 1)
                {
                    text[0].text  = "UES EMPLOYMENT CONTRACT";
                    text[0].text += "\nSUBSECTION 18a: BOUNTIES";
                    text[0].text += "\n";
                    if (Data.mode == DataEarntPersistent.mode)
                    {
                        text[0].text += "\nWhile deployed, UES employees should at all times endeavour to improve the relative safety of any environment they find themselves in. To this end, all employees are equipped a UES Threat Level Detection system which will quantify the threat of hostile organisms in the employee’s vicinity. If the organism is deemed to pose an imminent threat to UES operations, as part of our vertical integration policies (38b), the employee will be rewarded with supplemental UES Credits (10a) for eliminating the threat. Credits awarded is dependent upon the threat level of the organism. Credits can be exchanged for any items currently available in the UES Catalogue. Should the employee perish during deployment (41a), a drone will be dispatched to recover any items that were in their possession. Any Credits owing will be accredited to the employee’s next of kin, should they also be an employee of UES, as well as any items they owned.";
                    }
                    else if (Data.mode == DataEarntConsumable.mode)
                    {
                        text[0].text += "\nWhile deployed, UES employees should at all times endeavour to improve the relative safety of any environment they find themselves in. To this end, all employees are equipped a UES Threat Level Detection system which will quantify the threat of hostile organisms in the employee’s vicinity. If the organism is deemed to pose an imminent threat to UES operations, as part of our vertical integration policies (38b), the employee will be rewarded with supplemental UES Credits (10a) for eliminating the threat. Credits awarded is dependent upon the threat level of the organism. Credits can be exchanged for the loan of any items currently available in the UES Catalogue. Any items in the possession of an employee returning from a deployment will be reclaimed for refurbishment, the employee will not be reimbursed. Should the employee perish during deployment (41a), any Credits owing will be accredited to the employee’s next of kin, should they also be an employee of UES.";
                    }
                }
                else if (Data.earningMethod == 0)
                {
                    text[0].text  = "UES EMPLOYMENT CONTRACT";
                    text[0].text += "\nSUBSECTION 23a: TELEPORTATION";
                    text[0].text += "\n";
                    if (Data.mode == DataEarntPersistent.mode)
                    {
                        text[0].text += "\nThe employee agrees that primitive teleportation technology has no adverse, health related side effects and that any claims otherwise are unfounded. Should the employee be required to utilize primitive teleporters in the fulfilment of their duties while deployed, the employee agrees that UES is released from all responsibility and liability, and as part of our vertical integration policies (38b), will receive supplemental UES Credits (10a). Credits awarded is dependent upon the number of teleporter journeys the employee made during deployment and the effectiveness of the employee in carrying out the duties outlined in this contract. Credits can be exchanged for any items currently available in the UES Catalogue. Should the employee perish during deployment (41a), a drone will be dispatched to recover any items that were in their possession. Any Credits owing will be accredited to the employee’s next of kin, should they also be an employee of UES, as well as any items they owned.";
                    }
                    else if (Data.mode == DataEarntConsumable.mode)
                    {
                        text[0].text += "\nThe employee agrees that primitive teleportation technology has no adverse, health related side effects and that any claims otherwise are unfounded. Should the employee be required to utilize primitive teleporters in the fulfilment of their duties while deployed, the employee agrees that UES is released from all responsibility and liability, and as part of our vertical integration policies (38b), will receive supplemental UES Credits (10a). Credits awarded is dependent upon the number of teleporter journeys the employee made during deployment and the effectiveness of the employee in carrying out the duties outlined in this contract. Credits can be exchanged for the loan of any items currently available in the UES Catalogue. Any items in the possession of an employee returning from a deployment will be reclaimed for refurbishment, the employee will not be reimbursed. Should the employee perish during deployment (41a), any Credits owing will be accredited to the employee’s next of kin, should they also be an employee of UES.";
                    }
                }
                else if (Data.earningMethod == 2)
                {
                    text[0].text  = "UES EMPLOYMENT CONTRACT";
                    text[0].text += "\nSUBSECTION 14a: PERFORMANCE BONUSES";
                    text[0].text += "\n";
                    if (Data.mode == DataEarntPersistent.mode)
                    {
                        text[0].text += "\nIt is UES policy that the ends always justify the means (40d). To this end, as part of our vertical integration policies (38b), employees may earn an allotment of supplemental UES Credits (10a) when returning from deployment. Credits awarded is dependent upon the outcome of the deployment and is in no way impacted by the manner in which that outcome was achieved. Credits can be exchanged for any items currently available in the UES Catalogue. Should the employee perish during deployment (41a), a drone will be dispatched to recover any items that were in their possession. Any Credits owing will be accredited to the employee’s next of kin, should they also be an employee of UES, as well as any items they owned.";
                    }
                    else if (Data.mode == DataEarntConsumable.mode)
                    {
                        text[0].text += "\nIt is UES policy that the ends always justify the means (40d). To this end, as part of our vertical integration policies (38b), employees may earn an allotment of supplemental UES Credits (10a) when returning from deployment. Credits awarded is dependent upon the outcome of the deployment and is in no way impacted by the manner in which that outcome was achieved. Credits can be exchanged for the loan of any items currently available in the UES Catalogue. Any items in the possession of an employee returning from a deployment will be reclaimed for refurbishment, the employee will not be reimbursed. Should the employee perish during deployment (41a), any Credits owing will be accredited to the employee’s next of kin, should they also be an employee of UES.";
                    }
                }

                GameObject    backButton          = ButtonCreator.SpawnBlackButton(panelChildTransform.gameObject, new Vector2(UIConfig.blackButtonWidth, UIConfig.blackButtonHeight), "Back", new List <TMPro.TextMeshProUGUI>());
                RectTransform backButtonTransform = backButton.transform.parent.GetComponent <RectTransform>();

                backButtonTransform.localPosition = new Vector3(panelWidth / 2f - UIConfig.blackButtonWidth / 2f, -panelHeight + UIConfig.spacingVertical + UIConfig.blackButtonHeight, backButtonTransform.localPosition.z);

                RoR2.UI.HGButton previousSelectable = backButton.GetComponent <RoR2.UI.MPEventSystemLocator>().eventSystem.currentSelectedGameObject.GetComponent <RoR2.UI.HGButton>();
                Button           backButtonButton   = backButton.GetComponent <RoR2.UI.HGButton>();

                backButtonButton.onClick.AddListener(() => {
                    rootTransform.GetComponent <CanvasGroup>().interactable = true;
                    if (backButtonButton.GetComponent <RoR2.UI.MPEventSystemLocator>().eventSystem.currentInputSource == RoR2.UI.MPEventSystem.InputSource.Gamepad)
                    {
                        previousSelectable.Select();
                    }
                    else
                    {
                        previousSelectable.enabled = false;
                        previousSelectable.enabled = true;
                    }
                    Destroy(background.gameObject);
                });
                backButtonButton.Select();
            }
            static void DrawRecentPanel()
            {
                if (DataShop.RecentScrap())
                {
                    Transform background = ElementCreator.SpawnImageOffset(new List <Image>(), UIDrawer.rootTransform.transform.parent.gameObject, null, new Color(0, 0, 0, 0.95f), new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero).transform;
                    background.GetComponent <Image>().raycastTarget = true;

                    GameObject    panelOutline   = PanelCreator.CreatePanelSize(background);
                    RectTransform panelTransform = panelOutline.GetComponent <RectTransform>();
                    float         panelWidth     = 600 + UIConfig.panelPadding * 2 + 10;
                    float         panelHeight    = 400 + UIConfig.panelPadding * 2 + 10;
                    panelTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, panelWidth);
                    panelTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, panelHeight);
                    panelTransform.localPosition = new Vector3(-panelWidth / 2f, panelHeight / 2f, 0);
                    RectTransform panelChildTransform = panelTransform.GetChild(0).GetComponent <RectTransform>();

                    List <TMPro.TextMeshProUGUI> text = new List <TMPro.TextMeshProUGUI>();
                    ElementCreator.SpawnTextOffset(text, panelTransform.GetChild(0).gameObject, new Color(1, 1, 1), 24, 0, new Vector2(UIConfig.spacingHorizontal, UIConfig.spacingVertical + UIConfig.blackButtonHeight + UIConfig.spacingVertical * 2 + UIConfig.blueButtonHeight + UIConfig.spacingVertical), new Vector2(-UIConfig.spacingHorizontal, -UIConfig.spacingVertical));
                    text[0].text  = "THANK YOU";
                    text[0].text += "\nFor your (or your kinsman's) continued service. Working to the benefit of UES is working to the benefit of us all.";
                    text[0].text += "\n";
                    text[0].text += "\nYour UES Aptitude Scores have been increased by the following amounts:";

                    float scrapSpacing = 75;
                    List <TMPro.TextMeshProUGUI> scrapTexts = new List <TMPro.TextMeshProUGUI>();
                    for (int tierIndex = 0; tierIndex < DataShop.scrap.Count; tierIndex++)
                    {
                        ElementCreator.SpawnTextSize(scrapTexts, panelChildTransform.gameObject, new Color(1, 1, 1, 1), 30, 0, new Vector2(0.5f, 1), new Vector2(300, UIConfig.blueButtonHeight - UIConfig.panelPadding * 2), new Vector3(panelChildTransform.rect.width / 2f + (-DataShop.scrap.Count / 2f + tierIndex + 0.5f) * scrapSpacing, -panelChildTransform.rect.height + UIConfig.spacingVertical + UIConfig.blackButtonHeight + UIConfig.spacingVertical * 2 + UIConfig.blueButtonHeight, 0));
                        scrapTexts[tierIndex].text = DataShop.scrapRecent[tierIndex].ToString();
                        if (DataShop.scrapRecent[tierIndex] > 0)
                        {
                            scrapTexts[tierIndex].color = UIConfig.tierColours[tierIndex];
                        }
                        else
                        {
                            scrapTexts[tierIndex].color = UIConfig.tierColours[tierIndex] * 0.5f;
                        }
                    }

                    GameObject    backButton          = ButtonCreator.SpawnBlackButton(panelChildTransform.gameObject, new Vector2(UIConfig.blackButtonWidth, UIConfig.blackButtonHeight), "Back", new List <TMPro.TextMeshProUGUI>());
                    RectTransform backButtonTransform = backButton.transform.parent.GetComponent <RectTransform>();
                    backButtonTransform.localPosition = new Vector3(panelChildTransform.rect.width / 2f - UIConfig.blackButtonWidth / 2f, -panelHeight + UIConfig.spacingVertical + UIConfig.blackButtonHeight, backButtonTransform.localPosition.z);

                    RoR2.UI.HGButton previousSelectable = backButton.GetComponent <RoR2.UI.MPEventSystemLocator>().eventSystem.currentSelectedGameObject.GetComponent <RoR2.UI.HGButton>();
                    Button           backButtonButton   = backButton.GetComponent <RoR2.UI.HGButton>();
                    backButtonButton.onClick.AddListener(() => {
                        UIDrawer.rootTransform.GetComponent <CanvasGroup>().interactable = true;
                        if (backButtonButton.GetComponent <RoR2.UI.MPEventSystemLocator>().eventSystem.currentInputSource == RoR2.UI.MPEventSystem.InputSource.Gamepad)
                        {
                            previousSelectable.Select();
                        }
                        else
                        {
                            previousSelectable.enabled = false;
                            previousSelectable.enabled = true;
                        }
                        DataShop.ClearRecentScrap();
                        Data.SaveConfigProfile();
                        Destroy(background.gameObject);
                    });
                    backButtonButton.Select();

                    UIDrawer.rootTransform.GetComponent <CanvasGroup>().interactable = false;
                }
            }
            static void DrawRecentPanel()
            {
                if ((Data.mode == DataEarntConsumable.mode && DataEarntConsumable.userPointsRecent > 0) || (Data.mode == DataEarntPersistent.mode && DataEarntPersistent.userPointsRecent > 0))
                {
                    Transform background = ElementCreator.SpawnImageOffset(new List <Image>(), UIDrawer.rootTransform.transform.parent.gameObject, null, new Color(0, 0, 0, 0.95f), new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero).transform;
                    background.GetComponent <Image>().raycastTarget = true;

                    GameObject    panelOutline   = PanelCreator.CreatePanelSize(background);
                    RectTransform panelTransform = panelOutline.GetComponent <RectTransform>();
                    float         panelWidth     = 600 + UIConfig.panelPadding * 2 + 10;
                    float         panelHeight    = 350 + UIConfig.panelPadding * 2 + 10;
                    panelTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, panelWidth);
                    panelTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, panelHeight);
                    panelTransform.localPosition = new Vector3(-panelWidth / 2f, panelHeight / 2f, 0);
                    RectTransform panelChildTransform = panelTransform.GetChild(0).GetComponent <RectTransform>();

                    List <TMPro.TextMeshProUGUI> text = new List <TMPro.TextMeshProUGUI>();
                    ElementCreator.SpawnTextOffset(text, panelTransform.GetChild(0).gameObject, new Color(1, 1, 1), 24, 0, new Vector2(UIConfig.spacingHorizontal, UIConfig.spacingVertical + UIConfig.blackButtonHeight + UIConfig.spacingVertical + UIConfig.blueButtonHeight + UIConfig.spacingVertical), new Vector2(-UIConfig.spacingHorizontal, -UIConfig.spacingVertical));
                    text[0].text  = "THANK YOU";
                    text[0].text += "\nFor your (or your kinsman's) continued service. Working to the benefit of UES is working to the benefit of us all.";
                    text[0].text += "\n";
                    text[0].text += "\nYour UES Credit balance has been increased by the following amount:";

                    List <TMPro.TextMeshProUGUI> creditsText = new List <TMPro.TextMeshProUGUI>();
                    ElementCreator.SpawnTextSize(creditsText, panelChildTransform.gameObject, new Color(1, 1, 1, 1), 40, 0, new Vector2(0.5f, 1), new Vector2(300, UIConfig.blueButtonHeight - UIConfig.panelPadding * 2), new Vector3(panelChildTransform.rect.width / 2f, -panelChildTransform.rect.height + UIConfig.spacingVertical + UIConfig.blackButtonHeight + UIConfig.spacingVertical + UIConfig.blueButtonHeight, 0));
                    creditsText[0].text = "";
                    if (Data.mode == DataEarntConsumable.mode)
                    {
                        creditsText[0].text = DataEarntConsumable.userPointsRecent.ToString();
                    }
                    else if (Data.mode == DataEarntPersistent.mode)
                    {
                        creditsText[0].text = DataEarntPersistent.userPointsRecent.ToString();
                    }

                    GameObject    backButton          = ButtonCreator.SpawnBlackButton(panelChildTransform.gameObject, new Vector2(UIConfig.blackButtonWidth, UIConfig.blackButtonHeight), "Back", new List <TMPro.TextMeshProUGUI>());
                    RectTransform backButtonTransform = backButton.transform.parent.GetComponent <RectTransform>();
                    backButtonTransform.localPosition = new Vector3(panelChildTransform.rect.width / 2f - UIConfig.blackButtonWidth / 2f, -panelHeight + UIConfig.spacingVertical + UIConfig.blackButtonHeight, backButtonTransform.localPosition.z);

                    RoR2.UI.HGButton previousSelectable = backButton.GetComponent <RoR2.UI.MPEventSystemLocator>().eventSystem.currentSelectedGameObject.GetComponent <RoR2.UI.HGButton>();
                    Button           backButtonButton   = backButton.GetComponent <RoR2.UI.HGButton>();
                    backButtonButton.onClick.AddListener(() => {
                        UIDrawer.rootTransform.GetComponent <CanvasGroup>().interactable = true;
                        if (backButtonButton.GetComponent <RoR2.UI.MPEventSystemLocator>().eventSystem.currentInputSource == RoR2.UI.MPEventSystem.InputSource.Gamepad)
                        {
                            previousSelectable.Select();
                        }
                        else
                        {
                            previousSelectable.enabled = false;
                            previousSelectable.enabled = true;
                        }
                        if (Data.mode == DataEarntConsumable.mode)
                        {
                            DataEarntConsumable.ClearRecentPoints();
                        }
                        else if (Data.mode == DataEarntPersistent.mode)
                        {
                            DataEarntPersistent.ClearRecentPoints();
                        }
                        Data.SaveConfigProfile();
                        Destroy(background.gameObject);
                    });
                    backButtonButton.Select();

                    UIDrawer.rootTransform.GetComponent <CanvasGroup>().interactable = false;
                }
            }