| | |
| | | } |
| | | |
| | | |
| | | // 设置按钮是否可点击,且置灰,默认取第一个文本;图片需用ImageEx组件 |
| | | // 设置按钮是否可点击,且取第一个文本组件置灰或置原色 |
| | | // 要先设置文本再调用该函数 因为没有改变文本组件的颜色避免颜色被还原,同理恢复可以不用改变颜色改文字即可 |
| | | // 更多功能请使用SetColorful |
| | | public static void SetInteractable(this Button _btn, bool _interactable, Text _btnText = null) |
| | | { |
| | |
| | | if (!_interactable) |
| | | _btnText.text = UIHelper.AppendColor(TextColType.NavyGray, _btnText.text); //不改变组件颜色,只改变显示颜色 |
| | | else |
| | | _btnText.text = UIHelper.AppendColor(_btnText.color, _btnText.text); |
| | | _btnText.text = UIHelper.AppendColor(_btnText.color, UIHelper.RemoveColor(_btnText.text)); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | var sprite = UILoader.LoadSprite(folderName, iconName); |
| | | if (null == sprite) return; |
| | | _image.overrideSprite = sprite; |
| | | } |
| | | |
| | |
| | | var texture = UILoader.LoadTexture2D(_id); |
| | | _image.texture = texture; |
| | | } |
| | | |
| | | |
| | | public static void SetTexture2DPNG(this RawImage _image, string _id) |
| | | { |
| | | if (_image == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var texture = UILoader.LoadTexture2DPNG(_id); |
| | | _image.texture = texture; |
| | | } |
| | | } |