代码拉取完成,页面将自动刷新
工具类BindableProperty:
普通属性绑定类 BindableProperty API如下:
- ///绑定事件
- IUnRegister Register(Action<TValue> action);
- ///绑定事件并自动初始化
- IUnRegister RegisterWithInitValue(Action<TValue> action);
- ///注销事件,如没有传递事件则清空
- void UnRegisterEvent(Action<T> onEvent = null);
- ///绑定Mono生命周期,当Mono类销毁时自动注销
- void UnRegisterWaitGameObjectDestroy<TComponent>(TComponent component,Action callBack = null) where TComponent : UnityEngine.Component
数据强化,可自带回调 使用方式如下
public class TestScript
{
public BindableProperty<int> Num = new BindableProperty<int>(5);
public void Start()
{
Num.Register(value => Debug.Log(value));
}
}
额外拓展:
using YukiFrameWork;
public class TestScript : MonoBehaviour
{
void Start()
{
FastList<string> list = new FastList<string>();
///正常享受List的API:
//绑定事件(参数为列表的对象)
list.Register((value) => { });
//绑定事件并自动调用一次(这里会遍历列表里所有的数据都调用一次)
list.RegisterWithInitValue((value) => { });
//添加键值,自动调用注册的事件
list.Add("第一个");
在使用上FastList拥有比List更快的速度。
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。