//绑定command public void BindCommand <TComponent> (TComponent component, Action command, UnityEvent componentEvent = null, Func <Action, Action> wrapFunc = null) where TComponent : class { var bind = new BindCommand <TComponent>(component, command, componentEvent, wrapFunc); Binds.Add(bind); }
//绑定command public void BindCommand <TComponent> (TComponent component, Action command, UnityEvent componentEvent = null, Func <Action, Action> wrapFunc = null) where TComponent : class { Index++; if (!TryGetBinder <BindCommand <TComponent> >(out var result, (bind) => { bind.UpdateValue(component, command, componentEvent, wrapFunc); })) { result = new BindCommand <TComponent>(component, command, componentEvent, wrapFunc); CacheBinder[Index] = result; } }
//绑定command public void BindCommand <TComponent> (TComponent component, Action command, UnityEvent componentEvent = null, Func <Action, Action> wrapFunc = null) where TComponent : class { BindCommand <TComponent> bind; if (CacheBinds.Count > 0) { bind = (BindCommand <TComponent>)CacheBinds.Dequeue(); } else { bind = new BindCommand <TComponent>(Container); } bind.Reset(component, command, componentEvent, wrapFunc); AddClearable(bind); }