コード例 #1
0
        public sealed override IWebNode LoadUI(Action onCreated = null)
        {
            if (Inited)
            {
                return(EmptyWebNode.Instance);
            }

            if (null != _loadingWebNode)
            {
                return(_loadingWebNode);
            }

            _loadingWebNode = UIWindowManager.Instance.CreateUIWindow <WindowChild> (_windowResource, window =>
            {
                _window = window;
                Inited  = true;
                _OnLoad();

                _SyncWindowVisible();

                CallbackTools.Handle(ref onCreated, "[UIController.LoadUI()]");
            });

            return(_loadingWebNode);
        }
コード例 #2
0
        public IWebNode LoadUI <UIControllerT>(Action <UIControllerT> onCreated = null)
            where UIControllerT : UIControllerBase, new()
        {
            UIControllerT controller = GetController <UIControllerT> ();

            if (null != controller)
            {
                return(controller.LoadUI(() => CallbackTools.Handle(ref onCreated, controller, "[UIControllerManager.LoadUI()]")));
            }

            return(EmptyWebNode.Instance);
        }
コード例 #3
0
        private static IEnumerator _CoLoadInnerPrefabPool(InnerPrefabPool innerPool, Action <PrefabPool> handler)
        {
            var web = innerPool.GetWebPrefab();

            while (!web.isDone)
            {
                yield return(null);
            }

            var pool = new PrefabPool(innerPool);

            CallbackTools.Handle(ref handler, pool, "[PrefabPool._CoLoadInnerPrefabPool()]");
        }
コード例 #4
0
        internal static void Tick()
        {
            if (_receivedActions.Count > 0)
            {
                var count = _receivedActions.MoveToEx(_tempActions, _locker);
                for (int i = 0; i < count; ++i)
                {
                    var action = _tempActions[i] as Action;
                    CallbackTools.Handle(ref action, "[Loom.Tick()]");
                }

                _tempActions.Clear();
            }
        }
コード例 #5
0
        private IEnumerator _CoLoadInnerWebPrefab(Action <WebPrefab> handler)
        {
            var inner = _inner;

            if (!inner.isDone)
            {
                yield return(inner);
            }

            _loadingInnerRoutine = null;
            _nodeState.isLoaded  = true;
            error = inner.error;

            CallbackTools.Handle(ref handler, this, "[WebPrefab:_CoLoadInnerWebPrefab()]");
            _nodeState.isHandled = true;
        }
コード例 #6
0
ファイル: HttpClient.cs プロジェクト: ehyea/Unity-Utility
 private void _OnExitDownload()
 {
     Argument = new HttpClientArgument
     {
         Url                = Argument.Url,
         Timeout            = Argument.Timeout,
         Param1             = Argument.Param1,
         ThreadDecompressor = null,
         PostData           = null,
     };
     IsDone   = true;
     Progress = 1f;
     if (_handler != null)
     {
         Loom.QueueOnMainThread(() => {
             CallbackTools.Handle(ref _handler, this, "[HttpClient:_OnExitDownload()]");
         });
     }
 }
コード例 #7
0
        private IEnumerator _CoLoadItems(Action <WebGroup> handler)
        {
            var oldNodesCount = _nodes.Count;

            for (int index = 0; index < _nodes.Count; ++index)
            {
                var node = _nodes[index];
                if (null == node)
                {
                    continue;
                }

                // 这个地方切记不能使用yield return node,有两个重要的原因:
                // 1. WebGroup的handler是需要在所有子节点的handler都调用完成之后调用,这是假设前提;
                // 2. 每一个yield return node至少意味着一帧,当_nodes特别大时(1000+),仅仅yield操作就将花费几十秒
                while (!node.isUseless)
                {
                    yield return(null);
                }
            }

            if (_nodes.Count < oldNodesCount)
            {
                Console.Error.WriteLine("[_CoLoadItems()] _nodes list may be cleared, old={0}, new={1}", oldNodesCount.ToString(), _nodes.Count.ToString());
                yield break;
            }

            _loadItemsRoutine   = null;
            _nodeState.isLoaded = true;

            if (null != handler)
            {
                CallbackTools.Handle(ref handler, this, "[WebGroup:_CoLoadItems()]");
            }

            _nodeState.isHandled = true;
        }
コード例 #8
0
        private static void _RunAsyncAction(object state)
        {
            var action = state as Action;

            CallbackTools.Handle(ref action, "[Loom._RunAsyncAction()]");
        }