private void TryNext() { if (loaders.Count > 0) { ProgressView pv = MonoObjectPool <ProgressView> .Instance.Get(); ILoader loader = loaders.Dequeue(); pv.SetName(loader.Name); pv.cancelBtn.onClick.AddListener(() => OnClickCancelBtn(loader.Name)); pv.Register(loader.Progress); loader.StartAll(); pv.Show(views.Count); LoaderView lv = new LoaderView(loader, pv); views.Add(lv); } }
public void AddLoader(ILoader loader) { if (views.Count < showCount) { ProgressView v = MonoObjectPool <ProgressView> .Instance.Get(); LoaderView lv = new LoaderView(loader, v); v.SetName(loader.Name); v.cancelBtn.onClick.AddListener(() => OnClickCancelBtn(loader.Name)); v.Register(loader.Progress); loader.StartAll(); v.Show(views.Count); views.Add(lv); } else { loaders.Enqueue(loader); } }