void SetButtonSkin(ApplyUISkin.ButtonUI buttonUI, ButtonSkin skin) { SetImage(buttonUI.image, skin.buttonSkinData.customImage); if (buttonUI.text) { SetFontData(buttonUI.text, skin.buttonSkinData.customFontData); } SetSelectableSkin(buttonUI.button, skin.selectionProperties); }
public void ApplySkin(ApplyUISkin applyUISkin) { if (applyUISkin.uiType == ApplyUISkin.UI.Button) //Button { ButtonSkin buttonSkin = null; if (buttonSkins.ContainsKey(applyUISkin.category)) { buttonSkin = skin.buttonSkins[buttonSkins[applyUISkin.category]]; } else { buttonSkin = skin.buttonSkins[0]; } SetButtonSkin(applyUISkin.buttonUI, buttonSkin); } else if (applyUISkin.uiType == ApplyUISkin.UI.Toggle) //Toggle { ToggleSkin toggleSkin = null; if (toggleSkins.ContainsKey(applyUISkin.category)) { toggleSkin = skin.toggleSkins[toggleSkins[applyUISkin.category]]; } else { toggleSkin = skin.toggleSkins[0]; } SetToggleSkin(applyUISkin.toggleUI, toggleSkin); } else if (applyUISkin.uiType == ApplyUISkin.UI.Slider) //Slider { SliderSkin sliderSkin = null; if (sliderSkins.ContainsKey(applyUISkin.category)) { sliderSkin = skin.sliderSkins[sliderSkins[applyUISkin.category]]; } else { sliderSkin = skin.sliderSkins[0]; } SetSliderSkin(applyUISkin.sliderUI, sliderSkin); } else if (applyUISkin.uiType == ApplyUISkin.UI.Scrollbar) //Scrollbar { ScrollbarSkin scrollbarSkin = null; if (scrollbarskins.ContainsKey(applyUISkin.category)) { scrollbarSkin = skin.scrollbarSkins[scrollbarskins[applyUISkin.category]]; } else { scrollbarSkin = skin.scrollbarSkins[0]; } SetScrollbar(applyUISkin.scrollbarUI, scrollbarSkin); } else if (applyUISkin.uiType == ApplyUISkin.UI.InputField) //Scrollbar { InputFieldSkin inputFieldSkin = null; if (inputFieldSkins.ContainsKey(applyUISkin.category)) { inputFieldSkin = skin.inputFieldSkins[inputFieldSkins[applyUISkin.category]]; } else { inputFieldSkin = skin.inputFieldSkins[0]; } SetInputFieldUI(applyUISkin.inputfieldUI, inputFieldSkin); } else if (applyUISkin.uiType == ApplyUISkin.UI.DropDown) //DropDown { DropDownSkin dropDownSkin = null; if (dropDownSkins.ContainsKey(applyUISkin.category)) { dropDownSkin = skin.dropDownSkins[dropDownSkins[applyUISkin.category]]; } else { dropDownSkin = skin.dropDownSkins[0]; } SetDropDownSkin(applyUISkin.dropdownUI, dropDownSkin); } else if (applyUISkin.uiType == ApplyUISkin.UI.Text) { TextSkin textSkin = null; if (textSkins.ContainsKey(applyUISkin.category)) { textSkin = skin.textSkins[textSkins[applyUISkin.category]]; } else { textSkin = skin.textSkins[0]; } SetTextSkin(applyUISkin.textUI, textSkin); } else if (applyUISkin.uiType == ApplyUISkin.UI.Image) { ImageSkin imageSkin = null; if (imageSkins.ContainsKey(applyUISkin.category)) { imageSkin = skin.imageSkins[imageSkins[applyUISkin.category]]; } else { imageSkin = skin.imageSkins[0]; } SetImageSkin(applyUISkin.imageUI, imageSkin); } }