// Use this for initialization void Start() { GameObject dropper = GameObject.FindWithTag ("TypeSelect"); if(dropper == null) Debug.Log("Cannot find type select dropdown list"); else typeSelect = dropper.GetComponent<Dropdown>(); dropper = GameObject.FindWithTag ("MoveList"); if(dropper == null) Debug.Log("Cannot find Move List dropdown list"); else moveList = dropper.GetComponent<Dropdown>(); GameObject temp = GameObject.FindWithTag ("Size"); if(temp == null) Debug.Log("Cannot find Size text"); else size = temp.GetComponent<Text>(); temp = GameObject.FindWithTag ("Weight"); if(temp == null) Debug.Log("Cannot find Weight text"); else weight = temp.GetComponent<Text>(); pokeData = GameObject.FindWithTag ("PokeData"); if(pokeData == null) Debug.Log("Cannot find PokeData Gameobject"); else { movesPollFlag = false; dataPollFlag = false; } foreach(string str in types) { typeSelect.options.Add(new Dropdown.OptionData(str, null)); } }
/* * /BORDERLESS * */ // Use this for initialization void Start () { qualitySettings = transform.Find("QualitySettings").GetComponent<Dropdown>(); resolutionSettings = transform.Find("Resolutions").GetComponent<Dropdown>(); debugText = transform.Find("DEBUG").GetComponent<Text>(); windowSettings = transform.Find("WindowSettings").GetComponent<Dropdown>(); SetupInterface(); }
public void getValue(Dropdown target) { Debug.Log (string.Format (target.value.ToString())); GameObject imageDisplay = GameObject.Find ("mapImage"); }
void Start() { dropdown = GetComponent<Dropdown>(); LanguageManager.Instance.OnChangeLanguage += OnLanguageChanged; OnLanguageChanged(LanguageManager.Instance); }
void Start() { _data = GetComponent<Dropdown>(); if (_type == PrinterName) { if (!PrintDevice.isValid) { throw new NotSupportedException("認識できるプリンターがありません"); } var printer = PrintDevice.GetPrinterNames().GetEnumerator(); while (printer.MoveNext()) { _item = new Dropdown.OptionData(); _item.text = printer.Current; _data.options.Add(_item); } _data.captionText.text = _data.options[0].text; } else if (_type == PrinterColor) { var color = _offScreenCamera.GetComponent<Grayscale>(); if (_data.value == 0) { _printColor = PrintDevice.GetPrinterColorConfig(true); color.enabled = false; } else if (_data.value == 1) { _printColor = PrintDevice.GetPrinterColorConfig(false); color.enabled = true; } } }
void Start() { wepControl = GameObject.Find ("Player").GetComponent<PlayerWepControl> (); spellControl = GameObject.Find ("Player").GetComponent<PlayerSpellControl> (); mover = GameObject.Find ("Player").GetComponent<PlayerMove> (); wepSize = GameObject.Find ("Player").GetComponent<WeaponSize> (); mouseLook = GameObject.Find ("Player").GetComponentInChildren<SimpleSmoothMouseLook> (); bladeRenderer = GameObject.Find ("Player").transform.Find ("CharacterHead").Find ("RightWep").Find ("RightWepBlade").GetComponent<Renderer>(); handleRenderer = GameObject.Find ("Player").transform.Find ("CharacterHead").Find ("RightWep").Find ("RightWepHandle").GetComponent<Renderer>(); headSlider = transform.Find ("HeadSizeSlider").GetComponent<Slider> (); handleSlider = transform.Find ("HandleSizeSlider").GetComponent<Slider> (); typeDrop = transform.Find ("TypeDropdown").GetComponent<Dropdown> (); statText = transform.Find ("StatIndicator").GetComponent<Text> (); Transform colorStuff = transform.Find ("ColorCustomizers"); bladeRedSlider = colorStuff.Find ("BladeRedSlider").GetComponent<Slider>(); bladeGreenSlider = colorStuff.Find ("BladeGreenSlider").GetComponent<Slider>(); bladeBlueSlider = colorStuff.Find ("BladeBlueSlider").GetComponent<Slider>(); bladeColorImage = colorStuff.Find ("BladeColorImage").GetComponent<Image>(); handleRedSlider = colorStuff.Find ("HandleRedSlider").GetComponent<Slider>(); handleGreenSlider = colorStuff.Find ("HandleGreenSlider").GetComponent<Slider>(); handleBlueSlider = colorStuff.Find ("HandleBlueSlider").GetComponent<Slider>(); handleColorImage = colorStuff.Find ("HandleColorImage").GetComponent<Image>(); }
private void onTypeValueChanged(Dropdown drop) { if (selectedTile != null) { selectedTile.SetTileType((HexTileTypes)drop.value); } }
// Use this for initialization void Start() { drop = this.gameObject.gameObject.GetComponent<Dropdown> (); drop.onValueChanged.AddListener (delegate { valueChanged (drop); }); }
// Use this for initialization void Awake () { levelManager = GameObject.Find("LevelManager").GetComponent<LevelManager>(); characterNameText = GameObject.Find("CharacterNameText").GetComponent<Text>(); playerNameText = GameObject.Find("PlayerNameText").GetComponent<Text>(); speciesText = GameObject.Find("SpeciesText").GetComponent<Text>(); careerDropdown = GameObject.Find("CareerDropdown").GetComponent<Dropdown>(); specDropdown = GameObject.Find("SpecDropdown").GetComponent<Dropdown>(); nextButton = GameObject.Find("NextStepButton").GetComponent<Button>(); careerDescription = GameObject.Find("CareerDescriptionContent").GetComponent<Text>(); primarySpecDescription = GameObject.Find("PrimarySpecDescriptionContent").GetComponent<Text>(); careerSkillsText = GameObject.Find("CareerSkillsText").GetComponent<Text>(); bonusCareerSkillsText = GameObject.Find("BonusCareerSkillsText").GetComponent<Text>(); careerImage = GameObject.Find("CareerImage").GetComponent<Image>(); specImage = GameObject.Find("SpecImage").GetComponent<Image>(); characterNameText.text = CharacterInformation.CharacterName; playerNameText.text = CharacterInformation.PlayerName; speciesText.text = CharacterInformation.CharacterSpecies.SpeciesName; /*if (CharacterInformation.CharacterCareer != null) { SetCareerCombo(CharacterInformation.CharacterCareer); }*/ FillCareerDropdown(); /*if (CharacterInformation.characterSpecList.Count != 0) { SetSpecCombo(CharacterInformation.characterSpecList[0]); }*/ }
private void Start () { m_Dropdown = GetComponent<Dropdown>(); m_Dropdown.options.Clear(); m_Dropdown.captionText.text = string.Empty; m_Dropdown.value = -1; }
void Start() { Debug.Log("---- PLAYER_TYPE_DROPDOWN.Start()"); self = GetComponent<Dropdown>(); scriptselect.gameObject.SetActive(false); Debug.Log("---- END PLAYER_TYPE_DROPDOWN.Start()"); }
void Start() { VRSettings.enabled = false; InputField inF = FindObjectOfType(typeof(InputField)) as InputField; Dropdown[] dds = FindObjectsOfType(typeof(Dropdown)) as Dropdown[]; Slider CAD = FindObjectOfType(typeof(Slider)) as Slider; if (inF != null) { nameField = inF; } if (dds != null) { for (int i = 0; i < dds.Length; i++) { Dropdown dd = dds[i]; if (dd.name == "Trial Type") { trialType = dd; } else if (dd.name == "Handedness") { handedness = dd; } } } if (CAD != null) { CADExperience = CAD; } }
private Ingredient ConvertDropdownValueToIngredient(Dropdown dropdown, List<Ingredient> ingredientList) { var result = ingredientList.FirstOrDefault(i => i.Name == dropdown.options[dropdown.value].text); if (result == null) throw new Exception("Ingredient list did not contain selected option. Wrong combo of dropdown and ingredient list?"); return result; }
void OnOptionChange(Dropdown d) { if (d.value == 0) { Localisation.Instance.LoadLanguage(Localisation.Language.English); } else { Localisation.Instance.LoadLanguage(Localisation.Language.Russian); } GetComponentInParent<SettingsTranslation>().UpdateText(); }
void Start() { dp = GetComponent<Dropdown> (); dp.onValueChanged.AddListener(onChange); planets = new Rigidbody[] {Sun, Mercury, Venus, Earth, Mars, Jupiter, Saturn, Neptune, Uranus}; CurrentPlanet = PlanetToStartWith; }
private void FillDropdown(Dropdown partDrop) { partDrop.options.Clear(); foreach (BodyPart bp in Settings.Instance.GetAllowedBodyParts(partDrop == BodypartSelectors[0])) { partDrop.options.Add(new Dropdown.OptionData() { text = bp.Name }); } }
public void OnCommandChanged(int command) { Selected = null; if ((int)_codeLine.Cmd == command) return; _codeLine.Cmd = (CodeLine.Instruction) command; Setup(_codeLine, _number); }
void Start() { dropDown = GetComponent<Dropdown>(); cam_switcher = CameraSettingsManager.GetComponent<CameraSwitch>(); cam_switcher.Init(); dropDown.value = PlayerPrefs.GetInt(CameraSettings.Instance.CAMERA_TYPE); SetCameraType(); }
void onDropdownChanged(Dropdown dropdown) { if (team == 0) BoardManager.AIBlue = OptionsToAI[dropdown.value]; else BoardManager.AIRed = OptionsToAI[dropdown.value]; Debug.Log("AI selected: " + OptionsToAI[dropdown.value]); }
//=========================================================== // 関数定義 //=========================================================== //--------------------------------------------------- // コンストラクタ //--------------------------------------------------- void Awake() { m_CellList = new List<CZParamCell>(); m_ColName = transform.FindChild("InputName").FindChild("Text").GetComponent<Text>(); m_SelType = transform.FindChild("SelType").GetComponent<Dropdown>(); m_vColSize = m_ColName.GetComponent<RectTransform>().sizeDelta; }
public void OnCustomOptionSelected(Dropdown dropdown) { if (dropdown.value == 3) { TurnOnCanvasGroup(); } else { TurnOffCanvasGroup(); } }
// Use this for initialization void Start() { dropdown = GetComponent<Dropdown>(); foreach (var v in Enum.GetNames(typeof (Objectives.Type))) { dropdown.options.Add(new Dropdown.OptionData(v)); } }
// Use this for initialization void Start() { //image = GetComponent<Image>(); dropdown = GetComponent<Dropdown>(); dropdown.onValueChanged.AddListener(DropdownValueChange); houses = new GameObject(); houses.transform.name = "Houses"; }
//public Sprite imgDisabledState; // Use this for initialization void Start() { dropdown = GameObject.Find(object_name).GetComponent<Dropdown>(); dropdown.AddOptions(new List<string> { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", " " }); dropdown.onValueChanged.AddListener(ChangeValue); manager = GameObject.Find("Manager").GetComponent<Manager>(); //DisableSelectedNumbers(); manager.ValueChangedEvent += ResetSelectedNumbers; }
protected override void Init() { uiDropdown = GetComponent<Dropdown>(); uiDropdown.onValueChanged.AddListener(OnChangeId); AddUpdater(enabledName, UpdateEnabled); AddUpdater(interactableName, UpdateInteractable); AddUpdater(selectNumName, UpdateSelectNumber); AddUpdater(captionListName, UpdateCaptionList); }
public void ChangeScene(Dropdown _dropdown) { for (int i = 0; i < maps.transform.childCount; i++) { maps.transform.GetChild(i).gameObject.SetActive(false); } maps.transform.GetChild(_dropdown.value).gameObject.SetActive(true); selectedMap = maps.transform.GetChild(_dropdown.value).GetComponent<Map>(); }
void Start() { VRSettings.enabled = false; Dropdown dd = FindObjectOfType(typeof(Dropdown)) as Dropdown; if (dd != null) { userList = dd; } PopulateUserList(); }
public void PartDropChanged(Dropdown partDrop) { if (partDrop == BodypartSelectors[0]) { Settings.Instance.BodyPartTreated = Settings.Instance.GetBodypartByName(partDrop.captionText.text); FillDropdown(BodypartSelectors[1]); } else { Settings.Instance.BodyPartHealthy = Settings.Instance.GetBodypartByName(partDrop.captionText.text); FillDropdown(BodypartSelectors[0]); } Settings.Instance.SaveSettings(); }
//change to/from fullscreen public void changeFullscreen(Dropdown dropdown) { if (dropdown.value == 0)//fullscreen { Screen.SetResolution(maxGameWidth, maxGameHeight, true); } else if (dropdown.value == 1)//not fullscreen { Screen.SetResolution(gVar.gameWidth, gVar.gameHeight, false); } }
// Use this for initialization void Start () { m_Dropdown = GetComponent<Dropdown>(); Resolution[] resolutions = Screen.resolutions; foreach (Resolution resolution in resolutions) { m_Dropdown.options.Add(new Dropdown.OptionData(ResToString(resolution))); } m_Dropdown.onValueChanged.AddListener(delegate { Screen.SetResolution(resolutions[m_Dropdown.value].width, resolutions[m_Dropdown.value].height, true); }); }
public UINode DrawLayer(Layer layer, UINode parent) { UINode node = PSDImportUtility.InstantiateItem(PSDImporterConst.PREFAB_PATH_DROPDOWN, layer.name, parent); Dropdown dropdown = node.GetComponent <Dropdown>(); ScrollRect scrllRect = dropdown.template.GetComponent <ScrollRect>(); RectTransform content = scrllRect.content; Toggle toggle = content.GetComponentInChildren <Toggle>(); UINode childNode = new UINode(dropdown.template, node); childNode.transform.SetParent(PSDImportUtility.canvas.transform); childNode.anchoType = UINode.AnchoType.Down | UINode.AnchoType.XStretch; //由于设置相对坐标需要,所以修改了部分预制体的状态 childNode.ReprocessEvent = () => { RectTransform rt = childNode.GetComponent <RectTransform>(); rt.pivot = new Vector2(0.5f, 1); rt.anchoredPosition = Vector3.zero; }; for (int i = 0; i < layer.images.Length; i++) { Image image = layer.images[i]; string lowerName = image.name.ToLower(); if (lowerName.StartsWith("b1_")) { PSDImportUtility.SetPictureOrLoadColor(image, dropdown.image); PSDImportUtility.SetRectTransform(image, dropdown.GetComponent <RectTransform>()); dropdown.name = layer.name; } else if (lowerName.StartsWith("b2_")) { PSDImportUtility.SetPictureOrLoadColor(image, dropdown.template.GetComponent <Graphic>()); PSDImportUtility.SetRectTransform(image, dropdown.template); } else if (lowerName.StartsWith("b3_")) { UnityEngine.UI.Image itemimage = (UnityEngine.UI.Image)toggle.targetGraphic; PSDImportUtility.SetPictureOrLoadColor(image, itemimage); content.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, image.size.height); } else if (lowerName.StartsWith("l1_")) { PSDImportUtility.SetPictureOrLoadColor(image, dropdown.captionText); float size; if (float.TryParse(image.arguments[2], out size)) { dropdown.captionText.fontSize = (int)size; } dropdown.captionText.text = image.arguments[3]; } else if (lowerName.StartsWith("l2_")) { PSDImportUtility.SetPictureOrLoadColor(image, dropdown.itemText); float size; if (float.TryParse(image.arguments[2], out size)) { dropdown.itemText.fontSize = (int)size; } dropdown.itemText.text = image.arguments[3]; } else if (lowerName.StartsWith("m_")) { UnityEngine.UI.Image mask = (UnityEngine.UI.Image)toggle.graphic; PSDImportUtility.SetPictureOrLoadColor(image, mask); } else { ctrl.DrawImage(image, node); } } for (int i = 0; i < layer.layers.Length; i++) { Layer child = layer.layers[i]; string lowerName = child.name; if (lowerName.StartsWith("vb_")) { UINode barNode = ctrl.DrawLayer(child, childNode); scrllRect.verticalScrollbar = barNode.GetComponent <Scrollbar>(); scrllRect.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHide; } else { ctrl.DrawLayer(child, node); } } return(node); }
void valueChanged_customProfiles(Dropdown sender) { ConfigManager.GetInstance().SelectProfile_customize(sender.value); }
/// <summary> /// Set the selection to target index. /// </summary> /// <param name="dd"> dropdown object. </param> /// <param name="selection"> selection id. </param> public static void Dropdown_SetSelection(Dropdown dd, int selection) { dd.value = selection; }
public void OnVideoQualityValueChanged(Dropdown dp) { SetVideoQuality((VideoQuality)dp.value); }
/// <summary> /// Replacing entering DropDown optionsList to your sprite list /// </summary> /// <param name="dropdown">DropDown to replace</param> /// <param name="colors">Colors list to replace</param> /// <param name="enter">DropDown with starting parameters</param> public static void FillDropDownByColorAndTextList(out Dropdown dropdown, List <Color> colors, List <string> strings, Dropdown enter) { dropdown = enter; if (colors.Count != strings.Count) { return; } List <Dropdown.OptionData> options = new List <Dropdown.OptionData>(); for (int i = 0; i < colors.Count; i++) { Texture2D imgcol = new Texture2D(1, 1, TextureFormat.RGBA32, false); imgcol.SetPixel(1, 1, colors[i]); imgcol.Apply(); options.Add(new Dropdown.OptionData()); options[i].image = Sprite.Create(imgcol, new Rect(0.0f, 0.0f, imgcol.width, imgcol.height), new Vector2(0.5f, 0.5f)); options[i].text = strings[i]; } dropdown.options = options; }
public static Dropdown <THelper> SetDropup <THelper>(this Dropdown <THelper> dropdown, bool dropup = true) where THelper : BootstrapHelper <THelper> { dropdown.ToggleCss(Css.Dropup, dropup); return(dropdown); }
public static Dropdown <THelper> SetCaret <THelper>(this Dropdown <THelper> dropdown, bool caret = true) where THelper : BootstrapHelper <THelper> { dropdown.Caret = caret; return(dropdown); }
// Use this for initialization void Start() { selector = GetComponent <Dropdown> (); }
void Start() { dropdown = gameObject.GetComponent <Dropdown>(); UpdateValue(); }
void Start() { skeletonMaterial = Resources.Load("Skeleton", typeof(Material)) as Material; barracudaRunner = GameObject.Find("BarracudaRunner").GetComponent <VNectBarracudaRunner>(); barracudaRunner.ModelQuality = configurationSetting.TrainedModel; videoCapture = GameObject.Find("MainTexrure").GetComponent <VideoCapture>(); Menu = GameObject.Find("Menu"); cameraMover = GameObject.Find("MainCamera").GetComponent <CameraMover>(); sourceDevice = GameObject.Find("SourceDevice").GetComponent <Dropdown>(); WebCamDevice[] devices = WebCamTexture.devices; foreach (var d in devices) { sourceDevice.options.Add(new Dropdown.OptionData(d.name)); } sourceDevice.value = 0; btnPause = GameObject.Find("btnPause").GetComponent <Button>(); ifFrame = GameObject.Find("ifFrame").GetComponent <InputField>(); txFrameCount = GameObject.Find("txFrameCount").GetComponent <Text>(); btnSkip = GameObject.Find("btnSkip").GetComponent <Button>(); pnlVideoIF = GameObject.Find("pnlVideoIF"); pnlVideoIF.SetActive(false); btnSourceDevice = GameObject.Find("btnSourceDevice").GetComponent <Button>(); txtFPS = GameObject.Find("txtFPS").GetComponent <Text>(); btnRecord = GameObject.Find("btnRecord").GetComponent <Button>(); avatars = GameObject.Find("Avatars").GetComponent <Dropdown>(); avatarSetting = GameObject.Find("AvatarSetting").GetComponent <AvatarSettingScript>(); avatarSetting.Init(); avatarSetting.gameObject.SetActive(false); configuration = GameObject.Find("Configuration").GetComponent <ConfigurationScript>(); configuration.Init(); configuration.gameObject.SetActive(false); ReflectConfiguration(configurationSetting); var settings = PlayerPrefs.GetString("AvatarSettings", ""); //settings = ""; // Decode Avatar Setting string[] asStr = settings.Split(';'); foreach (var s in asStr) { string[] col = s.Split(','); if (col.Length != 16) { continue; } var setting = new AvatarSetting(); if (!int.TryParse(col[0], out setting.AvatarType)) { continue; } if (setting.AvatarType < 0) { } else if (setting.AvatarType == 0) { setting.VRMFilePath = col[1]; } else if (setting.AvatarType == 1) { setting.FBXFilePath = col[1]; } setting.AvatarName = col[2]; if (!float.TryParse(col[3], out setting.PosX)) { continue; } if (!float.TryParse(col[4], out setting.PosY)) { continue; } if (!float.TryParse(col[5], out setting.PosZ)) { continue; } if (!float.TryParse(col[6], out setting.DepthScale)) { continue; } if (!float.TryParse(col[7], out setting.Scale)) { continue; } if (!float.TryParse(col[8], out setting.FaceOriX)) { continue; } if (!float.TryParse(col[9], out setting.FaceOriY)) { continue; } if (!float.TryParse(col[10], out setting.FaceOriZ)) { continue; } if (!int.TryParse(col[11], out setting.SkeletonVisible)) { continue; } if (!float.TryParse(col[12], out setting.SkeletonPosX)) { continue; } if (!float.TryParse(col[13], out setting.SkeletonPosY)) { continue; } if (!float.TryParse(col[14], out setting.SkeletonPosZ)) { continue; } if (!float.TryParse(col[15], out setting.SkeletonScale)) { continue; } AvatarList.Add(setting); } ; if (AvatarList.Count == 0) { var setting = new AvatarSetting() { AvatarType = -1, AvatarName = "蘭鈴りゅん (Lune)", Avatar = GameObject.Find("Lune").GetComponent <VNectModel>(), }; setting.Avatar.SetNose(setting.FaceOriX, setting.FaceOriY, setting.FaceOriZ); AvatarList.Add(setting); barracudaRunner.InitVNectModel(setting.Avatar, configurationSetting); setting = new AvatarSetting() { AvatarType = -2, AvatarName = "yukihiko-chan", Avatar = GameObject.Find("YukihikoAoyagi").GetComponent <VNectModel>(), }; setting.Avatar.SetNose(setting.FaceOriX, setting.FaceOriY, setting.FaceOriZ); AvatarList.Add(setting); barracudaRunner.InitVNectModel(setting.Avatar, configurationSetting); } avatars.options.Clear(); foreach (var setting in AvatarList) { if (setting.AvatarType >= 0) { LoadAvatar(setting); } else if (setting.AvatarType < 0) { avatars.options.Add(new Dropdown.OptionData(setting.AvatarName)); switch (setting.AvatarType) { case -1: setting.Avatar = GameObject.Find("Lune").GetComponent <VNectModel>(); break; case -2: setting.Avatar = GameObject.Find("YukihikoAoyagi").GetComponent <VNectModel>(); break; } setting.Avatar.SetNose(setting.FaceOriX, setting.FaceOriY, setting.FaceOriZ); barracudaRunner.InitVNectModel(setting.Avatar, configurationSetting); } } avatars.value = 0; ChangedAvatar(0); }
private void Start() { enemy = transform.GetComponentInChildren <Dropdown>(); input = transform.GetComponentInChildren <InputField>(); waveSpawner = GameMaster.transform.GetComponent <WaveSpawner>(); }
/// <summary> /// Create the basic UI dropdown. /// </summary> /// <remarks> /// Hierarchy: /// (root) /// Dropdown /// - Label /// - Arrow /// - Template /// - Viewport /// - Content /// - Item /// - Item Background /// - Item Checkmark /// - Item Label /// - Scrollbar /// - Sliding Area /// - Handle /// </remarks> /// <param name="resources">The resources to use for creation.</param> /// <returns>The root GameObject of the created element.</returns> public static GameObject CreateDropdown(Resources resources) { GameObject root = CreateUIElementRoot("Dropdown", s_ThickElementSize); GameObject label = CreateUIObject("Label", root); GameObject arrow = CreateUIObject("Arrow", root); GameObject template = CreateUIObject("Template", root); GameObject viewport = CreateUIObject("Viewport", template); GameObject content = CreateUIObject("Content", viewport); GameObject item = CreateUIObject("Item", content); GameObject itemBackground = CreateUIObject("Item Background", item); GameObject itemCheckmark = CreateUIObject("Item Checkmark", item); GameObject itemLabel = CreateUIObject("Item Label", item); // Sub controls. GameObject scrollbar = CreateScrollbar(resources); scrollbar.name = "Scrollbar"; SetParentAndAlign(scrollbar, template); Scrollbar scrollbarScrollbar = scrollbar.GetComponent <Scrollbar>(); scrollbarScrollbar.SetDirection(Scrollbar.Direction.BottomToTop, true); RectTransform vScrollbarRT = scrollbar.GetComponent <RectTransform>(); vScrollbarRT.anchorMin = Vector2.right; vScrollbarRT.anchorMax = Vector2.one; vScrollbarRT.pivot = Vector2.one; vScrollbarRT.sizeDelta = new Vector2(vScrollbarRT.sizeDelta.x, 0); // Setup item UI components. LanguageText itemLabelText = itemLabel.AddComponent <LanguageText>(); SetDefaultTextValues(itemLabelText); itemLabelText.alignment = TextAnchor.MiddleLeft; Image itemBackgroundImage = itemBackground.AddComponent <Image>(); itemBackgroundImage.color = new Color32(245, 245, 245, 255); Image itemCheckmarkImage = itemCheckmark.AddComponent <Image>(); itemCheckmarkImage.sprite = resources.checkmark; Toggle itemToggle = item.AddComponent <Toggle>(); itemToggle.targetGraphic = itemBackgroundImage; itemToggle.graphic = itemCheckmarkImage; itemToggle.isOn = true; // Setup template UI components. Image templateImage = template.AddComponent <Image>(); templateImage.sprite = resources.standard; templateImage.type = Image.Type.Sliced; ScrollRect templateScrollRect = template.AddComponent <ScrollRect>(); templateScrollRect.content = (RectTransform)content.transform; templateScrollRect.viewport = (RectTransform)viewport.transform; templateScrollRect.horizontal = false; templateScrollRect.movementType = ScrollRect.MovementType.Clamped; templateScrollRect.verticalScrollbar = scrollbarScrollbar; templateScrollRect.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport; templateScrollRect.verticalScrollbarSpacing = -3; Mask scrollRectMask = viewport.AddComponent <Mask>(); scrollRectMask.showMaskGraphic = false; Image viewportImage = viewport.AddComponent <Image>(); viewportImage.sprite = resources.mask; viewportImage.type = Image.Type.Sliced; // Setup dropdown UI components. LanguageText labelText = label.AddComponent <LanguageText>(); SetDefaultTextValues(labelText); labelText.alignment = TextAnchor.MiddleLeft; Image arrowImage = arrow.AddComponent <Image>(); arrowImage.sprite = resources.dropdown; Image backgroundImage = root.AddComponent <Image>(); backgroundImage.sprite = resources.standard; backgroundImage.color = s_DefaultSelectableColor; backgroundImage.type = Image.Type.Sliced; Dropdown dropdown = root.AddComponent <Dropdown>(); dropdown.targetGraphic = backgroundImage; SetDefaultColorTransitionValues(dropdown); dropdown.template = template.GetComponent <RectTransform>(); dropdown.captionText = labelText; dropdown.itemText = itemLabelText; // Setting default Item list. itemLabelText.text = "Option A"; dropdown.options.Add(new Dropdown.OptionData { text = "Option A" }); dropdown.options.Add(new Dropdown.OptionData { text = "Option B" }); dropdown.options.Add(new Dropdown.OptionData { text = "Option C" }); dropdown.RefreshShownValue(); // Set up RectTransforms. RectTransform labelRT = label.GetComponent <RectTransform>(); labelRT.anchorMin = Vector2.zero; labelRT.anchorMax = Vector2.one; labelRT.offsetMin = new Vector2(10, 6); labelRT.offsetMax = new Vector2(-25, -7); RectTransform arrowRT = arrow.GetComponent <RectTransform>(); arrowRT.anchorMin = new Vector2(1, 0.5f); arrowRT.anchorMax = new Vector2(1, 0.5f); arrowRT.sizeDelta = new Vector2(20, 20); arrowRT.anchoredPosition = new Vector2(-15, 0); RectTransform templateRT = template.GetComponent <RectTransform>(); templateRT.anchorMin = new Vector2(0, 0); templateRT.anchorMax = new Vector2(1, 0); templateRT.pivot = new Vector2(0.5f, 1); templateRT.anchoredPosition = new Vector2(0, 2); templateRT.sizeDelta = new Vector2(0, 150); RectTransform viewportRT = viewport.GetComponent <RectTransform>(); viewportRT.anchorMin = new Vector2(0, 0); viewportRT.anchorMax = new Vector2(1, 1); viewportRT.sizeDelta = new Vector2(-18, 0); viewportRT.pivot = new Vector2(0, 1); RectTransform contentRT = content.GetComponent <RectTransform>(); contentRT.anchorMin = new Vector2(0f, 1); contentRT.anchorMax = new Vector2(1f, 1); contentRT.pivot = new Vector2(0.5f, 1); contentRT.anchoredPosition = new Vector2(0, 0); contentRT.sizeDelta = new Vector2(0, 28); RectTransform itemRT = item.GetComponent <RectTransform>(); itemRT.anchorMin = new Vector2(0, 0.5f); itemRT.anchorMax = new Vector2(1, 0.5f); itemRT.sizeDelta = new Vector2(0, 20); RectTransform itemBackgroundRT = itemBackground.GetComponent <RectTransform>(); itemBackgroundRT.anchorMin = Vector2.zero; itemBackgroundRT.anchorMax = Vector2.one; itemBackgroundRT.sizeDelta = Vector2.zero; RectTransform itemCheckmarkRT = itemCheckmark.GetComponent <RectTransform>(); itemCheckmarkRT.anchorMin = new Vector2(0, 0.5f); itemCheckmarkRT.anchorMax = new Vector2(0, 0.5f); itemCheckmarkRT.sizeDelta = new Vector2(20, 20); itemCheckmarkRT.anchoredPosition = new Vector2(10, 0); RectTransform itemLabelRT = itemLabel.GetComponent <RectTransform>(); itemLabelRT.anchorMin = Vector2.zero; itemLabelRT.anchorMax = Vector2.one; itemLabelRT.offsetMin = new Vector2(20, 1); itemLabelRT.offsetMax = new Vector2(-10, -2); template.SetActive(false); return(root); }
public void Initialize(MethodInfo info, SelectionBlock selected) { nameText.text = info.Name; SelectedBlock = selected; /* Iterate through parameters here and construct a new block * from the given parameter prefabs (e.g. FloatFieldPrefab, BoolFieldPrefab etc.) * Add new parameters in this loop * It's necessary to add a listener that will change the block's parameters */ ParameterInfo[] infos = info.GetParameters(); Parameters = (infos.Length > 0) ? new object[infos.Length] : null; for (int i = 0; i < infos.Length; i++) { Type parameterType = infos[i].ParameterType; int index = i; if (parameterType == typeof(int)) { InputField inputField = InstantiateBlockParameter <InputField>(IntFieldPrefab); // Instantiate the parameter UI Parameters[index] = Int32.Parse(inputField.text); // Get the initial value // Add a listener that changes the parameter property when edited inputField.onEndEdit.AddListener(delegate { if (inputField.text == "") { inputField.text = "0"; } Parameters[index] = Int32.Parse(inputField.text); }); } else if (parameterType.BaseType == typeof(Enum)) { Dropdown dropdown = InstantiateBlockParameter <Dropdown>(DropdownPrefab); // Populate the dropdown list foreach (var option in Enum.GetValues(infos[i].ParameterType)) { dropdown.options.Add(new Dropdown.OptionData(option.ToString())); } Parameters[index] = dropdown.value; dropdown.onValueChanged.AddListener(delegate { Parameters[index] = dropdown.value; }); } else if (parameterType == typeof(float)) { InputField inputField = InstantiateBlockParameter <InputField>(FloatFieldPrefab); Parameters[index] = float.Parse(inputField.text); inputField.onEndEdit.AddListener(delegate { if (inputField.text == "") { inputField.text = "0"; } Parameters[index] = float.Parse(inputField.text); }); } else if (parameterType == typeof(string)) { InputField inputField = InstantiateBlockParameter <InputField>(StringFieldPrefab); Parameters[index] = inputField.text; inputField.onEndEdit.AddListener(x => Parameters[index] = inputField.text); } else if (parameterType == typeof(bool)) { Toggle toggle = InstantiateBlockParameter <Toggle>(BoolFieldPrefab); Parameters[index] = toggle.isOn; toggle.onValueChanged.AddListener(x => Parameters[index] = toggle.isOn); } } Canvas.ForceUpdateCanvases(); FitToChildren(); }
void Start() { dropdown = GameObject.Find("Dropdown").GetComponent <Dropdown>(); PopulateList(); }
private void DrawRightHand(ParameterType type) { Destroy(_rightHand); Destroy(_comparator); _comparator = Instantiate(_timeLine.EntryHudScriptableObject.CastLabel, transform).GetComponent <Dropdown>(); _rightHand = Instantiate(_timeLine.EntryHudScriptableObject.CastLabel, transform).GetComponent <Dropdown>(); var rhOptions = from val in _mainTimeLine.CustomRefrenceValues where val.Type.Equality(type) select val; _rightHand.ClearOptions(); List <string> rhOptionsAsString = AsStringList(rhOptions); _rightHand.AddOptions(rhOptionsAsString); if (_entry.Parameters.TryGetValue(_righthandString, out ParameterData parameterDataRh)) { _rightHand.SetValueWithoutNotify(rhOptionsAsString.IndexOf(parameterDataRh.RefrenceValue.Label)); } else if (rhOptions.Count() != 0) { _rightHand.SetValueWithoutNotify(0); _entry.Parameters[_righthandString] = new ParameterData() { IsRefrenceValue = true, RefrenceValue = rhOptions.First() }; } _rightHand.onValueChanged.AddListener(r => { if (rhOptions.Count() == 0) { return; } var rhOption = rhOptions.ElementAt(r); StoreParameter(rhOption, _righthandString, new ParameterData() { IsRefrenceValue = true, RefrenceValue = rhOption, Value = null }); }); var comparatorOptions = new List <string>() { "==" }; if (type == ParameterType.NUM) { comparatorOptions.Add("<"); comparatorOptions.Add(">"); } _comparator.ClearOptions(); _comparator.AddOptions(comparatorOptions); if (_entry.Parameters.TryGetValue(_comparatorString, out ParameterData parameterDataComp)) { _comparator.SetValueWithoutNotify(comparatorOptions.IndexOf(parameterDataComp.Value.ToString())); } else { _entry.Parameters[_comparatorString] = new ParameterData { Value = comparatorOptions[0] }; _comparator.SetValueWithoutNotify(0); } _comparator.onValueChanged.AddListener(c => { _entry.Parameters[_comparatorString] = new ParameterData() { Value = comparatorOptions[c] }; }); AlignParameterWidnows(new List <GameObject> { _leftHand.gameObject, _comparator.gameObject, _rightHand.gameObject }); }
public override void Connect() { dropdown = GetComponent <Dropdown>(); var selectionPropertyEndPoint = MakeViewModelEndPoint(viewModelSelectionPropertyName, selectionUIToViewModelAdapter, null); var selectionPropertySync = new PropertySync( // Source selectionPropertyEndPoint, // Dest new PropertyEndPoint( this, "SelectedOption", CreateAdapter(selectionViewModelToUIAdapter), null, "view", this ), // Errors, exceptions and validation. !string.IsNullOrEmpty(exceptionPropertyName) ? MakeViewModelEndPoint(exceptionPropertyName, exceptionAdapterTypeName, null) : null , this ); selectionPropertyWatcher = selectionPropertyEndPoint .Watch(() => selectionPropertySync.SyncFromSource()); selectionEventWatcher = new UnityEventWatcher( dropdown, "onValueChanged", () => { selectedOption = Options[dropdown.value]; // Copy value back from dropdown. selectionPropertySync.SyncFromDest(); } ); var optionsPropertySync = new PropertySync( // Source MakeViewModelEndPoint(viewModelOptionsPropertyName, null, null), // Dest new PropertyEndPoint( this, "Options", CreateAdapter(optionsAdapter), null, "view", this ), // Errors, exceptions and validation. null, // Validation not needed this ); // Copy the initial value from view-model to view. optionsPropertySync.SyncFromSource(); selectionPropertySync.SyncFromSource(); UpdateOptions(); }
public void OnQualityDropdownValueChanged(Dropdown dropdown) { QualitySettings.SetQualityLevel(dropdown.value); }
void RobotDropdownValueChanged(Dropdown dp) { settings_IpConfigManager.NewRobotSelected(rosConnectors[dp.value]); settings_RosModeManager.NewRobotSelected(rosConnectors[dp.value]); robotControl_PoseSelectionManager.NewRobotSelected(rosConnectors[dp.value]); }
public static Dropdown <THelper> SetMenuLeft <THelper>(this Dropdown <THelper> dropdown, bool menuLeft = true) where THelper : BootstrapHelper <THelper> { dropdown.MenuLeft = menuLeft; return(dropdown); }
/// <summary> /// Replacing entering DropDown optionsList to your sprite list /// </summary> /// <param name="dropdown">DropDown to replace</param> /// <param name="sprites">Sprite list to replace</param> /// <param name="enter">DropDown with starting parameters</param> public static void FillDropDownBySpriteList(out Dropdown dropdown, List <Sprite> sprites, Dropdown enter) { dropdown = enter; List <Dropdown.OptionData> options = new List <Dropdown.OptionData>(); for (int i = 0; i < sprites.Count; i++) { options.Add(new Dropdown.OptionData()); options[i].image = sprites[i]; } dropdown.options = options; }
private void Awake() { dropdown = gameObject.GetComponentInChildren <Dropdown>(); }
/// <summary> /// Returns item vlaue by index. /// </summary> /// <param name="dd"> Dropdown object. </param> /// <param name="index"> item name. </param> /// <returns> Current selected text value. </returns> public static string Dropdown_GetItemValue(Dropdown dd, int index) { return(dd.options[index].text); }
protected override void Reset() { base.Reset(); this.dropdown = GetComponentInChildren <Dropdown>(); }
public void SaveSettingsButton() { Dropdown forward = GameObject.FindGameObjectWithTag("Forward").GetComponent <Dropdown>(); Dropdown backward = GameObject.FindGameObjectWithTag("Backward").GetComponent <Dropdown>(); Dropdown left = GameObject.FindGameObjectWithTag("Left").GetComponent <Dropdown>(); Dropdown right = GameObject.FindGameObjectWithTag("Right").GetComponent <Dropdown>(); Dropdown shoot = GameObject.FindGameObjectWithTag("Shoot").GetComponent <Dropdown>(); Dropdown use = GameObject.FindGameObjectWithTag("Use").GetComponent <Dropdown> (); Dropdown menu = GameObject.FindGameObjectWithTag("Menu").GetComponent <Dropdown>(); int forwardKey = forward.value; int backwardKey = backward.value; int leftKey = left.value; int rightKey = right.value; int shootKey = shoot.value; int useKey = use.value; int menuKey = menu.value; if (forwardKey == 0) { PlayerPrefs.SetString("control_forward", "w"); } else if (forwardKey == 1) { PlayerPrefs.SetString("control_forward", "up"); } if (backwardKey == 0) { PlayerPrefs.SetString("control_backward", "s"); } else if (backwardKey == 1) { PlayerPrefs.SetString("control_backward", "down"); } if (leftKey == 0) { PlayerPrefs.SetString("control_left", "a"); } else if (leftKey == 1) { PlayerPrefs.SetString("control_left", "left"); } if (rightKey == 0) { PlayerPrefs.SetString("control_right", "d"); } else if (rightKey == 1) { PlayerPrefs.SetString("control_right", "right"); } if (shootKey == 0) { PlayerPrefs.SetString("control_shoot", "mouse0"); } else if (shootKey == 1) { PlayerPrefs.SetString("control_shoot", "space"); } if (useKey == 0) { PlayerPrefs.SetString("control_use", "e"); } else if (useKey == 1) { PlayerPrefs.SetString("control_use", "f"); } if (menuKey == 0) { PlayerPrefs.SetString("control_menu", "escape"); } else if (menuKey == 1) { PlayerPrefs.SetString("control_menu", "p"); } }
/// <summary> /// Replacing entering DropDown optionsList to your text list /// </summary> /// <param name="dropdown">DropDown to replace</param> /// <param name="strings">String list to replace</param> /// <param name="enter">DropDown with starting parameters</param> public static void FillDropDownByTextList(out Dropdown dropdown, List <string> strings, Dropdown enter) { dropdown = enter; List <Dropdown.OptionData> options = new List <Dropdown.OptionData>(); for (int i = 0; i < strings.Count; i++) { options.Add(new Dropdown.OptionData()); options[i].text = strings[i]; } dropdown.options = options; }
public ActionResult Create() { ViewBag.GetCountryList = Dropdown.GetCountryList(); return(View()); }
/// <summary> /// Replacing entering DropDown optionsList to your sprite and string list (index to index) /// </summary> /// <param name="dropdown">DropDown to replace</param> /// <param name="sprites">Sprite list to replace</param> /// <param name="strings">String list to replace</param> /// <param name="enter">DropDown with starting parameters</param> public static void FillDropDownBySpriteAndTextList(out Dropdown dropdown, List <Sprite> sprites, List <string> strings, Dropdown enter) { dropdown = enter; if (sprites.Count != strings.Count) { return; } List <Dropdown.OptionData> options = new List <Dropdown.OptionData>(); for (int i = 0; i < sprites.Count; i++) { options.Add(new Dropdown.OptionData()); options[i].image = sprites[i]; options[i].text = strings[i]; } dropdown.options = options; }
void Awake() { dropdown = GetComponent <Dropdown>(); dropdown.onValueChanged.AddListener(OnDropdownClick); }
public void OnResolutionValueChanged(Dropdown dp) { SetResolution((VideoResolution)dp.value); }
/// <summary> /// Get the current selected value of the Dropdown object. /// </summary> /// <param name="dd"> drop down object. </param> /// <returns> Current selected text value. </returns> public static string Dropdown_GetSelectedValue(Dropdown dd) { return(Dropdown_GetItemValue(dd, dd.value)); }