Exemplo n.º 1
0
 void Update()
 {
     if (loadingList.Count > 0)
     {
         for (int i = 0; i < loadingList.Count; i++)
         {
             if (loadingList[i].IsDone)
             {
                 LoadAsset asset = loadingList[i];
                 for (int j = 0; j < asset.Listeners.Count; j++)
                 {
                     asset.Listeners[j].OnLoaded(asset.AssetName, asset.GetAsset);
                 }
                 nameAssetDict.Add(asset.AssetName, asset.GetAsset);
                 loadingList.RemoveAt(i);
             }
         }
     }
     while (waitingQue.Count > 0 && loadingList.Count < 5)
     {
         LoadAsset asset = waitingQue.Dequeue();
         loadingList.Add(asset);
         asset.LoadAsync();
     }
 }
Exemplo n.º 2
0
    void Update()
    {
        if (m_LoadingList.Count > 0)
        {
            for (int i = 0; i < m_LoadingList.Count; i++)
            {
                if (m_LoadingList[i].IsDone)
                {
                    LoadAsset asset = m_LoadingList[i];
                    for (int j = 0; j < asset.ListenerList.Count; j++)
                    {
                        asset.ListenerList[j].OnLoaded(asset.AssetName, asset.GetAsset);
                    }
                    m_LoadingList.RemoveAt(i);
                    m_AssetDict.Add(asset.AssetName, asset.GetAsset);
                }
            }
        }

        while (m_WaitingQueue.Count > 0 && m_LoadingList.Count < 5)
        {
            LoadAsset asset = m_WaitingQueue.Dequeue();
            m_LoadingList.Add(asset);
            asset.LoadAsync();
        }
    }