コード例 #1
0
        public void RegisterTab(string name, Transform tab, BaseModule module)
        {
            UIDynamicButton tabButton = ui.CreateButton(name, 150, 80, moduleSelectLayout.transform);

            tabButton.buttonText.fontSize = 48;
            UI.ColorButton(tabButton, Color.white, new Color(0.5f, 0.8f, 0.4f));

            UITabs.Add(tab);

            tab.gameObject.SetActive(false);

            tabButton.button.onClick.AddListener(() =>
            {
                UITabs.ForEach((uiTab) =>
                {
                    uiTab.gameObject.SetActive(false);
                });
                tab.gameObject.SetActive(true);
                module.OnModuleActivate();
            });
        }
コード例 #2
0
        public MorphSearch(BaseModule baseModule)
        {
            UI        ui       = baseModule.ui;
            Transform moduleUI = baseModule.moduleUI;
            Atom      atom     = baseModule.atom;

            searchBox = ui.CreateTextInput("Search For Morph", 800, 100, moduleUI);
            searchBox.transform.localPosition = new Vector3(0, -110, 0);

            paginationSlider = ui.CreateSlider("Page", 930, 80, true, moduleUI);
            paginationSlider.transform.localPosition = new Vector3(0, -200, 0);

            paginationValue = new JSONStorableFloat("Page", 0, (float value) =>
            {
            }, 0, 10, true, true);
            paginationSlider.valueFormat = "n0";
            paginationValue.slider       = paginationSlider.slider;

            paginationSlider.gameObject.SetActive(false);

            GridLayoutGroup layout = ui.CreateGridLayout(1200, 800, moduleUI);

            layout.transform.localPosition = new Vector3(0, -1010, 0);
            layout.constraintCount         = 3;
            layout.constraint = GridLayoutGroup.Constraint.FixedColumnCount;
            layout.GetComponent <RectTransform>().pivot = new Vector2(0, 0);

            layout.cellSize = new Vector2(400, 80);

            for (int i = 0; i < MAX_MORPHS_PER_PAGE - 1; i++)
            {
                UIDynamicSlider slider = ui.CreateMorphSlider("Slider " + i, 400, 80, moduleUI);
                slider.transform.SetParent(layout.transform, false);

                morphSliders.Add(slider);
                slider.gameObject.SetActive(false);
            }


            DAZCharacterSelector personGeometry = atom.GetStorableByID("geometry") as DAZCharacterSelector;

            morphControl = personGeometry.morphsControlUI;

            regions = new HashSet <string>();
            morphControl.GetMorphDisplayNames().ForEach((name) =>
            {
                DAZMorph morph = morphControl.GetMorphByDisplayName(name);
                regions.Add(morph.region);
            });

            morphNames = morphControl.GetMorphDisplayNames();

            searchBox.onValueChanged.AddListener(UpdateSearch);

            UIDynamicButton clearButton = ui.CreateButton("Clear", 120, 100, moduleUI);

            clearButton.transform.localPosition = new Vector3(810, -110, 0);
            clearButton.button.onClick.AddListener(() =>
            {
                searchBox.text = "";
                ClearSearch();
            });

            VerticalLayoutGroup commonTermsGroup = ui.CreateVerticalLayout(220, 0, moduleUI);

            commonTermsGroup.transform.localPosition = new Vector3(-230, -200, 0);
            commonTermsGroup.GetComponent <RectTransform>().pivot = new Vector2(0, 0);

            commonTermsGroup.childAlignment = TextAnchor.UpperLeft;


            for (int i = 0; i < MAX_TERMS; i++)
            {
                UIDynamicButton termButton = ui.CreateButton("Term", 220, 40, moduleUI);
                termButton.transform.SetParent(commonTermsGroup.transform, false);
                termButtons.Add(termButton);
                UI.ColorButton(termButton, Color.white, new Color(0.3f, 0.4f, 0.6f));

                termButton.gameObject.SetActive(false);

                ContentSizeFitter csf = termButton.gameObject.AddComponent <ContentSizeFitter>();
                csf.verticalFit = ContentSizeFitter.FitMode.MinSize;
            }

            //Debug.Log("----------------------------");
            //UIDynamicSlider testSlider = ui.CreateMorphSlider("test");
            //ui.DebugDeeper(testSlider.transform);
        }