Beispiel #1
0
        /// <summary>
        /// 以静态单例模式加载UI
        /// </summary>
        /// <param name="_info"></param>
        /// <param name="_callback"></param>
        /// <returns></returns>
        UUIWorker LoadFromStaticSingle(UUIInfoStaticSingle _info, EWorkerState _nextState, Action <UUIWorker, GameObject> _callback)
        {
            if (null == _info.Instance)
            {
                return(null);
            }

            UUIContainer container;
            UUIWorker    worker;

            if (Manager.TryGetSingleWorker(_info, out container, out worker))
            {
                container.RemoveFromContainer(worker);
                Container.Add(worker);
                if (worker.State == EWorkerState.Working)
                {
                    WorkLine.Add(worker);
                }
            }
            else
            {
                worker         = new UUIWorker(EWorkerState.Resting, _nextState, _info, _info.IsSceneObject);
                worker.Request = new UUIRequestByDone(_info.Instance);
                AddedToContainer(worker, _nextState);
                _callback(worker, _info.Instance);
            }
            return(worker);
        }
Beispiel #2
0
 internal bool TryGetSingleWorker(UUIInfoStaticSingle _info, out UUIContainer _container, out UUIWorker _worker)
 {
     _container = null;
     _worker    = null;
     foreach (var v in Containers)
     {
         if (v.Value.TryGetWoker(_info, out _worker))
         {
             _container = v.Value;
             return(true);
         }
     }
     return(false);
 }
Beispiel #3
0
 internal bool TryGetWoker(UUIInfoStaticSingle _info, out UUIWorker _worker)
 {
     _worker = Container.Find((v) => { return(v.Info == _info); });
     return(_worker != null);
 }