public void Setup(UICharacterCreateUMA ui, byte slotIndex, DnaSetter dnaSetter) { this.ui = ui; this.slotIndex = slotIndex; dnaName = dnaSetter.Name; if (textTitle != null) { string displayDnaName = dnaName; StringBuilder sb = new StringBuilder(); for (int i = 0; i < displayDnaName.Length; i++) { char c = displayDnaName[i]; if (i > 0 && char.IsUpper(c)) { sb.Append(' '); } if (i == 0) { c = char.ToUpper(c); } sb.Append(c); } textTitle.text = sb.ToString(); } if (slider != null) { slider.onValueChanged.RemoveListener(OnSliderValueChanged); slider.minValue = 0f; slider.maxValue = 1f; slider.value = 0.5f; OnSliderValueChanged(0.5f); slider.onValueChanged.AddListener(OnSliderValueChanged); } }
public void Setup(UICharacterCreateUMA ui, byte slotIndex) { this.ui = ui; this.slotIndex = slotIndex; SharedColorTable colorTable = GameInstance.Singleton.UmaRaces[ui.SelectedRaceIndex].colorTables[slotIndex]; if (textTitle != null) { textTitle.text = colorTable.sharedColorName; } if (dropdown != null) { List <DropdownWithColor.OptionData> dropdownOptions = new List <DropdownWithColor.OptionData>(); OverlayColorData[] colors = colorTable.colors; for (int i = 0; i < colors.Length; ++i) { dropdownOptions.Add(new DropdownWithColor.OptionData() { image = dropdownSprite, color = colors[i].color, }); } dropdown.onValueChanged.RemoveListener(OnDropdownValueChanged); dropdown.options = dropdownOptions; OnDropdownValueChanged(0); dropdown.onValueChanged.AddListener(OnDropdownValueChanged); } }
public virtual void Setup(UICharacterCreateUMA ui, byte slotIndex) { this.ui = ui; this.slotIndex = slotIndex; UmaCustomizableSlot slot = GameInstance.Singleton.UmaRaces[ui.SelectedRaceIndex].genders[ui.SelectedGenderIndex].customizableSlots[slotIndex]; // Set Title if (textTitle != null) { textTitle.text = slot.title; } // Set Dropdown options if (dropdown != null) { Dictionary <string, List <UMATextRecipe> > recipes = ui.UmaModel.CacheUmaAvatar.AvailableRecipes; List <UMATextRecipe> usingRecipes; List <DropdownWrapper.OptionData> dropdownOptions = new List <DropdownWrapper.OptionData>(); if (recipes.TryGetValue(slot.name, out usingRecipes)) { foreach (UMATextRecipe usingRecipe in usingRecipes) { string name; if (string.IsNullOrEmpty(usingRecipe.DisplayValue)) { name = usingRecipe.name; } else { name = usingRecipe.DisplayValue; } dropdownOptions.Add(new DropdownWrapper.OptionData() { text = name, }); } } dropdown.onValueChanged.RemoveListener(OnDropdownValueChanged); dropdown.options = dropdownOptions; OnDropdownValueChanged(0); dropdown.onValueChanged.AddListener(OnDropdownValueChanged); } }