コード例 #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);
        }
コード例 #2
0
ファイル: BindFactory.cs プロジェクト: ltz0836/Framework
 //绑定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;
     }
 }
コード例 #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);
        }