예제 #1
0
        public void SwitchScreens(ScreenId screen)
        {
            mainMenu.Visible        = false;
            combatScreen.Visible    = false;
            inventoryScreen.Visible = false;
            gameOver.Visible        = false;

            switch (screen)
            {
            case ScreenId.MAIN_MENU:
                mainMenu.Visible = true;
                break;

            case ScreenId.COMBAT:
                combatScreen.Visible = true;
                break;

            case ScreenId.INVENTORY:
                inventoryScreen.Visible = true;
                break;

            case ScreenId.GAME_OVER:
                gameOver.Visible = true;
                break;

            default:
                throw new ArgumentException();
            }
        }
 public BookableShowCreated(BookableShowId id, ScreenId screenId, DateTime showTime, List<BookableSeat> seats)
 {
     Id = id;
     ScreenId = screenId;
     ShowTime = showTime;
     Seats = seats;
 }
예제 #3
0
 public void addScreen(ScreenId id, Screen s, bool update = true, bool draw = true)
 {
     s.DoUpdate = update;
     s.DoDraw = draw;
     s.LoadContent();
     screens.Add(id, s);
 }
예제 #4
0
    /* Работа с экранами несколько отличается от работы модальных окон
     * Модальное окно может быть в единсвенном колличестве и они в очереди открытия, одно за другим
     * Экрны же могут открываться сворачивая предыдущий экран, а когда экран закрывается, то разворачивается предыдущий
     * в этом и вся разница
     */

    public void CreateMainScreen <TController, TView>(ControllerData paramsScreen) where TController : IControllerUI <TView>
    {
        titlePanelUIView.gameObject.SetActive(true);
        var id = ScreenId.GetMainScreen();

        if (id == null)
        {
            Debug.LogError("ВНИМАНИЕ!!! НЕТ ГЛАВНОГО ЭКРАНА В КОНФИГЕ!!!");
            return;
        }

        var controller = default(TController);

        controller = (TController)Activator.CreateInstance(typeof(TController));

        controller.SetData(paramsScreen);
        var createdAction = new Action <object>((obj) => { controller.OnCreatedView(((TView)obj)); });
        var prefab        = GetPrefab(id, "[Screen]");
        var screen        = Instantiate(prefab, screenRect).GetComponent <AbstractView>();

        closedActionMain  = new Action(() => { controller.OnWantToCloseView((TView)(screen as object)); });
        destroyActionMain = new Action(() => { controller.OnDestoyView((TView)(screen as object)); });

        currentMainScreen = screen;
        screen.GetComponent <RectTransform>().SetSiblingIndex(-999999);
        createdAction?.Invoke(screen);

        titlePanelUIView.SetScreenConfig("Main Screen", id.Config.TitleConfig);
    }
예제 #5
0
 public void addScreen(ScreenId id, Screen s, bool update = true, bool draw = true)
 {
     s.setUpdate(update);
     s.setDraw(draw);
     s.LoadContent();
     screens.Add(id, s);
 }
예제 #6
0
        public DailyProgramming(DailyProgrammingId aggregateId, MovieId movieId, ScreenId screenId, DateTime date, IEnumerable <Messages.Dtos.Seat> freeSeats, string movieTitle, string screenName)
        {
            //Null checks etc. ....


            RaiseEvent(new DailyProgrammingCreated(aggregateId, movieId, screenId, date, freeSeats, movieTitle, screenName));
        }
예제 #7
0
        /// <summary>
        /// Navigate Screen
        /// </summary>
        /// <param name="command"></param>
        public void LeftMenu(string command)
        {
            ScreenId fea = ScreenId.None;

            if (!string.IsNullOrEmpty(command))
            {
                Enum.TryParse(command, out fea);
            }
            switch (fea)
            {
            case ScreenId.SrcBook:
                ActivateItem(new BookViewModel());
                break;

            case ScreenId.SrcUser:
                ActivateItem(new UserViewModel());
                break;

            case ScreenId.SrcChangePass:
                ActivateItem(new ChangePasswordViewModel());
                break;

            case ScreenId.SrcAuthor:
                ActivateItem(new AuthorViewModel());
                break;

            case ScreenId.SrcCategoty:
                ActivateItem(new CategoryViewModel());
                break;
            }
        }
예제 #8
0
 public WindowQueue(ScreenId id, GameObject prefab, ControllerData paramsModal, ViewElementData screenElement)
 {
     Id            = id;
     Prafab        = prefab;
     ParamsModal   = paramsModal;
     ScreenElement = screenElement;
 }
 public BookableShowCreated(BookableShowId id, ScreenId screenId, DateTime showTime, List <BookableSeat> seats)
 {
     Id       = id;
     ScreenId = screenId;
     ShowTime = showTime;
     Seats    = seats;
 }
예제 #10
0
파일: Form1.cs 프로젝트: teeheeman/1
        public void SwitchScreen(ScreenId screen)
        {
            gameOverScreen1.Visible  = false;
            inventoryScreen1.Visible = false;
            combat1.Visible          = false;
            startScreen.Visible      = false;

            switch (screen)
            {
            case ScreenId.MAIN_MENU:
                startScreen.Visible = true;
                break;

            case ScreenId.COMBAT:
                combat1.Visible = true;
                break;

            case ScreenId.INVENTORY:
                inventoryScreen1.Visible = true;
                break;

            case ScreenId.GAME_OVER:
                gameOverScreen1.Visible = true;
                break;
            }
        }
예제 #11
0
 public void addScreen(ScreenId id, Screen s, bool update = true, bool draw = true)
 {
     s.DoUpdate = update;
     s.DoDraw   = draw;
     s.LoadContent();
     screens.Add(id, s);
 }
예제 #12
0
    /// <summary>
    /// Loads a screen based on it's screen id.
    /// </summary>
    /// <param name="screenId">Unique identifier for a screen.</param>
    private UIBaseScreen LoadScreen(ScreenId screenId)
    {
        GameObject screenPrefab = GetPrefabFromScreenId(screenId);

        if (screenPrefab != null)
        {
            // Instantiate the screen in the canvas.
            GameObject instantiatedPrefab = GameObject.Instantiate(screenPrefab, m_Canvas.transform);

            if (instantiatedPrefab != null)
            {
                UIBaseScreen screen = instantiatedPrefab.GetComponent <UIBaseScreen>();

                if (screen != null)
                {
                    // Call set defaults and assign the current screen.
                    screen.Initialize(m_ScreenParams);

                    // make sure prompts bar is last in the hierarchy
                    m_PromptsBar.SetAsLastSibling();

                    return(screen);
                }
            }
        }

        return(null);
    }
예제 #13
0
    /// <summary>
    /// Loads a screen based on it's screen id.
    /// </summary>
    /// <param name="screenId">Unique identifier for a screen.</param>
    private UIBaseScreen LoadScreen(ScreenId screenId)
    {
        GameObject screenPrefab = GetPrefabFromScreenId(screenId);

        if (screenPrefab != null)
        {
            // Instantiate the screen in the canvas.
            GameObject instantiatedPrefab = GameObject.Instantiate(screenPrefab, m_Canvas.transform);

            if (instantiatedPrefab != null)
            {
                UIBaseScreen screen = instantiatedPrefab.GetComponent <UIBaseScreen>();

                if (screen != null)
                {
                    // Call set defaults and assign the current screen.
                    screen.Initialize();

                    return(screen);
                }
            }
        }

        return(null);
    }
예제 #14
0
 private void Apply(DailyProgrammingCreated @event)
 {
     Id       = @event.AggregateId;
     movieId  = @event.MovieId;
     screenId = @event.ScreenId;
     date     = @event.Date;
     seats    = @event.Seats.ToEntity(SeatState.Free);
 }
예제 #15
0
    /// <summary>
    /// Transition to a screen by id.
    /// </summary>
    /// <param name="screenId"></param>
    public void TransitionToScreen(ScreenId screenId, object[] screenParams = null)
    {
        if (screenParams != null)
        {
            m_ScreenParams = screenParams;
        }

        StartCoroutine(DoScreenTransition(screenId));
    }
예제 #16
0
 public CreateDailyProgramming(DailyProgrammingId aggregateId, MovieId movieId, ScreenId screenId, DateTime date, IEnumerable <Dtos.Seat> seats, string movieTitle, string screenName) : base(aggregateId)
 {
     MovieId    = movieId;
     ScreenId   = screenId;
     Date       = date;
     Seats      = seats;
     MovieTitle = movieTitle;
     ScreenName = screenName;
 }
 public DailyProgrammingCreated(DailyProgrammingId aggregateId, MovieId movieId, ScreenId screenId, DateTime date, IEnumerable <Dtos.Seat> seats, string movieTitle, string screenName, string who = "anonymous")
     : base(aggregateId, who)
 {
     MovieId    = movieId;
     ScreenId   = screenId;
     Date       = date;
     Seats      = seats;
     MovieTitle = movieTitle;
     ScreenName = screenName;
 }
        private ScreenManager()
        {
            currentScreenId = ScreenId.Nil;
            screens         = new BaseScreen[(int)ScreenId.Count];

            lastTime       = DateTimeOffset.Now;
            timer          = new DispatcherTimer();
            timer.Interval = new TimeSpan(170000);
            timer.Tick    += Tick;
            timer.Start();
        }
예제 #19
0
    /// <summary>
    /// Transition Work Enumerator.
    /// Carries out the screen loading process and locks the system until a screen has been loaded.
    /// </summary>
    /// <param name="screenId"></param>
    /// <returns></returns>
    private IEnumerator DoScreenTransition(ScreenId screenId)
    {
        // if this is a new screen... (it should always be.)
        if (screenId != ScreenId.None)
        {
            m_InputLock = true;
            bool canNavigateBackwards = false;

            if (m_CurrentScreen != null)
            {
                canNavigateBackwards = m_CurrentScreen.CanNavigateBack;
                m_PromptsBarAnimator.SetTrigger("Outro");

                yield return(StartCoroutine(m_CurrentScreen.DoScreenAnimation(UIScreenAnimState.Outro)));

                UnloadCurrentScreen();
            }

            m_PrefabLoadingLock = true;
            UIBaseScreen loadedScreen = LoadScreen(screenId);

            if (loadedScreen != null)
            {
                while (m_PrefabLoadingLock)
                {
                    yield return(null);
                }

                // If the current screen doesn't support back navigation, remove it from the stack.
                if (!canNavigateBackwards && m_ScreenStack.Count > 0)
                {
                    m_ScreenStack.Pop();
                }

                m_CurrentScreen = loadedScreen;

                // Back transitions can't add the screen twice.
                if (m_ScreenStack.Count == 0 || (m_ScreenStack.Count > 0 && screenId != m_ScreenStack.Peek()))
                {
                    // Push the new screen onto the stack.
                    m_ScreenStack.Push(screenId);
                }

                yield return(StartCoroutine(m_CurrentScreen.DoScreenAnimation(UIScreenAnimState.Intro)));

                ClearPrompts();

                m_CurrentScreen.SetPrompts(m_PromptsBar, m_PromptPrefab);
                m_PromptsBarAnimator.SetTrigger("Intro");
            }
            m_InputLock = false;
        }
    }
예제 #20
0
 /// <summary>
 /// Экран закрылся
 /// </summary>
 private void OnCloseCurrentScreen(object screenObj)
 {
     if (stackScreen != null && stackScreen.Count > 0)
     {
         var screen = (screenObj as AbstractView);
         screen.OnClose -= OnCloseCurrentScreen;
         if (OpenedScreens.ContainsKey(screenObj))
         {
             OnCloseView?.Invoke(screenObj as IViewUI, OpenedScreens[screenObj].Id);
             OnCloseScreenView?.Invoke(screenObj as IViewUI, OpenedScreens[screenObj].Id);
             OpenedScreens[screenObj].OnDestroy?.Invoke(screenObj);
             OpenedScreens.Remove(screenObj);
             if (OpenedScreens.Count > 0)
             {
                 var openedScreen = OpenedScreens.Last();
                 var config       = openedScreen.Value.Id.Config.TitleConfig;
                 titlePanelUIController.SetScreenConfig(openedScreen.Value.Id.Name, config);
             }
             else
             {
                 if (currentMainScreen != null)
                 {
                     var config = ScreenId.GetMainScreen().Config.TitleConfig;
                     titlePanelUIController.SetScreenConfig("", config);
                 }
                 else
                 {
                     titlePanelUIController.SetScreenConfig("", TitlePanelConfig.GetEmpty());
                 }
             }
         }
         stackScreen.Remove(screen); //.RemoveAt(stackScreen.Count - 1);
         if (currentScreen == screen)
         {
             currentScreen = null;
         }
     }
     NextScreen();
     if (!IsAnyOpenScreen)
     {
         if (currentMainScreen != null)
         {
             var config = ScreenId.GetMainScreen().Config.TitleConfig;
             titlePanelUIController.SetScreenConfig("", config);
         }
         else
         {
             titlePanelUIController.SetScreenConfig("", TitlePanelConfig.GetEmpty());
         }
     }
 }
예제 #21
0
        /// <summary>
        /// Displays the selected image
        /// </summary>
        /// <param name="sid">Identifier for the image combination to display</param>
        /// <param name="slide">Boolean parameter to suggest that the transition should be animated</param>
        private void Show(ScreenId sid, bool slide)
        {
            Bitmap bmp = PrepareScreen(sid);

            if (slide)
            {
            }
            else
            {
                bmp.Flush();
            }

            _currentScreenId = sid;
        }
예제 #22
0
    /// <summary>
    /// Returns the prefab associated with a screen id.
    /// </summary>
    /// <param name="screenId"></param>
    /// <returns></returns>
    private GameObject GetPrefabFromScreenId(ScreenId screenId)
    {
        GameObject screenPrefab = null;

        if (screenId != ScreenId.None)
        {
            UIScreenPrefabInfo info = m_PrefabInfo.Find(p => p.ScreenId == screenId);
            screenPrefab = info.Prefab;
            return(screenPrefab);
        }

        Debug.AssertFormat(true, "{0} : Couldn't find a prefab for screenid : {1}. Make sure it is serialzied in mPrefabInfo.", UIManager.Identifier, screenId.ToString());
        return(screenPrefab);
    }
예제 #23
0
        /// <summary>
        /// Prepares the selected image combination by collating several bitmaps
        /// </summary>
        /// <param name="sid">Identifier for the image combination to display</param>
        /// <returns>The image combination to display</returns>
        private Bitmap PrepareScreen(ScreenId sid)
        {
            _systemBmp.Clear();

            switch (sid)
            {
            case ScreenId.NorthEast:
            {
                // put fire in the north/east corner and snowflake in the south/west
                _systemBmp.DrawImage(_ar[0].X, _ar[0].Y, Resources.GetBitmap(Resources.BitmapResources.fire), 0, 0, 50, 50);
                _systemBmp.DrawImage(_ar[2].X, _ar[2].Y, Resources.GetBitmap(Resources.BitmapResources.snowflake), 0, 0, 50, 50);
                this.ActiveRegions = new TouchScreen.ActiveRectangle[] { _ar[0], _ar[2] };
            }
            break;

            case ScreenId.NorthWest:
            {
                // put bit fire in the north/west and snowflake south/east corners
                _systemBmp.DrawImage(_ar[1].X, _ar[1].Y, Resources.GetBitmap(Resources.BitmapResources.fire), 0, 0, 50, 50);
                _systemBmp.DrawImage(_ar[3].X, _ar[3].Y, Resources.GetBitmap(Resources.BitmapResources.snowflake), 0, 0, 50, 50);
                this.ActiveRegions = new TouchScreen.ActiveRectangle[] { _ar[1], _ar[3] };
            }
            break;

            case ScreenId.SouthWest:
            {
                // put bit snowflake in the north/east and fire south/west corners
                _systemBmp.DrawImage(_ar[0].X, _ar[0].Y, Resources.GetBitmap(Resources.BitmapResources.snowflake), 0, 0, 50, 50);
                _systemBmp.DrawImage(_ar[2].X, _ar[2].Y, Resources.GetBitmap(Resources.BitmapResources.fire), 0, 0, 50, 50);
                this.ActiveRegions = new TouchScreen.ActiveRectangle[] { _ar[0], _ar[2] };
            }
            break;

            case ScreenId.SouthEast:
            {
                // put bit snowflake in the north/west and fire south/east corners
                _systemBmp.DrawImage(_ar[1].X, _ar[1].Y, Resources.GetBitmap(Resources.BitmapResources.snowflake), 0, 0, 50, 50);
                _systemBmp.DrawImage(_ar[3].X, _ar[3].Y, Resources.GetBitmap(Resources.BitmapResources.fire), 0, 0, 50, 50);
                this.ActiveRegions = new TouchScreen.ActiveRectangle[] { _ar[1], _ar[3] };
            }
            break;

            default:
                throw new ArgumentException();
            }

            return(_systemBmp);
        }
예제 #24
0
    private void CreateScreen <TController, TView>(ScreenId id, GameObject screenObject, ControllerData paramsScreen) where TController : IControllerUI <TView>
    {
        var controller = default(TController);

        controller = (TController)Activator.CreateInstance(typeof(TController));

        controller.SetData(paramsScreen);
        var createdAction = new Action <object>((obj) => { controller.OnCreatedView((TView)obj); });
        var closedAction  = new Action <object>((obj) => { controller.OnWantToCloseView((TView)obj); });
        var destroyAction = new Action <object>((obj) => { controller.OnDestoyView((TView)obj); });
        var screenElement = new ViewElementData {
            Id = id, OnClosed = closedAction, OnCreated = createdAction, OnDestroy = destroyAction
        };

        OpenScreen(new WindowQueue(id, screenObject, paramsScreen, screenElement));
    }
예제 #25
0
        public void OnDisconnectedFromServer(Client client)
        {
            Screen   currentScreen = CurrentScreen();
            ScreenId screenId      = (ScreenId)currentScreen.id;

            switch (screenId)
            {
            case ScreenId.Lobby:
                StopPeer();
                DialogPopup.ShowMessage(OnDisconnectedFromServerDialogFinish, "Server connection lost");
                break;

            case ScreenId.Multiplyer:
                break;
            }
        }
        public void Show(ScreenId screenId)
        {
            if (currentScreen != null)
            {
                currentScreen.Hide();
            }

            if (currentScreenId != screenId)
            {
                currentScreenId = screenId;
                currentScreen   = FindScreen(currentScreenId);;
                if (currentScreen == null)
                {
                    throw new NotImplementedException();
                }
            }

            currentScreen.Show();
        }
        private BaseScreen FindScreen(ScreenId screenId)
        {
            if (screens[(int)currentScreenId] != null)
            {
                return(screens[(int)currentScreenId]);
            }

            BaseScreen screen = null;

            switch (screenId)
            {
            case ScreenId.Splash:
                break;

            case ScreenId.Game:
                screen = new GameScreen(Context.Instance.Drawer);
                screen.Init();
                screens[(int)screenId] = screen;
                break;
            }
            return(screen);
        }
예제 #28
0
    public static async Task ChangeScreen(ScreenId id)
    {
        LOG.Log($"Chaning screen to: {id}");

        switch (id)
        {
        case ScreenId.Login:
            LoginScreenRefresherService.Refresh();
            break;

        case ScreenId.Universe:
            UniverseScreenRefresherService.Refresh();
            break;

        case ScreenId.Area:
            await AreaScreenRefresherService.Refresh();

            break;

        case ScreenId.CreateCharacter:
            CharacterCreationScreenRefresherService.Refresh();
            break;

        case ScreenId.Temp:
            await QuestScreenRefresherService.Refresh(QuestStatus.Available);

            break;
        }

        if (Object.currentScreen.Id != id)
        {
            Object.currentScreen.Hide();
            var screen = Object.screens.Find(x => x.Id == id);
            screen.Show();
            Object.currentScreen = screen;
        }
    }
예제 #29
0
 private Screen FindScreen(ScreenId id)
 {
     return(FindScreen((int)id));
 }
예제 #30
0
        /// <summary>
        /// Displays the selected image
        /// </summary>
        /// <param name="sid">Identifier for the image combination to display</param>
        /// <param name="slide">Boolean parameter to suggest that the transition should be animated</param>
        private void Show(ScreenId sid, bool slide) 
        {
            Bitmap bmp = PrepareScreen(sid);
            if (slide)
            {
            }
            else
            {
                bmp.Flush();
            }

            _currentScreenId = sid;
        }
예제 #31
0
        /// <summary>
        /// Prepares the selected image combination by collating several bitmaps
        /// </summary>
        /// <param name="sid">Identifier for the image combination to display</param>
        /// <returns>The image combination to display</returns>
        private Bitmap PrepareScreen(ScreenId sid)
        {
            _systemBmp.Clear();

            switch(sid)
            {
                case ScreenId.NorthEast:
                {
                    // put fire in the north/east corner and snowflake in the south/west 
                    _systemBmp.DrawImage(_ar[0].X, _ar[0].Y, Resources.GetBitmap(Resources.BitmapResources.fire)     , 0, 0, 50, 50);
                    _systemBmp.DrawImage(_ar[2].X, _ar[2].Y, Resources.GetBitmap(Resources.BitmapResources.snowflake), 0, 0, 50, 50);
                    this.ActiveRegions = new TouchScreen.ActiveRectangle[] { _ar[0], _ar[2] };
                }
                break;
                case ScreenId.NorthWest:
                {
                    // put bit fire in the north/west and snowflake south/east corners
                    _systemBmp.DrawImage(_ar[1].X, _ar[1].Y, Resources.GetBitmap(Resources.BitmapResources.fire)      , 0, 0, 50, 50);
                    _systemBmp.DrawImage(_ar[3].X, _ar[3].Y, Resources.GetBitmap(Resources.BitmapResources.snowflake), 0, 0, 50, 50);
                    this.ActiveRegions = new TouchScreen.ActiveRectangle[] { _ar[1], _ar[3] };
                }
                break;
                case ScreenId.SouthWest:
                {
                    // put bit snowflake in the north/east and fire south/west corners
                    _systemBmp.DrawImage(_ar[0].X, _ar[0].Y, Resources.GetBitmap(Resources.BitmapResources.snowflake), 0, 0, 50, 50);
                    _systemBmp.DrawImage(_ar[2].X, _ar[2].Y, Resources.GetBitmap(Resources.BitmapResources.fire)      , 0, 0, 50, 50);                    
                    this.ActiveRegions = new TouchScreen.ActiveRectangle[] { _ar[0], _ar[2] };
                }
                break;
                case ScreenId.SouthEast:
                {
                    // put bit snowflake in the north/west and fire south/east corners
                    _systemBmp.DrawImage(_ar[1].X, _ar[1].Y, Resources.GetBitmap(Resources.BitmapResources.snowflake), 0, 0, 50, 50);
                    _systemBmp.DrawImage(_ar[3].X, _ar[3].Y, Resources.GetBitmap(Resources.BitmapResources.fire), 0, 0, 50, 50);
                    this.ActiveRegions = new TouchScreen.ActiveRectangle[] { _ar[1], _ar[3] };
                }
                break;
                default:
                    throw new ArgumentException();
            }

            return _systemBmp;
        }
예제 #32
0
        /// <summary>
        /// Initializes the handler
        /// Starts the handler afterwards
        /// </summary>
        public static void Initialize(ScreenId screenId)
        {
            // Set the temp id
            var id = ((byte)screenId) - 1;

            // If there are not enough screens for that id, just return.
            if (id >= Screen.AllScreens.Length)
                return;

            // Set the current screen
            CurrentScreen = Screen.AllScreens[id];

            // Set the screen bitmap to the screen bounds
            ScreenBitmap = new Bitmap(CurrentScreen.Bounds.Width, CurrentScreen.Bounds.Height, PixelFormat.Format32bppArgb);

            // Start the handler
            AsyncHelper.ExecuteMethod(Start);
        }
예제 #33
0
 public static Screen getScreen(ScreenId id)
 {
     return screens[id];
 }
예제 #34
0
 public GameObject GetPrefab(ScreenId id, string tag)
 {
     id.UsagesCount++;
     return(GetPrefab(id.value, tag));
 }
 private Screen FindScreen(ScreenId id)
 {
     return FindScreen((int)id);
 }
예제 #36
0
    public void CreateWindow <TController, TView>(ScreenId id, ControllerData paramsWindow, bool showOnTop = false) where TController : IControllerUI <TView>
    {
        titlePanelUIView.gameObject.SetActive(true);
        var prefab = GetPrefab(id, "[Window]");

        var target = modalRect;
        var winGo  = Instantiate(prefab, target);
        var window = winGo.GetComponent <AbstractWindow>();

        window.SetTitle(id.Name);
        var controller = (TController)Activator.CreateInstance(typeof(TController));

        controller.SetData(paramsWindow);
        var createdAction = new Action <object>((obj) => { controller.OnCreatedView((TView)obj); });
        var closedAction  = new Action <object>((obj) => { controller.OnWantToCloseView((TView)obj); });
        var destroyAction = new Action <object>((obj) => { controller.OnDestoyView((TView)obj); });

        window.OnWantClose += (z) =>
        {
            if (OpenedWindows.ContainsKey(z))
            {
                closedAction?.Invoke(z);
            }
        };
        window.OnClose += (z) =>
        {
            if (OpenedWindows.ContainsKey(z))
            {
                OpenedWindows[z].OnDestroy?.Invoke(z);
                OnCloseView?.Invoke(z as IViewUI, OpenedWindows[z].Id);
                OnCloseWindowView?.Invoke(z as IViewUI, OpenedWindows[z].Id);
                OpenedWindows.Remove(z);
                if (OpenedWindows.Count > 0)
                {
                    var last   = OpenedWindows.Last();
                    var config = last.Value.Id.Config.TitleConfig;
                }
                else
                {
                    if (IsAnyOpenScreen)
                    {
                        if (OpenedScreens.Count > 0)
                        {
                            var openedScreen = OpenedScreens.Last();
                            var config       = openedScreen.Value.Id.Config.TitleConfig;
                        }
                    }
                    else
                    {
                        if (currentMainScreen != null)
                        {
                            var config = ScreenId.GetMainScreen().Config.TitleConfig;
                            titlePanelUIController.SetScreenConfig("", config);
                        }
                        else
                        {
                            titlePanelUIController.SetScreenConfig("", TitlePanelConfig.GetEmpty());
                        }
                    }
                }
            }
        };
        createdAction.Invoke(window);

        var windowElement = new ViewElementData {
            ViewElement = window, Id = id, OnClosed = closedAction, OnCreated = createdAction, OnDestroy = destroyAction
        };

        OpenedWindows[window] = windowElement;
    }
예제 #37
0
 public void CreateScreen <TController, TView>(ScreenId id, ControllerData paramsScreen) where TController : IControllerUI <TView>
 {
     titlePanelUIView.gameObject.SetActive(true);
     CreateScreen <TController, TView>(id, GetPrefab(id, "[Screen]"), paramsScreen);
 }