public void OnDisable()
        {
            initialized = false;

            DestroyImmediate(_keyBindPrefab);
            DestroyImmediate(modListHighlight);
            // GameObject.DestroyImmediate(_dropDownPrefab);
            // GameObject.DestroyImmediate(_inputFieldPrefab);

            RuntimePrefabManager.DestroyPrefabs();
        }
        public static void Init()
        {
            GameObject pauseMenuPrefab = Addressables.LoadAssetAsync <GameObject>("RoR2/Base/UI/PauseScreen.prefab").WaitForCompletion();

            if (pauseMenuPrefab == null)
            {
                throw new Exception("Couldn't initialize Risk Of Options! Continue at your own risk!");
            }

            pauseMenuPrefab.GetComponentInChildren <PauseScreenController>().settingsPanelPrefab
            .AddComponent <ModOptionPanelController>();

            LanguageAPI.Add(LanguageTokens.HeaderToken, "MOD OPTIONS");

            RuntimePrefabManager.Register <ModOptionsPanelPrefab>();
            RuntimePrefabManager.Register <CheckBoxPrefab>();
            RuntimePrefabManager.Register <SliderPrefab>();
            RuntimePrefabManager.Register <StepSliderPrefab>();
            RuntimePrefabManager.Register <KeyBindPrefab>();
            RuntimePrefabManager.Register <InputFieldPrefab>();
            RuntimePrefabManager.Register <GenericButtonPrefab>();
        }
        private void CreatePrefabs()
        {
            RuntimePrefabManager.InitializePrefabs(gameObject);

            _panel = RuntimePrefabManager.Get <ModOptionsPanelPrefab>();

            _revertButton = transform.Find("SafeArea").Find("FooterContainer").Find("FooterPanel, M&KB").Find("RevertAndBack (JUICED)").Find("NakedButton (Revert)").GetComponent <HGButton>();
            _revertButton.onClick.AddListener(RevertChanges);

            Transform subPanelArea = transform.Find("SafeArea").Find("SubPanelArea");

            //Transform headerArea = transform.Find("SafeArea").Find("HeaderContainer").Find("Header (JUICED)");

            //_leftGlyph = GameObject.Instantiate(headerArea.Find("GenericGlyph (Left)").gameObject);
            //_rightGlyph = GameObject.Instantiate(headerArea.Find("GenericGlyph (Right)").gameObject);

            //_leftGlyph.SetActive(false);
            //_rightGlyph.SetActive(false);

            //_leftGlyph.GetComponentInChildren<HGTextMeshProUGUI>().SetText("<sprite=\"tmpsprXboxOneGlyphs\" name=\"texXBoxOneGlyphs_5\">");
            //_rightGlyph.GetComponentInChildren<HGTextMeshProUGUI>().SetText("<sprite=\"tmpsprXboxOneGlyphs\" name=\"texXBoxOneGlyphs_9\">");

            _checkBoxPrefab      = RuntimePrefabManager.Get <CheckBoxPrefab>().CheckBoxButton;
            _sliderPrefab        = RuntimePrefabManager.Get <SliderPrefab>().Slider;
            _stepSliderPrefab    = RuntimePrefabManager.Get <StepSliderPrefab>().StepSlider;
            _keyBindPrefab       = RuntimePrefabManager.Get <KeyBindPrefab>().KeyBind;
            _inputFieldPrefab    = RuntimePrefabManager.Get <InputFieldPrefab>().InputField;
            _genericButtonPrefab = RuntimePrefabManager.Get <GenericButtonPrefab>().GenericButton;

            //_dropDownPrefab = GameObject.Instantiate(subPanelArea.Find("SettingsSubPanel, Video").Find("Scroll View").Find("Viewport").Find("VerticalLayout").Find("Option, Resolution").gameObject);
            //_inputFieldPrefab = GameObject.Instantiate(_checkBoxPrefab);

            //_dropDownPrefab.SetActive(false);

            // #region DropDown Prefab Setup
            //
            // GameObject.DestroyImmediate(_dropDownPrefab.transform.Find("CarouselRect").GetComponent<ResolutionControl>()); // Removing this entirely since it seems to mostly be made for resolution stuff.
            // GameObject.DestroyImmediate(_dropDownPrefab.transform.Find("CarouselRect").Find("RefreshRateDropdown").gameObject); // I only really need one Drop down element.
            // GameObject.DestroyImmediate(_dropDownPrefab.transform.Find("CarouselRect").Find("ApplyButton").gameObject); // I think most use cases don't need an apply button. If I think otherwise later I can make this optional
            // GameObject.DestroyImmediate(_dropDownPrefab.GetComponent<SelectableDescriptionUpdater>());
            // GameObject.DestroyImmediate(_dropDownPrefab.GetComponent<PanelSkinController>());
            // GameObject.DestroyImmediate(_dropDownPrefab.GetComponent<Image>());
            //
            //
            // GameObject.Instantiate(_checkBoxPrefab.transform.Find("BaseOutline").gameObject, _dropDownPrefab.transform);
            // GameObject dropDownHoverOutline = GameObject.Instantiate(_checkBoxPrefab.transform.Find("HoverOutline").gameObject, _dropDownPrefab.transform);
            //
            // HGButton dropDownButton = _dropDownPrefab.AddComponent<HGButton>(_checkBoxPrefab.GetComponent<HGButton>());
            //
            // dropDownButton.imageOnHover = dropDownHoverOutline.GetComponent<Image>();
            //
            // var dropDownImage = _dropDownPrefab.AddComponent(_checkBoxPrefab.GetComponent<Image>());
            //
            // _dropDownPrefab.AddComponent<ButtonSkinController>(_checkBoxPrefab.GetComponent<ButtonSkinController>());
            //
            // var dropDownTargetGraphic = dropDownImage;
            //
            // dropDownButton.targetGraphic = dropDownTargetGraphic;
            // dropDownButton.navigation = new Navigation();
            //
            // dropDownButton.onClick.RemoveAllListeners();
            //
            // _dropDownPrefab.AddComponent<DropDownController>().nameLabel = _dropDownPrefab.transform.Find("Text, Name").GetComponent<LanguageTextMeshController>();
            //
            // var dropDownGameObject = _dropDownPrefab.transform.Find("CarouselRect").Find("ResolutionDropdown").gameObject;
            //
            // dropDownGameObject.name = "Dropdown";
            //
            // var dropDownLayoutElement = dropDownGameObject.GetComponent<LayoutElement>();
            // dropDownLayoutElement.minWidth = 300;
            // dropDownLayoutElement.preferredWidth = 300;
            //
            // if (!RooDropdown.CheckMarkSprite)
            // {
            //     RooDropdown.CheckMarkSprite = dropDownGameObject.transform.Find("Template").Find("Viewport").Find("Content").Find("Item").Find("Item Checkmark").GetComponent<Image>().sprite;
            // }
            //
            // GameObject.DestroyImmediate(dropDownGameObject.GetComponent<MPDropdown>());
            // GameObject.DestroyImmediate(dropDownGameObject.transform.Find("Template").gameObject);
            //
            // dropDownGameObject.AddComponent<RooDropdown>().colors = _checkBoxPrefab.GetComponent<HGButton>().colors;
            //
            //
            // #endregion
            //
            // #region InputField Setup
            //
            // _inputFieldPrefab.SetActive(false);
            //
            // _inputFieldPrefab.name = "Input Field";
            //
            // GameObject.DestroyImmediate(_inputFieldPrefab.GetComponentInChildren<CarouselController>());
            // //GameObject.DestroyImmediate(_inputFieldPrefab.GetComponentInChildren<ButtonSkinController>());
            // //GameObject.DestroyImmediate(_inputFieldPrefab.GetComponentInChildren<HGButton>());
            // GameObject.DestroyImmediate(_inputFieldPrefab.transform.Find("CarouselRect").gameObject);
            //
            // _inputFieldPrefab.AddComponent<InputFieldController>();
            //
            // ColorBlock inputColors = _inputFieldPrefab.GetComponent<HGButton>().colors;
            //
            // GameObject textPreview = new GameObject("Text Preview", typeof(RectTransform), typeof(HorizontalLayoutGroup));
            //
            // textPreview.transform.SetParent(_inputFieldPrefab.transform);
            //
            // var textPreviewHorizontalLayoutGroup = textPreview.GetComponent<HorizontalLayoutGroup>();
            //
            // textPreviewHorizontalLayoutGroup.childAlignment = TextAnchor.MiddleRight;
            // textPreviewHorizontalLayoutGroup.padding = new RectOffset(8, 8, 0, 0);
            // textPreviewHorizontalLayoutGroup.spacing = 8;
            // textPreviewHorizontalLayoutGroup.childForceExpandWidth = false;
            // textPreviewHorizontalLayoutGroup.childForceExpandHeight = false;
            //
            // var textPreviewRectTransform = textPreview.GetComponent<RectTransform>();
            //
            // textPreviewRectTransform.anchorMin = new Vector2(0, 0);
            // textPreviewRectTransform.anchorMax = new Vector2(1, 1);
            // textPreviewRectTransform.pivot = new Vector2(1, 0.5f);
            // textPreviewRectTransform.anchoredPosition = new Vector2(-6, 0);
            //
            //
            // GameObject placeHolderTextArea = new GameObject("Text Area", typeof(RectTransform), typeof(RectMask2D), typeof(CanvasRenderer), typeof(LayoutElement), typeof(GraphicRaycaster));
            //
            // placeHolderTextArea.transform.SetParent(textPreview.transform);
            //
            // placeHolderTextArea.AddComponent<Image>(_checkBoxPrefab.GetComponent<Image>());
            //
            // var placeHolderLayoutElement = placeHolderTextArea.GetComponent<LayoutElement>();
            //
            // placeHolderLayoutElement.minWidth = 256;
            // placeHolderLayoutElement.minHeight = 48;
            // placeHolderLayoutElement.preferredWidth = 256;
            //
            // placeHolderTextArea.name = "Text Area";
            //
            //
            // GameObject textPlaceHolder = new GameObject("Text", typeof(RectTransform), typeof(RectMask2D), typeof(CanvasRenderer));
            //
            // textPlaceHolder.transform.SetParent(placeHolderTextArea.transform);
            //
            // textPlaceHolder.AddComponent<HGTextMeshProUGUI>(_inputFieldPrefab.transform.Find("ButtonText").GetComponent<HGTextMeshProUGUI>());
            //
            // textPlaceHolder.AddComponent<LanguageTextMeshController>();
            //
            //
            // var textPlaceHolderRectTransform = textPlaceHolder.GetComponent<RectTransform>();
            //
            // textPlaceHolderRectTransform.anchorMin = new Vector2(0.03f, 0.5f);
            // textPlaceHolderRectTransform.anchorMax = new Vector2(1, 0.5f);
            // textPlaceHolderRectTransform.sizeDelta = new Vector2(0, 100);
            //
            // textPlaceHolder.name = "Text";
            //
            // GameObject textCanvas = new GameObject("Text Overlay", typeof(RectTransform), typeof(RectMask2D), typeof(Canvas), typeof(GraphicRaycaster), typeof(CanvasGroup));
            //
            // textCanvas.SetActive(false);
            // textCanvas.transform.SetParent(_inputFieldPrefab.transform);
            //
            // //var textCanvasImage = textCanvas.AddComponent<Image>(_inputFieldPrefab.GetComponent<Image>());
            //
            // //textCanvas.AddComponent<TranslucentImage>(Prefabs.MoPanelPrefab.transform.Find("Scroll View").Find("BlurPanel").gameObject.GetComponent<TranslucentImage>());
            //
            // //textCanvasImage.color = inputColors.normalColor;
            //
            // textCanvas.AddComponent<RooInputFieldOverlay>();
            //
            // var textCanvasRectTransform = textCanvas.GetComponent<RectTransform>();
            //
            // textCanvasRectTransform.anchoredPosition = new Vector2(0, -50);
            // textCanvasRectTransform.sizeDelta = new Vector2(525, 48);
            //
            // textCanvas.name = "Text Overlay";
            //
            // //GameObject.Instantiate(_modOptionsPanelPrefab.OptionsPanel.transform.Find("Scroll View").Find("BlurPanel").gameObject, textCanvas.transform);
            // //GameObject.Instantiate(_modOptionsPanelPrefab.OptionsPanel.transform.Find("Scroll View").Find("ImagePanel").gameObject, textCanvas.transform);
            //
            // //GameObject.Instantiate(_inputFieldPrefab.transform.Find("BaseOutline"), textCanvas.transform);
            //
            //
            // GameObject textArea = new GameObject("Text Area", typeof(RectTransform), typeof(RectMask2D), typeof(CanvasRenderer), typeof(GraphicRaycaster));
            //
            // textArea.transform.SetParent(textCanvas.transform);
            //
            // var textAreaRectTransform = textArea.GetComponent<RectTransform>();
            //
            // textAreaRectTransform.anchorMin = new Vector2(0, 0);
            // textAreaRectTransform.anchorMax = new Vector2(1, 1);
            // textAreaRectTransform.anchoredPosition = Vector2.zero;
            // textAreaRectTransform.sizeDelta = Vector2.zero;
            //
            // var textAreaImage = textArea.AddComponent<Image>(_inputFieldPrefab.GetComponent<Image>());
            //
            // textAreaImage.color = inputColors.normalColor;
            //
            // textArea.name = "Text Area";
            //
            //
            // GameObject inputText = new GameObject("Text", typeof(RectTransform), typeof(CanvasRenderer));
            //
            // inputText.transform.SetParent(textAreaRectTransform.transform);
            //
            // inputText.AddComponent<HGTextMeshProUGUI>(_inputFieldPrefab.transform.Find("ButtonText").GetComponent<HGTextMeshProUGUI>());
            //
            // var inputTextRectTransform = inputText.GetComponent<RectTransform>();
            //
            // inputTextRectTransform.anchorMin = new Vector2(0.02f, 0);
            // inputTextRectTransform.anchorMax = new Vector2(0.98f, 1);
            // inputTextRectTransform.anchoredPosition = Vector2.zero;
            // inputTextRectTransform.sizeDelta = Vector2.zero;
            //
            // inputText.name = "Text";
            //
            // var tmpInputField = placeHolderTextArea.AddComponent<RooInputField>();
            //
            // tmpInputField.overlay = textCanvas;
            //
            // tmpInputField.textViewport = textAreaRectTransform;
            // tmpInputField.textComponent = inputText.GetComponent<HGTextMeshProUGUI>();
            //
            // tmpInputField.colors = inputColors;
            //
            //
            // //textCanvas.transform.SetAsFirstSibling();
            // //textPreview.transform.SetAsFirstSibling();
            //
            //
            // #endregion

            // if (!RooDropdown.CheckBoxPrefab)
            // {
            //     RooDropdown.CheckBoxPrefab = _checkBoxPrefab;
            // }
            //
            // if (!RooDropdown.PanelPrefab)
            // {
            //     RooDropdown.PanelPrefab = _modOptionsPanelPrefab.OptionsPanel;
            // }

            _checkBoxPrefab.SetActive(false);
            _sliderPrefab.SetActive(false);
            _stepSliderPrefab.SetActive(false);
            _keyBindPrefab.SetActive(false);
            _inputFieldPrefab.SetActive(false);
            _genericButtonPrefab.SetActive(false);
        }