| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void SetColorful(this GroupButtonEx _btn, Text _btnTxt, bool _colorful, int pattern = 0) |
| | | { |
| | | if (_btn != null) |
| | | { |
| | | if (_btn.selectIcon != null) |
| | | { |
| | | _btn.selectIcon.gray = !_colorful; |
| | | } |
| | | if (_btn.unSelectIcon != null) |
| | | { |
| | | _btn.unSelectIcon.gray = !_colorful; |
| | | } |
| | | } |
| | | if (_btnTxt != null) |
| | | { |
| | | switch (pattern) |
| | | { |
| | | case 1: |
| | | _btnTxt.color = UIHelper.GetUIColor(_colorful ? TextColType.LightWhite : TextColType.White); |
| | | break; |
| | | case 2: |
| | | _btnTxt.color = UIHelper.GetUIColor(_colorful ? TextColType.Green : TextColType.White); |
| | | break; |
| | | default: |
| | | //false 灰色,true 原色 |
| | | if (!_colorful) |
| | | _btnTxt.text = UIHelper.AppendColor(TextColType.NavyGray, _btnTxt.text); //不改变组件颜色,只改变显示颜色 |
| | | else |
| | | _btnTxt.text = UIHelper.AppendColor(_btnTxt.color, _btnTxt.text); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 设置按钮是否可点击,且取第一个文本组件置灰或置原色 |
| | | // 要先设置文本再调用该函数 因为没有改变文本组件的颜色避免颜色被还原,同理恢复可以不用改变颜色改文字即可 |
| | | // 更多功能请使用SetColorful |