/// <summary>
        /// Сигнал обновления модели
        /// </summary>
        /// <param name="parDeltaTime">Время кадра в секундах</param>
        public override void Update(double parDeltaTime)
        {
            base.Update(parDeltaTime);
            if (IsFirstUpdate)
            {
                IsFirstUpdate = false;
                if (ParentGameObject.LinkedAppModel.GetGameplaySettingsData().IsIntroDisabled)
                {
                    //пропускаем заставку
                    ToMainMenu();
                }
                else
                {
                    WatchingCutsceneProviderComponent = ParentGameObject.AddComponent <IntroViewProviderComponent>(
                        ActualLinkedObjectPoolSupportData.LinkedPoolManager
                        .GetObject <IntroViewProviderComponent>(typeof(IntroViewProviderComponent))
                        .Init(ParentGameObject));

                    ParentGameObject.LinkedAppModel.GetSoundManager().PlaySfx(EAppSfxAssets.IntroCutscene, false);

                    WatchingCutsceneProviderComponent.OnIntroCutsceneEndedPerform += OnCutsceneEnd;
                }
            }
            else if (_gameStartSignal)
            {
                //уничтожаем меню

                _currentMainMenuControlComponent.MenuClosedEvent -= ApplicationExit;
                _currentMainMenuControlComponent.OnGameStart     -= StartGame;

                _currentMainMenuControlComponent.DisableAndSendToPool();
                _currentMainMenuMainGameObject.DisableAndSendToPool();


                _currentMainMenuMainGameObject   = null;
                _currentMainMenuControlComponent = null;

                Console.WriteLine("Game is starting...");
                //переходим к выбранному игровому уровню
                _currentGameSessionGameObject = ActualLinkedObjectPoolSupportData.LinkedPoolManager
                                                .GetObject <GameObject>(typeof(GameObject)).Init(ParentGameObject.LinkedAppModel);

                _currentGameSessionControlComponent = ActualLinkedObjectPoolSupportData.LinkedPoolManager
                                                      .GetObject <GameSessionControllerComponent>(typeof(GameSessionControllerComponent))
                                                      .Init(_currentGameSessionGameObject, _selectedLevel);
                _currentGameSessionGameObject.AddComponent(_currentGameSessionControlComponent);

                _currentGameSessionControlComponent.OnGameSessionEnd += EndGameSession;

                _gameStartSignal = false;
            }
        }
Exemple #2
0
        /// <summary>
        /// Определяет основные стандартные обработчики ввода для осуществления операций перемешения по элементам
        /// пользовательского интерфейса меню
        /// </summary>
        protected void DefineStdMenuHandlingControls()
        {
            MenuHandlingControls = new List <KeyListenerComponent>();

            KeyListenerData menuMoveUp =
                new KeyListenerData(EGameActionButton.Dpad_Menu_Up, PlayerRef, StdMenuMoveUp, false);
            KeyListenerData menuMoveDown =
                new KeyListenerData(EGameActionButton.Dpad_Menu_Down, PlayerRef, StdMenuMoveDown, false);

            KeyListenerComponent menuControlComponent =
                ActualLinkedObjectPoolSupportData.LinkedPoolManager
                .GetObject <KeyListenerComponent>(typeof(KeyListenerComponent)).Init(ParentGameObject);

            menuControlComponent.WatchData.Add(menuMoveUp);
            menuControlComponent.WatchData.Add(menuMoveDown);

            MenuHandlingControls.Add(ParentGameObject.AddComponent <KeyListenerComponent>(menuControlComponent));
        }
        /// <summary>
        /// Обработчик завершения стартовой заставки
        /// </summary>
        private void OnCutsceneEnd()
        {
            Console.WriteLine("Intro cutscene ending handled!");
            //dispose watcher and player
            WatchingCutsceneProviderComponent?.DisableAndSendToPool();
            WatchingCutsceneProviderComponent = null;

            //add listener for main menu transition
            WatchingKeyComponent = ParentGameObject.AddComponent <KeyListenerComponent>(ActualLinkedObjectPoolSupportData
                                                                                        .LinkedPoolManager.GetObject <KeyListenerComponent>(typeof(KeyListenerComponent)))
                                   .Init(ParentGameObject);

            WatchingKeyComponent.WatchData.Add(new KeyListenerData(EGameActionButton.Button_Start,
                                                                   ParentGameObject.LinkedAppModel.GetPlayersManager().Player1,
                                                                   ToMainMenu, true));

            //transitioning to main menu
        }
Exemple #4
0
        /// <summary>
        /// Процедура активации главного меню
        /// </summary>
        public override void Activate()
        {
            //заполенение подменю
            SubMenus = new List <MenuControlComponent>();

            SinglePlayerLobbySubMenu =
                ParentGameObject.AddComponent <SinglePlayerLobbyMenuControlComponent>(
                    ActualLinkedObjectPoolSupportData.LinkedPoolManager
                    .GetObject <SinglePlayerLobbyMenuControlComponent>(typeof(SinglePlayerLobbyMenuControlComponent))
                    .Init(ParentGameObject));

            SubMenus.Add(SinglePlayerLobbySubMenu);

            OptionsSubMenu =
                ParentGameObject.AddComponent <OptionsMenuControlComponent>(
                    ActualLinkedObjectPoolSupportData.LinkedPoolManager
                    .GetObject <OptionsMenuControlComponent>(typeof(OptionsMenuControlComponent))
                    .Init(ParentGameObject));

            SubMenus.Add(OptionsSubMenu);

            RecordsSubMenu =
                ParentGameObject.AddComponent <RecordsMenuControlComponent>(
                    ActualLinkedObjectPoolSupportData.LinkedPoolManager
                    .GetObject <RecordsMenuControlComponent>(typeof(RecordsMenuControlComponent))
                    .Init(ParentGameObject));

            SubMenus.Add(RecordsSubMenu);

            JukeboxSubMenu =
                ParentGameObject.AddComponent <JukeboxMenuControlComponent>(
                    ActualLinkedObjectPoolSupportData.LinkedPoolManager
                    .GetObject <JukeboxMenuControlComponent>(typeof(JukeboxMenuControlComponent))
                    .Init(ParentGameObject));

            SubMenus.Add(JukeboxSubMenu);


            //заполнение кнопок меню
            MenuUiElements = new LinkedList <UiElement>();

            NewGame1PPocketButton = CreateStandardButton(() => GoToSubmenu(SinglePlayerLobbySubMenu));

            MenuUiElements.AddLast(NewGame1PPocketButton); //лобби


            OptionsButton = CreateStandardButton(() => GoToSubmenu(OptionsSubMenu));

            MenuUiElements.AddLast(OptionsButton); //настройки


            RecordsButton = CreateStandardButton(() => GoToSubmenu(RecordsSubMenu));

            MenuUiElements.AddLast(RecordsButton); //рекорды


            JukeboxButton = CreateStandardButton(() => GoToSubmenu(JukeboxSubMenu));

            MenuUiElements.AddLast(JukeboxButton); //музыкальный плеер


            ExitButton = CreateStandardButton(ExitAction);

            MenuUiElements.AddLast(ExitButton); //выход


            SelectUiElement(MenuUiElements.First.Value);

            //Активация управления меню

            DefineStdMenuHandlingControls();

            base.Activate();
        }