| | |
| | | using UnityEngine.Events;
|
| | | using System;
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | |
|
| | | public static class ComponentExtersion
|
| | | {
|
| | |
|
| | |
| | | return component;
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | |
| | | public static void AddListener(this Button _button, UnityAction _action)
|
| | | {
|
| | | if (_button == null)
|
| | |
| | | _button.onClick.AddListener(_action);
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | |
| | | public static void RemoveAllListeners(this Button _button)
|
| | | {
|
| | | if (_button == null)
|
| | |
| | | _button.onClick.RemoveAllListeners();
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | |
| | | public static void SetListener(this Button button, UnityAction action)
|
| | | {
|
| | | if (button == null)
|
| | |
| | | _toggle.onValueChanged.AddListener(_action);
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | |
| | | public static void SetListener(this Toggle toggle, UnityAction<bool> action)
|
| | | {
|
| | | if (toggle == null)
|
| | |
| | | _toggle.onValueChanged.RemoveAllListeners();
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | |
| | | public static void AddListener(this Slider _slider, UnityAction<float> _action)
|
| | | {
|
| | | if (_slider == null)
|
| | |
| | | _slider.onValueChanged.AddListener(_action);
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | |
| | | public static void SetListener(this Slider slider, UnityAction<float> action)
|
| | | {
|
| | | if (slider == null)
|
| | |
| | | _slider.onValueChanged.RemoveAllListeners();
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | |
| | | public static void AddListener(this InputField _inputField, UnityAction<string> _action)
|
| | | {
|
| | | if (_inputField == null)
|
| | |
| | | inputField.onValueChanged.AddListener(action);
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | |
| | | public static void RemoveAllListeners(this InputField _inputField)
|
| | | {
|
| | | if (_inputField == null)
|
| | |
| | | _inputField.onValueChanged.RemoveAllListeners();
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | |
| | | public static void SetEnable(this Button _btn, Text _btnTxt, bool _enable, EnableButtonConfig.EnableButtonType _type =
|
| | | EnableButtonConfig.EnableButtonType.Default)
|
| | | {
|
| | | EnableButtonConfig.SetEnable(_btn, _btnTxt, _enable, _type);
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | |
| | | public static void SetColorful(this Button _btn, Text _btnTxt, bool _colorful, int pattern = 0)
|
| | | {
|
| | | if (_btn != null)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | |
| | | public static void SetInteractable(this Button _btn, Text _btnText, bool _interactable)
|
| | | {
|
| | | if (_btn != null)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | |
| | | public static void SetSprite(this Image _image, string _id)
|
| | | {
|
| | | if (_image == null)
|
| | |
| | | _image.overrideSprite = sprite;
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | |
| | | public static void SetSprite(this TextImage _textImage, string _id)
|
| | | {
|
| | | if (_textImage == null)
|