/// <summary> /// Создать контроллер /// </summary> /// <param name="context">Контекст</param> /// <param name="viewPath">Путь к вью</param> /// <param name="projection">Проекция данных</param> /// <returns></returns> public ViewControllerComposite Create(Contexts context, string viewPath, IEntityProjection projection) { Queue <ViewControllerComposite> queue; if (_destroyed.TryGetValue(viewPath, out queue) == false) { queue = new Queue <ViewControllerComposite>(); _destroyed.Add(viewPath, queue); } ViewControllerComposite viewController; if (queue.Count == 0) { var viewPrefab = _viewPrefabs.GetValue(viewPath); var viewObj = GameObject.Instantiate(viewPrefab); var viewControllers = viewObj.GetComponentsInChildren <IViewController>(true); viewController = new ViewControllerComposite(viewPath, viewObj, viewControllers); viewController.BeginController(context); } else { viewController = queue.Dequeue(); } viewController.OpenController(projection); return(viewController); }
/// <summary> /// Возвращает находящиеся по пути Resources/Configs/ конфигурации /// </summary> /// <typeparam name="T">Тип конфигурации</typeparam> /// <returns></returns> private T GetSettings <T>() where T : ScriptableObject { return((T)_configs.GetValue(string.Format("Configs/{0}", typeof(T).Name))); }