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)
        {
            LabelAndValueDropdownWithTableView dropdown = MonoBehaviour.Instantiate(safePrefab, parent, false);

            dropdown.gameObject.SetActive(false);
            dropdown.name = "BSMLDropDownList";
            TextMeshProUGUI text = dropdown.GetField <TextMeshProUGUI, LabelAndValueDropdownWithTableView>("_labelText");

            text.fontSize = 5;
            dropdown.gameObject.AddComponent <ExternalComponents>().components.Add(text);

            LayoutElement layoutElement = dropdown.gameObject.AddComponent <LayoutElement>();

            layoutElement.preferredHeight = 8;
            layoutElement.preferredWidth  = 90;
            dropdown.SetLabelText("Default Text");
            dropdown.SetValueText("Default Text");

            DropDownListSetting dropDownListSetting = dropdown.gameObject.AddComponent <DropDownListSetting>();

            dropDownListSetting.tableView            = dropdown.GetField <TableView, DropdownWithTableView>("_tableView");
            dropDownListSetting.dropdown             = dropdown;
            dropDownListSetting.tableView.dataSource = dropDownListSetting;

            return(dropdown.gameObject);
        }
        public override GameObject CreateObject(Transform parent)
        {
            LabelAndValueDropdownWithTableView dropdown = MonoBehaviour.Instantiate(safePrefab, parent, false);

            dropdown.gameObject.SetActive(false);
            dropdown.name = "BSMLDropDownList";
            TextMeshProUGUI text = dropdown.GetPrivateField <TextMeshProUGUI>("_labelText");

            text.fontSize = 5;
            dropdown.gameObject.AddComponent <ExternalComponents>().components.Add(text);

            LayoutElement layoutElement = dropdown.gameObject.AddComponent <LayoutElement>();

            layoutElement.preferredHeight = 8;
            layoutElement.preferredWidth  = 90;
            dropdown.SetLabelText("Default Text");
            dropdown.SetValueText("Default Text");

            DropDownListSetting dropDownListSetting = dropdown.gameObject.AddComponent <DropDownListSetting>();
            //dropDownListSetting.tableView = dropdown.GetPrivateField<TableView>("_tableView");
            //temp
            FieldInfo fieldInfo = typeof(DropdownWithTableView).GetField("_tableView", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);

            dropDownListSetting.tableView = fieldInfo.GetValue(dropdown) as TableView;
            //
            dropDownListSetting.dropdown             = dropdown;
            dropDownListSetting.tableView.dataSource = dropDownListSetting;

            return(dropdown.gameObject);
        }
        public override void HandleType(ComponentTypeWithData componentType, BSMLParserParams parserParams)
        {
            DropDownListSetting listSetting = componentType.component as DropDownListSetting;

            if (componentType.data.TryGetValue("options", out string options))
            {
                if (!parserParams.values.TryGetValue(options, out BSMLValue values))
                {
                    throw new Exception("options '" + options + "' not found");
                }

                listSetting.values = values.GetValue() as List <object>;
            }
            else
            {
                throw new Exception("list must have associated options");
            }
        }
        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);
        }