Example #1
0
 private void TryNewFiche()
 {
     if (ListPlayer.All(X => X.AnswersByFicheId.ContainsKey(CurrentFiche.Id)))
     {
         CountPointPlayer();
         MoveAfrerEndFiche();
     }
 }
Example #2
0
 public void Register(UserFiche user)
 {
     if (!ListPlayer.Any(X => X.LoginToProcess == user.Name))
     {
         if (CurentMultiPlayerGame != null)
         {
             lock (CurentMultiPlayerGame)
             {
                 CurentMultiPlayerGame.Unregister(user);
             }
         }
         ListPlayer.Register(new User(user));
         CurentMultiPlayerGame = this;
     }
 }
Example #3
0
        public void Unregister(UserFiche user = null)
        {
            User gameUser;

            if (user == null)
            {
                gameUser = GetUserBySesionFicheUser();
            }
            else
            {
                gameUser = new User(user);
            }
            if (CurentMultiPlayerGame != null && gameUser != null)
            {
                CurentMultiPlayerGame.ListPlayer.Unregister(gameUser);
                if (CurrentFiche != null && ListPlayer.Any())
                {
                    TryNewFiche();
                }
                CurentMultiPlayerGame = null;
            }
        }
Example #4
0
 private void ShowFiche()
 {
     if (MultiPlayerGameData.IsLimitTime)
     {
         var CurrentFicheId = CurrentFiche.Id;
         Task.Run(async() =>
         {
             await Task.Delay(MultiPlayerGameData.LimitTimeInSek * 1000 + 3000);
             lock (this)
             {
                 if (CurrentFicheId == CurrentFiche.Id)
                 {
                     foreach (var item in ListPlayer.Where(X => !X.AnswersByFicheId.ContainsKey(CurrentFiche.Id)))
                     {
                         item.AnswersByFicheId.Add(CurrentFiche.Id, LoadFicheResponse(false));
                     }
                 }
                 TryNewFiche();
             }
         });
     }
     CurrentFicheStartShow = DateTime.Now;
     CommandAdd(CommandMultiGame.LoadNextFiche);
 }