Пример #1
0
        public static void MoveThroughPartList(int step, PartList partList)
        {
            if (partList.parts.Count <= 0)
            {
                Logger.log.Debug("Part list is empty! Ensure mod part lists are installed in ../BeatSaber/SaberForgeParts");
                return;
            }

            partList.index += step;

            if (partList.index >= partList.parts.Count)
            {
                partList.index = 0;
            }

            else if (partList.index < 0)
            {
                partList.index = partList.parts.Count - 1;
            }

            //set text
            UIFunctions.UpdateAllPartLabels();

            if (step != 0)
            {
                onPartModelChange();
            }
        }
Пример #2
0
        public static void MoveThroughMatList(int step, MatList matList)
        {
            if (matList.mats.Count <= 0)
            {
                Logger.log.Debug("Material list is empty! Ensure mod part lists are installed in ../BeatSaber/SaberForgeParts");
                return;
            }

            matList.index += step;

            if (matList.index >= matList.mats.Count)
            {
                matList.index = 0;
            }

            else if (matList.index < 0)
            {
                matList.index = matList.mats.Count - 1;
            }

            //set text
            UIFunctions.UpdateAllMatLabels();

            if (step != 0)
            {
                onMaterialChange();
            }
        }
Пример #3
0
        private void FirstActivation()
        {
            string tipsText = "<size=140%><b>Tips</b><size=110%>\n" +
                              "\n" +
                              "You can load your own trail and name textures into SaberForge! \n " +
                              "Place .png files in /BeatSaber/SaberForgeAssets/UserTextures and follow the naming guide found there. \n" +
                              "\n" +
                              //  "For a live update of the sabers in your hand try installing the Custom Pointers mod by Kylon99.\n" +
                              // "\n" +
                              "For other saber tweaks, such as saber position and trail length, use the Saber Tailor mod.\n"

            ;


            RectTransform verticalLayout = UIFunctions.CreateVerticalLayoutObj(new RectOffset(6, 6, 6, 6), 1, TextAnchor.UpperCenter);

            UIFunctions.SetRect(verticalLayout, transform, new Vector2(0, 1), new Vector2(0, 1), new Vector2(60, -40), new Vector2(120, 80));


            TextMeshProUGUI tips = BeatSaberUI.CreateText(verticalLayout, tipsText, new Vector2(0, 0), new Vector2(120, 80));

            //format
            tips.alignment          = TextAlignmentOptions.Top;
            tips.enableWordWrapping = true;
        }
        private void FirstActivation()
        {
            string creditsText = "<b><size=140%>Developed by Frost Dragon</b> <size=100%>\n " +
                                 "\n" +
                                 "This mod would not be possible without the assitance of - \n" +
                                 "\n" +
                                 "The <b>Beat Saber Modding Group Discord</b> and <b>British Beat Saber Discord</b>.\n" +
                                 "The developers of BSIPA, BS Utils, CustomUI, Custom Sabers.\n " +
                                 "\n" +
                                 "With special thanks to community members -  \n" +
                                 "\n" +
                                 "Wolven "
            ;


            RectTransform verticalLayout = UIFunctions.CreateVerticalLayoutObj(new RectOffset(6, 6, 6, 6), 1, TextAnchor.UpperCenter);

            UIFunctions.SetRect(verticalLayout, transform, new Vector2(0, 1), new Vector2(0, 1), new Vector2(60, -40), new Vector2(120, 80));


            TextMeshProUGUI credits = BeatSaberUI.CreateText(verticalLayout, creditsText, new Vector2(0, 0), new Vector2(120, 80));

            //format
            credits.alignment          = TextAlignmentOptions.Top;
            credits.enableWordWrapping = true;
        }
Пример #5
0
        //i hate everyone
        public IEnumerator SetInitialText()
        {
            UIFunctions.UpdateSliderLabel(this, this.Scrollbar.value);
            yield return(new WaitForSeconds(0.1f));

            UIFunctions.UpdateSliderLabel(this, this.Scrollbar.value);
        }
Пример #6
0
 public static void ReloadAssets()
 {
     AssetLoader.Init();
     SaberForgeConfig.LoadConfig();
     PartEditor.UpdateSabers();
     UIFunctions.UpdateAllPartLabels();
     UIFunctions.UpdateAllMatLabels();
 }
Пример #7
0
        private void FirstActivation()
        {
            // add some buttons
            RectTransform verticalLayout = UIFunctions.CreateVerticalLayoutObj(new RectOffset(6, 6, 6, 6), 1, TextAnchor.UpperCenter);

            UIFunctions.SetRect(verticalLayout, transform, new Vector2(0, 1), new Vector2(0, 1), new Vector2(85, -40), new Vector2(150, 80));

            UIFunctions.CreateModelSwapPanel(verticalLayout, PartEditor.BladeList, "BLADE MODEL");
            UIFunctions.CreateModelSwapPanel(verticalLayout, PartEditor.GuardList, "GUARD MODEL");
            UIFunctions.CreateModelSwapPanel(verticalLayout, PartEditor.HandleList, "HANDLE MODEL");
            UIFunctions.CreateModelSwapPanel(verticalLayout, PartEditor.PommelList, "POMMEL MODEL");;

            UIFunctions.CreateModelSwapPanel(verticalLayout, PartEditor.AccAList, "ACCESSORY A MODEL");
            UIFunctions.CreateModelSwapPanel(verticalLayout, PartEditor.AccBList, "ACCESSORY B MODEL");

            BeatSaberUI.CreateUIButton(transform.GetComponent <RectTransform>(), "PlayButton", new Vector2(69, 33), new Vector2(16, 16), delegate() { SaberForgeUI.HelpMenu.Present(); }, "?");
        }
Пример #8
0
        private void FirstActivation()
        {
            string helpText = "<size=150%><b>Instructions</b> \n" +
                              "\n" +
                              "<size=120%>1 - Adjust your sabers using the options provided in Saber Forge.\n" +
                              "\n" +
                              "2 - Open the Custom Sabers mod menu and choose the 'Saber Forge' sabers. \n" +
                              "\n" +
                              "3 - Hit bloq"
            ;

            RectTransform verticalLayout = UIFunctions.CreateVerticalLayoutObj(new RectOffset(6, 6, 6, 6), 1, TextAnchor.UpperCenter);

            UIFunctions.SetRect(verticalLayout, transform, new Vector2(0, 1), new Vector2(0, 1), new Vector2(85, -40), new Vector2(150, 80));

            TextMeshProUGUI matLabelText = BeatSaberUI.CreateText(verticalLayout, helpText, new Vector2(0, 0), new Vector2(100, 80));

            //format
            matLabelText.alignment = TextAlignmentOptions.Top;

            //donate button
            Button donate = BeatSaberUI.CreateUIButton(transform as RectTransform, "PlayButton", new Vector2(-50, -33), new Vector2(50, 16), null, "DONATE <3");

            donate.onClick.AddListener(() => { GoTo("https://ko-fi.com/frostdragonliz", donate); });
            BeatSaberUI.AddHintText(donate.transform as RectTransform, "Kofi $$ will go towards future mod and part development, ta!");


            //reload assets button TO DO
            //  Button reload = BeatSaberUI.CreateUIButton(transform as RectTransform, "PlayButton", new Vector2(0, -33), new Vector2(50, 16), null, "USER TEXTURES");
            //  reload.onClick.AddListener(() => { Plugin.ReloadAssets(); });
            //  BeatSaberUI.AddHintText(reload.transform as RectTransform, "Force a reload of SaberForge Assets");

            //tutes button
            Button tutorials = BeatSaberUI.CreateUIButton(transform as RectTransform, "PlayButton", new Vector2(8, -33), new Vector2(50, 16), null, "TUTORIALS");

            tutorials.onClick.AddListener(() => { GoTo("https://www.youtube.com/playlist?list=PLyJh_4G6B76PPdL-rAmb44-475D0_0UBs", tutorials); });
            BeatSaberUI.AddHintText(tutorials.transform as RectTransform, "YouTube Tutorials");


            //github button
            Button github = BeatSaberUI.CreateUIButton(transform as RectTransform, "PlayButton", new Vector2(60, -33), new Vector2(50, 16), null, "SOURCE");

            github.onClick.AddListener(() => { GoTo("https://github.com/lizfrost/SaberForge", github); });
            BeatSaberUI.AddHintText(github.transform as RectTransform, "Source and mod info");
        }
Пример #9
0
        private void FirstActivation()
        {
            // Page 1


            // add some buttons
            pageOneLayout = UIFunctions.CreateVerticalLayoutObj(new RectOffset(6, 6, 6, 6), 1, TextAnchor.UpperCenter);
            UIFunctions.SetRect(pageOneLayout, transform, new Vector2(0, 1), new Vector2(0, 1), new Vector2(60, -40), new Vector2(120, 70));

            pageSwitchButton = BeatSaberUI.CreateUIButton(transform.GetComponent <RectTransform>(), "PlayButton", new Vector2(48, 33), new Vector2(16, 16), delegate() { SwitchPages(); }, "1/2");

            UIFunctions.CreateMaterialSwapPanel(pageOneLayout, PartEditor.GlowList, "GLOW MATERIAL");
            UIFunctions.CreateMaterialSwapPanel(pageOneLayout, PartEditor.SecondaryList, "DETAIL MATERIAL");
            UIFunctions.CreateMaterialSwapPanel(pageOneLayout, PartEditor.TertiaryList, "HANDLE MATERIAL");
            UIFunctions.CreateMaterialSwapPanel(pageOneLayout, PartEditor.NamePlateList, "NAME PLATE MATERIAL");
            UIFunctions.CreateMaterialSwapPanel(pageOneLayout, PartEditor.TrailList, "TRAIL MATERIAL");

            //PAGE TWO



            // add some buttons
            pageTwoLayout = UIFunctions.CreateVerticalLayoutObj(new RectOffset(6, 6, 6, 6), 1, TextAnchor.UpperCenter);
            UIFunctions.SetRect(pageTwoLayout, transform, new Vector2(0, 1), new Vector2(0, 1), new Vector2(60, -40), new Vector2(120, 70));

            pageTwoSliders.Add(UIFunctions.CreateSliderPanel(pageTwoLayout, "GUARD ANGLE", PartEditor.GuardAngle));

            pageTwoSliders.Add(UIFunctions.CreateSliderPanel(pageTwoLayout, "ACCESSORY A ANGLE", PartEditor.AccAAngle));
            pageTwoSliders.Add(UIFunctions.CreateSliderPanel(pageTwoLayout, "ACCESSORY A ROTATION", PartEditor.AccARotSpeed));

            pageTwoSliders.Add(UIFunctions.CreateSliderPanel(pageTwoLayout, "ACCESSORY B ANGLE", PartEditor.AccBAngle));
            pageTwoSliders.Add(UIFunctions.CreateSliderPanel(pageTwoLayout, "ACCESSORY B ROTATION", PartEditor.AccBRotSpeed));


            //  RectTransform accASpinPanel = UIFunctions.CreateRectPanel(pageTwoLayout, "ACCESSORY SPIN REVERSE");
            //  BeatSaberUI.CreateUIButton(accASpinPanel, "PlayButton", new Vector2(0, 0), new Vector2(8, 8), delegate { PartEditor.AccARotReverseLeft = !PartEditor.AccARotReverseLeft; PartEditor.AccBRotReverseLeft = !PartEditor.AccBRotReverseLeft; }, "LEFT");
            // BeatSaberUI.CreateUIButton(accASpinPanel, "PlayButton", new Vector2(25, 0), new Vector2(8, 8), delegate { PartEditor.AccARotReverseRight = !PartEditor.AccARotReverseRight; PartEditor.AccBRotReverseRight = !PartEditor.AccBRotReverseRight; }, "RIGHT");


            pageTwoLayout.gameObject.SetActive(false);
        }
Пример #10
0
        private void FirstActivation()
        {
            // Page 1

            // add some buttons
            pageOneLayout = UIFunctions.CreateVerticalLayoutObj(new RectOffset(6, 6, 6, 6), 1, TextAnchor.UpperCenter);
            UIFunctions.SetRect(pageOneLayout, transform, new Vector2(0, 1), new Vector2(0, 1), new Vector2(60, -40), new Vector2(120, 70));

            pageSwitchButton = BeatSaberUI.CreateUIButton(transform.GetComponent <RectTransform>(), "PlayButton", new Vector2(48, 33), new Vector2(16, 16), delegate() { SwitchPages(); }, "1/2");

            //Sliders!!!

            pageOneSliders.Add(UIFunctions.CreateSliderPanel(pageOneLayout, "BLADE WIDTH", PartEditor.BladeXScale));
            pageOneSliders.Add(UIFunctions.CreateSliderPanel(pageOneLayout, "BLADE HEIGHT", PartEditor.BladeYScale));
            pageOneSliders.Add(UIFunctions.CreateSliderPanel(pageOneLayout, "GUARD SIZE", PartEditor.GuardScale));
            pageOneSliders.Add(UIFunctions.CreateSliderPanel(pageOneLayout, "HANDLE SIZE", PartEditor.HandleScale));
            pageOneSliders.Add(UIFunctions.CreateSliderPanel(pageOneLayout, "HANDLE LENGTH", PartEditor.HandleLength));
            pageOneSliders.Add(UIFunctions.CreateSliderPanel(pageOneLayout, "POMMEL SIZE", PartEditor.PommelScale));

            //PAGE TWO

            // add some buttons
            pageTwoLayout = UIFunctions.CreateVerticalLayoutObj(new RectOffset(6, 6, 6, 6), 1, TextAnchor.UpperCenter);
            UIFunctions.SetRect(pageTwoLayout, transform, new Vector2(0, 1), new Vector2(0, 1), new Vector2(60, -40), new Vector2(120, 70));

            pageTwoSliders.Add(UIFunctions.CreateSliderPanel(pageTwoLayout, "ACCESSORY A POSITION", PartEditor.AccAPos));
            pageTwoSliders.Add(UIFunctions.CreateSliderPanel(pageTwoLayout, "ACCESSORY A SIZE", PartEditor.AccAScale));

            pageTwoSliders.Add(UIFunctions.CreateSliderPanel(pageTwoLayout, "ACCESSORY B POSITION", PartEditor.AccBPos));
            pageTwoSliders.Add(UIFunctions.CreateSliderPanel(pageTwoLayout, "ACCESSORY B SIZE", PartEditor.AccBScale));

            pageTwoSliders.Add(UIFunctions.CreateSliderPanel(pageTwoLayout, "TRAIL START", PartEditor.TrailStart));
            pageTwoSliders.Add(UIFunctions.CreateSliderPanel(pageTwoLayout, "TRAIL END", PartEditor.TrailEnd));

            pageTwoLayout.gameObject.SetActive(false);
        }
Пример #11
0
        //find user textures and send them to be loaded into custom materials
        public static void FindUserTextures()
        {
            List <string> imagePaths = (Directory.GetFiles(Path.Combine(Application.dataPath, "../SaberForgeAssets/UserTextures/"), "*.png", SearchOption.AllDirectories).ToList());

            Logger.log.Debug($"Found {imagePaths.Count} user textures");


            foreach (string path in imagePaths)
            {
                string fileName = path.Replace(Path.Combine(Application.dataPath, "../SaberForgeAssets/UserTextures/"), "");

                string[] fileInfo = fileName.Split('_');

                if (fileInfo.Length != 3)
                {
                    Logger.log.Debug("Invalid texture name " + fileName + ", please refer to user guide for texture naming guidelines");
                    continue;
                }

                bool customColor = false;

                if (fileInfo[1] == "cctrue")
                {
                    customColor = true;
                }
                else if (fileInfo[1] == "ccfalse")
                {
                    customColor = false;
                }
                else
                {
                    Logger.log.Debug("Invalid texture name " + fileName + ", please refer to user guide for texture naming guidelines");
                    continue;
                }

                string   textureName = fileInfo[2].Replace(".png", "");
                Material templateMat;
                MaterialInfo.MaterialType matType = MaterialInfo.MaterialType.NamePlate;



                //find template material using file name
                if (fileInfo[0] == "cutout")
                {
                    textureName += "_Cutout";

                    if (customColor)
                    {
                        templateMat = PartEditor.FindMaterialInList("FrostDragon.CoreParts.Template.Cutout_Demo_CC", PartEditor.TemplateList);
                    }

                    else
                    {
                        templateMat = PartEditor.FindMaterialInList("FrostDragon.CoreParts.Template.Cutout_Demo_NoCC", PartEditor.TemplateList);
                    }
                }
                else if (fileInfo[0] == "trans")
                {
                    textureName += "_Trans";

                    if (customColor)
                    {
                        templateMat = PartEditor.FindMaterialInList("FrostDragon.CoreParts.Template.Trans_Demo_CC", PartEditor.TemplateList);
                    }
                    else
                    {
                        templateMat = PartEditor.FindMaterialInList("FrostDragon.CoreParts.Template.Trans_Demo_NoCC", PartEditor.TemplateList);
                    }
                }
                else if (fileInfo[0] == "opaque")
                {
                    textureName += "_Opaque";

                    if (customColor)
                    {
                        templateMat = PartEditor.FindMaterialInList("FrostDragon.CoreParts.Template.Opaque_Demo_CC", PartEditor.TemplateList);
                    }
                    else
                    {
                        templateMat = PartEditor.FindMaterialInList("FrostDragon.CoreParts.Template.Opaque_Demo_NoCC", PartEditor.TemplateList);
                    }
                }
                else if (fileInfo[0] == "trail")
                {
                    textureName += "_Trail";
                    matType      = MaterialInfo.MaterialType.Trail;

                    if (customColor)
                    {
                        templateMat = PartEditor.FindMaterialInList("FrostDragon.CoreParts.Template.Basic_Trail_CC", PartEditor.TemplateList);
                    }
                    else
                    {
                        templateMat = PartEditor.FindMaterialInList("FrostDragon.CoreParts.Template.Basic_Trail_NoCC", PartEditor.TemplateList);
                    }
                }
                else if (fileInfo[0] == "flagtrail")
                {
                    textureName += "_FlagTrail";
                    matType      = MaterialInfo.MaterialType.Trail;

                    if (customColor)
                    {
                        templateMat = PartEditor.FindMaterialInList("FrostDragon.CoreParts.Template.Flag_Trail_CC", PartEditor.TemplateList);
                    }
                    else
                    {
                        templateMat = PartEditor.FindMaterialInList("FrostDragon.CoreParts.Template.Flag_Trail_NoCC", PartEditor.TemplateList);
                    }
                }
                else
                {
                    Logger.log.Debug("Invalid texture name " + fileName + ", please refer to user guide for texture naming guidelines");
                    continue;
                }

                GenerateUserMaterial(path, textureName, templateMat, customColor, matType);
            }

            //update labels
            UIFunctions.UpdateAllMatLabels();
        }
Пример #12
0
 public void ForceSliders()
 {
     UIFunctions.ForceSliderText(pageTwoSliders);
 }