//public override void SetButtonsEnabled(bool isEnabled)
        //{
        //base.SetButtonsEnabled(isEnabled);
        //}

        public void ResumeButtonHandler()
        {
            print("RESUME");
            InterfaceController.Instance.Hide(GameWindow.PauseMenu);
            LocalisationController.Instance.PlayAudioClip(Settings.Autogenerated.SoundSettingsKey.PopupSound);
            GameResumed?.Invoke();
        }
예제 #2
0
 private void OnGameResumed(GameResumed gameResumedEvent)
 {
     defaultUI.gameObject.SetActive(false);
     SetFullInGameMenu(true);
     ActivateMenu(inGameMenu);
     ToggleBlackFade(false);
     Time.timeScale = 1;
 }
        public void ResumeGameButtonHandler()
        {
            SceneActivationBehaviour <TopBarUIActivator> .Instance.SetButtons(true);

            InterfaceController.Instance.Hide(GameWindow.BoardMenu);
            InterfaceController.Instance.Hide(GameWindow.BoardBlur);

            GameResumed?.Invoke();
        }
예제 #4
0
        private void Check_Timer()
        {
            Thread.CurrentThread.Name = "Memory_Thread_Check_Timer";
            float old_timer = 0;

            DateTime old_time   = DateTime.Now;
            bool     gamePaused = false;

            while (true)
            {
                Thread.Sleep(10);

                //get animation timer
                float    timer = memory.ReadFloat(timer_offsets);
                DateTime time  = DateTime.Now;

                if (timer < old_timer)
                {
                    AnimationTimeResetted?.Invoke(this, EventArgs.Empty);
                }
                if (timer != old_timer)
                {
                    AnimationTimeUpdated?.Invoke(this, new FloatArg(timer));
                }
                if (timer == old_timer)
                {
                    if (!gamePaused)
                    {
                        if (time > old_time + new TimeSpan(0, 0, 0, 0, 150))
                        {
                            gamePaused = true;
                            Notification_Message?.Invoke(this, new StringArg("Game paused"));
                            GamePaused?.Invoke(this, EventArgs.Empty);
                        }
                    }
                }
                else
                {
                    if (gamePaused)
                    {
                        gamePaused = false;
                        Notification_Message?.Invoke(this, new StringArg("Game resumed"));
                        GameResumed?.Invoke(this, EventArgs.Empty);
                    }
                    old_time = time;
                }

                old_timer = timer;
            }
        }
예제 #5
0
    private void OnGameResumedAsync(GameResumed message)
    {
        if (string.IsNullOrWhiteSpace(message.Level))
        {
            return;
        }

        Debug.Log($"Game resumed");

        this.defaultAudioSource.loop = false;
        this.defaultAudioSource.Stop();
        this.defaultAudioSource.clip = null;

        var fadingMenu = this.sounds.SoftRelease(MENU, MUSIC_CHANGE_RATEx4);

        this.sounds.PlayLooped(this.AmbientNoize2, NOISE, MUSIC_VOLUME / 3, MUSIC_CHANGE_RATE);

        string levelName = "Level_" + message.Level;

        switch (message.Level)
        {
        case Level.LABORATORY:
            if (this.sounds.IsPlaying(levelName, this.Level1BackgroungMusic))
            {
                break;
            }

            this.sounds.PlayLooped(this.Level1BackgroungMusic, levelName, MUSIC_VOLUME, MUSIC_CHANGE_RATE);
            break;

        case Level.LABORATORY2:
            if (this.sounds.IsPlaying(levelName, this.Level2BackgroungMusic))
            {
                break;
            }

            this.sounds.PlayLooped(this.Level2BackgroungMusic, levelName, MUSIC_VOLUME, MUSIC_CHANGE_RATE);
            break;
        }

        if (this.currentLevelMusic != levelName)
        {
            var releasingPrevLevelMusic = this.sounds.SoftRelease(this.currentLevelMusic);
        }
        this.currentLevelMusic = levelName;
    }
예제 #6
0
        private void HandleRequest(RequestData request)
        {
            switch (request.Request)
            {
            case Request.Disconnect:
                // server closed or kicked player
                HandleDisconnect();
                break;

            case Request.Heartbeat:
                // Response is send below.
                break;

            case Request.StartGame:
                GameStarted?.Invoke(this, EventArgs.Empty);
                SendStartGameRequest();
                // Start game messages are sent asynchronously.
                return;

            case Request.AllowUserInput:
                InputAllowed?.Invoke(this, EventArgs.Empty);
                break;

            case Request.DisallowUserInput:
                InputDisallowed?.Invoke(this, EventArgs.Empty);
                break;

            case Request.Pause:
                GamePaused?.Invoke(this, EventArgs.Empty);
                break;

            case Request.Resume:
                GameResumed?.Invoke(this, EventArgs.Empty);
                break;

            default:
                // all other requests can not be send to a client
                throw new ExceptionFreeserf(ErrorSystemType.Network, $"Request {request} can not be send to a client.");
            }

            RespondToRequest(request);
        }
예제 #7
0
 private static void OnGameResumed(GameResumed gameResumedEvent)
 {
     GameIsPaused = false;
 }
예제 #8
0
 public void UnpauseGame()
 {
     Time.timeScale = 1;
     GameResumed?.Invoke();
 }
예제 #9
0
 private void OnGameResumed(GameResumed gameResumedEvent)
 {
     gameOver = false;
 }
예제 #10
0
 public static void CallGameResumed()
 {
     MonoBehaviour.print("Event: RESUME GAME");
     GameResumed?.Invoke();
 }
예제 #11
0
        private void HandleRequest(RequestData request, ResponseHandler responseHandler)
        {
            switch (request.Request)
            {
            case Request.Disconnect:
                // server closed or kicked player
                HandleDisconnect();
                break;

            case Request.Heartbeat:
                // Response is send below.
                break;

            case Request.StartGame:
                if (Game != null)
                {
                    responseHandler?.Invoke(ResponseType.BadState);
                    return;
                }
                serverState = ServerState.Loading;
                if (PlayerIndex == 0u)
                {
                    // We have to wait for first heartbeat to set the player index.
                    SendHeartbeatRequest(response =>
                    {
                        GameStarted?.Invoke(this, EventArgs.Empty);
                        SendStartGameRequest();
                    });
                }
                else
                {
                    GameStarted?.Invoke(this, EventArgs.Empty);
                    SendStartGameRequest();
                }
                return;

            case Request.AllowUserInput:
                if (serverState == ServerState.Loading)
                {
                    serverState = ServerState.Game;
                }
                InputAllowed?.Invoke(this, EventArgs.Empty);
                break;

            case Request.DisallowUserInput:
                InputDisallowed?.Invoke(this, EventArgs.Empty);
                break;

            case Request.Pause:
                GamePaused?.Invoke(this, EventArgs.Empty);
                break;

            case Request.Resume:
                GameResumed?.Invoke(this, EventArgs.Empty);
                break;

            default:
                // all other requests can not be send to a client
                throw new ExceptionFreeserf(ErrorSystemType.Network, $"Request {request} can not be send to a client.");
            }

            RespondToRequest(request);
        }
 private void Resume()
 {
     gameMenuPanel.SetActive(false);
     Time.timeScale = 1f;
     GameResumed?.Invoke();
 }
예제 #13
0
 public static void CallGameResumed()
 {
     GameResumed?.Invoke();
 }