private async Task <UIViewBase> ShowNewView(SO_UIViewConfig config) { if (viewLayerDic.ContainsKey(config.viewLayer) == false) { Debug.LogError("展示新窗口失败,Layer不存在"); return(null); } Task <UIViewBase> handle = CreateUIView(config); await handle; if (handle.Status == TaskStatus.RanToCompletion && handle.Result != null) { handle.Result.Init(); handle.Result.transform.SetParent(viewLayerDic[config.viewLayer].transform); handle.Result.GetComponent <RectTransform>().Normalize(); } return(handle.Result); }
private UIViewBase GetViewFromCache(SO_UIViewConfig config) { if (config == null) { return(null); } UIViewBase view = null; List <UIViewBase> cache = null; switch (config.cacheScheme) { case UIViewCacheScheme.Cache: cache = screenUICache; break; case UIViewCacheScheme.TempCache: cache = screenUITempCache; break; } if (cache != null) { for (int i = 0; i < cache.Count; i++) { if (cache[i].Config.viewName == config.viewName) { view = cache[i]; cache.RemoveAt(i); break; } } } return(view); }