/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { Debug.WriteLine(gameTime.TotalGameTime); //if (gameTime.TotalGameTime.Seconds - _lastTime.Seconds >= _timeInterval) if (gameTime.TotalGameTime.Seconds % 3 == 0) { _lastTime = gameTime.TotalGameTime; //Debug.WriteLine(gameTime.TotalGameTime); // TODO: Add your update logic here if (_quoridorServiceConnector.IsLogged()) { if (this.usunToJakOgarnieszServer == 1) { var users = _quoridorServiceConnector.GetConnectedUsers(); if (_users != users.Count) { GamePage.UpdateConnectedPlayers(users); _users = users.Count; } // tymczasowe rozwiazanie if (Session.Instance.GameState != GameState.Play && _users > 0) { Session.Instance.GameState = GameState.Play; Session.Instance.Opponent = users.First(u => u.Id != Session.Instance.User.Id); var gameScreen = new GameBoard(graphics.GraphicsDevice); gameScreen.MoveEvent += BoardMoveEvent; ScreenManager.Instance.SwitchScreen(gameScreen); } this.usunToJakOgarnieszServer = 2; } GetAndDispatchMessages(); if (_myId == 0) { QuoridorService s1 = (QuoridorService)_quoridorServiceConnector; _myId = s1.MyId; } } } //ScreenManager.Instance.Update(gameTime); //HandleKeybord(); HandleGameEvents(); base.Update(gameTime); }