//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(); }
public void ResumeGameButtonHandler() { SceneActivationBehaviour <TopBarUIActivator> .Instance.SetButtons(true); InterfaceController.Instance.Hide(GameWindow.BoardMenu); InterfaceController.Instance.Hide(GameWindow.BoardBlur); GameResumed?.Invoke(); }
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; } }
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); }
public void UnpauseGame() { Time.timeScale = 1; GameResumed?.Invoke(); }
public static void CallGameResumed() { MonoBehaviour.print("Event: RESUME GAME"); GameResumed?.Invoke(); }
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(); }
public static void CallGameResumed() { GameResumed?.Invoke(); }