Exemplo n.º 1
0
        private void _PorcessLoading()
        {
            if (m_loading.Count == 0)
            {
                return;
            }

            var itor = m_loading.First;

            while (itor != null)
            {
                ulong hash = itor.Value;
                var   cur  = itor;
                itor = itor.Next;

                Request request = null;
                m_dict.TryGetValue(hash, out request);

                if (request == null)
                {
                    Log.WarningFormat("[RequestLoader] loading list container null request pathHash={0}.", hash);
                    m_loading.Remove(cur);
                }
                else if (request.IsDone())
                {
                    m_loaded.AddLast(hash);
                    m_loading.Remove(cur);
                }

                if (ResourceTimeControl.TimeOut())
                {
                    break;
                }
            }
        }
        public override bool LoadDone()
        {
            foreach (var spawnHandle in m_spawnList)
            {
                if (spawnHandle.isInterrupt || spawnHandle.isDone)
                {
                    continue;
                }

                spawnHandle.isDone = true;
                GameObject spawnGameObject = null;
                if (m_data != null)
                {
                    m_data.Spawn(out spawnGameObject);
                }
                spawnHandle.gameObject = spawnGameObject;
                spawnHandle.success    = spawnGameObject != null;
                if (spawnGameObject != null)
                {
                    spawnHandle.spawnID = spawnGameObject.GetInstanceID();
                }
                // spawn cost much time yield it
                if (ResourceTimeControl.TimeOut())
                {
                    return(false);
                }
            }

            return(base.LoadDone());
        }
Exemplo n.º 3
0
 public void Update()
 {
     _ProcessTryLoad();
     if (ResourceTimeControl.TimeOut())
     {
         return;
     }
     _PorcessLoading();
     if (ResourceTimeControl.TimeOut())
     {
         return;
     }
     _ProcessLoadDone();
 }
Exemplo n.º 4
0
 void LateUpdate()
 {
     ResourceTimeControl.Reset();
     for (int i = 0; i < m_updaterDelegate.Count; ++i)
     {
         try
         {
             m_updaterDelegate[i]();
         }
         catch (System.Exception ex)
         {
             Log.Exception(ex);
         }
     }
 }