Ejemplo n.º 1
0
        //绑定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);
        }
Ejemplo n.º 2
0
 //绑定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;
     }
 }
Ejemplo n.º 3
0
        //绑定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);
        }