private void AddPanelsToSettings()
        {
            Transform headerArea = transform.Find("SafeArea").Find("HeaderContainer").Find("Header (JUICED)");

            HGHeaderNavigationController navigationController = GetComponent <HGHeaderNavigationController>();

            GameObject modOptionsHeaderButton = Instantiate(_panel.ModOptionsHeaderButton, headerArea);

            modOptionsHeaderButton.name = "GenericHeaderButton (Mod Options)";
            modOptionsHeaderButton.GetComponentInChildren <LanguageTextMeshController>().token = LanguageTokens.HeaderToken;
            modOptionsHeaderButton.GetComponentInChildren <HGButton>().onClick.RemoveAllListeners();
            modOptionsHeaderButton.GetComponentInChildren <HGButton>().onClick.AddListener(delegate()
            {
                navigationController.ChooseHeaderByButton(modOptionsHeaderButton.GetComponentInChildren <HGButton>());
            });

            List <HGHeaderNavigationController.Header> headers = GetComponent <HGHeaderNavigationController>().headers.ToList();

            modOptionsHeaderButton.GetComponentInChildren <HGTextMeshProUGUI>().SetText("MOD OPTIONS");

            HGHeaderNavigationController.Header header = new HGHeaderNavigationController.Header
            {
                headerButton  = modOptionsHeaderButton.GetComponent <HGButton>(),
                headerName    = "Mod Options",
                tmpHeaderText = modOptionsHeaderButton.GetComponentInChildren <HGTextMeshProUGUI>(),
                headerRoot    = _panel.Canvas
            };

            headers.Add(header);

            GetComponent <HGHeaderNavigationController>().headers = headers.ToArray();

            transform.Find("SafeArea").Find("HeaderContainer").Find("Header (JUICED)").Find("GenericGlyph (Right)").SetAsLastSibling();
        }
        private void CreateModListButtons()
        {
            HGHeaderNavigationController navigationController = _panel.ModListPanel.GetComponent <HGHeaderNavigationController>();

            List <HGHeaderNavigationController.Header> headers = new List <HGHeaderNavigationController.Header>();

            //_leftGlyph.transform.SetParent(modListLayout);

            Transform modListVerticalLayout = _panel.ModListPanel.transform.Find("Scroll View").Find("Viewport")
                                              .Find("VerticalLayout");

            foreach (var collection in ModSettingsManager.OptionCollection)
            {
                GameObject newModButton = Instantiate(_panel.ModListButton, modListVerticalLayout);

                ModListButton modListButton = newModButton.GetComponent <ModListButton>();

                modListButton.description          = collection.description;
                modListButton.nameLabel            = modListButton.GetComponent <LanguageTextMeshController>();
                modListButton.token                = collection.NameToken;
                modListButton.modGuid              = collection.ModGuid;
                modListButton.navigationController = navigationController;
                modListButton.descriptionText      = _panel.ModDescriptionPanel.GetComponentInChildren <HGTextMeshProUGUI>();

                RectTransform modIconRectTransform = newModButton.transform.Find("ModIcon").gameObject.GetComponent <RectTransform>();

                modIconRectTransform.localPosition    = new Vector3(-147f, -0.32f, 0f);
                modIconRectTransform.sizeDelta        = Vector2.zero;
                modIconRectTransform.anchoredPosition = Vector2.zero;
                modIconRectTransform.gameObject.AddComponent <FetchIconWhenReady>().modGuid = collection.ModGuid;

                newModButton.name = $"ModListButton ({collection.ModName})";
                newModButton.SetActive(true);

                HGHeaderNavigationController.Header header = new HGHeaderNavigationController.Header
                {
                    headerButton  = newModButton.GetComponent <ModListButton>(),
                    headerName    = $"ModListButton ({collection.ModName})",
                    tmpHeaderText = newModButton.GetComponentInChildren <HGTextMeshProUGUI>(),
                    headerRoot    = null
                };

                headers.Add(header);
            }

            //_rightGlyph.transform.SetParent(modListLayout);

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

            navigationController.headers = headers.ToArray();

            navigationController.currentHeaderIndex = -1;
        }
Example #3
0
        internal static void SetupVRSettings(GameObject panel)
        {
            HGHeaderNavigationController controller = panel.GetComponent <HGHeaderNavigationController>();

            if (!controller)
            {
                return;
            }

            Transform header       = panel.transform.Find("SafeArea/HeaderContainer/Header (JUICED)");
            Transform subPanelArea = panel.transform.Find("SafeArea/SubPanelArea");

            if (!header || !subPanelArea)
            {
                return;
            }

            GameObject subPanelInstance = SetupSubPanel(subPanelArea);

            GameObject headerInstance = SetupHeader(header);

            LanguageTextMeshController text = headerInstance.GetComponent <LanguageTextMeshController>();

            text.token = "VR";

            HGHeaderNavigationController.Header headerInfo = new HGHeaderNavigationController.Header();
            headerInfo.headerButton  = headerInstance.GetComponent <HGButton>();
            headerInfo.headerName    = "VR";
            headerInfo.tmpHeaderText = headerInstance.GetComponentInChildren <HGTextMeshProUGUI>();
            headerInfo.headerRoot    = subPanelInstance;

            List <HGHeaderNavigationController.Header> headerList = controller.headers.ToList();

            headerList.Add(headerInfo);

            controller.headers = headerList.ToArray();
        }
Example #4
0
        private static void ApplyMenuEdits(Int32 bodyIndex, CharacterSelectController controller)
        {
            if (menuEditsInEffect)
            {
                return;
            }
            menuEditsInEffect = true;



            var headerPanelObj = controller.loadoutHeaderButton.transform.parent;

            var headerNavController = headerPanelObj.GetComponent <HGHeaderNavigationController>();



            if (headerNavController.headers.Length != 4)
            {
                if (String.IsNullOrEmpty(wispySkinHeader.headerName))
                {
                    HGHeaderNavigationController.Header refHeader = default;
                    Int32 counter = 0;

                    while (counter < 3 && String.IsNullOrEmpty(refHeader.headerName))
                    {
                        var temp = headerNavController.headers[counter++];
                        if (temp.headerName == "Overview")
                        {
                            refHeader = temp;
                        }
                    }


                    if (!String.IsNullOrEmpty(refHeader.headerName))
                    {
                        var newButtonObj = UnityEngine.Object.Instantiate <GameObject>(refHeader.headerButton.gameObject, refHeader.headerButton.transform.parent);
                        var newButton    = newButtonObj.GetComponent <HGButton>();


                        var buttonTrans = newButtonObj.transform.Find("ButtonText");

                        var newButtonText = buttonTrans.GetComponent <HGTextMeshProUGUI>();

                        var newButtonLang = newButtonObj.GetComponent <LanguageTextMeshController>();

                        newButtonLang.token = "LOADOUT_SKIN";


                        var newPanel = UnityEngine.Object.Instantiate <GameObject>(refHeader.headerRoot, refHeader.headerRoot.transform.parent);

                        var skinUI = newPanel.AddComponent <WispSkinSelectionUI>();

                        skinUI.SetData(bodyIndex, getLocalUser(controller).userProfile);

                        var panelTextObj = newPanel.transform.Find("TextMeshPro Text");

                        panelTextObj.GetComponent <HGTextMeshProUGUI>().text = "";


                        wispySkinHeader = new HGHeaderNavigationController.Header
                        {
                            headerName    = "Skins",
                            headerButton  = newButton,
                            tmpHeaderText = newButtonText,
                            headerRoot    = newPanel,
                        };

                        Array.Resize <Image>(ref controller.primaryColorImages, defaultImagesLength + 1);

                        controller.primaryColorImages[defaultImagesLength] = newButtonObj.GetComponent <Image>();
                    }
                }
                Array.Resize <HGHeaderNavigationController.Header>(ref headerNavController.headers, 4);
                headerNavController.headers[3] = wispySkinHeader;
                wispySkinHeader.headerButton.gameObject.SetActive(true);
            }
        }
        internal void LoadModOptionsFromOptionCollection(string modGuid)
        {
            OptionCollection collection = ModSettingsManager.OptionCollection[modGuid];

            GameObject categoriesObject = _panel.CategoryHeader.transform.Find("Scroll View").Find("Viewport").Find("Categories (JUICED)").gameObject;

            HGHeaderNavigationController navigationController = categoriesObject.GetComponent <HGHeaderNavigationController>();

            CategoryScrollRect categoryScrollRect = _panel.CategoryHeader.GetComponentInChildren <CategoryScrollRect>();

            if (_panel.CategoryHeader.activeSelf || _panel.ModOptionsPanel.activeSelf || _panel.ModOptionsDescriptionPanel.activeSelf || categoryScrollRect.categoryButtons.Count > 0)
            {
                UnloadExistingCategoryButtons();
            }

            if (_panel.ModDescriptionPanel.activeSelf || !_panel.CategoryHeader.activeSelf || !_panel.ModOptionsPanel.activeSelf || !_panel.ModOptionsDescriptionPanel.activeSelf)
            {
                _panel.ModDescriptionPanel.GetComponentInChildren <HGTextMeshProUGUI>().SetText("");

                _panel.ModDescriptionPanel.SetActive(false);
                _panel.CategoryHeader.SetActive(true);
                _panel.ModOptionsPanel.SetActive(true);
                _panel.ModOptionsDescriptionPanel.SetActive(true);
            }

            List <HGHeaderNavigationController.Header> headers = new List <HGHeaderNavigationController.Header>();

            navigationController.currentHeaderIndex = 0;

            categoryScrollRect.Categories = collection.CategoryCount;

            _panel.CategoryLeftButton.SetActive(true);
            _panel.CategoryLeftButton.transform.SetSiblingIndex(_panel.CategoryPageIndicators.transform.GetSiblingIndex() - 1);

            for (int i = 0; i < collection.CategoryCount; i++)
            {
                GameObject newCategoryButton = Instantiate(_panel.ModOptionsHeaderButton, categoriesObject.transform);

                LayoutElement le = newCategoryButton.AddComponent <LayoutElement>();

                le.preferredWidth = 200;

                newCategoryButton.GetComponentInChildren <LanguageTextMeshController>().token = collection[i].NameToken;
                newCategoryButton.GetComponentInChildren <HGTextMeshProUGUI>().SetText(collection[i].name);
                newCategoryButton.GetComponentInChildren <HGButton>().onClick.RemoveAllListeners();

                var categoryIndex = i;

                newCategoryButton.GetComponentInChildren <HGButton>().onClick.AddListener(delegate
                {
                    navigationController.ChooseHeaderByButton(newCategoryButton.GetComponentInChildren <HGButton>());

                    LoadOptionListFromCategory(modGuid, categoryIndex, headers.Count);
                });

                newCategoryButton.name = $"Category Button, {collection[i].name}";
                newCategoryButton.SetActive(true);

                HGHeaderNavigationController.Header header = new HGHeaderNavigationController.Header
                {
                    headerButton  = newCategoryButton.GetComponent <HGButton>(),
                    headerName    = $"Category Button, {collection[i].name}",
                    tmpHeaderText = newCategoryButton.GetComponentInChildren <HGTextMeshProUGUI>(),
                    headerRoot    = null
                };

                categoryScrollRect.categoryButtons.Add(newCategoryButton);

                headers.Add(header);
            }
            categoryScrollRect.SetPage(0);
            categoryScrollRect.FixExtra();

            navigationController.headers = headers.ToArray();
            navigationController.InvokeMethod("RebuildHeaders");

            _panel.CategoryRightButton.SetActive(true);
            _panel.CategoryRightButton.transform.SetAsLastSibling();

            LoadOptionListFromCategory(collection.ModGuid, navigationController.currentHeaderIndex, navigationController.headers.Length);
        }