Пример #1
0
        public TScreen ShowScreen <TScreen>(IGenericNewTypeContainer <TScreen> screenTypeContainer, int?sortOrder = null) where TScreen : IScreen
        {
            Type screenType = screenTypeContainer.GetGenericType();

            TScreen screen;

            if (!_screens.ContainsKey(screenType))
            {
                screen = (TScreen)Activator.CreateInstance(screenType);
                screen.ScreenManager = this;
                _screens.Add(screenType, screen);
                screen.Data.transform.SetParent(Container.ScreensContainer);
                screen.Init();
            }
            else
            {
                screen = (TScreen)_screens[screenType];
            }

            if (sortOrder != null)
            {
                screen.Data.CanvasController.Canvas.sortingOrder = (int)sortOrder;
            }

            screen.Show();

            return(screen);
        }
Пример #2
0
 protected T HideShow <T>(IGenericNewTypeContainer <T> screenTypeContainer) where T : IScreen
 {
     Hide();
     return(ScreenManager.ShowScreen(screenTypeContainer));
 }