少年修仙传客户端代码仓库
client_linchunjie
2018-09-12 d618b3950569fbbabbb1bda866ae7eb3fed85a81
Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
1个文件已修改
44 ■■■■■ 已修改文件
Utility/ComponentExtersion.cs 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Utility/ComponentExtersion.cs
@@ -75,6 +75,17 @@
        _button.onClick.RemoveAllListeners();
    }
    public static void SetListener(this Button button, UnityAction action)
    {
        if (button == null)
        {
            return;
        }
        button.onClick.RemoveAllListeners();
        button.AddListener(action);
    }
    public static void AddListener(this Toggle _toggle, UnityAction<bool> _action)
    {
        if (_toggle == null)
@@ -82,6 +93,17 @@
            return;
        }
        _toggle.onValueChanged.AddListener(_action);
    }
    public static void SetListener(this Toggle toggle, UnityAction<bool> action)
    {
        if (toggle == null)
        {
            return;
        }
        toggle.onValueChanged.RemoveAllListeners();
        toggle.onValueChanged.AddListener(action);
    }
    public static void RemoveAllListeners(this Toggle _toggle)
@@ -102,6 +124,17 @@
        _slider.onValueChanged.AddListener(_action);
    }
    public static void SetListener(this Slider slider, UnityAction<float> action)
    {
        if (slider == null)
        {
            return;
        }
        slider.onValueChanged.RemoveAllListeners();
        slider.onValueChanged.AddListener(action);
    }
    public static void RemoveAllListeners(this Slider _slider)
    {
        if (_slider == null)
@@ -120,6 +153,17 @@
        _inputField.onValueChanged.AddListener(_action);
    }
    public static void SetListener(this InputField inputField, UnityAction<string> action)
    {
        if (inputField == null)
        {
            return;
        }
        inputField.onValueChanged.RemoveAllListeners();
        inputField.onValueChanged.AddListener(action);
    }
    public static void RemoveAllListeners(this InputField _inputField)
    {
        if (_inputField == null)