private static GameObject GetBooleanOption(HeaderNavigationController self) { GameObject booleanOption; var gameplayRoot = self.headers.First(p => p.headerName == "Gameplay").headerRoot; var gameplayLayout = getLayout(gameplayRoot); booleanOption = null; foreach (Transform child in gameplayLayout.transform) { if (child.gameObject.name == "Option, HUD") { booleanOption = UnityEngine.Object.Instantiate(child.gameObject); booleanOption.SetActive(false); break; } } if (booleanOption == null) { Debug.LogError("couldn't find bool template"); } return(booleanOption); }
private static void CreateModButton(HeaderNavigationController self, out MPButton button, out TMPro.TextMeshProUGUI text, out GameObject root) { button = Object.Instantiate(self.headers[0].headerButton, self.headers[0].headerButton.transform.parent); //copy button text = Object.Instantiate(self.headers[0].tmpHeaderText, button.transform); //copy textmesh field text.name = "Text, Custom"; //button internal name text.GetComponent <LanguageTextMeshController>().token = "Mods"; //button text root = Object.Instantiate(self.headers[0].headerRoot, self.headers[0].headerRoot.transform.parent); //copy headerRoot }
private void makeconfig(HeaderNavigationController self) { #if DEBUG Debug.Log("instance"); #endif GameObject root = makeHeader(self); setBoolChoices(root); Getmultichoice(self); }
//Fuction that makes the entire mod option section private static void MakeModCategory(HeaderNavigationController self) { GameObject optionSection = makeHeader(self); RemoveOldOptions(optionSection); var optionPart = getLayout(optionSection); GetSettingInputs(self, out GameObject boolean, out GameObject multipleChoice); setBoolChoices(optionPart, boolean); //Getmultichoice(self); }
private void Getmultichoice(HeaderNavigationController self) { var root = self.headers[4].headerRoot; var graphiclayout = getLayout(root); GameObject original = null; foreach (Transform child in graphiclayout.transform) { if (child.gameObject.name != "Option, Vsync") { //Destroy(child.gameObject); } else { original = child.gameObject; } } foreach (var setting in listSettings.Where(p => p.type == typeof(CustomMultichoiceSetting)).Cast <CustomMultichoiceSetting>()) { GameObject stringconfig = Instantiate(original, layout.transform); stringconfig.name = "Option, " + setting.settingname; stringconfig.AddComponent <catagorymod>(); var textobject = stringconfig.gameObject.transform.Find("Text, Name").gameObject; var texttokenobject = textobject.GetComponent <LanguageTextMeshController>(); texttokenobject.token = setting.settingtext; var choiceobject = stringconfig.gameObject.transform.Find("CarouselRect").gameObject; var choices = choiceobject.GetComponent <CarouselController>(); choices.settingName = setting.conVar.name; choices.optionalText.text = "does the host need it?"; choices.settingSource = BaseSettingsControl.SettingSource.ConVar; List <CarouselController.Choice> userchoises = new List <CarouselController.Choice>(); foreach (var choice in setting.Choices) { var userchoice = new CarouselController.Choice { convarValue = choice.Value, customSprite = choices.choices[0].customSprite, suboptionDisplayToken = choice.DisplayText }; userchoises.Add(userchoice); } choices.choices = userchoises.ToArray(); } }
private static GameObject makeHeader(HeaderNavigationController self) { CreateModButton(self, out MPButton button, out TMPro.TextMeshProUGUI text, out GameObject root); button.name = "Button, Custom"; RemoveOldStuff(button); root.name = "SettingsSubPanel, Mods"; var Header = new HeaderNavigationController.Header { headerButton = button, headerName = "Button, Custom", headerRoot = root, tmpHeaderText = text }; var list = self.headers.ToList(); list.Add(Header); self.headers = list.ToArray(); return(root); }
private static GameObject makeHeader(HeaderNavigationController self) { instanciate(self, out MPButton button, out TMPro.TextMeshProUGUI text, out GameObject root); button.name = "Button, custom"; removoldbutton(button); nameconfigcatagory(text); root.name = "SettingsSubPanel, Mods"; var Header = new HeaderNavigationController.Header { headerButton = button, headerName = "Button, custom", headerRoot = root, tmpHeaderText = text }; var list = self.headers.ToList(); list.Add(Header); self.headers = list.ToArray(); return(root); }
private static GameObject GetMultiChoiceOption(HeaderNavigationController self) { GameObject multipleChoiceOption; var graphicRoot = self.headers.First(p => p.headerName == "Video").headerRoot; var graphiclayout = getLayout(graphicRoot); multipleChoiceOption = null; foreach (Transform child in graphiclayout.transform) { if (child.gameObject.name == "Option, Vsync") { multipleChoiceOption = UnityEngine.Object.Instantiate(child.gameObject); multipleChoiceOption.SetActive(false); break; } } if (multipleChoiceOption == null) { Debug.LogError("couldn't find multipleChoice template"); } return(multipleChoiceOption); }
internal static void GenerateNewHeader(On.RoR2.UI.HeaderNavigationController.orig_RebuildHeaders orig, HeaderNavigationController self) { //should prevent duplicates if (!self.headers.Any(p => p.headerName == "Button, Custom")) { //only in the options section if (self.headers.Any(p => p.headerName == "Gameplay")) { MakeModCategory(self); } } orig(self); }
private static void GetSettingInputs(HeaderNavigationController self, out GameObject booleanOption, out GameObject multipleChoiceOption) { multipleChoiceOption = GetMultiChoiceOption(self); booleanOption = GetBooleanOption(self); }
private void HeaderNavigationController_RebuildHeaders(On.RoR2.UI.HeaderNavigationController.orig_RebuildHeaders orig, HeaderNavigationController self) { if (!self.headers.Any(p => p.headerName == "Button, custom")) { //if (self.headers.Any(p => p.headerName == "Button, Gameplay")) //{ makeconfig(self); //} } orig(self); }
private static void instanciate(HeaderNavigationController self, out MPButton button, out TMPro.TextMeshProUGUI text, out GameObject root) { button = Instantiate(self.headers[0].headerButton, self.headers[0].headerButton.transform.parent); text = Instantiate(self.headers[0].tmpHeaderText, button.transform); root = Instantiate(self.headers[0].headerRoot, self.headers[0].headerRoot.transform.parent); }
private void GenerateNewHeader(On.RoR2.UI.HeaderNavigationController.orig_RebuildHeaders orig, HeaderNavigationController self) { orig(self); if (!self.headers.Any(p => p.headerName == "Button, custom")) { if (self.headers.Any(p => p.headerName == "Gameplay")) { MakeHeader(self); } } }