static void DrawInstructions() { List <TMPro.TextMeshProUGUI> instructionsText = new List <TMPro.TextMeshProUGUI>(); Vector3 position = new Vector3(); position.x = rootTransform.rect.width / 2f; position.y = -UIConfig.offsetVertical - UIConfig.blueButtonCount[Data.mode] * (UIConfig.blueButtonHeight + UIConfig.spacingVertical) - storeHeight - UIConfig.spacingVertical; ElementCreator.SpawnTextSize(instructionsText, rootTransform.gameObject, new Color(1, 1, 1, 1), 24, 0, new Vector2(0.5f, 1), new Vector2(500, UIConfig.blackButtonHeight), position); if (UIConfig.GetMode() == 0) { instructionsText[0].text = instructionTexts[0]; } else if (UIConfig.GetMode() == 1) { instructionsText[0].text = instructionTexts[1]; } else if (UIConfig.GetMode() == 2) { if (!DataShop.canDisablePurchasedBlueprints) { instructionsText[0].text = instructionTexts[2]; } else { instructionsText[0].text = instructionTexts[0]; } } shopInterfaces.Add(instructionsText[0].gameObject); }
static void DrawInstructions() { instructionsText.Clear(); Vector3 position = new Vector3(); position.x = rootTransform.rect.width / 2f; position.y = -UIConfig.offsetVertical - UIConfig.blueButtonHeight - UIConfig.spacingVertical - storeHeight - UIConfig.spacingVertical; ElementCreator.SpawnTextSize(instructionsText, rootTransform.gameObject, new Color(1, 1, 1, 1), 24, 0, new Vector2(0.5f, 1), new Vector2(500, UIConfig.blackButtonHeight), position); SetInstructionsText(); shopInterfaces.Add(instructionsText[0].gameObject); }
static void DrawModName() { List <TMPro.TextMeshProUGUI> modText = new List <TMPro.TextMeshProUGUI>(); Vector3 position = new Vector3(); position.x = rootTransform.rect.width - UIConfig.offsetHorizontal - UIConfig.blackButtons[Data.mode] * (UIConfig.blackButtonWidth / 2f + UIConfig.spacingHorizontal); position.y = -UIConfig.offsetVertical - UIConfig.blueButtonCount[Data.mode] * (UIConfig.blueButtonHeight + UIConfig.spacingVertical) - storeHeight - UIConfig.spacingVertical; ElementCreator.SpawnTextSize(modText, rootTransform.gameObject, new Color(1, 1, 1, 0.025f), 24, 0, new Vector2(1, 1), new Vector2(300, UIConfig.blackButtonHeight), position); modText[0].text = Data.developerName + ":\n" + Data.modName; modText[0].alignment = TMPro.TextAlignmentOptions.Right; shopInterfaces.Add(modText[0].gameObject); }
static void DrawPoints() { List <TMPro.TextMeshProUGUI> pointsText = new List <TMPro.TextMeshProUGUI>(); Vector2 pivot = new Vector2(); pivot.y = 1; Vector3 position = new Vector3(); if (Data.mode != DataRandom.mode) { int modesDisabled = 0; foreach (bool modeEnabled in Data.modesEnabled) { if (!modeEnabled) { modesDisabled += 1; } } float offset = 0; if (modesDisabled <= 0) { offset = (Data.modeCount - Data.profileCount) * (UIConfig.blueButtonWidth + UIConfig.spacingHorizontal) * 0.5f; } position.x = rootTransform.rect.width / 2f + offset; pivot.x = 0.5f; } else { position.x = rootTransform.rect.width - UIConfig.offsetHorizontal; pivot.x = 1; } position.y = -UIConfig.offsetVertical; ElementCreator.SpawnTextSize(pointsText, rootTransform.gameObject, new Color(1, 1, 1, 1), 40, 0, pivot, new Vector2(400, UIConfig.blueButtonHeight), position); pointText = pointsText[0]; pointText.text = "Credits: 400¢"; if (Data.mode == DataRandom.mode) { pointText.alignment = TMPro.TextAlignmentOptions.Right; } shopInterfaces.Add(pointsText[0].gameObject); }
static void DrawScrapTotals() { if (DataShop.shopMode == 0 || (DataShop.shopMode == 1 && !DataShop.canDisablePurchasedBlueprints)) { float scrapSpacing = 75; float titlePreferredWidth = 195.76f; GameObject panelOutline = PanelCreator.CreatePanelSize(UIDrawer.rootTransform); RectTransform panelTransform = panelOutline.GetComponent <RectTransform>(); float panelWidth = titlePreferredWidth + (DataShop.scrap.Count + 0.5f) * scrapSpacing + UIConfig.panelPadding * 2 + 10; panelTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, panelWidth); panelTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, UIConfig.blueButtonHeight); panelTransform.localPosition = new Vector3(UIDrawer.rootTransform.rect.width - UIConfig.offsetHorizontal - panelWidth, -UIConfig.offsetVertical, 0); UIDrawer.shopInterfaces.Add(panelOutline); for (int tierIndex = 0; tierIndex < DataShop.scrap.Count; tierIndex++) { ElementCreator.SpawnTextSize(scrapTexts, panelOutline.transform.GetChild(0).gameObject, new Color(1, 1, 1, 1), 30, 0, new Vector2(0.5f, 1), new Vector2(300, UIConfig.blueButtonHeight - UIConfig.panelPadding * 2), new Vector3((tierIndex + 0.5f) * scrapSpacing, 0, 0)); } List <TMPro.TextMeshProUGUI> titleText = new List <TMPro.TextMeshProUGUI>(); ElementCreator.SpawnTextSize(titleText, panelOutline.transform.GetChild(0).gameObject, new Color(1, 1, 1, 1), 30, 0, new Vector2(0, 1), new Vector2(400, UIConfig.blueButtonHeight - UIConfig.panelPadding * 2), new Vector3((DataShop.scrap.Count + 0.5f) * scrapSpacing, 0, 0)); titleText[0].text = "APTITUDE SCORES"; titleText[0].alignment = TMPro.TextAlignmentOptions.Left; } }
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; } }