//从池中获取界面 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; default: 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); }
//初始化界面配置 private void InitViewConfig() { Object[] config = GetAssetsFromBundle("scriptableobjects/uiview.unity3d", typeof(SO_UIViewConfig)); if (config != null) { for (int i = 0; i < config.Length; ++i) { SO_UIViewConfig uvConfig = config[i] as SO_UIViewConfig; if (uvConfig == null) { continue; } if (uvConfig.cacheScheme == UIViewCacheScheme.Cache) { uvConfig.unique = true; } uiViewConfig.Add(uvConfig.viewName, uvConfig); } } MgrLog("View config inited."); }