Example #1
0
        public WebLoader Load(string url, string savePath)
        {
            WebLoader loader = new WebLoader(url, savePath);

            Load(loader);
            return(loader);
        }
Example #2
0
 public void ClearAll()
 {
     for (int i = 0; i < Loaders.Count; i++)
     {
         WebLoader load = Loaders[i];
         load.Close();
     }
 }
Example #3
0
 private void SingleLoaded(WebLoader loader)
 {
     if (!string.IsNullOrEmpty(loader.Error))
     {
         SingleError(loader);
         return;
     }
     OnSingleLoaded?.Invoke(loader);
 }
Example #4
0
        public WebLoader GetLoader(string url, string savePath)
        {
            WebLoader loader = Loaders.Find((t) =>
            {
                return((t.Url == url) && (t.SavePath == savePath));
            });

            return(loader);
        }
Example #5
0
 private void SingleError(WebLoader loader)
 {
     loader.Close();
     for (int i = 0; i < WebLoaders.Count; i++)
     {
         WebLoader oLoader = WebLoaders[i];
         oLoader.Clear();
     }
     WebLoaders.Clear();
     Close();
     OnError?.Invoke(this);
 }
Example #6
0
 public void UnloadAll()
 {
     WebLoaders.Clear();
     for (int i = 0; i < AlreadyLoaders.Count; i++)
     {
         WebLoader oLoader = AlreadyLoaders[i];
         if (oLoader.IsStart)
         {
             oLoader.Close();
         }
         oLoader.Clear();
     }
 }
Example #7
0
 public void UnLoadAll()
 {
     if (CurLoader != null)
     {
         CurLoader.Close();
     }
     for (int i = 0; i < Loaders.Count; i++)
     {
         WebLoader oLoader = Loaders[i];
         oLoader.Close();
         oLoader.Clear();
     }
     Loaders.Clear();
 }
Example #8
0
        public void Unload(string url, string savePath)
        {
            WebLoader loader = GetLoader(url, savePath);

            if (loader != null)
            {
                Loaders.Remove(loader);
            }
            if (CurLoader != null && loader == CurLoader)
            {
                loader.Close();
                loader.Clear();
                loader = null;
            }
        }
Example #9
0
 public void LoadAll(WebAssetDir[] dirs)
 {
     LoadNum   = dirs.Length;
     Urls      = new string[LoadNum];
     SavePaths = new string[LoadNum];
     for (int i = 0; i < dirs.Length; i++)
     {
         WebAssetDir dir = dirs[i];
         Urls[i]      = dir.Url;
         SavePaths[i] = dir.SavePath;
         WebLoader oLoader = new WebLoader(Urls[i], SavePaths[i]);
         oLoader.SetEventLoading(SingleLoading);
         oLoader.SetEventLoaded(SingleLoaded);
         WebLoaders.Add(oLoader);
     }
 }
Example #10
0
 private void AllLoading(WebLoader loader)
 {
     SingleProgress = loader.Progress;
     mTotalProgress = LoadIndex + SingleProgress;
     FinalProgress  = mTotalProgress / LoadNum;
     if (loader.IsDone)
     {
         LoadIndex = LoadIndex + 1;
     }
     if (LoadIndex == LoadNum)
     {
         IsDone = true;
     }
     OnAllLoading?.Invoke(this);
     if (IsDone)
     {
         OnAllLoaded?.Invoke(this);
     }
 }
Example #11
0
 public void Loop(float deltaTime)
 {
     if (mCurLoader == null)
     {
         if (WebLoaders.Count > 0)
         {
             mCurLoader = WebLoaders[0];
             WebLoaders.RemoveAt(0);
             mCurLoader.Start();
             AlreadyLoaders.Add(mCurLoader);
         }
     }
     if (mCurLoader != null)
     {
         if (mCurLoader.IsDone)
         {
             mCurLoader.Close();
             mCurLoader = null;
         }
     }
 }
Example #12
0
        public void Loop(float lastDuration)
        {
            if (CurLoader == null)
            {
                if (Loaders.Count > 0)
                {
                    CurLoader = Loaders[0];
                    CurLoader.Start();
                    Loaders.RemoveAt(0);
                }
            }

            if (CurLoader != null)
            {
                if (CurLoader.IsDone)
                {
                    CurLoader.Close();
                    CurLoader = null;
                }
            }
        }
Example #13
0
 private void SingleLoading(WebLoader loader)
 {
     OnSingleLoading?.Invoke(loader);
     AllLoading(loader);
 }
Example #14
0
        public WebLoader GetLoader(string url, string savePath)
        {
            WebLoader oLoader = WebLoaders.Find((t) => { return(t.Url == url && t.SavePath == savePath); });

            return(oLoader);
        }
Example #15
0
 public void Load(WebLoader loader)
 {
     Loaders.Add(loader);
 }