public override GameObject CreateObject(Transform parent) { GameObject gameObject = MonoBehaviour.Instantiate(safePrefab, parent, false); gameObject.name = "BSMLDropdownList"; SimpleTextDropdown dropdown = gameObject.GetComponentInChildren <SimpleTextDropdown>(); dropdown.gameObject.SetActive(false); dropdown.name = "Dropdown"; dropdown.GetComponentInChildren <VRGraphicRaycaster>(true).SetField("_physicsRaycaster", BeatSaberUI.PhysicsRaycasterWithCache); dropdown.GetComponentInChildren <ModalView>(true).SetField("_container", BeatSaberUI.DiContainer); ExternalComponents externalComponents = dropdown.gameObject.AddComponent <ExternalComponents>(); GameObject labelObject = gameObject.transform.Find("Label").gameObject; MonoBehaviour.Destroy(labelObject.GetComponent <LocalizedTextMeshProUGUI>()); externalComponents.components.Add(gameObject.transform.Find("Label").GetComponent <CurvedTextMeshPro>()); LayoutElement layoutElement = gameObject.AddComponent <LayoutElement>(); layoutElement.preferredHeight = 8; layoutElement.preferredWidth = 90; externalComponents.components.Add(layoutElement); DropDownListSetting dropDownListSetting = dropdown.gameObject.AddComponent <DropDownListSetting>(); dropDownListSetting.dropdown = dropdown; dropdown.gameObject.SetActive(true); gameObject.SetActive(true); return(dropdown.gameObject); }
public override GameObject CreateObject(Transform parent) { GameObject gameObject = Object.Instantiate(safePrefab, parent, false); gameObject.name = "BSMLDropdownList"; SimpleTextDropdown dropdown = gameObject.GetComponentInChildren <SimpleTextDropdown>(); dropdown.gameObject.SetActive(false); dropdown.name = "Dropdown"; dropdown.GetComponentInChildren <VRGraphicRaycaster>(true).SetField("_physicsRaycaster", BeatSaberUI.PhysicsRaycasterWithCache); dropdown.GetComponentInChildren <ModalView>(true).SetField("_container", BeatSaberUI.DiContainer); dropdown.GetComponentInChildren <ScrollView>(true).SetField("_platformHelper", BeatSaberUI.PlatformHelper); GameObject labelObject = gameObject.transform.Find("Label").gameObject; LocalizedTextMeshProUGUI localizedText = ConfigureLocalizedText(labelObject); CurvedTextMeshPro textMesh = labelObject.GetComponent <CurvedTextMeshPro>(); textMesh.text = "Default Text"; LayoutElement layoutElement = gameObject.AddComponent <LayoutElement>(); layoutElement.preferredHeight = 8; layoutElement.preferredWidth = 90; List <Component> externalComponents = dropdown.gameObject.AddComponent <ExternalComponents>().components; externalComponents.Add(textMesh); externalComponents.Add(localizedText); externalComponents.Add(layoutElement); DropDownListSetting dropDownListSetting = dropdown.gameObject.AddComponent <DropDownListSetting>(); dropDownListSetting.dropdown = dropdown; dropdown.gameObject.SetActive(true); gameObject.SetActive(true); return(dropdown.gameObject); }