public OnlineGame(IntegratedOpenGl.Mode mode, GameModel model) { _mode = mode; Model = model; OnlineSession.InitializeSession(model); var playerPos = Model.ParticipantsHashId.IndexOf(Profile.Instance.CurrentProfile.UserHashId); _userPointsManager = new PointsManager(playerPos); cts = new CancellationTokenSource(); CancellationToken token = cts.Token; Task.Factory.StartNew(() => UpdateGameModelTask(token), token); }
/// <summary> /// Select the mode in which the opengl windows should run /// </summary> /// <param name="mode"></param> public void SelectMode(IntegratedOpenGl.Mode mode) { if (_integratedOpenGl == null) { throw new NullReferenceException("The winform integrated open gl user control is not created"); } if (mode != IntegratedOpenGl.Mode.ModeTest && mode != IntegratedOpenGl.Mode.ModeEditeur) { PointsPanel.Visible = true; BallsPanel.Visible = true; } else { PointsPanel.Visible = false; BallsPanel.Visible = false; } _integratedOpenGl.AssignerMode(mode); _integratedOpenGl.AssignerEstTerminee(false); _integratedOpenGl.Show(); _integratedOpenGl.MettreAJour(); }
public LocalGame(IntegratedOpenGl.Mode mode) { _mode = mode; _userPointsManager = new PointsManager(0); }
/// <summary> /// Need to be called only on the point manager of the player's points /// </summary> public void StartGame(IntegratedOpenGl.Mode mode, bool isOnline = false, bool isFriendZone = false, bool isCompe = false, int numbJoueurs = 0) { _gameMode = mode; _isOnline = isOnline; _isFriendZone = isFriendZone; Timer.Start(); // Stats StatsManager.AddGamePlayed(); if (isOnline) { AchievementManager.AchieveFirstOnlineGame(); } if (_isFriendZone) { AchievementManager.AchievePlayFriendMap(); } // Label visibility if (isCompe) { PointJoueur1Label.Visible = true; BallLabel1.Visible = true; if (numbJoueurs > 1) { PointJoueur2Label.Visible = true; BallLabel2.Visible = true; } if (numbJoueurs > 2) { PointJoueur3Label.Visible = true; BallLabel3.Visible = true; } if (numbJoueurs > 3) { PointJoueur4Label.Visible = true; BallLabel4.Visible = true; } } else { if (PointJoueur2Label != null) { PointJoueur2Label.Visible = false; } if (PointJoueur3Label != null) { PointJoueur3Label.Visible = false; } if (PointJoueur4Label != null) { PointJoueur4Label.Visible = false; } if (PointJoueur1Label != null) { PointJoueur1Label.Visible = true; } if (BallLabel2 != null) { BallLabel2.Visible = false; } if (BallLabel3 != null) { BallLabel3.Visible = false; } if (BallLabel4 != null) { BallLabel4.Visible = false; } if (BallLabel1 != null) { BallLabel1.Visible = true; } } }